Class: CapUtil::RakeTask
- Inherits:
-
Object
- Object
- CapUtil::RakeTask
- Includes:
- CapUtil
- Defined in:
- lib/cap-util/rake_task.rb
Overview
This defines a base utiltiy for building tasks that run rake tasks. Pass in the rake task name and this will make sure it is run with the appropriate settings and environment
Constant Summary
Constants included from CapUtil
Instance Attribute Summary collapse
-
#cmd ⇒ Object
readonly
Returns the value of attribute cmd.
Instance Method Summary collapse
-
#initialize(cap, task, opts = nil) ⇒ RakeTask
constructor
A new instance of RakeTask.
- #run ⇒ Object
Methods included from CapUtil
color, #get, halt, #hostname, included, run_locally, run_locally_with_stdin, say, say_bulleted, say_error, say_raw, say_warning, time
Constructor Details
#initialize(cap, task, opts = nil) ⇒ RakeTask
Returns a new instance of RakeTask.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/cap-util/rake_task.rb', line 14 def initialize(cap, task, opts=nil) @cap = cap opts ||= {} opts[:root] ||= :current_path opts[:rake] ||= "bundle exec rake" opts[:env] ||= "" rakefile_root = cap.send(opts[:root]) @cmd = "cd #{rakefile_root} && #{opts[:env]} #{opts[:rake]} #{task}" end |
Instance Attribute Details
#cmd ⇒ Object (readonly)
Returns the value of attribute cmd.
12 13 14 |
# File 'lib/cap-util/rake_task.rb', line 12 def cmd @cmd end |
Instance Method Details
#run ⇒ Object
26 |
# File 'lib/cap-util/rake_task.rb', line 26 def run; super(@cmd); end |