2014-04-27 17 views
5

Bu şablon https://github.com/TalkingQuickly/capistrano-3-rails-template/blob/master/Capfile ile bir raylar 4.1.0 uygulaması dağıtmaya çalışıyorum. Ben Capistrano 3.1 compile_assets_locally

cap production deploy:setup_config 

çalıştırdığınızda ben

set :application, 'myapp' 

set :deploy_user, 'deployer' 

set :scm, :git 

set :repo_url, '[email protected]:~/.git/myapp.git' 

set :rbenv_type, :system 
set :rbenv_ruby, '2.1.1' 
set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec" 
set :rbenv_map_bins, %w{rake gem bundle ruby rails} 

set :keep_releases, 5 

set :linked_files, %w{config/database.yml} 

set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system} 

set :tests, [] 

set(:config_files, %w(
    nginx.conf 
    database.example.yml 
    log_rotation 
    monit 
    unicorn.rb 
    unicorn_init.sh 
)) 

set(:executable_config_files, %w(
    unicorn_init.sh 
)) 

set(:symlinks, [ 
    { 
    source: "nginx.conf", 
    link: "/etc/nginx/sites-enabled/{{full_app_name}}" 
    }, 
    { 
    source: "unicorn_init.sh", 
    link: "/etc/init.d/unicorn_{{full_app_name}}" 
    }, 
    { 
    source: "log_rotation", 
    link: "/etc/logrotate.d/{{full_app_name}}" 
    } 
]) 

namespace :deploy do 

    before :deploy, "deploy:check_revision" 
    before :deploy, "deploy:run_tests" 
    after 'deploy:symlink:shared', 'deploy:compile_assets_locally' 
    after :finishing, 'deploy:cleanup' 
    before 'deploy:setup_config', 'nginx:remove_default_vhost' 
    after 'deploy:setup_config', 'nginx:reload' 
    after 'deploy:setup_config', 'monit:restart' 
    after 'deploy:publishing', 'deploy:restart' 
end 

cevap

1

hata iletisi 'tanımlamak olmadığını söyler hata mesaj

cap aborted! 
Don't know how to build task 'deploy:compile_assets_locally' 

Capfile

require 'capistrano/setup' 
require 'capistrano/deploy' 
require 'capistrano/rbenv' 
require 'capistrano/rails/migrations' 
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined. 
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } 
Dir.glob('lib/capistrano/**/*.rb').each { |r| import r } 

deploy.rb olsun compile_assets_locally 'görev.

O zaten capistrano-raylar mücevher dahil görünüyor, bu yüzden ikinci yöntem konuyu kolayca

  • İlk yöntem düzeltebilirsiniz düşünüyorum: compile_assets_locally görevi tanımlayın. template kopyalayın ve lib/capistrano/task dizinine yerleştirin (uzantının .cap olduğundan emin olun).

  • İkinci yöntem:/deploy.rb set :assets_roles, [:app]

    after 'deploy:symlink:shared', 'deploy:compile_assets_locally'

  • kaldırmak capistrano-raylar gem

    • yapılandırma kullanarak Capfile require 'capistrano/rails/assets'

+0

İkinci yöntemi denedim ancak şimdi bir hata alıyorum "Görevin nasıl oluşturulduğunu bilmiyorum" konuşlandır: setup_config '" – markhorrocks

+0

Görevleri lib/capistrano/task'a kopyaladım ama yine de aynı hatayı aldım. – markhorrocks

+1

Benim Capfile'mda Dir.glob ('lib/capistrano/tasks/*. Rake') değiştirmek zorunda kaldı, her {| r | import r} 'ye Dir.glob (' lib/capistrano/tasks/*. cap '). içe aktarma – markhorrocks