Class: Compote::ServiceConfig
- Inherits:
-
Object
- Object
- Compote::ServiceConfig
- Defined in:
- lib/compote/service_config.rb
Instance Method Summary collapse
- #commands ⇒ Object
- #compose_config ⇒ Object
-
#initialize(config, name, data) ⇒ ServiceConfig
constructor
A new instance of ServiceConfig.
Constructor Details
#initialize(config, name, data) ⇒ ServiceConfig
Returns a new instance of ServiceConfig.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/compote/service_config.rb', line 5 def initialize ( config, name, data ) @config = config @name = name @data = apply_extends data @compote_settings = @data.fetch 'compote', {} @service_settings = @data.reject { | key, value | key == 'compote' } end |
Instance Method Details
#commands ⇒ Object
20 21 22 23 24 |
# File 'lib/compote/service_config.rb', line 20 def commands @compote_settings.fetch 'commands', {} end |
#compose_config ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/compote/service_config.rb', line 26 def compose_config compose_config = {} compose_config[ 'version' ] = @config.compose_version compose_config[ 'services' ] = @service_settings.empty? ? {} : { @name => @service_settings } compose_config[ 'volumes' ] = @compote_settings.fetch 'volumes', {} compose_config[ 'networks' ] = @compote_settings.fetch 'networks', {} compose_config end |