让我解释.
这是一个取自cAPIstrano / rails gem的片段
namespace :deploy do desc 'Runs rake db:migrate if migrations are set' task :migrate => [:set_rails_env] do on primary fetch(:migration_role) do within release_path do with rails_env: fetch(:rails_env) do execute :rake,"db:migrate" end end end end #[...]end
当执行cap integration integration:migrate时,它会发送以下命令:
cd / srv / app / releases / 20131106101722&& (RAILS_ENV = integration /tmp/app/rvm-auto.sh.rake assets:precompile)
我将为delayed_job提供的(非工作)代码改为一点
namespace :delayed_job do def args fetch(:delayed_job_args,'') end def delayed_job_roles fetch(:delayed_job_server_role,:app) end def delayed_job_bin fetch(:delayed_job_bin,:'bin/delayed_job') end desc 'Restart the delayed_job process' task :restart do on roles(delayed_job_roles) do within release_path do with rails_env: fetch(:rails_env) do execute delayed_job_bin,'restart',args end end end endend
我得到以下命令cd / srv / winddle / current&& (RAILS_ENV =集成bin / delayed_job重启)
显然,它错过了bundle exec命令.
我深入了解cAPIstrano / bundler和cAPIstrano / rails,寻找某种钩子,它会自动将bundle exec添加到这些命令中(或者强制ssh kit命令的注册)但却无法找到.
我找到的唯一解决方案是使用
execute:bundle,:exec,delayed_job_bin,:start,args当然不可接受.
欢迎任何适当的解决方案/解释.
问候
v3很依赖sshkit,所以阅读文档应该是一个很大的帮助.自述文件提供了一个可以解决您的问题的示例.
SSHKit.config.command_map.prefix[:rake].push("bundle exec")puts SSHKit.config.command_map[:rake]# => bundle exec rake
我还在Semaphore blog post中找到了另一种解决方案.
SSHKit.config.command_map[:rake] = "bundle exec rake"SSHKit.config.command_map[:rails] = "bundle exec rails"总结
以上是内存溢出为你收集整理的ruby-on-rails – Capistrano 3 – 理解任务全部内容,希望文章能够帮你解决ruby-on-rails – Capistrano 3 – 理解任务所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)