Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Issues creating a project-specific rvm gemset
My rails_apps_composer gem creates an application template from
various "recipes" (similar to Michael Bleigh’s RailsWizard gem):
I've got a recipe that creates a project-specific rvm gemset.
Quite a few users use the recipe without problems but several
have reported errors. I'm not able to identify the source of the errors.
I'd like to get some help. First, to review my code and identify
any obvious errors. Second, for suggestions about how I might
help my users diagnose system configuration issues that might
be causing the errors.
My application template (Thor commands) contains this code:
app_name = 'myapp'
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
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."
RVM.gemset_create app_name
run "rvm rvmrc trust"
RVM.gemset_use! app_name
rescue StandardError
raise "rvm failure: unable to use gemset #{app_name}"
How can I improve the code for improved failure diagnostics?
Here I've got an issue without sufficient details to diagnose or resolve:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment