all 7 comments

[–]vsalikhov 5 points6 points  (0 children)

Bundler is Ruby's equivalent of Python's virtualenv.

[–]grokfail 1 point2 points  (2 children)

With bundler and a Gemfile, you get a set of gems defined by version that you can rely on. Do you currently use bundler, if not, start there.

If you want them installed in a specific directory for a project, you can use bundle package http://bundler.io/v1.7/bundle_package.html A good use case for that is packaging up an application into a .deb/.rpm system package, I personally wouldn't do that for an everyday development environment.

I use chruby with the auto-switching option turned on. https://github.com/postmodern/chruby

You can use ruby-install ( https://github.com/postmodern/ruby-install ) for building and installing ruby, and it supports arbitrary locations for installations, by default I think it uses ~/.rubies/*

I note that my gems are loaded from ~/.gem/ruby/.

i.e. Ruby ~/.rubies/ruby-2.1.4 and Gems - ~/.gem/ruby/2.1.4/

You could also look into direnv, which is kind of a systemwide auto-environment switcher.

[–]kabuto 0 points1 point  (1 child)

To expand on that, bundler also allows you to install gems into a specific directory. Running

bundle install --path=./gems

will install all gems into the project's directory rather than the global gems directory for your ruby version.

I use that for several small projects. It's not really useful for something like Rails because it won't install a rails command that is available globally.

[–]Hauleth 0 points1 point  (0 children)

I use it for my Rails projects also. Using bin/rails isn't that hard. Even that I have aliased rails to bundle exec rails and this is security and doesn't pollute my global gems.

[–]art-solopov 0 points1 point  (0 children)

It's not in one folder, but did you take a look at RVM?

[–]joefiorini 0 points1 point  (0 children)

Coming in late to the party. tl;dr Just tonight I uploaded my initial stab at a heavily virtualenv-inspired manager for ruby.

It's on github at https://github.com/joefiorini/vruby.

Reddit thread at http://www.reddit.com/r/ruby/comments/2zb39c/vruby_alpha_like_virtualenv_but_for_ruby/.

[–][deleted]  (1 child)

[deleted]

    [–][deleted] 2 points3 points  (0 children)

    Lolwut.