Class: Navy::Container
- Inherits:
-
Object
- Object
- Navy::Container
- Defined in:
- lib/navy/container.rb
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#specification ⇒ Object
readonly
Returns the value of attribute specification.
Instance Method Summary collapse
- #app ⇒ Object
- #can_be_started?(etcd) ⇒ Boolean
- #can_never_be_started?(etcd) ⇒ Boolean
- #daemon? ⇒ Boolean
-
#initialize(options = {}) ⇒ Container
constructor
A new instance of Container.
- #name ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
Instance Attribute Details
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
2 3 4 |
# File 'lib/navy/container.rb', line 2 def dependencies @dependencies end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
2 3 4 |
# File 'lib/navy/container.rb', line 2 def @options end |
#specification ⇒ Object (readonly)
Returns the value of attribute specification.
2 3 4 |
# File 'lib/navy/container.rb', line 2 def specification @specification end |
Instance Method Details
#app ⇒ Object
18 19 20 |
# File 'lib/navy/container.rb', line 18 def app specification[:name] end |
#can_be_started?(etcd) ⇒ Boolean
22 23 24 25 26 27 |
# File 'lib/navy/container.rb', line 22 def can_be_started?(etcd) dependencies.each do |dep| return false unless desired?(etcd, dep) end true end |
#can_never_be_started?(etcd) ⇒ Boolean
29 30 31 32 33 34 |
# File 'lib/navy/container.rb', line 29 def can_never_be_started?(etcd) dependencies.each do |dep| return true if errored?(etcd, dep) end false end |
#daemon? ⇒ Boolean
10 11 12 |
# File 'lib/navy/container.rb', line 10 def daemon? specification[:type] == "application" end |
#name ⇒ Object
14 15 16 |
# File 'lib/navy/container.rb', line 14 def name specification[:container_name] end |
#start ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/navy/container.rb', line 36 def start if daemon? cmd = command_builder.build Navy::Runner.launch(cmd) else commands.each do |command| cmd = command_builder.build :command => command success = Navy::Runner.launch(cmd, :logger => @logger) return false unless success end true end end |