Created
August 13, 2013 14:42
-
-
Save AnthonyMastrean/6221825 to your computer and use it in GitHub Desktop.
Args for custom Rake tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :default => [ :puts ] | |
def says(*args, &block) | |
copy = block | |
body = proc { | |
copy.call | |
puts args.message | |
} | |
Rake::Task.define_task *args, &body | |
end | |
task :puts, [ :message ] do |t, args| | |
args.with_defaults :message => 'Hello, rake!' | |
puts args.message | |
end | |
says :says, [ :message ] do |t, args| | |
args.with_defaults :message => 'Hello, rake!' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://stackoverflow.com/questions/15205428