Tag: Capistrano3/deploy_via_copyする
TODO:
gem "capistrano-scm-copy"
set :scm, :copy set :exclude_dir, ['vendor/bundle']
set :deploy_to, '/home/tanaka/www/demoapp'
require 'capistrano/copy'
I had the same problem but could find a proper solution; remove require 'capistrano/copy' anywhere! This problem occurs when we use this module with capistrano/setup because capistrano/setup loads a scm module with the :scm value. https://github.com/capistrano/capistrano/blob/master/lib/capistrano/setup.rb#L18 Good luck!
group :deployment do gem 'capistrano', '~> 3.0', require: false gem 'rubyzip', require: false end
require 'zip' Zip.setup do |c| c.unicode_names = true c.on_exists_proc = true c.continue_on_exists_proc = true end namespace :copy do task :check do end task :set_current_revision do end task create_release: 'release.zip' do |t| file = t.prerequisites.first on roles(:app) do execute :mkdir, '-p', fetch(:tmp_dir) upload! file, fetch(:tmp_dir) execute :unzip, '-o', "#{fetch(:tmp_dir)}/release.zip", '-d', release_path end File.delete file if File.exists?(file) end file 'release.zip' do |t| release_filename = File.join(Dir.pwd, t.name) Dir.chdir fetch(:copy_dir) do Zip::File.open(release_filename, Zip::File::CREATE) do |zipfile| files = FileList['**/*'] files.exclude(*fetch(:copy_exclude)).each do |file| zipfile.add(file, file) end end end end end
set :scm, 'copy' set :copy_dir, '.' set :tmp_dir, '/tmp' set :copy_exclude, [ /\.log$/, %r!^files/.+! ]
set :copy_exclude, [ /^logs/, /^tmp/, /^vendor/ ]