What does bundle exec rake mean?

JnBrymn

What does bundle exec rake db:migrate mean? Or just bundle exec rake <command> in general?

I understand that bundle takes care of maintaining things in the Gemfile. I know what the word "exec" means. I understand that rake maintains all the different scripty things you can do, and I know that db:migrate is one of those. I just don't know what all these words are doing together. Why should bundle be used to execute rake to execute a database migrate?

ghoppe

bundle exec is a Bundler command to execute a script in the context of the current bundle (the one from your directory's Gemfile). rake db:migrate is the script where db is the namespace and migrate is the task name defined.

So bundle exec rake db:migrate executes the rake script with the command db:migrate in the context of the current bundle.

As to the "why?" I'll quote from the bundler page:

In some cases, running executables without bundle exec may work, if the executable happens to be installed in your system and does not pull in any gems that conflict with your bundle.

However, this is unreliable and is the source of considerable pain. Even if it looks like it works, it may not work in the future or on another machine.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Where does bundle exec rake db:migrate come from?

From Dev

What does .:format mean in rake routes

From Dev

What does (.:format) mean in rake routes' output?

From Dev

What does .:format mean in rake routes

From Dev

Ruby rake loaderror - bundle exec rake not working

From Dev

Bundle exec rake spec and custom rake tasks

From Dev

Could not find rake with bundle exec

From Dev

What does "Document is distributed as a bundle" mean?

From Dev

OSGi - What does system.bundle mean?

From Dev

What does desktop_Exec mean?

From Dev

What does desktop_Exec mean?

From Dev

What does + mean in the bash `-exec command {} +`?

From Dev

What does this part mean in find command with -exec \{\}?

From Dev

Segmentation fault when running 'bundle exec rake'

From Dev

Must prepend bundle exec to rake db:migrate

From Dev

bundle exec rake test throwing error

From Dev

Bundle Exec Rake DB Migrate Error

From Dev

bundle exec rake test throwing error

From Java

What does `* Mark bundle as not supporting multiuse` mean in my curl trace?

From Dev

What does “exec some_cmd &” mean in bash

From Dev

What does file.path in gulp-exec mean

From Dev

What does file.path in gulp-exec mean

From Dev

How do I undo bundle exec rake db:setup?

From Dev

Travis CI: The command "bundle exec rake" exited with 1

From Dev

bundle exec rake assets:precompile issue with the generated files

From Dev

How do I use bundle exec rake on RubyMine?

From Dev

MySQLproblem - RAILS_ENV=production bundle exec rake db:migrate

From Dev

Need Assistance Solving Rails "bundle exec rake test" Error

From Dev

Bundle exec rake test running fine but rails test fails

Related Related

HotTag

Archive