Class: Engineyard::Local::Middleware::Bundle
Instance Method Summary
collapse
#project_dir, #ssh_exec, #ssh_exec!
#bash_rvm_setup, #export_ruby, #ruby_env_const, #rvm_env, #use_ruby_with_gemset
Constructor Details
#initialize(app, env) ⇒ Bundle
8
9
10
11
|
# File 'lib/engineyard-local/middleware/bundle.rb', line 8
def initialize(app, env)
@app = app
@env = env
end
|
Instance Method Details
#call(env) ⇒ Object
13
14
15
16
17
|
# File 'lib/engineyard-local/middleware/bundle.rb', line 13
def call(env)
@env[:ui].info I18n.t("eylocal.setup.bundling")
ssh_exec!(env, commands)
@app.call(env)
end
|
#commands ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/engineyard-local/middleware/bundle.rb', line 19
def commands
rvm_env +
[
ensure_bundler_is_installed,
"cd #{project_dir}",
"sudo mkdir -p #{project_dir} /data/#{Engineyard::Local.config['app_name']}/",
"if [[ ! -e /data/#{Engineyard::Local.config['app_name']}/current ]]; then sudo ln -sf #{project_dir} /data/#{Engineyard::Local.config['app_name']}/current; fi",
"if [[ ! -e /data/#{Engineyard::Local.config['app_name']}/current/public ]]; then sudo mkdir -p /data/#{Engineyard::Local.config['app_name']}/current/public; fi",
if_gemfile_exists("sudo bundle install")
]
end
|
#ensure_bundler_is_installed ⇒ Object
31
32
33
|
# File 'lib/engineyard-local/middleware/bundle.rb', line 31
def ensure_bundler_is_installed
"sudo bash -c 'command -v bundle &>/dev/null || { sudo gem install bundler; exit 0; }'"
end
|
#if_gemfile_exists(cmd) ⇒ Object
35
36
37
|
# File 'lib/engineyard-local/middleware/bundle.rb', line 35
def if_gemfile_exists(cmd)
"if [[ -e Gemfile || -e Gemfile.lock ]]; then #{cmd}; fi"
end
|