Class: Engineyard::Local::Middleware::Exec

Inherits:
Object
  • Object
show all
Includes:
Helpers::Executable, Helpers::Rvm
Defined in:
lib/engineyard-local/middleware/exec.rb

Instance Method Summary collapse

Methods included from Helpers::Executable

#project_dir, #ssh_exec, #ssh_exec!

Methods included from Helpers::Rvm

#bash_rvm_setup, #export_ruby, #ruby_env_const, #rvm_env, #use_ruby_with_gemset

Constructor Details

#initialize(app, env) ⇒ Exec

Returns a new instance of Exec.



8
9
10
# File 'lib/engineyard-local/middleware/exec.rb', line 8

def initialize(app, env)
  @app, @env = app, env
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
# File 'lib/engineyard-local/middleware/exec.rb', line 12

def call(env)
  ssh_exec!(env, commands, :prefix => false)
  @app.call(env)
end

#command_argsObject



22
23
24
# File 'lib/engineyard-local/middleware/exec.rb', line 22

def command_args
  @env["eylocal.exec.command_args"].join(" ")
end

#commandsObject



17
18
19
20
# File 'lib/engineyard-local/middleware/exec.rb', line 17

def commands
  rvm_env +
    [ "cd #{project_dir}", command_args ]
end