如何恢复我的Rails 5 binstub?

时间:2016-11-23 04:37:17

标签: bundle ruby-on-rails-5 capistrano3 bin rvm-capistrano

我正在macOS Sierra的 Rails 5 应用程序中工作,一切顺利,直到我准备好生产 Digital Ocean VPS 。我使用 Capistrano 跟踪了一个最着名的Deploy Rails app tutorial,我发现了一些错误,最后我的应用程序开始在生产中运行。

现在在我的本地环境中,当我运行rails serverrails console 时,我收到了此警告,我不知道如何修复它或者是什么问题。

Looks like your app's ./bin/rails is a stub that was generated by Bundler.

In Rails 5, 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
  rails app:update:bin          # Use the new Rails 5 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

=> Booting Puma
=> Rails 5.0.0.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.6.0 (ruby 2.3.1-p112), codename: Sleepy Sunday Serenity
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop

我一直在搜索这个错误以及如何解决但我没有运气!作为参考,它似乎与Capistrano有关,但我已经完成了他们所说的解决方案而且它不起作用或者我没有以正确的方式实现它:

  

解决方案是:

     

1.-从bin 中删除linked_dirs(这不是我的情况)

     

2.-将set :bundle_binstubs, nil添加到config/deploy.rb以生成binstub

我找到的一些文章:

  1. https://github.com/capistrano/rails/issues/171
  2. https://github.com/capistrano/capistrano/issues/1675
  3. Rails 5 console not working when deploying with Capistrano
  4. https://github.com/capistrano/bundler/issues/45
  5. 我非常感谢您能为我提供的任何帮助。 提前谢谢。

1 个答案:

答案 0 :(得分:1)

我知道这有点晚了,但我发现我可以运行$ rails app:update并且它会恢复/覆盖我的binstubs ...以及覆盖你开始使用的所有其他配置文件。所以要小心。

有关此任务的更多信息,请参阅Upgrading Ruby on Rails指南。