米娜部署不工作

时间:2014-07-03 11:53:02

标签: ruby-on-rails ruby-on-rails-4 deployment

我正在尝试使用Mina部署应用程序,但我收到此错误:

-----> Skipping asset precompilation
       $ cp -R "/home/deploy/integracao/current/public/assets" "./public/assets"
       cp: cannot create directory ‘./public/assets’: No such file or directory
 !     ERROR: Deploy failed.

我第一次部署时,一切正常。在第二遍(依此类推)我看到上面的错误。
这是我的deploy.rb

require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv'  # for rbenv support. (http://rbenv.org)

set :domain, '192.168.0.87'
set :deploy_to, '/home/deploy/integracao'
set :repository, 'https://github.com...'
set :branch, 'master'

set :rails_env, 'production'

set :shared_paths, ['config/database.yml', 'log', 'config/application.yml']


 set :user, 'deploy'    # Username in the server to SSH to.

task :environment do
  # If you're using rbenv, use this to load the rbenv environment.
  # Be sure to commit your .rbenv-version to your repository.
  invoke :'rbenv:load'

  # For those using RVM, use this to load an RVM version@gemset.
  # invoke :'rvm:use[ruby-1.9.3-p125@default]'
end

# Put any custom mkdir's in here for when `mina setup` is ran.
# For Rails apps, we'll make some of the shared paths that are shared between
# all releases.
task :setup => :environment do
  queue! %[mkdir -p "#{deploy_to}/shared/log"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"]

  queue! %[mkdir -p "#{deploy_to}/shared/config"]
  queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"]

  queue! %[touch "#{deploy_to}/shared/config/database.yml"]
  queue  %[echo "-----> Be sure to edit 'shared/config/database.yml'."]
end

desc "Deploys the current version to the server."
task :deploy => :environment do
  deploy do
    # Put things that will set up an empty directory into a fully set-up
    # instance of your project.
    invoke :'git:clone'
    invoke :'deploy:link_shared_paths'
    invoke :'bundle:install'
    invoke :'rails:db_migrate'
    invoke :'rails:assets_precompile'

    to :launch do
      queue "touch #{deploy_to}/tmp/restart.txt"
    end
  end
end

1 个答案:

答案 0 :(得分:4)

我刚刚在部署任务中更改为invoke :'rails:assets_precompile:force'并使其正常工作