script/use_rails in andrewroth_activeadmin-0.3.4.3 vs script/use_rails in andrewroth_activeadmin-0.3.4.4

- old
+ new

@@ -1,10 +1,12 @@ #!/usr/bin/env ruby # # Switches the development environment to use the given # version of rails. Caches the Gemfile.locks so that # switching it very fast. +# +require File.expand_path("../../spec/support/detect_rails_version", __FILE__) def cmd(command) puts command exit 1 unless system command end @@ -32,15 +34,20 @@ # --clobber passed in if File.exists?(gem_lock_file) && ARGV.include?('--clobber') cmd "rm #{gem_lock_file}" end -unless File.exists?(gem_lock_file) - # Generate it +write_rails_version(version) + +# Ensure that bundler installs +ENV['RUBYOPT'] = '' + +if File.exists?(gem_lock_file) + cmd("rm Gemfile.lock") if file_or_symlink?("Gemfile.lock") + cmd("ln -s #{gem_lock_file} Gemfile.lock") + cmd("bundle") +else cmd "rm Gemfile.lock" if file_or_symlink?("Gemfile.lock") - cmd "export RAILS=#{version} && bundle install" + cmd "bundle install" cmd "mv Gemfile.lock #{gem_lock_file}" + cmd("ln -s #{gem_lock_file} Gemfile.lock") end - -cmd("rm Gemfile.lock") if file_or_symlink?("Gemfile.lock") -cmd("ln -s #{gem_lock_file} Gemfile.lock") -cmd("bundle")