Created
April 12, 2013 22:56
-
-
Save samkim/5375860 to your computer and use it in GitHub Desktop.
Meta rake file that collects tasks in other rake files
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
require "rubygems" | |
require "rake" | |
Rake::TaskManager.record_task_metadata = true | |
puts "Begin loading tasks" | |
# Import rake scripts from the following directories: | |
[ | |
'build', | |
'deploy' | |
].each do |dir| | |
Dir.glob("#{dir}/*.rake").each do |file| | |
puts "Loading #{file}" | |
import file | |
end | |
end | |
puts "Done loading tasks" | |
puts | |
# Require user to specify an action before doing anything | |
desc "Show usage info by default" | |
task :default => [:usage] | |
desc "Show overview of available tasks" | |
task :usage do | |
# Using heredocs, excuse the weird formatting | |
# Overview info | |
puts <<INTRO | |
Rake development tasks | |
Usage: rake <task> <options> | |
INTRO | |
# List and describe all available tasks | |
puts <<TASKS | |
Available tasks: | |
==================== | |
TASKS | |
Rake.application.tasks.each do |task| | |
puts "#{task.name} - #{task.comment}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment