You're running
Your system-wide Gemfile may differ from this Gemfile. You may have newer or older gems with which this script doesn't play nice. This difference in versions can give you weird errors.
See more on the man page.
Here's an example Gemfile:
bundle exec on a program. The program's
creators wrote it when certain versions of gems were available. The
program Gemfile specifies the versions of the gems the creators decided
to use. That is, the script was made to run correctly against these gem
versions. Your system-wide Gemfile may differ from this Gemfile. You may have newer or older gems with which this script doesn't play nice. This difference in versions can give you weird errors.
Bundle exec helps you avoid these errors. It executes
the script using the gems specified in the script's Gemfile rather than
the systemwide Gemfile. It executes the certain gem versions with the
magic of shell aliases.See more on the man page.
Here's an example Gemfile:
source 'http://rubygems.org'
gem 'rails', '2.8.3'
Here, bundle exec would execute the script using rails version 2.8.3 and not some other version you may have installed system-wide.
This comes up a lot when your gemfile.lock has different versions of
the gems installed on your machine. You may get a warning after running
rake (or rspec or others) such as:
Prepending
Fortunately, there is a gem that solves this: rubygems-bundler.
Then try your rake, rspec, or whatever again.
You have already activated rake 10.3.1, but your Gemfile
requires rake 10.1.0. Prepending "bundle exec" to your command may solve
this.Prepending
bundle exec tells the bundler to execute this
command regardless of the version differential. There isn't always an
issue, however, you might run into problems.Fortunately, there is a gem that solves this: rubygems-bundler.
$ gem install rubygems-bundler$ $ gem regenerate_binstubsThen try your rake, rspec, or whatever again.
No comments:
Post a Comment