Module: Capistrano::Configuration::Connections

Defined in:
lib/capistrano_winrm/configuration/connections.rb

Defined Under Namespace

Classes: WinRMConnectionFactory

Instance Method Summary collapse

Instance Method Details

#connection_factoryObject

Returns the object responsible for establishing new connections. The factory will respond to #connect_to, which can be used to establish connections to servers defined via ServerDefinition objects.



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/capistrano_winrm/configuration/connections.rb', line 17

def connection_factory
  @connection_factory ||= begin
    if exists?(:gateway)
      logger.debug "establishing connection to gateway `#{fetch(:gateway)}'"
      GatewayConnectionFactory.new(fetch(:gateway), self)
    elsif(exists?(:winrm_running))
      logger.debug "establishing connection to WinRM"
      WinRMConnectionFactory.new(self)
    else
      DefaultConnectionFactory.new(self)
    end
  end
end