Created
November 6, 2012 20:00
-
-
Save hsanchez/4027117 to your computer and use it in GitHub Desktop.
Things to remember about Rake Tasks
This file contains 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
# tasks with arguments | |
task :taskname, :argument do |t, args| | |
message = args[:argument] || 'Hello' | |
puts message | |
end | |
# Tasks in namespaces | |
namespace :namespacename do | |
task :taskname, :argument do |t, args| | |
message = args[:argument] || 'Hello' | |
puts message | |
Rake::Task["namespacename:taskname1"].invoke(message) | |
Rake::Task["namespacename:yeah"].execute | |
end | |
task :taskname1, :argument do |t, args| | |
message = args[:argument] || 'Hello' | |
puts message | |
end | |
tasks :yeah do | |
end | |
end | |
how to define namespaces | |
task :mytask do | |
# ... | |
end | |
namespace :myscope do | |
task :mytask => "rake:mytask" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment