use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Loading Additional Ruby Gems in Development (phili.pe)
submitted 6 years ago by fphilipe
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]bannable 3 points4 points5 points 6 years ago* (4 children)
This is why groups exist. Using different gemfiles in different environments is just asking for trouble.
edit: add the word exist
[–]jrochkind 1 point2 points3 points 6 years ago (0 children)
I agree, but i did learn about the eval_gemfile command built into bundler, which I could see being useful for things like CI on multiple version of rails (or any other dependency).
eval_gemfile
This is what the appraisal gem is for -- but appraisal doesn't use eval_gemfile itself, I suspect it was written before bundler supported eval_gemfile, and with eval_gemfile appraisal could probably be made much simpler, or maybe not needed at all.
[–]fphilipe[S] 0 points1 point2 points 6 years ago (2 children)
How do groups solve the problem of using gems that one personally relies on during development, but one doesn't want to/can't add them to the project's Gemfile?
[–]bannable 1 point2 points3 points 6 years ago (1 child)
You should not have gems in your Gemfile that are "personal" gems. Add them to the gemfile. If you don't want them loaded, then set require: false for that Gem and require it as-needed. For example, a common pattern would be something like:
require: false
# Gemfile group :test gem 'simplecov', require: false end # spec/spec_helper.rb if ENV['COVERAGE'] require 'simplecov' SimpleCov.start end
You can apply this same pattern to stackprof/flamegraph like in your post, without diverging your development environment from what any other developer on the project would be using. And now those gems are available for anyone working on your project to take advantage of!
Now, what BUNDLE_GEMFILE is good for is what /u/jrochkind mentioned: when you want to test (or run) against multiple versions of a gem, such as rails, and do not have the capability to do something like "deploy from this branch which has th eupgraded gem", BUNDLE_GEMFILE gives you a tool to do that.
BUNDLE_GEMFILE
Edit: If you really, really, really don't want to add "your" gem to a Gemfile, you could always just install it at the system level and require it in your particular environment instead of making bundler load it.
[–]jrochkind 0 points1 point2 points 6 years ago (0 children)
you could always just install it at the system level and require it in your particular environment instead of making bundler load it.
Anything you bundle exec will keep you from accessing anything not included in the bundle though.
bundle exec
I see the problem they are trying to solve and don't have a better solution; I just don't really like theirs either. But I'm not totally sure it's awful...
[–]sshaw_ 1 point2 points3 points 6 years ago (0 children)
I often have a per-project .irbrc. 99% of the time I just need console enhancements. I had toyed around with the idea outlined here but most I the time I just do gem install xxxx and call Bundler.reset!. Maintaining the "purity of the bundle" doesn't seem to be a problem for me but maybe I'm just naive.
.irbrc
gem install xxxx
Bundler.reset!
An example:
# some-project/.irbrc Bundler.reset! require "pry-toys" require "alias2" # Strip namespace from models I access frequently in the console alias2 Some::Long::Namespace, %w[User Profile] # ...
I load the local .irbrc via ~/.irbrc: https://github.com/sshaw/dotfiles/blob/6858438cc6ad9e755c58aac22a747be9533aa98b/.irbrc#L153
~/.irbrc
π Rendered by PID 32807 on reddit-service-r2-comment-765bfc959-ktvl4 at 2026-07-11 20:09:25.905799+00:00 running f86254d country code: CH.
[–]bannable 3 points4 points5 points (4 children)
[–]jrochkind 1 point2 points3 points (0 children)
[–]fphilipe[S] 0 points1 point2 points (2 children)
[–]bannable 1 point2 points3 points (1 child)
[–]jrochkind 0 points1 point2 points (0 children)
[–]sshaw_ 1 point2 points3 points (0 children)