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
+6 -2
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:**
+15 -6
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
@@ -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