Class: Pult::Executor

Inherits:
Object
  • Object
show all
Includes:
Enver
Defined in:
lib/init/struct.rb,
lib/pult/executor.rb

Defined Under Namespace

Modules: Enver Classes: Job, Screener, Terminator

Constant Summary collapse

NOEXEC =
'Нет запуска'

Constants included from Enver

Enver::CURRENT, Enver::DEFAULT, Enver::DEFAULT_VARS, Enver::ENVS, Enver::ENV_BASE, Enver::RESOLVER

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Enver

#with_env

Constructor Details

#initialize(command, dir, params = {}) ⇒ Executor

Returns a new instance of Executor.



25
26
27
28
29
30
31
# File 'lib/pult/executor.rb', line 25

def initialize command, dir, params={}
  @command  = command
  @dir      = dir
  @params   = params.stringify_keys.transform_values {|v| v.to_s }

  @runner   = { info: NOEXEC }
end

Instance Attribute Details

#runnerObject (readonly)

Returns the value of attribute runner.



11
12
13
# File 'lib/pult/executor.rb', line 11

def runner
  @runner
end

Class Method Details

.run!(*args) ⇒ Object



15
16
17
18
19
# File 'lib/pult/executor.rb', line 15

def self.run! *args
  runner = Pult::Executor.new(*args)
  runner.run!
  runner.runner
end

.run_job!(*args) ⇒ Object



21
22
23
# File 'lib/pult/executor.rb', line 21

def self.run_job! *args
  Job.perform_later(*args)
end

Instance Method Details

#run!Object



33
34
35
36
37
# File 'lib/pult/executor.rb', line 33

def run!
  if @command && @dir && @params
    execute!
  end
end