-
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
I use the rvm gem (version 1.11.3.9) in Rails Composer to generate a project-specific rvm gemset.
I've got Ruby 2.2.2 (installed with RVM) and Rails Composer works fine:
$ rails new myapp -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb
.
.
.
Use or create a project-specific rvm gemset? (y/n) y
.
.
.
(success)
I recently installed Ruby 2.2.3 and Rails 4.2.5 and Rails Composer fails:
$ rails new myapp -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb
.
.
.
Use or create a project-specific rvm gemset? (y/n) y
.
.
.
recipe creating project-specific rvm gemset and .rvmrc
https://raw.github.com/RailsApps/rails-composer/master/composer.rb:2606:
in `rescue in apply': RVM gem is currently unavailable. (RuntimeError)
from https://raw.github.com/RailsApps/rails-composer/master/composer.rb:2600:in `apply'
Here's the code that uses the rvm gem:
if prefs[:rvmrc]
if which("rvm")
say_wizard "recipe creating project-specific rvm gemset and .rvmrc"
# using the rvm Ruby API, see:
# http://blog.thefrontiergroup.com.au/2010/12/a-brief-introduction-to-the-rvm-ruby-api/
# https://rvm.io/integration/passenger
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
begin
gems_path = ENV['MY_RUBY_HOME'].split(/@/)[0].sub(/rubies/,'gems')
ENV['GEM_PATH'] = "#{gems_path}:#{gems_path}@global"
require 'rvm'
RVM.use_from_path! File.dirname(File.dirname(__FILE__))
rescue LoadError
raise "RVM gem is currently unavailable."
end
end
say_wizard "creating RVM gemset '#{app_name}'"
RVM.gemset_create app_name
say_wizard "switching to gemset '#{app_name}'"
# RVM.gemset_use! requires rvm version 1.11.3.5 or newer
rvm_spec =
if Gem::Specification.respond_to?(:find_by_name)
Gem::Specification.find_by_name("rvm")
else
Gem.source_index.find_name("rvm").last
end
unless rvm_spec.version > Gem::Version.create('1.11.3.4')
say_wizard "rvm gem version: #{rvm_spec.version}"
raise "Please update rvm gem to 1.11.3.5 or newer"
end
begin
RVM.gemset_use! app_name
rescue => e
say_wizard "rvm failure: unable to use gemset #{app_name}, reason: #{e}"
raise
end
if File.exist?('.ruby-version')
say_wizard ".ruby-version file already exists"
else
create_file '.ruby-version', "#{RUBY_VERSION}\n"
end
if File.exist?('.ruby-gemset')
say_wizard ".ruby-gemset file already exists"
else
create_file '.ruby-gemset', "#{app_name}\n"
end
else
say_wizard "WARNING! RVM does not appear to be available."
end
end
Has something changed? Does the rvm gem still work with Ruby 2.2.3?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels