Stop using bundle exec
Install this gem and stop using bundle exec
or even
Geordi
Show archive.org snapshot
's handy b
. Yay!
Related cards:
How to discard a surrounding Bundler environment
tl;dr: Ruby's Bundler environment is passed on to system calls, which may not be what you may want as it changes gem and binary lookup. Use Bundler.with_original_env
to restore the environment's state before Bundler was launched. Do this whe...
RubyGems can't find bundle executable although Bundler is installed
I had this error:
> gem install bundler
Successfully installed bundler-2.0.1
1 gem installed
> bundle install
Traceback (most recent call last):
2: from /home/henning/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>'
1: from /home/hennin...
How to update a single gem conservatively
The problem
Calling bundle update GEMNAME
will update a lot more gems than you think. E.g. when you do this:
bundle update cucumber-rails
... you might think this will only update cucumber-rails
. But it actually **updates cucumber...
Bundler 2.3 honors the version specified in `BUNDLED_WITH`
Bundler so far ignored the version specified under BUNDLED_WITH
in the Gemfile.lock
. This had two annoying consequences:
- If the bundler version on your system was lower than in the
Gemfile.lock
, you got an error message and had to manu...
When upgrading/downgrading RubyGems and Bundler on a server, you must clear bundled gems
On application servers, gems are usually bundled into the project directory, at a location shared across deployments.
This is usually shared/bundle
inside your project's root directory, e.g. /var/www/your-project/shared/bundle/
.
If you can't ...
Install a local Gemfile on a remote server
Call with the server's hostname (and user if you have no SSH agent), e.g.
install-gems-remotely my.server.com
# or without agent:
install-gems-remotely me@my.server.com
When you call it from a rails directory, it uploads your `Gemfil...
Automatically run bundle exec if required
There will probably be better solutions as we become more experienced with using Bundler, and more command line tools become Bundler-aware.
b
will use bundle exec
if there is a Gemfile
in the working directory, and run the call without Bund...
Use a Bash function to alias the rake command to Spring binstubs or "bundle exec" fallback
There are different ways to run rake:
- On Rails 4.1+ projects, you have Spring and its binstubs which dramatically improve boot-up time for Rake and similar. You need to run
bin/rake
to use them. - On older projects, you want to run "bundle ex...
Bundler for Rails 2.3.x
Update RubyGems and Passenger
Bundler requires Rubygems >= 1.3.6. Run gem update --system
if you have an older version.
It also is not compatible with older versions of passenger, so bring that up to date ...
whenever: Make runner commands use bundle exec
In whenever you can schedule Ruby code directly like so:
every 1.day, :at => '4:30 am' do
runner "MyModel.task_to_run_at_four_thirty_in_the_morning"
end
Combined with the best practice to hide backg...