Skip to content

Instantly share code, notes, and snippets.

@ukitazume
Created February 28, 2012 09:30
Show Gist options
  • Select an option

  • Save ukitazume/1931523 to your computer and use it in GitHub Desktop.

Select an option

Save ukitazume/1931523 to your computer and use it in GitHub Desktop.
require 'rake'
task :create do
p 'created'
end
task :create_all do
Rake::Task['create'].invoke
end
task :create_by, :tool do |task, args|
p "created by #{args[:tool]}"
end
task :create_by_select do
Rake::Task['create_by'].invoke("paper") # 引数が順位渡る
end
task :create_by_all do
[:knife, :pen].each do |tool|
# executeの引数そのものがargs
# Invoke the task if it is needed. Prerequites are invoked first.
Rake::Task['create_by'].execute(:tool => tool)
end
end
namespace :hitech do
task :create_by, :tool do |task, args|
p "created by #{args[:tool]}"
end
task :create_by_all do
[:pc, :arduino].each do |tool|
Rake::Task['hitech:create_by'].execute(:tool => tool)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment