Class: DockerDeploy::Context
- Inherits:
-
Object
- Object
- DockerDeploy::Context
- Defined in:
- lib/docker_deploy/context.rb
Instance Attribute Summary collapse
-
#env_files ⇒ Object
readonly
Returns the value of attribute env_files.
-
#links ⇒ Object
readonly
Returns the value of attribute links.
-
#ports ⇒ Object
readonly
Returns the value of attribute ports.
-
#stages ⇒ Object
readonly
Returns the value of attribute stages.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
Instance Method Summary collapse
- #container(name = nil) ⇒ Object
- #env(variables = {}) ⇒ Object
- #env_file(env_file) ⇒ Object
- #image(name = nil) ⇒ Object
-
#initialize ⇒ Context
constructor
A new instance of Context.
- #link(links = {}) ⇒ Object
- #local(&block) ⇒ Object
- #port(ports = {}) ⇒ Object
- #revision ⇒ Object
- #stage(name, &block) ⇒ Object
Constructor Details
#initialize ⇒ Context
Returns a new instance of Context.
5 6 7 8 9 10 11 |
# File 'lib/docker_deploy/context.rb', line 5 def initialize @stages = [] @env_files = [] @variables = {} @ports = {} @links = {} end |
Instance Attribute Details
#env_files ⇒ Object (readonly)
Returns the value of attribute env_files.
3 4 5 |
# File 'lib/docker_deploy/context.rb', line 3 def env_files @env_files end |
#links ⇒ Object (readonly)
Returns the value of attribute links.
3 4 5 |
# File 'lib/docker_deploy/context.rb', line 3 def links @links end |
#ports ⇒ Object (readonly)
Returns the value of attribute ports.
3 4 5 |
# File 'lib/docker_deploy/context.rb', line 3 def ports @ports end |
#stages ⇒ Object (readonly)
Returns the value of attribute stages.
3 4 5 |
# File 'lib/docker_deploy/context.rb', line 3 def stages @stages end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
3 4 5 |
# File 'lib/docker_deploy/context.rb', line 3 def variables @variables end |
Instance Method Details
#container(name = nil) ⇒ Object
34 35 36 37 |
# File 'lib/docker_deploy/context.rb', line 34 def container(name = nil) @container = name if name @container or @image.split("/").last end |
#env(variables = {}) ⇒ Object
13 14 15 |
# File 'lib/docker_deploy/context.rb', line 13 def env(variables = {}) @variables.merge!(variables) end |
#env_file(env_file) ⇒ Object
25 26 27 |
# File 'lib/docker_deploy/context.rb', line 25 def env_file(env_file) @env_files.push(env_file) end |
#image(name = nil) ⇒ Object
29 30 31 32 |
# File 'lib/docker_deploy/context.rb', line 29 def image(name = nil) @image = name if name @image end |
#link(links = {}) ⇒ Object
21 22 23 |
# File 'lib/docker_deploy/context.rb', line 21 def link(links = {}) @links.merge!(links) end |
#local(&block) ⇒ Object
43 44 45 46 47 |
# File 'lib/docker_deploy/context.rb', line 43 def local(&block) stage = LocalStage.new(self) stage.instance_eval(&block) @stages << stage end |
#port(ports = {}) ⇒ Object
17 18 19 |
# File 'lib/docker_deploy/context.rb', line 17 def port(ports = {}) @ports.merge!(ports) end |
#revision ⇒ Object
39 40 41 |
# File 'lib/docker_deploy/context.rb', line 39 def revision @revision ||= `git rev-parse HEAD`.chomp[0...8] end |
#stage(name, &block) ⇒ Object
49 50 51 52 53 |
# File 'lib/docker_deploy/context.rb', line 49 def stage(name, &block) stage = RemoteStage.new(self, name) stage.instance_eval(&block) @stages << stage end |