0

これは私にとって初めての Rails プロジェクトであり、カピストラーノでの作業は本当に楽しいものでした。

私の現在の問題は、 cap deploy:migrate と cap:deploy:migration を別々のタスクとして実行する必要があることです。これらを組み合わせた cap deploy:migration が必要だと思います。

これが私の端末出力です:

kris$ cap staging deploy:migration
      triggering load callbacks
     * executing `staging'
    the task `deploy:migration' does not exist

私のセットアップはマルチステージを使用しており、RVM capistrano プラグインを使用しています。

ここに私の宝石ファイルがあります:

source 'https://rubygems.org'

gem 'rails', '3.2.1'

group :development do
  gem 'sqlite3'
end

group :production do
  gem 'mysql2'
end

group :test do
  gem 'sqlite3'
  gem 'ZenTest'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

#formtastic 2.2 breaks activeadmin
gem "formtastic", "~> 2.1.1"
gem "activeadmin", "~> 0.4.3"

# meta_search required for activeadmin
gem 'meta_search'

gem 'jquery-rails'
gem "paperclip", "~> 3.0"

gem 'acts_as_list'
 gem 'unicorn'

# Deploy with Capistrano
 gem 'capistrano'
 gem 'rvm-capistrano'

gem 'mail'
gem 'friendly_id'

ここに私の設定/展開ファイルがあります:

set :rvm_ruby_string, 'ruby-1.9.3-p194@xxx'                     # Or:
#set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"") # Read from local system

require "rvm/capistrano"                               # Load RVM's capistrano plugin.
require "bundler/capistrano"

# set :verbose ,1

require 'capistrano/ext/multistage'
set :stages, %w(staging production)
set :default_stage, "staging"
set :deploy_via, :remote_cache

set :user, "webm"
# set :deploy_via, :remote_cache
set :use_sudo, false

set :scm, "git"
set :repository, "git@xx.beanstalkapp.com:/xx.git"

# :branch is being set in stage files

default_run_options[:pty] = true
# ssh_options[:forward_agent] = true

after "deploy", "deploy:cleanup" # keep only the last 5 releases

namespace :deploy do
    %w[start stop restart].each do |command|
        desc "#{command} unicorn server"
        task command, roles: :app, except: {no_release: true} do
            run "#{sudo} service unicorn_#{server_configuration} #{command}"
        end
    end

    desc "build missing paperclip styles"
    task :build_missing_paperclip_styles, :roles=> :app do
        run "cd #{release_path}; RAILS_ENV=production bundle exec rake paperclip:refresh:missing_styles"
    end
    after "deploy:update", "deploy:build_missing_paperclip_styles"

    task :setup_config, roles: :app do
        puts "#making symlink to nginx sites-enabled"
        run "#{sudo} ln -fs #{current_path}/config/server/#{server_configuration}/nginx.conf /etc/nginx/sites-enabled/#{server_configuration}"
        puts "#making symlink to unicorn service script"
        run "#{sudo} ln -fs #{current_path}/config/server/#{server_configuration}/unicorn_init.sh /etc/init.d/unicorn_#{server_configuration}"
        puts "#making a the new config directory"
        run "mkdir -p #{shared_path}/config"
        run "sunique 1"
        put File.read("config/database.yml"), "#{shared_path}/config/database.yml"
        run "sunique 0"
        puts "Now edit the config files in #{shared_path}."
    end
    after "deploy:setup", "deploy:setup_config"

    task :symlink_config, roles: :app do
        run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"

        puts "#for reference:"
        puts "#rvm wrapper 1.9.3@ac_helenefrance_01 ruby-1.9.3-p194@#{server_configuration} unicorn cap"
        puts "#now be sure to run: sudo update-rc.d unicorn_#{server_configuration} defaults"
    end
    after "deploy:finalize_update", "deploy:symlink_config"

    # desc "Make sure local git is in sync with remote."
    # task :check_revision, roles: :web do
        # if :isRemote == false
            # unless `git rev-parse HEAD` == `git rev-parse beanstalk/#{branch}`
                # puts "WARNING: HEAD is not the same as beanstalk/#{branch}"
                # puts "Run `git push` to sync changes."
                # exit
            # end
        # end
    # end
    #before "deploy", "deploy:check_revision"
end

なぜdeploy:migration壊れているのかについての助けは非常に役に立ちます。ありがとうございました。

4

1 に答える 1

4

のようにsを忘れましたcap deploy:migrations

于 2012-06-08T14:44:11.527 に答える