Class: PopulateEnv::Heroku::Compilation

Inherits:
Object
  • Object
show all
Defined in:
lib/populate_env/heroku/compilation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Compilation

Returns a new instance of Compilation.



6
7
8
# File 'lib/populate_env/heroku/compilation.rb', line 6

def initialize(options)
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/populate_env/heroku/compilation.rb', line 4

def options
  @options
end

Instance Method Details

#attribute_definitionsObject



14
15
16
# File 'lib/populate_env/heroku/compilation.rb', line 14

def attribute_definitions
  manifest.attribute_definitions_for(options.manifest_environment)
end

#contentObject



29
30
31
# File 'lib/populate_env/heroku/compilation.rb', line 29

def content
  sections.compact.join("\n")
end

#manifestObject



10
11
12
# File 'lib/populate_env/heroku/compilation.rb', line 10

def manifest
  Manifest.new(options.manifest)
end

#performObject



33
34
35
# File 'lib/populate_env/heroku/compilation.rb', line 33

def perform
  options.destination.write(content)
end

#remote_configObject



18
19
20
# File 'lib/populate_env/heroku/compilation.rb', line 18

def remote_config
  @remote_config ||= RemoteConfig.new(options)
end

#sectionsObject



22
23
24
25
26
27
# File 'lib/populate_env/heroku/compilation.rb', line 22

def sections
  attribute_definitions.map do |definition|
    attribute = AttributeCompilation.new(definition, options, remote_config).perform
    Formatters::EnvShellSection.new(attribute) if attribute
  end
end