Search code examples
ruby-on-railsrubyrbenv

vendor/bundle and ruby version


I want to know if I'm doing incorrectly with rbenv and bundler.

I'm using rbenv and ruby 2.1.2, like so

rbenv versions
  system
* 2.1.2 (set by /home/deploy/cp/repo/.ruby-version)

I run

bundle install --deployment --without=development,test --path=vendor/bundle

from /home/deploy/cp

but get

vendor/bundle/ruby/2.1.0

created with all my gems. Is there a versioning scheme I'm unaware of for bundler, or should I see a

/home/deploy/cp/repo/vendor/bundle/ruby/2.1.2

dir?


Solution

  • I've noticed this too, I just assumed it must just be a convention Bundler is using. I have apps that have been upgraded from 1.9.3 to 2.1.2, and I have:

    /path/to/shared/bundle
      /ruby
        /1.9.1
        /2.1.0
    

    These machines have never had 1.9.1 or 2.1.0 installed, only 1.9.3 and 2.1.2.

    edit: Ok so I dug for fun... It comes from RbConfig in Bundler::Installer#generate_standalone:

    (nick@thin)-(~)
    (505)⚡️ ruby --version
    ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
    
    (nick@thin)-(~)
    (506)⚡️ pry
    [1] pry(main)> RbConfig::CONFIG['ruby_version']
    => "2.1.0"