Class: Capissh::Configuration

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/capissh/configuration.rb

Overview

Represents a specific Capissh configuration.

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

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={})
  @options = options.dup
  @logger = Capissh::Logger.new(@options)
  @options[:default_environment] ||= {}
  @options[:default_run_options] ||= {}
  @options[:default_shell] ||= nil
end

Class Attribute Details

.default_placeholder_callbackObject

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

#loggerObject (readonly)

Returns the value of attribute logger.



21
22
23
# File 'lib/capissh/configuration.rb', line 21

def logger
  @logger
end

#optionsObject (readonly)

Returns the value of attribute options.



21
22
23
# File 'lib/capissh/configuration.rb', line 21

def options
  @options
end

Instance Method Details

#connection_managerObject



51
52
53
# File 'lib/capissh/configuration.rb', line 51

def connection_manager
  @connection_manager ||= ConnectionManager.new(@options.merge(:logger => logger))
end

#debugObject



39
40
41
# File 'lib/capissh/configuration.rb', line 39

def debug
  fetch :debug, false
end

#dry_runObject



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_transfersObject



55
56
57
# File 'lib/capissh/configuration.rb', line 55

def file_transfers
  @file_transfers ||= FileTransfers.new(self, connection_manager, :logger => logger)
end

#invocationObject



60
61
62
# File 'lib/capissh/configuration.rb', line 60

def invocation
  @invocation ||= Invocation.new(self, connection_manager, :logger => logger)
end

#placeholder_callbackObject



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