Class: Vx::Builder::Script::Ruby

Inherits:
Struct
  • Object
show all
Includes:
Helper::TraceShCommand
Defined in:
lib/vx/builder/script/ruby.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper::TraceShCommand

#trace_sh_command

Instance Attribute Details

#app ⇒ Object

Returns the value of attribute app

Returns:

  • (Object) —

    the current value of app



5
6
7
# File 'lib/vx/builder/script/ruby.rb', line 5

def app
  @app
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/vx/builder/script/ruby.rb', line 9

def call(env)
  if rvm env
    env.cache_key << "rvm-#{rvm env}"

    env.before_install.tap do |i|
      i << 'eval "$(rbenv init -)" || true'
      i << "rbenv shell #{make_rbenv_version_command env}"
      i << 'export BUNDLE_GEMFILE=${PWD}/Gemfile'
      i << 'export GEM_HOME=$HOME/cached/rubygems'
    end

    env.announce.tap do |a|
      a << trace_sh_command("ruby --version")
      a << trace_sh_command("gem --version")
      a << trace_sh_command("bundle --version")
    end

    env.install.tap do |i|
      i << trace_sh_command("bundle install")
      i << trace_sh_command("bundle clean --force")
    end
  end

  app.call(env)
end