Skip to content

Instantly share code, notes, and snippets.

@jxson
Created June 9, 2010 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jxson/432033 to your computer and use it in GitHub Desktop.
Save jxson/432033 to your computer and use it in GitHub Desktop.
example arg pasing in rake
desc 'shortcut to do:dev'
task :do => 'do:dev'
namespace :do do
FileList["#{CONFIG_DIR}/*.json"].each do |f|
target = File.basename(f, '.*')
desc "do stuff for #{target}"
task target do
Rake::Task['do:stuff'].invoke(target)
end
end
task :junk, :target do |t, args|
puts "doing junk first"
puts args.inspect
end
task :otherstuff, :target do |t, args|
puts "doing otherstuff"
puts args.inspect
end
task :stuff, [:target] => [:junk] do |t, args|
target = args.target
puts "doing stuff"
puts args.inspect
Rake::Task['do:otherstuff'].invoke(target)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment