Class: RakeDocker::Container::Provisioner
- Inherits:
-
Object
- Object
- RakeDocker::Container::Provisioner
- Includes:
- Utilities
- Defined in:
- lib/rake_docker/container.rb
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#ports ⇒ Object
readonly
Returns the value of attribute ports.
-
#ready ⇒ Object
readonly
Returns the value of attribute ready.
-
#reporter ⇒ Object
readonly
Returns the value of attribute reporter.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(name, image, opts = {}) ⇒ Provisioner
constructor
A new instance of Provisioner.
Methods included from Utilities
#enhance_with_name, #find_container
Constructor Details
#initialize(name, image, opts = {}) ⇒ Provisioner
Returns a new instance of Provisioner.
146 147 148 149 150 151 152 153 |
# File 'lib/rake_docker/container.rb', line 146 def initialize(name, image, opts = {}) @name = name @image = image @environment = opts[:environment] || {} @ports = opts[:ports] || [] @ready = opts[:ready?] @reporter = opts[:reporter] || NullReporter.new end |
Instance Attribute Details
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
144 145 146 |
# File 'lib/rake_docker/container.rb', line 144 def environment @environment end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
144 145 146 |
# File 'lib/rake_docker/container.rb', line 144 def image @image end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
144 145 146 |
# File 'lib/rake_docker/container.rb', line 144 def name @name end |
#ports ⇒ Object (readonly)
Returns the value of attribute ports.
144 145 146 |
# File 'lib/rake_docker/container.rb', line 144 def ports @ports end |
#ready ⇒ Object (readonly)
Returns the value of attribute ready.
144 145 146 |
# File 'lib/rake_docker/container.rb', line 144 def ready @ready end |
#reporter ⇒ Object (readonly)
Returns the value of attribute reporter.
144 145 146 |
# File 'lib/rake_docker/container.rb', line 144 def reporter @reporter end |
Instance Method Details
#execute ⇒ Object
155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/rake_docker/container.rb', line 155 def execute reporter.checking_if_container_exists(name) container = find_container(name) if container reporter.container_exists(container) ensure_container_running(container) else reporter.container_does_not_exist(name) ensure_image_available(image) create_and_start_container(name, image, ports, environment) end reporter.done end |