【问题标题】:How to use capistrano in Rails4如何在 Rails4 中使用 capistrano
【发布时间】:2013-12-22 02:59:27
【问题描述】:

我正在使用 rails 4 和 capistrano gem 'capistrano','~> 3.0.0' 和 'capistrano-rails','~> 1.1.0'

我在运行 cap staging deploy:setup --trace 时遇到问题

错误: ** 调用暂存(first_time) ** 执行分期 ** 调用负载:默认值(first_time) ** 执行加载:默认值 capistrano/ext/multistage 需要 Capistrano 2

我已经在 deploy.rb 文件中包含了“需要 capistrano/ext/multistage”

deploy.rb 文件


 #require "bundler/capistrano"
 require 'capistrano/ext/multistage'

 set :application, 'management.zisoo.nl'
 # ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }

 # set :deploy_to, '/var/www/my_app'
 set :scm, :git
 set :repo_url, 'https://brails@bitbucket.org/johnmuller/motoronderdelen.nl.git'
 set :stages, %w(production staging dev)
 set :default_stage, "staging"

 #set :user, "server-user-name"

 # set :format, :pretty
 # set :log_level, :debug
 # set :pty, true

 # set :linked_files, %w{config/database.yml}
 # set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle
   public/system}

 # set :default_env, { path: "/opt/ruby/bin:$PATH" }
 # set :keep_releases, 5

 namespace :deploy do

   desc 'Restart application'
   task :restart do
     on roles(:app), in: :sequence, wait: 5 do
     # Your restart mechanism here, for example:
     # execute :touch, release_path.join('tmp/restart.txt')
   end
 end

  after :restart, :clear_cache do
    on roles(:web), in: :groups, limit: 3, wait: 10 do
      # Here we can do anything such as:
      # within release_path do
      #   execute :rake, 'cache:clear'
    # end
   end
 end

 after :finishing, 'deploy:cleanup'

结束

【问题讨论】:

    标签: ruby-on-rails capistrano


    【解决方案1】:

    由于 capistrano-rails 的依赖性问题,您需要在 Gemfile 中指定 Capistrano 的第 2 版,例如:

    gem 'capistrano', '~> 2.15'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多