Module: Engineyard::Local::Middleware::Helpers::Executable

Included in:
Bundle, Chef, Cookbooks, Cookbooks, DNA, Exec, Rails::Assets, Rails::Command, Rails::DB, Rails::Install, Rails::New
Defined in:
lib/engineyard-local/middleware/helpers/executable.rb

Instance Method Summary collapse

Instance Method Details

#project_dirObject

TODO might belong in a general helpers mixin



32
33
34
# File 'lib/engineyard-local/middleware/helpers/executable.rb', line 32

def project_dir
  @env[:vm].config.vm.shared_folders["v-root"][:guestpath]
end

#ssh_exec(env, bash_commands, opts = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/engineyard-local/middleware/helpers/executable.rb', line 19

def ssh_exec(env, bash_commands, opts = {})
  commands = bash_commands.join(";\n")

  r = Hash.new {|h,k| h[k] = []}

  env[:vm].channel.execute(commands, opts) do |stream, data|
    r[stream] << data
  end

  r
end

#ssh_exec!(env, bash_commands, opts = {}) ⇒ Object

Depends soley on the commands method



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/engineyard-local/middleware/helpers/executable.rb', line 7

def ssh_exec!(env, bash_commands, opts = {})
  commands = bash_commands.join(";\n")

  env[:vm].channel.execute(commands) do |stream, data|
    if stream == :stdout
      env[:vm].ui.info(data.strip, opts)
    else
      env[:vm].ui.error(data.strip, opts)
    end
  end
end