Class: DockerDeploy::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/docker_deploy/service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stage, name) ⇒ Service

Returns a new instance of Service.



5
6
7
8
9
# File 'lib/docker_deploy/service.rb', line 5

def initialize(stage, name)
  @stage = stage
  @name = name
  @ports = {}
end

Instance Attribute Details

#command(name = nil) ⇒ Object (readonly)

Returns the value of attribute command.



3
4
5
# File 'lib/docker_deploy/service.rb', line 3

def command
  @command
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/docker_deploy/service.rb', line 3

def name
  @name
end

Instance Method Details

#container(name = nil) ⇒ Object



24
25
26
27
# File 'lib/docker_deploy/service.rb', line 24

def container(name = nil)
  @container = name if name
  @container or "#{@stage.container}_#{@name}"
end

#port(ports = {}) ⇒ Object



16
17
18
# File 'lib/docker_deploy/service.rb', line 16

def port(ports = {})
  @ports.merge!(ports)
end

#port_mappingsObject



20
21
22
# File 'lib/docker_deploy/service.rb', line 20

def port_mappings
  DockerDeploy.format_params("-p %s:%s", @ports)
end