Class: Capissh::Configuration
- Inherits:
-
Object
- Object
- Capissh::Configuration
- Extended by:
- Forwardable
- Defined in:
- lib/capissh/configuration.rb
Overview
Represents a specific Capissh configuration.
Class Attribute Summary collapse
-
.default_placeholder_callback ⇒ Object
Returns the value of attribute default_placeholder_callback.
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #connection_manager ⇒ Object
- #debug ⇒ Object
- #dry_run ⇒ Object
- #fetch(key, *args, &block) ⇒ Object
- #file_transfers ⇒ Object
-
#initialize(options = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #invocation ⇒ Object
- #placeholder_callback ⇒ Object
- #set(key, value) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Configuration
Returns a new instance of Configuration.
23 24 25 26 27 28 29 |
# File 'lib/capissh/configuration.rb', line 23 def initialize(={}) @options = .dup @logger = Capissh::Logger.new(@options) @options[:default_environment] ||= {} @options[:default_run_options] ||= {} @options[:default_shell] ||= nil end |
Class Attribute Details
.default_placeholder_callback ⇒ Object
Returns the value of attribute default_placeholder_callback.
14 15 16 |
# File 'lib/capissh/configuration.rb', line 14 def default_placeholder_callback @default_placeholder_callback end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
21 22 23 |
# File 'lib/capissh/configuration.rb', line 21 def logger @logger end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
21 22 23 |
# File 'lib/capissh/configuration.rb', line 21 def @options end |
Instance Method Details
#connection_manager ⇒ Object
51 52 53 |
# File 'lib/capissh/configuration.rb', line 51 def connection_manager @connection_manager ||= ConnectionManager.new(@options.merge(:logger => logger)) end |
#debug ⇒ Object
39 40 41 |
# File 'lib/capissh/configuration.rb', line 39 def debug fetch :debug, false end |
#dry_run ⇒ Object
43 44 45 |
# File 'lib/capissh/configuration.rb', line 43 def dry_run fetch :dry_run, false end |
#fetch(key, *args, &block) ⇒ Object
35 36 37 |
# File 'lib/capissh/configuration.rb', line 35 def fetch(key, *args, &block) @options.fetch(key.to_sym, *args, &block) end |
#file_transfers ⇒ Object
55 56 57 |
# File 'lib/capissh/configuration.rb', line 55 def file_transfers @file_transfers ||= FileTransfers.new(self, connection_manager, :logger => logger) end |
#invocation ⇒ Object
60 61 62 |
# File 'lib/capissh/configuration.rb', line 60 def invocation @invocation ||= Invocation.new(self, connection_manager, :logger => logger) end |
#placeholder_callback ⇒ Object
47 48 49 |
# File 'lib/capissh/configuration.rb', line 47 def placeholder_callback fetch :placeholder_callback, self.class.default_placeholder_callback end |
#set(key, value) ⇒ Object
31 32 33 |
# File 'lib/capissh/configuration.rb', line 31 def set(key, value) @options[key.to_sym] = value end |