Class: ComposeEnv::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/compose_env/builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Builder

Returns a new instance of Builder.



5
6
7
# File 'lib/compose_env/builder.rb', line 5

def initialize(options)
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/compose_env/builder.rb', line 3

def options
  @options
end

Instance Method Details

#build_compose_filesObject Also known as: build_compose_files!



9
10
11
12
13
# File 'lib/compose_env/builder.rb', line 9

def build_compose_files
  parse_all do |current_env, raw_yaml|
    File.write(environment_file_name(current_env), raw_yaml)
  end
end

#parse_allObject



16
17
18
19
20
21
22
23
# File 'lib/compose_env/builder.rb', line 16

def parse_all
  options.envs.map do |current_env|
    result = [current_env, parse_file(current_env)]
    yield(*result) if block_given?

    result
  end.to_h
end