简体   繁体   中英

rbenv or bundler gemset sandboxing?

The rbenv documentation states that you can use the gemsets plugin to sandbox your gems if you aren't using bundler:

Manage gemsets. Bundler is a better way to manage application dependencies. If you have projects that are not yet using  Bundler you can install the rbenv-gemset plugin.

However, I am using bundler and when I switch between projects that have different gemsets I need to re-bundle. When I was using rvm, this was simple due to the .gemsets file.

Is there a sandboxing functionality in bundler that I am not aware of or have I misunderstood the documentation?

I found this clear, well-documented solution:

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

Now when you gem install (see “Bundler” section below) something it will go to your helloset gem area.

You can combine use of multiple gemsets with it.

The big benefit to this setup is enabling each project to use a different set of differently versioned gems.

Read the section entitled Enable RVM-style “gemsets” (optional) .

It uses the rbenv plugin for gemsets: https://github.com/jamis/rbenv-gemset .

Update 8/12/2012
I am using this to manage two projects with different versions of Ruby, and separate sets of gems. It works well.

捆绑程序使用GemfileGemfile.lock文件为您通过以bundle exec Gemfile.lock命令访问的特定项目创建一个“ gemset”

Try using chgems with Bundler. chgems is like chroot for RubyGems. It spawns a new sub-shell with PATH , GEM_HOME and GEM_PATH updated to use $project/.gem/$ruby/$version as the primary GEM_HOME . Since all gems are installed inside of the project directory, cleaning up after a project is as easy as rm -rf $project/ .

It may have to do with the way rbevn uses shims. You might want check out https://github.com/carsomyr/rbenv-bundler

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM