from my research, bundle exec is responsible for executing a command in the context of a bundle.
anyway, I don't quite understand yet for what it does differently for just the command rake db:migrate
comparing with bundle exec rake db:migrate
.
for example in my case, I executed the first command, and what I got was the following errors:
$ rake db:migrate
(in c:/rails/rails_projects/soccerweb)
rake aborted!
uninitialized constant Rake::DSL
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:8:in `<clas
s:TaskLib>'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:6:in `<modu
le:Rake>'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/tasklib.rb:3:in `<top
(required)>'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/testtask.rb:4:in `requ
ire'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/testtask.rb:4:in `<top
(required)>'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/test_unit/testing.r
ake:2:in `require'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/test_unit/testing.r
ake:2:in `<top (required)>'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/test_unit/railtie.r
b:12:in `load'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/test_unit/railtie.r
b:12:in `block in <class:TestUnitRailtie>'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/railtie.rb:183:in `
call'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/railtie.rb:183:in `
block in load_tasks'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/railtie.rb:183:in `
each'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/railtie.rb:183:in `
load_tasks'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/engine.rb:396:in `b
lock in load_tasks'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/application/railtie
s.rb:8:in `each'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/application/railtie
s.rb:8:in `all'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/engine.rb:396:in `l
oad_tasks'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/application.rb:103:
in `load_tasks'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.1.1/lib/rails/railtie/configurabl
e.rb:30:in `method_missing'
c:/rails/rails_projects/soccerweb/Rakefile:7:in `<top (required)>'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `load'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:1991:in `run'
c:/Ruby192/bin/rake:31:in `<main>'
but when I used "bundle exec" preceding that "rake db:migrate" command, everything just worked for me gracefully!
anyone can shed some light on me?