Class: DockerDeploy::Stage
- Inherits:
-
Object
- Object
- DockerDeploy::Stage
- Includes:
- Rake::FileUtilsExt
- Defined in:
- lib/docker_deploy/stage.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#container(name = nil) ⇒ Object
readonly
Returns the value of attribute container.
-
#deploy ⇒ Object
readonly
Returns the value of attribute deploy.
-
#env_files ⇒ Object
readonly
Returns the value of attribute env_files.
-
#links ⇒ Object
readonly
Returns the value of attribute links.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#servers ⇒ Object
readonly
Returns the value of attribute servers.
-
#services ⇒ Object
readonly
Returns the value of attribute services.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
Instance Method Summary collapse
- #env(variables = {}) ⇒ Object
- #env_file(env_file) ⇒ Object
- #host(name = nil) ⇒ Object
-
#initialize(context, name) ⇒ Stage
constructor
A new instance of Stage.
- #link(links = {}) ⇒ Object
- #link_mappings ⇒ Object
- #options ⇒ Object
- #port(ports = {}) ⇒ Object
- #port_mappings ⇒ Object
- #service(name, &block) ⇒ Object
Constructor Details
#initialize(context, name) ⇒ Stage
Returns a new instance of Stage.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/docker_deploy/stage.rb', line 7 def initialize(context, name) @context = context @name = name @env_files = [] @services = [] @variables = {} @ports = {} @links = {} @deploy = ["docker:build", "docker:push", :pull, :restart] end |
Instance Attribute Details
#container(name = nil) ⇒ Object (readonly)
Returns the value of attribute container.
5 6 7 |
# File 'lib/docker_deploy/stage.rb', line 5 def container @container end |
#deploy ⇒ Object (readonly)
Returns the value of attribute deploy.
5 6 7 |
# File 'lib/docker_deploy/stage.rb', line 5 def deploy @deploy end |
#env_files ⇒ Object (readonly)
Returns the value of attribute env_files.
5 6 7 |
# File 'lib/docker_deploy/stage.rb', line 5 def env_files @env_files end |
#links ⇒ Object (readonly)
Returns the value of attribute links.
5 6 7 |
# File 'lib/docker_deploy/stage.rb', line 5 def links @links end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/docker_deploy/stage.rb', line 5 def name @name end |
#servers ⇒ Object (readonly)
Returns the value of attribute servers.
5 6 7 |
# File 'lib/docker_deploy/stage.rb', line 5 def servers @servers end |
#services ⇒ Object (readonly)
Returns the value of attribute services.
5 6 7 |
# File 'lib/docker_deploy/stage.rb', line 5 def services @services end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
5 6 7 |
# File 'lib/docker_deploy/stage.rb', line 5 def variables @variables end |
Instance Method Details
#env(variables = {}) ⇒ Object
18 19 20 |
# File 'lib/docker_deploy/stage.rb', line 18 def env(variables = {}) @variables.merge!(variables) end |
#env_file(env_file) ⇒ Object
30 31 32 |
# File 'lib/docker_deploy/stage.rb', line 30 def env_file(env_file) @env_files.push(env_file) end |
#host(name = nil) ⇒ Object
34 35 36 37 |
# File 'lib/docker_deploy/stage.rb', line 34 def host(name = nil) @host = name if name @host end |
#link(links = {}) ⇒ Object
26 27 28 |
# File 'lib/docker_deploy/stage.rb', line 26 def link(links = {}) @links.merge!(links) end |
#link_mappings ⇒ Object
39 40 41 |
# File 'lib/docker_deploy/stage.rb', line 39 def link_mappings DockerDeploy.format_params("--link %s:%s", @context.links.merge(@links)) end |
#options ⇒ Object
47 48 49 50 |
# File 'lib/docker_deploy/stage.rb', line 47 def DockerDeploy.format_params("--env-file %s", @context.env_files + @env_files) + " " + DockerDeploy.format_params("-e %s=%s", @context.variables.merge(@variables)) end |
#port(ports = {}) ⇒ Object
22 23 24 |
# File 'lib/docker_deploy/stage.rb', line 22 def port(ports = {}) @ports.merge!(ports) end |
#port_mappings ⇒ Object
43 44 45 |
# File 'lib/docker_deploy/stage.rb', line 43 def port_mappings DockerDeploy.format_params("-p %s:%s", @context.ports.merge(@ports)) end |
#service(name, &block) ⇒ Object
57 58 59 60 61 |
# File 'lib/docker_deploy/stage.rb', line 57 def service(name, &block) service = Service.new(self, name) service.instance_eval(&block) @services << service end |