Class: Capistrano::NetStorage::Config
- Inherits:
-
Object
- Object
- Capistrano::NetStorage::Config
- Defined in:
- lib/capistrano/net_storage/config.rb
Instance Method Summary collapse
-
#archive_on_missing? ⇒ Boolean
If
true, create archive ONLY when it’s not found on Network Storage. -
#archive_path ⇒ Pathname
Path of archive file to be downloaded on servers.
-
#archive_suffix ⇒ String
Suffix of archive file.
-
#config_files ⇒ Array<String, Pathname>
Application configuration files to be deployed with.
- #executor_class(type) ⇒ Object
-
#local_archive_path ⇒ Pathname
Destination path to archive application on localhost.
-
#local_base_path ⇒ Pathname
Path of base directory on localhost.
-
#local_bundle_path ⇒ Pathname
Shared directory to install gems.
-
#local_mirror_path ⇒ Pathname
Path to clone repository on localhost.
-
#local_release_path ⇒ Pathname
Path to take a snapshot of repository for release.
-
#local_releases_path ⇒ Pathname
Path to keep release directories and archives on localhost.
- #max_parallels ⇒ Object
-
#rsync_options ⇒ Object
You can set
:user,:keys,:portas ssh options forrsynccommand to sync configs when:net_storage_upload_files_by_rsyncis settrue. -
#servers ⇒ Object
Servers to deploy.
-
#skip_bundle? ⇒ Boolean
If
true, skip to bundle gems bundled with target app. -
#upload_files_by_rsync? ⇒ Boolean
If
true, usersyncto sync config files.
Instance Method Details
#archive_on_missing? ⇒ Boolean
If true, create archive ONLY when it’s not found on Network Storage. Otherwise, create archive ALWAYS. Defaults to true
59 60 61 62 63 64 65 |
# File 'lib/capistrano/net_storage/config.rb', line 59 def archive_on_missing? @has_checked_archive_on_missing ||= begin @archive_on_missing = fetch(:net_storage_archive_on_missing, true) true end @archive_on_missing end |
#archive_path ⇒ Pathname
Path of archive file to be downloaded on servers
129 130 131 132 133 134 135 136 |
# File 'lib/capistrano/net_storage/config.rb', line 129 def archive_path @archive_path ||= pathname(fetch(:net_storage_archive_path)) @archive_path ||= begin # Set release_timestamp if not set fetch(:release_path, set_release_path) pathname("#{release_path}.#{archive_suffix}") end end |
#archive_suffix ⇒ String
Suffix of archive file
140 141 142 143 144 145 146 147 148 149 |
# File 'lib/capistrano/net_storage/config.rb', line 140 def archive_suffix case Capistrano::NetStorage.archiver when Capistrano::NetStorage::Archiver::Zip 'zip' when Capistrano::NetStorage::Archiver::TarGzip 'tar.gz' else 'archive' end end |
#config_files ⇒ Array<String, Pathname>
Application configuration files to be deployed with
42 43 44 |
# File 'lib/capistrano/net_storage/config.rb', line 42 def config_files @config_files ||= fetch(:net_storage_config_files) end |
#executor_class(type) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/capistrano/net_storage/config.rb', line 9 def executor_class(type) @executor_classes ||= {} @executor_classes[type] ||= fetch(:"net_storage_#{type}") @executor_classes[type] ||= begin case type when :archiver Capistrano::NetStorage::Archiver::Zip when :scm Capistrano::NetStorage::SCM::Git when :cleaner Capistrano::NetStorage::Cleaner when :bundler Capistrano::NetStorage::Bundler when :transport msg = 'You have to set :net_storage_transport because no default transport class!' raise Capistrano::NetStorage::Error, msg else raise "Unknown type! #{type}" end end end |
#local_archive_path ⇒ Pathname
Destination path to archive application on localhost
122 123 124 125 |
# File 'lib/capistrano/net_storage/config.rb', line 122 def local_archive_path @local_archive_path ||= pathname(fetch(:net_storage_local_archive_path)) @local_archive_path ||= pathname("#{local_release_path}.#{archive_suffix}") end |
#local_base_path ⇒ Pathname
Path of base directory on localhost
88 89 90 |
# File 'lib/capistrano/net_storage/config.rb', line 88 def local_base_path @local_base_path ||= pathname(fetch(:net_storage_local_base_path, "#{Dir.pwd}/.local_repo")) end |
#local_bundle_path ⇒ Pathname
Shared directory to install gems
115 116 117 118 |
# File 'lib/capistrano/net_storage/config.rb', line 115 def local_bundle_path @local_bundle_path ||= pathname(fetch(:net_storage_local_bundle_path)) @local_bundle_path ||= local_base_path.join('bundle') end |
#local_mirror_path ⇒ Pathname
Path to clone repository on localhost
94 95 96 97 |
# File 'lib/capistrano/net_storage/config.rb', line 94 def local_mirror_path @local_mirror_path ||= pathname(fetch(:net_storage_local_mirror_path)) @local_mirror_path ||= local_base_path.join('mirror') end |
#local_release_path ⇒ Pathname
Path to take a snapshot of repository for release
108 109 110 111 |
# File 'lib/capistrano/net_storage/config.rb', line 108 def local_release_path @local_release_path ||= pathname(fetch(:net_storage_local_release_path)) @local_release_path ||= local_releases_path.join() end |
#local_releases_path ⇒ Pathname
Path to keep release directories and archives on localhost
101 102 103 104 |
# File 'lib/capistrano/net_storage/config.rb', line 101 def local_releases_path @local_releases_path ||= pathname(fetch(:net_storage_local_releases_path)) @local_releases_path ||= local_base_path.join('releases') end |
#max_parallels ⇒ Object
36 37 38 |
# File 'lib/capistrano/net_storage/config.rb', line 36 def max_parallels @max_parallels ||= fetch(:net_storage_max_parallels, servers.size) end |
#rsync_options ⇒ Object
You can set :user, :keys, :port as ssh options for rsync command to sync configs when :net_storage_upload_files_by_rsync is set true.
78 79 80 |
# File 'lib/capistrano/net_storage/config.rb', line 78 def ||= fetch(:net_storage_rsync_options, fetch(:ssh_options, {})) end |
#servers ⇒ Object
Servers to deploy
32 33 34 |
# File 'lib/capistrano/net_storage/config.rb', line 32 def servers fetch(:net_storage_servers, -> { release_roles(:all) }) end |
#skip_bundle? ⇒ Boolean
If true, skip to bundle gems bundled with target app. Defaults to true
48 49 50 51 52 53 54 |
# File 'lib/capistrano/net_storage/config.rb', line 48 def skip_bundle? @has_checked_skip_bundle ||= begin @skip_bundle = !fetch(:net_storage_with_bundle) true end @skip_bundle end |
#upload_files_by_rsync? ⇒ Boolean
If true, use rsync to sync config files. Otherwise, use upload! by sshkit. Defaults to false
71 72 73 |
# File 'lib/capistrano/net_storage/config.rb', line 71 def upload_files_by_rsync? @upload_files_by_rsync ||= fetch(:net_storage_upload_files_by_rsync, false) end |