Created
April 16, 2017 20:00
-
-
Save jakkn/859ad59abdbdd921ad24526d1e1f46ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'fileutils' | |
| require 'set' | |
| require 'byebug' | |
| GFF_SOURCES = FileList["cache/gff/*.*"] | |
| RESMAN_DIRS = Set.new.merge GFF_SOURCES.pathmap("%{.*,*}x") { |ext| | |
| ext.delete('.') | |
| } | |
| RESMAN_SYMLINKS = GFF_SOURCES.pathmap("resman/%{\.,}x/%f") | |
| desc 'Create resman dir tree and symbolic links to files in cache/gff' | |
| task :symlinks => [:resman_folders, :resman_symlinks] | |
| directory "resman" | |
| desc 'Create resman dir tree' | |
| task :resman_folders => ["resman"] do | |
| Dir.chdir("resman") do | |
| RESMAN_DIRS.each do |dir| | |
| FileUtils.mkdir(dir) unless File.exists?(dir) | |
| end | |
| end | |
| end | |
| desc 'Create resman symlinks' | |
| task :resman_symlinks => RESMAN_SYMLINKS | |
| rule( /resman\/*\/*.*/ => ->(f){ source_for_symlink(f) }) do |t| | |
| FileUtils.symlink("../../#{t.source}", "#{t.name}") | |
| end | |
| def source_for_symlink(dest) | |
| GFF_SOURCES.detect{|src| File.basename(dest) == File.basename(src)} | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment