lib/vx/builder/script_builder/ruby.rb in vx-builder-0.4.0 vs lib/vx/builder/script_builder/ruby.rb in vx-builder-0.5.0

- old
+ new

@@ -6,18 +6,19 @@ DEFAULT_RUBY = '1.9.3' def call(env) if enabled?(env) + + vxvm_install(env, 'ruby', ruby_version(env)) + do_cache_key(env) do |i| - i << "rvm-#{ruby env}" + i << "rvm-#{ruby_version env}" i << gemfile(env) end do_before_install(env) do |i| - i << 'eval "$(rbenv init -)" || true' - i << "rbenv shell #{make_rbenv_version_command env}" i << trace_sh_command("export BUNDLE_GEMFILE=${PWD}/#{gemfile(env)}") i << trace_sh_command('export GEM_HOME=~/.rubygems') end do_announce(env) do |i| @@ -49,30 +50,15 @@ def enabled?(env) env.source.rvm.first || env.source.language == 'ruby' end - def ruby(env) + def ruby_version(env) env.source.rvm.first || DEFAULT_RUBY end def gemfile(env) env.source.gemfile.first || "Gemfile" - end - - def make_rbenv_version_command(env) - select_rbenv_version(env) - end - - def select_rbenv_version(env) - %{ - $(rbenv versions | - sed -e 's/^\*/ /' | - awk '{print $1}' | - grep -v 'system' | - grep '#{ruby env}' | - tail -n1) - }.gsub(/\n/, ' ').gsub(/ +/, ' ').strip end end end end