Class: Capistrano::BundleRsync::Config
- Inherits:
-
Object
- Object
- Capistrano::BundleRsync::Config
- Defined in:
- lib/capistrano/bundle_rsync/config.rb
Class Method Summary collapse
-
.build_ssh_command(host) ⇒ Object
Build ssh command options for rsync.
- .bundle_install_jobs ⇒ Object
- .bundle_install_standalone ⇒ Object
- .bundle_install_standalone_option ⇒ Object
- .bundle_without ⇒ Object
- .config_files ⇒ Object
- .keep_releases ⇒ Object
- .local_base_path ⇒ Object
- .local_bundle_path ⇒ Object
- .local_mirror_path ⇒ Object
- .local_release_app_path ⇒ Object
- .local_release_path ⇒ Object
- .local_releases_path ⇒ Object
-
.max_parallels(hosts) ⇒ Object
Fetch the :bundle_rsync_max_parallels, where the default is the number of hosts.
- .release_app_path ⇒ Object
- .rsync_options ⇒ Object
- .shared_dirs ⇒ Object
- .skip_bundle ⇒ Object
Class Method Details
.build_ssh_command(host) ⇒ Object
Build ssh command options for rsync
First, search available user and keys configurations for each role:
role :app, ['hostname'], {
user: username,
keys: File.('~/.ssh/id_rsa'),
port: 22,
}
If not available, look :bundle_rsync_ssh_options:
set :bundle_rsync_ssh_options {
user: username,
keys: [File.('~/.ssh/id_rsa')],
port: 22,
}
If :bundle_rsync_ssh_options are not available also, look :ssh_options finally:
set :ssh_options {
user: username,
keys: [File.('~/.ssh/id_rsa')],
port: 22,
}
keys can be a string or an array. NOTE: :password is not supported.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/capistrano/bundle_rsync/config.rb', line 69 def self.build_ssh_command(host) user_opt, key_opt, port_opt = "", "", "" = fetch(:bundle_rsync_ssh_options) if user = host.user || [:user] user_opt = " -l #{user}" end if keys = (host.keys.empty? ? [:keys] : host.keys) keys = keys.is_a?(Array) ? keys : [keys] key_opt = keys.map {|key| " -i #{key}" }.join("") end if port = host.port || [:port] port_opt = " -p #{port}" end "ssh#{user_opt}#{key_opt}#{port_opt}" end |
.bundle_install_jobs ⇒ Object
103 104 105 |
# File 'lib/capistrano/bundle_rsync/config.rb', line 103 def self.bundle_install_jobs fetch(:bundle_rsync_bundle_install_jobs) end |
.bundle_install_standalone ⇒ Object
107 108 109 |
# File 'lib/capistrano/bundle_rsync/config.rb', line 107 def self.bundle_install_standalone fetch(:bundle_rsync_bundle_install_standalone) end |
.bundle_install_standalone_option ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/capistrano/bundle_rsync/config.rb', line 111 def self.bundle_install_standalone_option case value = self.bundle_install_standalone when true "--standalone" when Array "--standalone #{value.join(' ')}" when String "--standalone #{value}" else nil end end |
.bundle_without ⇒ Object
124 125 126 |
# File 'lib/capistrano/bundle_rsync/config.rb', line 124 def self.bundle_without fetch(:bundle_rsync_bundle_without) end |
.config_files ⇒ Object
31 32 33 34 |
# File 'lib/capistrano/bundle_rsync/config.rb', line 31 def self.config_files return nil unless config_files = fetch(:bundle_rsync_config_files) config_files.is_a?(Array) ? config_files : [config_files] end |
.keep_releases ⇒ Object
85 86 87 |
# File 'lib/capistrano/bundle_rsync/config.rb', line 85 def self.keep_releases @keep_releases = fetch(:bundle_rsync_keep_releases) end |
.local_base_path ⇒ Object
3 4 5 |
# File 'lib/capistrano/bundle_rsync/config.rb', line 3 def self.local_base_path @local_base_path ||= fetch(:bundle_rsync_local_base_path) end |
.local_bundle_path ⇒ Object
23 24 25 |
# File 'lib/capistrano/bundle_rsync/config.rb', line 23 def self.local_bundle_path @local_bundle_path ||= fetch(:bundle_rsync_local_bundle_path) end |
.local_mirror_path ⇒ Object
7 8 9 |
# File 'lib/capistrano/bundle_rsync/config.rb', line 7 def self.local_mirror_path @local_mirror_path ||= fetch(:bundle_rsync_local_mirror_path) end |
.local_release_app_path ⇒ Object
19 20 21 |
# File 'lib/capistrano/bundle_rsync/config.rb', line 19 def self.local_release_app_path @local_release_app_path ||= Pathname.new(local_release_path).join(fetch(:bundle_rsync_app_path)) end |
.local_release_path ⇒ Object
15 16 17 |
# File 'lib/capistrano/bundle_rsync/config.rb', line 15 def self.local_release_path @local_release_path ||= fetch(:bundle_rsync_local_release_path) end |
.local_releases_path ⇒ Object
11 12 13 |
# File 'lib/capistrano/bundle_rsync/config.rb', line 11 def self.local_releases_path @local_releases_path ||= fetch(:bundle_rsync_local_releases_path) end |
.max_parallels(hosts) ⇒ Object
Fetch the :bundle_rsync_max_parallels, where the default is the number of hosts
91 92 93 |
# File 'lib/capistrano/bundle_rsync/config.rb', line 91 def self.max_parallels(hosts) (fetch(:bundle_rsync_max_parallels) || hosts.size).to_i end |
.release_app_path ⇒ Object
27 28 29 |
# File 'lib/capistrano/bundle_rsync/config.rb', line 27 def self.release_app_path @release_app_path ||= release_path.join(fetch(:bundle_rsync_app_path)) end |
.rsync_options ⇒ Object
95 96 97 |
# File 'lib/capistrano/bundle_rsync/config.rb', line 95 def self. fetch(:bundle_rsync_rsync_options) end |
.shared_dirs ⇒ Object
36 37 38 39 |
# File 'lib/capistrano/bundle_rsync/config.rb', line 36 def self.shared_dirs return nil unless shared_dirs = fetch(:bundle_rsync_shared_dirs) shared_dirs.is_a?(Array) ? shared_dirs : [shared_dirs] end |
.skip_bundle ⇒ Object
99 100 101 |
# File 'lib/capistrano/bundle_rsync/config.rb', line 99 def self.skip_bundle fetch(:bundle_rsync_skip_bundle) end |