Class: Scripted::Commands::Rake

Inherits:
Object
  • Object
show all
Defined in:
lib/scripted/commands/rake.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ Rake

Returns a new instance of Rake.



10
11
12
# File 'lib/scripted/commands/rake.rb', line 10

def initialize(command)
  @command = command
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



8
9
10
# File 'lib/scripted/commands/rake.rb', line 8

def command
  @command
end

Instance Method Details

#execute!(log = STDOUT) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/scripted/commands/rake.rb', line 14

def execute!(log = STDOUT)
  task = Rake::Task[command]
rescue NameError
  # not running from within Rake, so falling back shelling out
  Shell.new("rake #{command} --trace").execute!(log)
else
  Ruby.new(lambda { task.invoke }).execute!(log)
end