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`
# 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

View File

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

View File

@ -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:**

View File

@ -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

View File

@ -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