Class: Rap::Rake
- Inherits:
-
Tap::Task
- Object
- Tap::Task
- Rap::Rake
- Defined in:
- lib/rap/rake.rb
Overview
:startdoc::task run rake tasks
Simply enques the specified rake task(s) for execution. Useful when a rake task needs to be executed within a workflow. For example these are equivalent:
% rap rake test
% rake test
The only exeception is in the use of the –help option. Use –rake-help to access the rake help, and –help to access this help.
Class Method Summary collapse
-
.has_rakefile? ⇒ Boolean
Returns true if Rake detects a rakefile.
-
.parse!(argv, app = Tap::App.instance) ⇒ Object
Overrides Tap::Support::FrameworkClass#parse! to do nothing so that all args get passed forward to rake.
Instance Method Summary collapse
-
#process(*argv) ⇒ Object
Executes Rake using the input arguments as if they came from the command line.
Class Method Details
.has_rakefile? ⇒ Boolean
Returns true if Rake detects a rakefile.
34 35 36 |
# File 'lib/rap/rake.rb', line 34 def has_rakefile? ::Rake.application.have_rakefile != nil end |
.parse!(argv, app = Tap::App.instance) ⇒ Object
Overrides Tap::Support::FrameworkClass#parse! to do
nothing so that all args get passed forward to rake.
23 24 25 26 27 28 29 30 31 |
# File 'lib/rap/rake.rb', line 23 def parse!(argv, app=Tap::App.instance) # => instance, argv if argv.include?('--help') puts help exit end argv.collect! {|arg| arg == '--rake-help' ? '--help' : arg} new({}, app) end |
Instance Method Details
#process(*argv) ⇒ Object
Executes Rake using the input arguments as if they came from the command line.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/rap/rake.rb', line 41 def process(*argv) rake = ::Rake.application # run as if from command line using argv current_argv = ARGV.dup begin ARGV.clear ARGV.concat(argv) # now follow the same protocol as # in run, handling options rake.init rake.load_rakefile ensure ARGV.clear ARGV.concat(current_argv) end rake.top_level nil end |