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
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.
32 33 34 |
# File 'lib/rap/rake.rb', line 32 def has_rakefile? ::Rake.application.have_rakefile != nil end |
.parse!(argv, app = Tap::App.instance) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/rap/rake.rb', line 21 def parse!(argv, app=Tap::App.instance) if argv.include?('--help') puts help exit end argv.collect! {|arg| arg == '--rake-help' ? '--help' : arg} [new({}, app), argv] end |
Instance Method Details
#process(*argv) ⇒ Object
Executes Rake using the input arguments as if they came from the command line.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/rap/rake.rb', line 39 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 |