Sha256: f5406e94ddc6a3b2e1520371627220240f5953f69d93e259b60d00cc1882cda4
Contents?: true
Size: 1.66 KB
Versions: 5
Compression:
Stored size: 1.66 KB
Contents
require 'capistrano/bundle_rsync/base' require 'capistrano/configuration/filter' class Capistrano::BundleRsync::Bundler < Capistrano::BundleRsync::Base def install Bundler.with_clean_env do with bundle_app_config: config.local_base_path do opts = "--gemfile #{config.local_release_path}/Gemfile --deployment --quiet --path #{config.local_bundle_path} --without development test" if standalone = config.bundle_install_standalone_option opts += " #{standalone}" end execute :bundle, opts execute :rm, "#{config.local_base_path}/config" end end end def rsync hosts = release_roles(:all) on hosts, in: :groups, limit: config.max_parallels(hosts) do within release_path do execute :mkdir, '-p', '.bundle' end end lines = <<-EOS --- BUNDLE_FROZEN: '1' BUNDLE_PATH: #{shared_path.join('bundle')} BUNDLE_WITHOUT: development:test BUNDLE_DISABLE_SHARED_GEMS: '1' BUNDLE_BIN: #{release_path.join('bin')} EOS # BUNDLE_BIN requires rbenv-binstubs plugin to make it effectively work bundle_config_path = "#{config.local_base_path}/bundle_config" File.open(bundle_config_path, "w") {|file| file.print(lines) } hosts = ::Capistrano::Configuration.env.filter(hosts) rsync_options = config.rsync_options Parallel.each(hosts, in_threads: config.max_parallels(hosts)) do |host| ssh = config.build_ssh_command(host) execute :rsync, "#{rsync_options} --rsh='#{ssh}' #{config.local_bundle_path}/ #{host}:#{shared_path}/bundle/" execute :rsync, "#{rsync_options} --rsh='#{ssh}' #{bundle_config_path} #{host}:#{release_path}/.bundle/config" end end end
Version data entries
5 entries across 5 versions & 1 rubygems