Class: RakeDocker::Container::Provisioner
- Inherits:
-
Object
- Object
- RakeDocker::Container::Provisioner
- Includes:
- Utilities
- Defined in:
- lib/rake_docker/container.rb
Overview
rubocop:disable Metrics/ClassLength
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
rubocop:disable Metrics/AbcSize.
-
#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.
149 150 151 152 153 154 155 156 |
# File 'lib/rake_docker/container.rb', line 149 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.
147 148 149 |
# File 'lib/rake_docker/container.rb', line 147 def environment @environment end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
147 148 149 |
# File 'lib/rake_docker/container.rb', line 147 def image @image end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
147 148 149 |
# File 'lib/rake_docker/container.rb', line 147 def name @name end |
#ports ⇒ Object (readonly)
Returns the value of attribute ports.
147 148 149 |
# File 'lib/rake_docker/container.rb', line 147 def ports @ports end |
#ready ⇒ Object (readonly)
Returns the value of attribute ready.
147 148 149 |
# File 'lib/rake_docker/container.rb', line 147 def ready @ready end |
#reporter ⇒ Object (readonly)
Returns the value of attribute reporter.
147 148 149 |
# File 'lib/rake_docker/container.rb', line 147 def reporter @reporter end |
Instance Method Details
#execute ⇒ Object
rubocop:disable Metrics/AbcSize
159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/rake_docker/container.rb', line 159 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) start_new_container(name, image, ports, environment) end reporter.done end |