Blankman
Blankman

Reputation: 267240

What does 'bundle exec rake' versus rake do?

What is the difference between doing:

bundle exec rake

and

rake

I see people doing both, I never do bundle before my commands, curious what the reason for it is?

Upvotes: 27

Views: 5762

Answers (2)

Tolik Kukul
Tolik Kukul

Reputation: 2016

bundle exec executes a command in the context of the bundle. This command executes the command, making all gems specified in the Gemfile available to require in Ruby programs. Very useful when you have many applications with different versions of gems used in them.

Please see docs for more information: http://gembundler.com/man/bundle-exec.1.html

Upvotes: 22

weddingcakes
weddingcakes

Reputation: 653

bundle exec runs the command after it in the environment of Bundler. So say you had rake 0.9 in you Gemfile, but rake 10 installed in RubyGems.bundle exec rake will run rake 0.9 instead of rake 10.

Upvotes: 15

Related Questions