rake com argumentos
desc "Say hi. Use USER environment variable as default"
task :hi, :user do |t, args|
args.with_defaults(:user => ENV["USER"])
puts "Hi #{args[:user]}!"
end
Código disponível em http://gist.github.com/130194
logo:
celestino@macbook:~ $ echo $USER celestino celestino@macbook:~ $ rake hi (in /Users/celestino) Hi celestino! celestino@macbook:~ $ USER=tino rake hi (in /Users/celestino) Hi tino! celestino@macbook:~ $ rake hi USER=tino2 (in /Users/celestino) Hi tino2! celestino@macbook:~ $ rake hi[tino3] (in /Users/celestino) Hi tino3!
Fonte: http://nhw.pl/wp/2008/10/11/rake-and-arguments-for-tasks







