Class: Kdeploy::Configuration
- Inherits:
-
Object
- Object
- Kdeploy::Configuration
- Defined in:
- lib/kdeploy/config/configuration.rb
Overview
Configuration management for Kdeploy
Constant Summary collapse
- DEFAULT_PARALLEL =
10- DEFAULT_SSH_TIMEOUT =
30- DEFAULT_VERIFY_HOST_KEY =
:never- DEFAULT_RETRIES =
0- DEFAULT_RETRY_DELAY =
1- DEFAULT_HOST_TIMEOUT =
nil- DEFAULT_RETRY_ON_NONZERO =
false- DEFAULT_SYNC_FAST =
false- DEFAULT_STEP_TIMEOUT =
nil- DEFAULT_RETRY_POLICY =
nil- DEFAULT_SYNC_PARALLEL =
1- CONFIG_FILE_NAME =
'.kdeploy.yml'
Class Attribute Summary collapse
-
.default_host_timeout ⇒ Object
Returns the value of attribute default_host_timeout.
-
.default_parallel ⇒ Object
Returns the value of attribute default_parallel.
-
.default_retries ⇒ Object
Returns the value of attribute default_retries.
-
.default_retry_delay ⇒ Object
Returns the value of attribute default_retry_delay.
-
.default_retry_on_nonzero ⇒ Object
Returns the value of attribute default_retry_on_nonzero.
-
.default_retry_policy ⇒ Object
Returns the value of attribute default_retry_policy.
-
.default_ssh_timeout ⇒ Object
Returns the value of attribute default_ssh_timeout.
-
.default_step_timeout ⇒ Object
Returns the value of attribute default_step_timeout.
-
.default_sync_fast ⇒ Object
Returns the value of attribute default_sync_fast.
-
.default_sync_parallel ⇒ Object
Returns the value of attribute default_sync_parallel.
-
.default_verify_host_key ⇒ Object
Returns the value of attribute default_verify_host_key.
Class Method Summary collapse
- .find_config_file(start_dir = Dir.pwd) ⇒ Object
- .load_from_file(config_path = nil) ⇒ Object
- .reset ⇒ Object
Class Attribute Details
.default_host_timeout ⇒ Object
Returns the value of attribute default_host_timeout.
22 23 24 |
# File 'lib/kdeploy/config/configuration.rb', line 22 def default_host_timeout @default_host_timeout end |
.default_parallel ⇒ Object
Returns the value of attribute default_parallel.
22 23 24 |
# File 'lib/kdeploy/config/configuration.rb', line 22 def default_parallel @default_parallel end |
.default_retries ⇒ Object
Returns the value of attribute default_retries.
22 23 24 |
# File 'lib/kdeploy/config/configuration.rb', line 22 def default_retries @default_retries end |
.default_retry_delay ⇒ Object
Returns the value of attribute default_retry_delay.
22 23 24 |
# File 'lib/kdeploy/config/configuration.rb', line 22 def default_retry_delay @default_retry_delay end |
.default_retry_on_nonzero ⇒ Object
Returns the value of attribute default_retry_on_nonzero.
22 23 24 |
# File 'lib/kdeploy/config/configuration.rb', line 22 def default_retry_on_nonzero @default_retry_on_nonzero end |
.default_retry_policy ⇒ Object
Returns the value of attribute default_retry_policy.
22 23 24 |
# File 'lib/kdeploy/config/configuration.rb', line 22 def default_retry_policy @default_retry_policy end |
.default_ssh_timeout ⇒ Object
Returns the value of attribute default_ssh_timeout.
22 23 24 |
# File 'lib/kdeploy/config/configuration.rb', line 22 def default_ssh_timeout @default_ssh_timeout end |
.default_step_timeout ⇒ Object
Returns the value of attribute default_step_timeout.
22 23 24 |
# File 'lib/kdeploy/config/configuration.rb', line 22 def default_step_timeout @default_step_timeout end |
.default_sync_fast ⇒ Object
Returns the value of attribute default_sync_fast.
22 23 24 |
# File 'lib/kdeploy/config/configuration.rb', line 22 def default_sync_fast @default_sync_fast end |
.default_sync_parallel ⇒ Object
Returns the value of attribute default_sync_parallel.
22 23 24 |
# File 'lib/kdeploy/config/configuration.rb', line 22 def default_sync_parallel @default_sync_parallel end |
.default_verify_host_key ⇒ Object
Returns the value of attribute default_verify_host_key.
22 23 24 |
# File 'lib/kdeploy/config/configuration.rb', line 22 def default_verify_host_key @default_verify_host_key end |
Class Method Details
.find_config_file(start_dir = Dir.pwd) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/kdeploy/config/configuration.rb', line 59 def find_config_file(start_dir = Dir.pwd) current_dir = File.(start_dir) loop do config_file = File.join(current_dir, CONFIG_FILE_NAME) return config_file if File.exist?(config_file) parent_dir = File.dirname(current_dir) break if parent_dir == current_dir current_dir = parent_dir end nil end |
.load_from_file(config_path = nil) ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/kdeploy/config/configuration.rb', line 48 def load_from_file(config_path = nil) config_path ||= find_config_file return unless config_path && File.exist?(config_path) config = YAML.safe_load_file(config_path, permitted_classes: [Symbol]) apply_config(config) rescue StandardError => e warn "Warning: Failed to load config from #{config_path}: #{e.}" nil end |
.reset ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/kdeploy/config/configuration.rb', line 34 def reset @default_parallel = DEFAULT_PARALLEL @default_ssh_timeout = DEFAULT_SSH_TIMEOUT @default_verify_host_key = DEFAULT_VERIFY_HOST_KEY @default_retries = DEFAULT_RETRIES @default_retry_delay = DEFAULT_RETRY_DELAY @default_host_timeout = DEFAULT_HOST_TIMEOUT @default_retry_on_nonzero = DEFAULT_RETRY_ON_NONZERO @default_sync_fast = DEFAULT_SYNC_FAST @default_step_timeout = DEFAULT_STEP_TIMEOUT @default_retry_policy = DEFAULT_RETRY_POLICY @default_sync_parallel = DEFAULT_SYNC_PARALLEL end |