Class: Balmora::Command::Exec

Inherits:
Balmora::Command show all
Defined in:
lib/balmora/command/exec.rb

Defined Under Namespace

Classes: Error

Instance Method Summary collapse

Methods inherited from Balmora::Command

#_execute, #execute, #init, #initialize, #option

Constructor Details

This class inherits a constructor from Balmora::Command

Instance Method Details

#optionsObject



5
6
7
# File 'lib/balmora/command/exec.rb', line 5

def options()
  return super().concat([:exec])
end

#runObject



15
16
17
18
19
20
21
22
# File 'lib/balmora/command/exec.rb', line 15

def run()
  exec = option(:exec)
  if !exec.instance_of?(::Array)
    exec = [@shell.expression(exec)]
  end

  @shell.system(exec, change: true)
end

#verifyObject



9
10
11
12
13
# File 'lib/balmora/command/exec.rb', line 9

def verify()
  if @exec.nil?()
    raise Error.new('"exec" should be defined')
  end
end