Class: ForemanAdmin::ExternalCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/foreman_admin/external_command.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

command_name, #command_name, description, #description

Class Method Details

.external_invocation(invocation = nil) ⇒ Object

The base command that will be executed externally. Think of this as ARGV of what we’re running externally.



7
8
9
10
# File 'lib/foreman_admin/external_command.rb', line 7

def self.external_invocation(invocation = nil)
  @external_invocation = invocation if invocation
  @external_invocation
end

Instance Method Details

#executeObject



22
23
24
# File 'lib/foreman_admin/external_command.rb', line 22

def execute
  puts `#{external_command}`
end

#external_commandObject

The exact assembled command that will be executed externally. Override this in a child class if you want it have logic.



18
19
20
# File 'lib/foreman_admin/external_command.rb', line 18

def external_command
  "#{external_invocation}"
end

#external_invocationObject



12
13
14
# File 'lib/foreman_admin/external_command.rb', line 12

def external_invocation
  self.class.external_invocation
end