Skip to content

Instantly share code, notes, and snippets.

@DanielKehoe
Created September 10, 2012 18:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanielKehoe/3692587 to your computer and use it in GitHub Desktop.
Save DanielKehoe/3692587 to your computer and use it in GitHub Desktop.
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):
https://github.com/RailsApps/rails_apps_composer
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')
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
RVM.gemset_create app_name
run "rvm rvmrc trust"
begin
RVM.gemset_use! app_name
rescue StandardError
raise "rvm failure: unable to use gemset #{app_name}"
end
````
How can I improve the code for improved failure diagnostics?
Here I've got an issue without sufficient details to diagnose or resolve:
https://github.com/RailsApps/rails-composer/issues/14
Thanks!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment