Class: Navy::Application
- Inherits:
-
Object
- Object
- Navy::Application
- Defined in:
- lib/navy/application.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #dependencies(config) ⇒ Object
- #env_var ⇒ Object
- #env_var? ⇒ Boolean
- #image ⇒ Object
-
#initialize(name, settings) ⇒ Application
constructor
A new instance of Application.
- #linked_apps(config) ⇒ Object
- #links ⇒ Object
- #modes ⇒ Object
- #proxy_port(mode = nil) ⇒ Object
- #proxy_to?(mode = nil) ⇒ Boolean
- #volumes_from ⇒ Object
Constructor Details
#initialize(name, settings) ⇒ Application
Returns a new instance of Application.
5 6 7 8 |
# File 'lib/navy/application.rb', line 5 def initialize(name, settings) @name = name @settings = settings end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/navy/application.rb', line 3 def name @name end |
Instance Method Details
#dependencies(config) ⇒ Object
26 27 28 29 |
# File 'lib/navy/application.rb', line 26 def dependencies(config) apps = config.applications links - apps end |
#env_var ⇒ Object
41 42 43 |
# File 'lib/navy/application.rb', line 41 def env_var @settings['env_var'] end |
#env_var? ⇒ Boolean
37 38 39 |
# File 'lib/navy/application.rb', line 37 def env_var? !!@settings['env_var'] end |
#image ⇒ Object
10 11 12 |
# File 'lib/navy/application.rb', line 10 def image @settings['image'] end |
#linked_apps(config) ⇒ Object
31 32 33 34 35 |
# File 'lib/navy/application.rb', line 31 def linked_apps(config) apps = config.applications links = @settings['links'] || [] links & apps end |
#links ⇒ Object
22 23 24 |
# File 'lib/navy/application.rb', line 22 def links @settings['links'] || [] end |
#modes ⇒ Object
14 15 16 |
# File 'lib/navy/application.rb', line 14 def modes @settings['modes'] end |
#proxy_port(mode = nil) ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/navy/application.rb', line 54 def proxy_port(mode=nil) if mode proxy = @settings['proxy_to'] || {} proxy[mode] else @settings['proxy_to'] end end |
#proxy_to?(mode = nil) ⇒ Boolean
45 46 47 48 49 50 51 52 |
# File 'lib/navy/application.rb', line 45 def proxy_to?(mode=nil) if mode proxy = @settings['proxy_to'] || {} proxy.keys.include? mode else @settings['proxy_to'] end end |
#volumes_from ⇒ Object
18 19 20 |
# File 'lib/navy/application.rb', line 18 def volumes_from @settings['volumes_from'] || [] end |