Class: Indocker::Server

Inherits:
Object
  • Object
show all
Includes:
Concerns::Inspectable
Defined in:
lib/indocker/server.rb

Direct Known Subclasses

BuildServer

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Concerns::Inspectable

#inspect

Constructor Details

#initialize(name:, host:, user:, port:, jump_host: nil) ⇒ Server

jump_host ("user@host") makes every connection to this server tunnel through another one. Servers whose public address is unreachable can still be deployed to over their internal address that way.



9
10
11
12
13
14
15
# File 'lib/indocker/server.rb', line 9

def initialize(name:, host:, user:, port:, jump_host: nil)
  @name = name
  @host = host
  @user = user
  @port = port
  @jump_host = jump_host
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



4
5
6
# File 'lib/indocker/server.rb', line 4

def host
  @host
end

#jump_hostObject (readonly)

Returns the value of attribute jump_host.



4
5
6
# File 'lib/indocker/server.rb', line 4

def jump_host
  @jump_host
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/indocker/server.rb', line 4

def name
  @name
end

#portObject (readonly)

Returns the value of attribute port.



4
5
6
# File 'lib/indocker/server.rb', line 4

def port
  @port
end

#userObject (readonly)

Returns the value of attribute user.



4
5
6
# File 'lib/indocker/server.rb', line 4

def user
  @user
end

Instance Method Details

#==(value) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/indocker/server.rb', line 17

def ==(value)
  if value.is_a?(Indocker::Server)
    @name == value.name
  else
    super
  end
end

#semaphoreObject



31
32
33
# File 'lib/indocker/server.rb', line 31

def semaphore
  @semaphore ||= Mutex.new
end

#synchronize(&block) ⇒ Object



25
26
27
28
29
# File 'lib/indocker/server.rb', line 25

def synchronize(&block)
  semaphore.synchronize do
    block.call if block_given?
  end
end