Class: Capistrano::BundleRsync::Bundler
- Defined in:
- lib/capistrano/bundle_rsync/bundler.rb
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Capistrano::BundleRsync::Base
Instance Method Details
#install ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/capistrano/bundle_rsync/bundler.rb', line 5 def install within config.local_release_app_path do Bundler.public_send(Bundler.respond_to?(:with_unbundled_env) ? :with_unbundled_env : :with_clean_env) do with bundle_app_config: config.local_base_path, rbenv_version: nil, rbenv_dir: nil do bundle_commands = if test :rbenv, 'version' %w[rbenv exec bundle] else %w[bundle] end execute *bundle_commands, 'config', '--local', 'deployment', 'true' execute *bundle_commands, 'config', '--local', 'path', config.local_bundle_path execute *bundle_commands, 'config', '--local', 'without', *config.bundle_without opts = ['--quiet'] if jobs = config.bundle_install_jobs opts.push('--jobs', jobs) end if standalone = config.bundle_install_standalone_option opts.push(standalone) end execute *bundle_commands, *opts execute :rm, "#{config.local_base_path}/config" end end end end |
#rsync ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/capistrano/bundle_rsync/bundler.rb', line 35 def rsync hosts = release_roles(:all) release_app_path = config.release_app_path on hosts, in: :groups, limit: config.max_parallels(hosts) do within release_app_path do execute :mkdir, '-p', '.bundle' end end lines = "---\nBUNDLE_FROZEN: '1'\nBUNDLE_PATH: \#{shared_path.join('bundle')}\nBUNDLE_WITHOUT: \#{config.bundle_without.join(':')}\nBUNDLE_DISABLE_SHARED_GEMS: '1'\nBUNDLE_BIN: \#{release_app_path.join('bin')}\n EOS\n # BUNDLE_BIN requires rbenv-binstubs plugin to make it effectively work\n bundle_config_path = \"\#{config.local_base_path}/bundle_config\"\n File.open(bundle_config_path, \"w\") {|file| file.print(lines) }\n\n hosts = ::Capistrano::Configuration.env.filter(hosts)\n rsync_options = config.rsync_options\n Parallel.each(hosts, in_threads: config.max_parallels(hosts)) do |host|\n ssh = config.build_ssh_command(host)\n execute :rsync, \"\#{rsync_options} --rsh='\#{ssh}' \#{config.local_bundle_path}/ \#{host}:\#{shared_path}/bundle/\"\n execute :rsync, \"\#{rsync_options} --rsh='\#{ssh}' \#{bundle_config_path} \#{host}:\#{release_app_path}/.bundle/config\"\n end\nend\n" |