rbenv: Surviving without gemsets

前端 未结 3 997
南笙
南笙 2020-12-12 23:55

TL;DR

  • Don\'t bother with gemsets; multiple versions of a gem may be installed concurrently.
  • When necessary, specify which version to
3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-13 00:38

    Most people solve this by installing the rails gem first via gem install rails. If you refuse to do that for some reason, you can opt out of the automatic bundling that Rails attempts to do for you. This will work completely regardless of your ruby management system.

    mkdir myapp
    cd myapp
    echo "source :rubygems" > Gemfile
    echo "gem 'rails', '3.2.2'" >> Gemfile
    bundle install --path vendor/bundle
    bundle exec rails new . --skip-bundle
    

    When prompted, type "y" to replace your Gemfile with the default Rails one (or not, as you prefer). Then, once it's done:

    bundle install
    

    You're done, and you have boostrapped a new rails app with the version of your choice without installing the rails gem into rubygems.

提交回复
热议问题