Class: Ppl::Command::External

Inherits:
Application::Command show all
Defined in:
lib/ppl/command/external.rb

Instance Attribute Summary collapse

Attributes inherited from Application::Command

#storage

Instance Method Summary collapse

Methods inherited from Application::Command

add_property, #options

Constructor Details

#initialize(name, command, description) ⇒ External

Returns a new instance of External.



5
6
7
8
9
# File 'lib/ppl/command/external.rb', line 5

def initialize(name, command, description)
  @name = name
  @command = command
  @description = description
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



3
4
5
# File 'lib/ppl/command/external.rb', line 3

def command
  @command
end

Instance Method Details

#execute(input, output) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/ppl/command/external.rb', line 11

def execute(input, output)
  if !input.arguments.empty?
    @command += " " + input.arguments.join(" ")
  end
  Dir.chdir(@storage.path)
  Kernel.exec(@command)
end