Class: GitHubChangelogGenerator::ChangelogGenerator

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

Overview

Main class and entry point for this script.

Instance Method Summary collapse

Constructor Details

#initialize(params = ARGV) ⇒ Object

Class, responsible for whole changelog generation cycle



25
26
27
28
# File 'lib/github_changelog_generator.rb', line 25

def initialize(params = ARGV)
  @options = Parser.parse_options(params)
  @generator = Generator.new(@options)
end

Instance Method Details

#run ⇒ Object

The entry point of this script to generate changelog

Raises:



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/github_changelog_generator.rb', line 32

def run
  log = generator.compound_changelog

  if options.write_to_file?
    output_filename = options[:output].to_s
    File.open(output_filename, "wb") { |file| file.write(log) }
    puts "Done!"
    puts "Generated log placed in #{File.absolute_path(output_filename)}"
  else
    puts log
  end
end