bin/git-releaselog
#!/usr/bin/env ruby
require "git-releaselog"
require "docopt"
doc = <<DOCOPT
A script to generate release-notes from a git repository
Commit messages are parsed for lines of the following format:
`* fix: [<scope(optional)>] <description>`
`* feat: [<scope(optional)>] <description>`
`* gui: [<scope(optional)>] <description>`
`* refactor: [<scope(optional)>] <description>`
The descriptions are collected and printed as releaselog.
Usage:
#{__FILE__} [--complete][--debug][--format=<format>][--scope=<scope>]
#{__FILE__} <from-ref> [--debug][--format=<format>][--scope=<scope>]
#{__FILE__} <from-ref> <to-ref> [--debug][--format=<format>][--scope=<scope>]
#{__FILE__} -h | --help
#{__FILE__} --version
Options:
from-ref Git-Ref from which should the log be generated. Can be a tag-name or commit-hash. Will default to the latest tag
to-ref Git-Ref to which the log should be generated. Can be a tag-name or commit-hash. Has to be newer than `from-ref`. Will default to head
--scope=<scope> The scope. Will only include releaselog entries with that scope or without scope.
--format=<format> The format in which the output should be generated. Currently supports 'slack' and 'md' (for markdown)
--complete Traverses the whole git history and generates a releaselog for all tags
-h --help Show this screen.
--version Show version.
--debug Show debug output
DOCOPT
# Parse Commandline Arguments
begin
args = Docopt::docopt(doc, version: Releaselog::VERSION)
rescue Docopt::Exit => e
puts e.message
exit
end
puts Releaselog::Releaselog.generate_releaselog(
repo_path: ".",
from_ref: args["<from-ref>"],
to_ref: args["<to-ref>"],
scope: args["--scope"],
format: args["--format"] || "slack",
generate_complete: args["--complete"],
verbose: (args["--debug"] ? true : false)
)