lib/vx/builder/script_builder/ruby.rb in vx-builder-0.5.23 vs lib/vx/builder/script_builder/ruby.rb in vx-builder-0.5.24
- old
+ new
@@ -11,22 +11,24 @@
'jruby-19mode' => 'jruby'
}
def call(env)
if enabled?(env)
- vxvm_install(env, 'ruby', ruby_version(env))
do_cache_key(env) do |i|
- i << "rvm-#{ruby_version env}"
+ ruby_v = ruby_version(env) || 'default'
+ i << "rvm-#{ruby_v}"
i << gemfile(env)
end
do_before_install(env) do |i|
i << trace_sh_command("export RAILS_ENV=test")
i << trace_sh_command("export RACK_ENV=test")
i << trace_sh_command("export BUNDLE_GEMFILE=${PWD}/#{gemfile(env)}")
i << trace_sh_command('export GEM_HOME=~/.rubygems')
+ i << trace_sh_command("vx_builder ruby:install #{ruby_version env}")
+ i << "source $(cat .ruby-activate)"
end
do_announce(env) do |i|
i << trace_sh_command("ruby --version")
i << trace_sh_command("gem --version")
@@ -34,10 +36,11 @@
end
do_install(env) do |i|
bundler_args = env.source.bundler_args.first || DEFAULT_BUNDLE_INSTALL_ARGS
i << trace_sh_command("bundle install #{bundler_args}")
+ i << trace_sh_command("vx_builder ruby:rails:install")
end
do_script(env) do |i|
script = "if [ -f Rakefile ] ; then \n #{trace_sh_command "bundle exec rake"}\nfi"
i << script
@@ -46,28 +49,10 @@
do_cached_directories(env) do |i|
i << "~/.rubygems"
end
end
- if auto_build?(env)
- vxvm_install(env, 'ruby', DEFAULT_RUBY)
-
- do_init(env) do |i|
- src = File.read(File.expand_path("../../../../../bin/vx_ruby_auto_build", __FILE__))
- i << upload_sh_command("~/vx_ruby_auto_build", src)
- i << "sudo chmod 0755 ~/vx_ruby_auto_build"
- end
-
- do_script(env) do |i|
- i << "~/vx_ruby_auto_build"
- end
-
- do_cached_directories(env) do |i|
- i << "~/.rubygems"
- end
- end
-
app.call(env)
end
private
@@ -78,10 +63,10 @@
def enabled?(env)
env.source.rvm.first || env.source.language == 'ruby'
end
def ruby_version(env)
- v = env.source.rvm.first || DEFAULT_RUBY
+ v = env.source.rvm.first
ALIASES[v] || v
end
def gemfile(env)
env.source.gemfile.first || "Gemfile"