Ruby   发布时间:2022-04-03  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ruby-on-rails – 如何通过capistrano进入rails控制台?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我想通过capistrano从本地计算机进入生产服务器上的rails控制台.
发现了一些要点,例如 https://gist.github.com/813291当我进入控制台
cap production console

我得到以下结果

192-168-0-100:foldername username $cap console RAILS_ENV=production
  * execuTing `console'
  * execuTing "cd /var/www/myapp/current && rails console production"
    servers: ["www.example.de"]
    [www.example.de] execuTing command
    [www.example.de] rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-sHell '1.9.3' -c 'cd /var/www/myapp/current && rails console production'
/var/www/myapp/releases/20120305102218/app/controllers/users_controller.rb:3: warning: already initialized constant VERIFY_PEER
Loading production environment (Rails 3.2.1)
Switch to inspect mode.

这就是…现在我可以输入一些文字,但什么也没有发生…

有人有一个想法如何获得这个工作或另一个解决方案为我的问题?

解决方法

我为这种事情添加了自己的任务:
namespace :rails do
  desc "Remote console"
  task :console,:roles => :app do
    run_interactively "bundle exec rails console #{rails_env}"
  end

  desc "Remote dbconsole"
  task :dbconsole,:roles => :app do
    run_interactively "bundle exec rails dbconsole #{rails_env}"
  end
end

def run_interactively(command)
  server ||= find_servers_for_task(current_task).first
  exec %Q(ssh #{user}@#{myproductionhost} -t '#{CommanD}')
end

我现在说cap rails:控制台,并得到一个控制台.

大佬总结

以上是大佬教程为你收集整理的ruby-on-rails – 如何通过capistrano进入rails控制台?全部内容,希望文章能够帮你解决ruby-on-rails – 如何通过capistrano进入rails控制台?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。