Class: Kdeploy::Configuration
- Inherits:
-
Object
- Object
- Kdeploy::Configuration
- Defined in:
- lib/kdeploy/configuration.rb
Overview
Configuration management for Kdeploy
Constant Summary collapse
- DEFAULT_PARALLEL =
10- DEFAULT_SSH_TIMEOUT =
30- DEFAULT_VERIFY_HOST_KEY =
:never- CONFIG_FILE_NAME =
'.kdeploy.yml'
Class Attribute Summary collapse
-
.default_parallel ⇒ Object
Returns the value of attribute default_parallel.
-
.default_ssh_timeout ⇒ Object
Returns the value of attribute default_ssh_timeout.
-
.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_parallel ⇒ Object
Returns the value of attribute default_parallel.
14 15 16 |
# File 'lib/kdeploy/configuration.rb', line 14 def default_parallel @default_parallel end |
.default_ssh_timeout ⇒ Object
Returns the value of attribute default_ssh_timeout.
14 15 16 |
# File 'lib/kdeploy/configuration.rb', line 14 def default_ssh_timeout @default_ssh_timeout end |
.default_verify_host_key ⇒ Object
Returns the value of attribute default_verify_host_key.
14 15 16 |
# File 'lib/kdeploy/configuration.rb', line 14 def default_verify_host_key @default_verify_host_key end |
Class Method Details
.find_config_file(start_dir = Dir.pwd) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/kdeploy/configuration.rb', line 35 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
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/kdeploy/configuration.rb', line 24 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.message}" nil end |
.reset ⇒ Object
18 19 20 21 22 |
# File 'lib/kdeploy/configuration.rb', line 18 def reset @default_parallel = DEFAULT_PARALLEL @default_ssh_timeout = DEFAULT_SSH_TIMEOUT @default_verify_host_key = DEFAULT_VERIFY_HOST_KEY end |