Class: Renogen::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/renogen/generator.rb

Overview

This is the conductor of the application

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(version, source, output_format, options = {}) ⇒ Generator

Returns a new instance of Generator.



8
9
10
11
12
13
# File 'lib/renogen/generator.rb', line 8

def initialize(version, source, output_format, options = {})
  @version = version
  @source = source
  @output_format = output_format
  @options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/renogen/generator.rb', line 6

def options
  @options
end

#output_formatObject

Returns the value of attribute output_format.



6
7
8
# File 'lib/renogen/generator.rb', line 6

def output_format
  @output_format
end

#sourceObject

Returns the value of attribute source.



6
7
8
# File 'lib/renogen/generator.rb', line 6

def source
  @source
end

#versionObject

Returns the value of attribute version.



6
7
8
# File 'lib/renogen/generator.rb', line 6

def version
  @version
end

Instance Method Details

#generate!Object

Create the change log



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

def generate!
  changelog = extraction_stratagy.extract
  changelog.version = version
  changelog.date = options['release_date']

  validator.validate!(changelog) if options['allowed_values']&.any?
  writer.write!(changelog)
end