Class: Vx::Worker::RunScript

Inherits:
Struct
  • Object
show all
Includes:
Common::Helper::UploadShCommand, Helper::Config, Helper::Logger
Defined in:
lib/vx/worker/middlewares/run_script.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper::Config

#config

Methods included from Helper::Logger

#logger

Instance Attribute Details

#appObject

Returns the value of attribute app

Returns:

  • (Object)

    the current value of app



6
7
8
# File 'lib/vx/worker/middlewares/run_script.rb', line 6

def app
  @app
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/vx/worker/middlewares/run_script.rb', line 12

def call(env)
  if env.spawner
    code = run_script(env)
    run_after_script(env)

    if code == 0
      app.call env
    else
      case read_state(env)
      when "script"
        code
      else
        code * -1
      end
    end
  else
    app.call env
  end
end