3 ms·
Does Ruby not have a virtualenv equivalent? (I am reading through the comments trying to work out if I should learn Docker. I already know how to use a virtual
by collyw 12y ago
Does Ruby not have a virtualenv equivalent?
(I am reading through the comments trying to work out if I should learn Docker. I already know how to use a virtualenv and I already know how to use a VM.)
- pdkl95 12y agoWhile I'm not familiar with python & virtualenv, the problem of that would be solved by putting rails in a container (isolating the ruby environment in a fairly easily deployable way) was solved many years ago with Gemfiles/bundler[1] that pin your dependencies, and the various ways of deploying multiple rubies. RVM does indeed suck hard, but rbenv[2] is very simple (I've used it personally to develop and deploy a few projects). One of the preferred ways to deploy rails is (was? I did this ~2 years ago) was to check it in with git and the name/version of the ruby environment to use is stored in the file ".rbenv-version", with dependencies managed by bundler (which you point to a local gem server). Install is then 1) use rbenv/ruby-install to install basic ruby, 2) install app with "git clone", and 3) run bundler. Many tools exist to do this in one step over ssh/etc automagically. Even better than rbenv, you can just use chruby[3] to point to any rubies you want; just check one into your project itself (or whatever) and configure the siteruby/etc load paths to point to project directories. Really, chruby just fixes up your dev environment to point to a specific ruby; you set the actual project to be self contained with known paths, just like you would do de facto in a container. While dependency issues were a problem back in the ruby 1.8 / rails 2.x days, this [1] http://bundler.io/ http://bundler.io/ [2] https://github.com/sstephenson/rbenv https://github.com/sstephenson/rbenv [3] https://github.com/postmodern/chruby https://github.com/postmodern/chruby
- rylee 12y agoThere's Bundler, which allows you to install all gems to a local path (e.g. `vendor/`) and then one simply runs `bundle exec <command to run in virtual environment>` to do the needful.