TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Rubies and Bundles - switching from RVM to rbenv

48 点作者 hcm超过 12 年前

7 条评论

bradleyland超过 12 年前
Why manage something manually when there are good tools to abstract it away in to the background? That's kind of the feeling I get when using rbenv + bundler.<p>Let me predicate this by pointing out that I manage a lot of Ruby projects (many are old) that require a wide variety of Ruby and gem versions. Obviously my solution isn't the best for everyone. Some developers will never have to worry about conflicting gem versions, because they work primarily on one project with one set of dependencies. The incremental value of the items I'm about to point out don't represent significant value to them. Enough with the disclaimers.<p>Bundler has the ability to alter your Ruby env variables so that you can easily install and execute gems from any location. This is the feature that allows you to use completely different gems across many projects without any conflicts. As the author suggests, you can pass a path at the time you invoke `bundle install` as a means to specify this location. This allows you to segregate gems to avoid conflicts. The author also points out that the trade-off is "one annoying side effect: any binaries that are installed (e.g. rspec, foreman, cap) are no longer available in your shell’s path". Bummer. I wonder if there's a way around that? Hey, we could manage our environment so that these items are in our path, but remain segregated. We could even write some tidy scripts that automate it for us. Enter RVM.<p>This is why I don't understand the drive to move to rbenv for developers who need these features. I use RVM <i>and</i> bundler all the time. RVM doesn't preclude the use of bundler, and bundler doesn't make RVM obsolete. When I establish an RVM gemset and .rvmrc, I've abstracted away all the '--path=./.somebundledir' and `bundle exec` nonsense. I only think about it once, then I'm free to use the tools without additional cruft. I'm probably happier than I should be that I can type `cap staging deploy:pending` instead of `bundle exec cap staging deploy:pending`.<p>If you don't need gemsets, or you're only managing a very small number of Ruby projects, I suppose I can understand wanting a simpler tool, but I don't find RVM terribly complex. A lot of people will say "choice is good", but principle applied without cause isn't good, it's just pedantic.
评论 #4758389 未加载
评论 #4758713 未加载
masnick超过 12 年前
I've never found it necessary to use the --path or --binatubs options with rbenv.<p>For --path, I just use the default which presumably puts everything in the main rbenv folder for gems. I've never had a problem with this.<p>For the problem of having to type "bundle exec" before every command that uses a binary from a gem, I've heard of two alternative solutions. One is aliasing "bundle exec" to "be" or something to make it quicker to type. The other is using zsh/oh-my-zsh instead of bash and using a plugin (can't remember the name off the top of my head) that automatically figures out what should be bundle execed and takes care of it behind the scenes. I've never had trouble with this either.
评论 #4757518 未加载
darrencauthon超过 12 年前
Sometimes the simpler solution is the more complex tool -- if that's what everybody already uses and if it already works. Just like RVM.
评论 #4757752 未加载
评论 #4757638 未加载
zimbatm超过 12 年前
Just a little plug, I wrote this language-agnostic environment loader: <a href="http://direnv.net" rel="nofollow">http://direnv.net</a> . Unline rvm it doesn't hijack all your shell builtins and is very lightweigh (keeps your prompt fast). I use it every day load load ruby/python/go/... projects in isolation.
llasram超过 12 年前
For something even simpler, check out redenv -- <a href="https://github.com/damballa/redenv" rel="nofollow">https://github.com/damballa/redenv</a> . It tries to provide something which works more like Python's virtualenv, just doing the minimum necessary to setup an environment referencing a particular system-provided Ruby installation, but with an isolated gemset.
hayksaakian超过 12 年前
In one of the linked posts they compare it to the rails vs Sinatra relationship, but in this case, since rvm and rbenv don't ever make their way to a consumer there's no real reason to switch.<p>I suppose if you're someone who has to work with multiple Ruby versions, it COULD save you time switching between them.
patrickslee超过 12 年前
But there is <a href="https://github.com/carsomyr/rbenv-bundler" rel="nofollow">https://github.com/carsomyr/rbenv-bundler</a> already.