diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 989cb63..2c75cff 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,5 +1,5 @@ # This configuration was generated by `rubocop --auto-gen-config` -# on 2015-05-22 13:30:52 +0300 using RuboCop version 0.31.0. +# on 2015-05-22 14:06:42 +0300 using RuboCop version 0.31.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -16,7 +16,7 @@ Metrics/BlockNesting: # Offense count: 3 # Configuration parameters: CountComments. Metrics/ClassLength: - Max: 345 + Max: 350 # Offense count: 5 Metrics/CyclomaticComplexity: @@ -72,3 +72,8 @@ Style/Next: # Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes. Style/RegexpLiteral: Enabled: false + +# Offense count: 1 +# Cop supports --auto-correct. +Style/TrailingWhitespace: + Enabled: false diff --git a/bin/github_changelog_generator b/bin/github_changelog_generator index f0c5fd4..5d0d48a 100755 --- a/bin/github_changelog_generator +++ b/bin/github_changelog_generator @@ -1,4 +1,4 @@ #! /usr/bin/env ruby require_relative "../lib/github_changelog_generator" -GitHubChangelogGenerator::ChangelogGenerator.new.compound_changelog +GitHubChangelogGenerator::ChangelogGenerator.new.run diff --git a/lib/CHANGELOG.md b/lib/CHANGELOG.md index a261d8f..3c6e8bd 100644 --- a/lib/CHANGELOG.md +++ b/lib/CHANGELOG.md @@ -1,8 +1,12 @@ # Change Log -## [Unreleased](https://github.com/skywinder/changelog_test/tree/HEAD) +## [0.0.4](https://github.com/skywinder/changelog_test/tree/0.0.4) (2015-05-22) -[Full Changelog](https://github.com/skywinder/changelog_test/compare/v0.0.3...HEAD) +[Full Changelog](https://github.com/skywinder/changelog_test/compare/v0.0.3...0.0.4) + +**Closed issues:** + +- Test issue, that should appear in 0.0.4 [\#3](https://github.com/skywinder/changelog_test/issues/3) **Merged pull requests:** diff --git a/lib/github_changelog_generator.rb b/lib/github_changelog_generator.rb index 45c7909..21a055a 100755 --- a/lib/github_changelog_generator.rb +++ b/lib/github_changelog_generator.rb @@ -190,6 +190,18 @@ module GitHubChangelogGenerator # 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 = compound_changelog + + output_filename = "#{@options[:output]}" + File.open(output_filename, "w") { |file| file.write(log) } + puts "Done!" + puts "Generated log placed in #{Dir.pwd}/#{output_filename}" + end + + # Main function to start change log generation + # + # @return [String] Generated change log file def compound_changelog log = "# Change Log\n\n" @@ -219,11 +231,8 @@ module GitHubChangelogGenerator end log += "\n\n\\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*" - - output_filename = "#{@options[:output]}" - File.open(output_filename, "w") { |file| file.write(log) } - puts "Done!" - puts "Generated log placed in #{Dir.pwd}/#{output_filename}" + @log = log + @log = log end # The full cycle of generation for whole project @@ -531,6 +540,6 @@ module GitHubChangelogGenerator end if __FILE__ == $PROGRAM_NAME - GitHubChangelogGenerator::ChangelogGenerator.new.compound_changelog + GitHubChangelogGenerator::ChangelogGenerator.new.run end end diff --git a/lib/github_changelog_generator/generator.rb b/lib/github_changelog_generator/generator.rb index fdc0943..345bc81 100644 --- a/lib/github_changelog_generator/generator.rb +++ b/lib/github_changelog_generator/generator.rb @@ -1,5 +1,11 @@ module GitHubChangelogGenerator class Generator + # A Generator responsible for all logic, related with change log generation from ready-to-parse issues + # + # Example: + # generator = GitHubChangelogGenerator::Generator.new + # content = generator.compound_changelog + def initialize(options = nil) @options = options end @@ -42,5 +48,7 @@ module GitHubChangelogGenerator string end + + end end