Class: DockerDeploy::Service
- Inherits:
-
Object
- Object
- DockerDeploy::Service
- Defined in:
- lib/docker_deploy/service.rb
Instance Attribute Summary collapse
-
#command(name = nil) ⇒ Object
readonly
Returns the value of attribute command.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #container(name = nil) ⇒ Object
-
#initialize(stage, name) ⇒ Service
constructor
A new instance of Service.
- #port(ports = {}) ⇒ Object
- #port_mappings ⇒ Object
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 |
#name ⇒ Object (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_mappings ⇒ Object
20 21 22 |
# File 'lib/docker_deploy/service.rb', line 20 def port_mappings DockerDeploy.format_params("-p %s:%s", @ports) end |