Module: ChangesSince

Defined in:
lib/changes_since.rb,
lib/changes_since/version.rb,
lib/changes_since/commit_parser.rb,
lib/changes_since/changelog_printer.rb

Defined Under Namespace

Classes: ChangelogPrinter, CommitParser

Constant Summary collapse

VERSION =
"0.0.10"

Class Method Summary collapse

Class Method Details

.fetch(tag, teams = nil, repo = nil) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/changes_since.rb', line 6

def self.fetch(tag, teams=nil, repo=nil)
  options = parse_options
  parser  = CommitParser.new(tag, options)
  commits = parser.parse
  printer = ChangelogPrinter.new(commits, teams, options, repo)
  printer.print!
end

.parse_optionsObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/changes_since.rb', line 14

def self.parse_options
  options = {}
  OptionParser.new do |opts|
    opts.banner = "Usage: script/changes_since TAG [options]"

    opts.on("-a", "--all", "Consider all interesting commits ([AI-1234] or [ZD#1234] or #bug/public/internal), not just PR merges") do |a|
      options[:all] = a
    end

    opts.on("-s", "--sha", "Include commit sha in the output") do |s|
      options[:sha] = s
    end

    opts.on("-f", "--filter [authors]", "Limit to authors matching the passed string(s). Comma-separated list works.") do |authors|
      options[:author_filter] = authors.split(",")
    end

    opts.on("-t", "--tags", "Group commits by public, internal or bugs") do |t|
      options[:tags] = t
    end

    opts.on("-r", "--risk", "Group commits by high, medium or low risk") do |r|
      options[:risk] = r
    end

    opts.on("-m", "--markdown", "Use tables in Atlassian as markdown") do |m|
      options[:markdown] = m
    end
  end.parse!
  options
end