如何在Rails 4中使用capistrano

时间:2013-12-05 08:55:24

标签: ruby-on-rails capistrano

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

当我运行cap staging deploy时,我遇到了问题:setup --trace

错误:     **调用staging(first_time)     **执行升级     **调用load:defaults(first_time)     **执行加载:默认值     capistrano / ext / multistage需要Capistrano 2

我已在deploy.rb文件中包含'require 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'

1 个答案:

答案 0 :(得分:0)

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

gem 'capistrano', '~> 2.15'