Posts Tagged ‘rake’

rake 带参数就这么做

Posted: May 17, 2011 in Ruby
Tags: ,
task :t1, :a1, :a2, :needs => [:t2, :t3] do |t, args|
  args.with_defaults(:a1 => 'default_1 in task t1', :a2 => 'default_2 in task t1')
  puts t.name
  puts args
end

task :t2, :a1, :a2 do |t, args|
  args.with_defaults(:a1 => 'default_1 in task t2', :a2 => 'default_2 in task t2')
  puts "this is t2"
  puts args
end

task :t3, :a1, :a2 do |t, args|
  args.with_defaults(:a1 => 'default_1 in task t3', :a2 => 'default_2 in task t3')
  puts "this is t3"
end

可以执行rake t1[1,2]或者rake t1试试