似乎无法更新 bin/ 中的 rails 可执行文件
cannot seem to update the rails executable in bin/
我有一个 rails 项目,我在其中使用 bin/rails
而不是仅仅调用 rails
自身。升级到 rails 4.2 后,我做了:
rm -rf .bundle/gems
bundle
当一切都完成后,我做了bin/rails
$ bin/rails
Looks like your app's ./bin/rails is a stub that was generated by Bundler.
In Rails 4, your app's bin/ directory contains executables that are versioned
like any other source code, rather than stubs that are generated on demand.
Here's how to upgrade:
bundle config --delete bin # Turn off Bundler's stub generator
rake rails:update:bin # Use the new Rails 4 executables
git add bin # Add bin/ to source control
You may need to remove bin/ from your .gitignore as well.
When you install a gem whose executable you want to use in your app,
generate it and add it to source control:
bundle binstubs some-gem-name
git add bin/new-executable
/Users/Adam/Documents/Rails-Projects/Libraries-and-Helpers/Xaaron/.bundle/gems/gems/railties-4.2.0/lib/rails/app_rails_loader.rb:44:in `require': cannot load such file -- /Users/Adam/Documents/Rails-Projects/Libraries-and-Helpers/Xaaron/config/boot (LoadError)
from /Users/Adam/Documents/Rails-Projects/Libraries-and-Helpers/Xaaron/.bundle/gems/gems/railties-4.2.0/lib/rails/app_rails_loader.rb:44:in `block in exec_app_rails'
from /Users/Adam/Documents/Rails-Projects/Libraries-and-Helpers/Xaaron/.bundle/gems/gems/railties-4.2.0/lib/rails/app_rails_loader.rb:34:in `loop'
from /Users/Adam/Documents/Rails-Projects/Libraries-and-Helpers/Xaaron/.bundle/gems/gems/railties-4.2.0/lib/rails/app_rails_loader.rb:34:in `exec_app_rails'
from /Users/Adam/Documents/Rails-Projects/Libraries-and-Helpers/Xaaron/.bundle/gems/gems/railties-4.2.0/lib/rails/cli.rb:5:in `<top (required)>'
from /Users/Adam/Documents/Rails-Projects/Libraries-and-Helpers/Xaaron/.bundle/gems/gems/railties-4.2.0/bin/rails:9:in `require'
from /Users/Adam/Documents/Rails-Projects/Libraries-and-Helpers/Xaaron/.bundle/gems/gems/railties-4.2.0/bin/rails:9:in `<top (required)>'
from bin/rails:16:in `load'
from bin/rails:16:in `<main>'
所以我假设我可以做,在做 bundle config --delete bin
:
rake rails:update:bin
但后来我得到:
rake aborted!
Don't know how to build task 'rails'
我正在从我创建的 rails 引擎的根目录运行它。我很好奇发生了什么事。我应该从虚拟应用程序运行此命令吗?我怀疑不是,因为 bin/
目录位于引擎目录的根目录而不是虚拟应用程序。
根据对问题的评论,正确答案是 运行:
rake app:rails:update:bin
在引擎的根部。
我有一个 rails 项目,我在其中使用 bin/rails
而不是仅仅调用 rails
自身。升级到 rails 4.2 后,我做了:
rm -rf .bundle/gems
bundle
当一切都完成后,我做了bin/rails
$ bin/rails
Looks like your app's ./bin/rails is a stub that was generated by Bundler.
In Rails 4, your app's bin/ directory contains executables that are versioned
like any other source code, rather than stubs that are generated on demand.
Here's how to upgrade:
bundle config --delete bin # Turn off Bundler's stub generator
rake rails:update:bin # Use the new Rails 4 executables
git add bin # Add bin/ to source control
You may need to remove bin/ from your .gitignore as well.
When you install a gem whose executable you want to use in your app,
generate it and add it to source control:
bundle binstubs some-gem-name
git add bin/new-executable
/Users/Adam/Documents/Rails-Projects/Libraries-and-Helpers/Xaaron/.bundle/gems/gems/railties-4.2.0/lib/rails/app_rails_loader.rb:44:in `require': cannot load such file -- /Users/Adam/Documents/Rails-Projects/Libraries-and-Helpers/Xaaron/config/boot (LoadError)
from /Users/Adam/Documents/Rails-Projects/Libraries-and-Helpers/Xaaron/.bundle/gems/gems/railties-4.2.0/lib/rails/app_rails_loader.rb:44:in `block in exec_app_rails'
from /Users/Adam/Documents/Rails-Projects/Libraries-and-Helpers/Xaaron/.bundle/gems/gems/railties-4.2.0/lib/rails/app_rails_loader.rb:34:in `loop'
from /Users/Adam/Documents/Rails-Projects/Libraries-and-Helpers/Xaaron/.bundle/gems/gems/railties-4.2.0/lib/rails/app_rails_loader.rb:34:in `exec_app_rails'
from /Users/Adam/Documents/Rails-Projects/Libraries-and-Helpers/Xaaron/.bundle/gems/gems/railties-4.2.0/lib/rails/cli.rb:5:in `<top (required)>'
from /Users/Adam/Documents/Rails-Projects/Libraries-and-Helpers/Xaaron/.bundle/gems/gems/railties-4.2.0/bin/rails:9:in `require'
from /Users/Adam/Documents/Rails-Projects/Libraries-and-Helpers/Xaaron/.bundle/gems/gems/railties-4.2.0/bin/rails:9:in `<top (required)>'
from bin/rails:16:in `load'
from bin/rails:16:in `<main>'
所以我假设我可以做,在做 bundle config --delete bin
:
rake rails:update:bin
但后来我得到:
rake aborted!
Don't know how to build task 'rails'
我正在从我创建的 rails 引擎的根目录运行它。我很好奇发生了什么事。我应该从虚拟应用程序运行此命令吗?我怀疑不是,因为 bin/
目录位于引擎目录的根目录而不是虚拟应用程序。
根据对问题的评论,正确答案是 运行:
rake app:rails:update:bin
在引擎的根部。