2014-11-06 13:51:15 +00:00
|
|
|
#!/usr/bin/env ruby
|
2016-09-22 17:16:29 +00:00
|
|
|
# frozen_string_literal: true
|
2014-11-06 13:51:15 +00:00
|
|
|
|
2016-05-18 17:13:22 +00:00
|
|
|
require "octokit"
|
2016-07-02 14:36:27 +00:00
|
|
|
require "faraday-http-cache"
|
2016-05-18 22:40:25 +00:00
|
|
|
require "logger"
|
|
|
|
require "active_support"
|
2017-05-25 12:07:34 +00:00
|
|
|
require "active_support/core_ext/object/blank"
|
2015-04-02 09:05:26 +00:00
|
|
|
require "json"
|
2016-07-02 12:44:20 +00:00
|
|
|
require "multi_json"
|
2015-04-02 09:05:26 +00:00
|
|
|
require "benchmark"
|
2014-12-15 12:15:39 +00:00
|
|
|
|
2017-05-24 22:11:02 +00:00
|
|
|
require "github_changelog_generator/helper"
|
|
|
|
require "github_changelog_generator/options"
|
|
|
|
require "github_changelog_generator/parser"
|
|
|
|
require "github_changelog_generator/parser_file"
|
|
|
|
require "github_changelog_generator/generator/generator"
|
|
|
|
require "github_changelog_generator/version"
|
|
|
|
require "github_changelog_generator/reader"
|
2014-11-06 13:51:15 +00:00
|
|
|
|
2015-05-22 14:44:06 +00:00
|
|
|
# The main module, where placed all classes (now, at least)
|
2014-11-17 15:54:13 +00:00
|
|
|
module GitHubChangelogGenerator
|
2015-04-03 15:59:37 +00:00
|
|
|
# Main class and entry point for this script.
|
2014-11-17 15:54:13 +00:00
|
|
|
class ChangelogGenerator
|
2017-12-13 21:06:00 +00:00
|
|
|
# Class, responsible for whole changelog generation cycle
|
2015-04-21 17:42:33 +00:00
|
|
|
# @return initialised instance of ChangelogGenerator
|
2014-11-18 13:20:57 +00:00
|
|
|
def initialize
|
2014-11-17 15:54:13 +00:00
|
|
|
@options = Parser.parse_options
|
2015-04-21 17:42:33 +00:00
|
|
|
@generator = Generator.new @options
|
2014-11-17 15:54:13 +00:00
|
|
|
end
|
2014-11-06 13:51:15 +00:00
|
|
|
|
2017-12-13 21:06:00 +00:00
|
|
|
# The entry point of this script to generate changelog
|
2015-05-22 12:28:43 +00:00
|
|
|
# @raise (ChangelogGeneratorError) Is thrown when one of specified tags was not found in list of tags.
|
|
|
|
def run
|
|
|
|
log = @generator.compound_changelog
|
|
|
|
|
2017-05-24 22:11:02 +00:00
|
|
|
output_filename = @options[:output].to_s
|
|
|
|
File.open(output_filename, "wb") { |file| file.write(log) }
|
2015-05-22 12:28:43 +00:00
|
|
|
puts "Done!"
|
|
|
|
puts "Generated log placed in #{Dir.pwd}/#{output_filename}"
|
|
|
|
end
|
2014-11-07 15:04:03 +00:00
|
|
|
end
|
2015-01-24 12:42:11 +00:00
|
|
|
end
|