rename, prepare to moving methods to generator

This commit is contained in:
Petr Korolev 2015-05-22 14:06:48 +03:00
parent 536b39c961
commit 7f696b6b09
5 changed files with 37 additions and 11 deletions

View File

@ -1,5 +1,5 @@
# This configuration was generated by `rubocop --auto-gen-config` # 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 # The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base. # one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new # Note that changes in the inspected code, or installation of new
@ -16,7 +16,7 @@ Metrics/BlockNesting:
# Offense count: 3 # Offense count: 3
# Configuration parameters: CountComments. # Configuration parameters: CountComments.
Metrics/ClassLength: Metrics/ClassLength:
Max: 345 Max: 350
# Offense count: 5 # Offense count: 5
Metrics/CyclomaticComplexity: Metrics/CyclomaticComplexity:
@ -72,3 +72,8 @@ Style/Next:
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes. # Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.
Style/RegexpLiteral: Style/RegexpLiteral:
Enabled: false Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/TrailingWhitespace:
Enabled: false

View File

@ -1,4 +1,4 @@
#! /usr/bin/env ruby #! /usr/bin/env ruby
require_relative "../lib/github_changelog_generator" require_relative "../lib/github_changelog_generator"
GitHubChangelogGenerator::ChangelogGenerator.new.compound_changelog GitHubChangelogGenerator::ChangelogGenerator.new.run

View File

@ -1,8 +1,12 @@
# Change Log # 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:** **Merged pull requests:**

View File

@ -190,6 +190,18 @@ module GitHubChangelogGenerator
# The entry point of this script to generate change log # 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. # @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 def compound_changelog
log = "# Change Log\n\n" log = "# Change Log\n\n"
@ -219,11 +231,8 @@ module GitHubChangelogGenerator
end end
log += "\n\n\\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*" log += "\n\n\\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*"
@log = log
output_filename = "#{@options[:output]}" @log = log
File.open(output_filename, "w") { |file| file.write(log) }
puts "Done!"
puts "Generated log placed in #{Dir.pwd}/#{output_filename}"
end end
# The full cycle of generation for whole project # The full cycle of generation for whole project
@ -531,6 +540,6 @@ module GitHubChangelogGenerator
end end
if __FILE__ == $PROGRAM_NAME if __FILE__ == $PROGRAM_NAME
GitHubChangelogGenerator::ChangelogGenerator.new.compound_changelog GitHubChangelogGenerator::ChangelogGenerator.new.run
end end
end end

View File

@ -1,5 +1,11 @@
module GitHubChangelogGenerator module GitHubChangelogGenerator
class Generator 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) def initialize(options = nil)
@options = options @options = options
end end
@ -42,5 +48,7 @@ module GitHubChangelogGenerator
string string
end end
end end
end end