在 Rails 3 中确实如此rails s
调用捆绑器,这样你就不需要做bundle exec rails s
or is bundle exec
需要运行rails s
在您的应用程序 Gemfile 环境中?
Update据了解bundle exec
由于 rake 版本不同,应在 rake 任务之前使用。看http://railsapps.github.com/installing-rails-3-1.html更多细节。这个问题是关于 Rails 脚本的,例如:
rails s
rails server
rails c
rails console
^Should bundle exec
在这些rails脚本之前使用,还是由rails命令调用bundler?
您应该在 Rail >= 3.1 中看到此行为,但是您需要小心,因为您可能正在使用旧版本的 rake:
最好使用命令 bundle exec rake 而不是 rake
因此您将使用 gemfile 中指定的 Rake 版本(或
Gemfile.lock 文件中指定的依赖项)而不是默认的
版本。例如,运行bundle exec rake,而不是rake db:migrate
数据库:迁移。
您需要了解的内容:确保您使用的是 Rake 0.9.2.2(或更高版本)
在安装 Rails 3.1 之前使用 gem update rake。并使用捆绑执行
用耙子代替耙子。
引用自:http://railsapps.github.com/installing-rails-3-1.html
对于 Rails 命令来说,情况恰恰相反:
不要在rails命令之前运行bundle exec,rails已经检查了
Bundler 通过 Gemfile 存在并设置一切
根据它,没有捆绑执行的开销。 Rails 命令是
唯一的例外。
引用自:https://www.wyeworks.com/blog/2011/12/27/bundle-exec-rails-executes-bundler-setup-3-times/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)