Class: CapUtil::RakeTask

Inherits:
Object
  • Object
show all
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

VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#cmdObject (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

#runObject



26
# File 'lib/cap-util/rake_task.rb', line 26

def run; super(@cmd); end