2014-11-06 15:51:15 +02:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
2015-04-02 12:05:26 +03:00
|
|
|
require "github_api"
|
|
|
|
require "json"
|
|
|
|
require "colorize"
|
|
|
|
require "benchmark"
|
2014-12-15 14:15:39 +02:00
|
|
|
|
2015-06-10 13:27:27 +03:00
|
|
|
require_relative "github_changelog_generator/helper"
|
2015-04-02 12:05:26 +03:00
|
|
|
require_relative "github_changelog_generator/parser"
|
2015-09-14 01:02:52 -03:00
|
|
|
require_relative "github_changelog_generator/parser_file"
|
2015-05-22 15:55:37 +03:00
|
|
|
require_relative "github_changelog_generator/generator/generator"
|
2015-04-02 12:05:26 +03:00
|
|
|
require_relative "github_changelog_generator/version"
|
|
|
|
require_relative "github_changelog_generator/reader"
|
2014-11-06 15:51:15 +02:00
|
|
|
|
2015-05-22 17:44:06 +03:00
|
|
|
# The main module, where placed all classes (now, at least)
|
2014-11-17 17:54:13 +02:00
|
|
|
module GitHubChangelogGenerator
|
2015-04-03 18:59:37 +03:00
|
|
|
# Main class and entry point for this script.
|
2014-11-17 17:54:13 +02:00
|
|
|
class ChangelogGenerator
|
2015-04-03 18:59:37 +03:00
|
|
|
# Class, responsible for whole change log generation cycle
|
2015-04-21 20:42:33 +03:00
|
|
|
# @return initialised instance of ChangelogGenerator
|
2014-11-18 15:20:57 +02:00
|
|
|
def initialize
|
2014-11-17 17:54:13 +02:00
|
|
|
@options = Parser.parse_options
|
2015-04-21 20:42:33 +03:00
|
|
|
@generator = Generator.new @options
|
2014-11-17 17:54:13 +02:00
|
|
|
end
|
2014-11-06 15:51:15 +02:00
|
|
|
|
2015-05-22 15:28:43 +03:00
|
|
|
# The entry point of this script to generate change log
|
|
|
|
# @raise (ChangelogGeneratorError) Is thrown when one of specified tags was not found in list of tags.
|
|
|
|
def run
|
|
|
|
log = @generator.compound_changelog
|
|
|
|
|
2016-02-23 12:25:55 +02:00
|
|
|
output_filename = (@options[:output]).to_s
|
2015-05-22 15:28:43 +03:00
|
|
|
File.open(output_filename, "w") { |file| file.write(log) }
|
|
|
|
puts "Done!"
|
|
|
|
puts "Generated log placed in #{Dir.pwd}/#{output_filename}"
|
|
|
|
end
|
2014-11-07 17:04:03 +02:00
|
|
|
end
|
|
|
|
|
2015-03-26 15:43:47 +02:00
|
|
|
if __FILE__ == $PROGRAM_NAME
|
2015-05-22 14:06:48 +03:00
|
|
|
GitHubChangelogGenerator::ChangelogGenerator.new.run
|
2014-11-17 17:54:13 +02:00
|
|
|
end
|
2015-01-24 21:42:11 +09:00
|
|
|
end
|