lib/pah/partials/_rvm.rb in pah-0.0.4 vs lib/pah/partials/_rvm.rb in pah-0.0.5
- old
+ new
@@ -4,24 +4,25 @@
# Need to strip colors in case rvm_pretty_print_flag is enabled in user's .rvmrc
rvm_list = `rvm list`.gsub(Regexp.new("\e\\[.?.?.?m"), '')
current_ruby = rvm_list.match(/=.? ([^ ]+)/)[1]
-desired_ruby = ask_unless_test("Which RVM Ruby would you like to use? [#{current_ruby}]".red)
-desired_ruby = current_ruby if desired_ruby.blank?
+desired_ruby = current_ruby.gsub(/\-p\d+/, "")
@env = RVM::Environment.new(desired_ruby)
-gemset_name = ask_unless_test("What name should the custom gemset have? [#{@app_name}]".red)
-gemset_name = @app_name if gemset_name.blank?
+gemset_name = @app_name
puts "Creating gemset #{gemset_name} in #{desired_ruby}"
@env.gemset_create(gemset_name)
puts "Now using gemset #{gemset_name}"
@env.gemset_use!(gemset_name)
-if `rvm current`.strip.split('@')[1] != gemset_name
- puts "Error using gemset #{gemset_name}".red
+rvm_current = `rvm current`.match(/[\w\d.-]+@[\w\d\.-]+/)[0].strip.split('@').last
+
+if rvm_current != gemset_name
+ puts "Error using gemset #{gemset_name}:".red
+ puts "#{rvm_current} does not match the gemset #{gemset_name}".yellow
exit
end
# Since the gemset is likely empty, manually install bundler so it can install the rest
run "gem install bundler --no-ri --no-rdoc"