Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # vim: filetype=ruby
- output "compiled/files"
- class AsyFilter < Rake::Pipeline::Filter
- attr_accessor :config
- def initialize
- @output_name_generator = proc { |fn, wrap|
- @config = {'ext' => 'png', 'opt' => ''}
- /^---$(.*?)^---$/m.match(wrap.read) do
- require 'yaml'
- config.merge!(YAML::load($1))
- end
- ext = config['ext']
- fn.sub(/\.[^.]+$/, '.' + ext)
- }
- end
- def generate_output(inputs, output)
- system("asy #{config['opt']} -f #{config['ext']} -o " +
- File.join(output.root,output.path) + " " +
- File.join(inputs[0].root, inputs[0].path))
- end
- end
- input "files" do
- match '**/*.asy' do
- filter AsyFilter
- end
- filter Rake::Pipeline::ConcatFilter
- end
Add Comment
Please, Sign In to add comment