RailsApps/rails_apps_composer

Error when installing rails_apps_composer using Bundler

mmay opened this issue · 10 comments

mmay commented

Got the RuntimeError:

RVM gem is currently unavailable

when creating a new app like so:

rails_apps_composer new name -r core

Not sure if this is something on my end or something internal.

      recipe  Running extras recipe...
      extras  Set a robots.txt file to ban spiders? (y/n) 
      extras  Set a robots.txt file to ban spiders? (y/n) y
      extras  Create a project-specific rvm gemset and .rvmrc? (y/n) y
      extras  Create a GitHub repository? (y/n) n
      extras  recipe banning spiders by modifying 'public/robots.txt'
      extras  recipe creating project-specific rvm gemset and .rvmrc
/var/folders/p3/rnkdqw0x1rsfsv7nvf9y91gc0000gn/T/template20120913-21771-16vdqdm:1652:in `rescue in apply': RVM gem is currently unavailable. (RuntimeError)
    from /var/folders/p3/rnkdqw0x1rsfsv7nvf9y91gc0000gn/T/template20120913-21771-16vdqdm:1646:in `apply'
    from /.../.rvm/gems/ruby-1.9.3-head/gems/thor-0.16.0/lib/thor/actions.rb:221:in `instance_eval'
    from /.../.rvm/gems/ruby-1.9.3-head/gems/thor-0.16.0/lib/thor/actions.rb:221:in `apply'
    from /.../.rvm/gems/ruby-1.9.3-head/gems/railties-3.2.7/lib/rails/generators/app_base.rb:109:in `apply_rails_template'
    from (eval):1:in `apply_rails_template'
    from /.../.rvm/gems/ruby-1.9.3-head/gems/thor-0.16.0/lib/thor/task.rb:27:in `run'
    from /.../.rvm/gems/ruby-1.9.3-head/gems/thor-0.16.0/lib/thor/invocation.rb:120:in `invoke_task'
    from /.../.rvm/gems/ruby-1.9.3-head/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `block in invoke_all'
    from /.../.rvm/gems/ruby-1.9.3-head/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `each'
    from /.../.rvm/gems/ruby-1.9.3-head/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `map'
    from /.../.rvm/gems/ruby-1.9.3-head/gems/thor-0.16.0/lib/thor/invocation.rb:126:in `invoke_all'
    from /.../.rvm/gems/ruby-1.9.3-head/gems/thor-0.16.0/lib/thor/group.rb:238:in `dispatch'
    from /.../.rvm/gems/ruby-1.9.3-head/gems/thor-0.16.0/lib/thor/base.rb:425:in `start'
    from /.../.rvm/gems/ruby-1.9.3-head/gems/railties-3.2.7/lib/rails/commands/application.rb:38:in `<top (required)>'
    from /.../.rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /.../.rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /.../.rvm/gems/ruby-1.9.3-head/gems/railties-3.2.7/lib/rails/cli.rb:15:in `<top (required)>'
    from /.../.rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /.../.rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
    from /.../.rvm/gems/ruby-1.9.3-head/gems/railties-3.2.7/bin/rails:7:in `<top (required)>'
    from /.../.rvm/gems/ruby-1.9.3-head/bin/rails:19:in `load'
    from /.../.rvm/gems/ruby-1.9.3-head/bin/rails:19:in `<main>'

This is most likely due to an rvm installation problem. First, can you create a new rvm gemset manually? Do you have the newest rvm release? $ rvm get latest Try updating your rvm gem gem update rvm If still seeing a failure, I recommend removing and reinstalling rvm. Let me know how it goes.

mmay commented

Thanks for the quick reply. Silly me, the problem was that I didn't have the rvm gem in my current gemset.

Closing.

I'm getting the same error. I'm using both the latest stable version of rvm and the latest version of the rvm gem.

Do I need to run rails_apps_composer from ruby's global gemset?

And if I say no to the rvm question, I still get an rvm-(seemingly-)related error:

The template [/path/to/template.rb] could not be loaded. Error: cannot load such file -- html2haml

Hmmm... I'm getting somewhere now. I'm using bundler to install rails_apps_composer, and it looks like I need to include all the gems I'll need in the Gemfile:

source 'https://rubygems.org'

gem 'rails'
gem 'rails_apps_composer'
gem 'html2haml'
gem 'rvm'
gem 'activerecord-postgresql-adapter'
gem 'simple_form'
gem 'figaro'
gem 'rspec-rails'
gem 'devise'
gem 'email_spec'

You can install rails_apps_composer into the global gemset, but I recommend creating a gemset for rails_apps_composer:

$ rvm use ruby-2.0.0@rails_apps_composer --create

You'll need to add Rails before running rails_apps_composer:

$ gem install rails

Installation is simple:

$ gem install rails_apps_composer

Then try

rails_apps_composer new myapp -r core

There is no need to install additional gems as rails_apps_composer will add them to to a temporary application template and Bundler will install them as needed.

I suggest taking a look at the article http://railsapps.github.com/installing-rails.html to make sure your development environment is set up correctly. Not sure why you are seeing the errors.

I'm pretty sure the problem was that I had installed rails_apps_composer via bundler. Bundler was probably isolating rails_apps_composer from other gemsets (or some other such nonsense that is entirely acceptable except in rails_apps_composer's case).

I've got it working now(-ish) by not using bundler to install rails_apps_composer. Would you mind updating the Installation part of the readme to advise against using bundler to install rails_apps_composer? I think it would help others.

I've never used Bundler this way so please help me understand. Did you create a new folder with a Gemfile that includes rails_apps_composer? And then ran bundle install to install rails_apps_composer?

That's exactly what I did. And it borked everything.

Ok, good to know. I've update the README install instructions to offer a warning.