github_changelog_generator 1.2.8 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,20 +5,20 @@ module GitHubChangelogGenerator
5
5
  @options = options
6
6
  end
7
7
 
8
- def get_string_for_pull_request(pull_request)
9
- encapsulated_title = self.encapsulate_string pull_request[:title]
10
-
11
- merge = "#{@options[:merge_prefix]}#{encapsulated_title} [\\##{pull_request[:number]}](#{pull_request.html_url})"
12
- if @options[:author]
13
- if pull_request.user.nil?
14
- merge += " ({Null user})\n\n"
15
- else
16
- merge += " ([#{pull_request.user.login}](#{pull_request.user.html_url}))\n\n"
8
+ def get_string_for_issue(issue)
9
+ encapsulated_title = self.encapsulate_string issue[:title]
10
+
11
+ merge = "#{encapsulated_title} [\\##{issue[:number]}](#{issue.html_url})"
12
+ unless issue.pull_request.nil?
13
+ if @options[:author]
14
+ if issue.user.nil?
15
+ merge += " ({Null user})\n\n"
16
+ else
17
+ merge += " ([#{issue.user.login}](#{issue.user.html_url}))\n\n"
18
+ end
17
19
  end
18
- else
19
- merge += "\n\n"
20
20
  end
21
- merge
21
+ merge += "\n"
22
22
  end
23
23
 
24
24
  def encapsulate_string(string)
@@ -26,7 +26,7 @@ module GitHubChangelogGenerator
26
26
  string.gsub! '\\', '\\\\'
27
27
 
28
28
  encpas_chars = %w(> * _ \( \) [ ])
29
- encpas_chars.each{ |char|
29
+ encpas_chars.each { |char|
30
30
  string.gsub! char, "\\#{char}"
31
31
  }
32
32
 
@@ -6,7 +6,28 @@ require_relative 'version'
6
6
  module GitHubChangelogGenerator
7
7
  class Parser
8
8
  def self.parse_options
9
- options = {:tag1 => nil, :tag2 => nil, :format => '%d/%m/%y', :output => 'CHANGELOG.md', :labels => %w(bug enhancement), :pulls => true, :issues => true, :verbose => true, :add_issues_wo_labels => true, :merge_prefix => '*Merged pull-request:* ', :author => true, :pull_request_labels => nil, :filter_issues_by_milestone => true, :compare_link => true}
9
+ # :include_labels => %w(bug enhancement),
10
+ hash = {
11
+ :tag1 => nil,
12
+ :tag2 => nil,
13
+ :format => '%Y-%m-%d',
14
+ :output => 'CHANGELOG.md',
15
+ :exclude_labels => %w(duplicate question invalid wontfix),
16
+ :pulls => true,
17
+ :issues => true,
18
+ :verbose => true,
19
+ :add_issues_wo_labels => true,
20
+ :add_pr_wo_labels => true,
21
+ :merge_prefix => '#### Merged pull requests:',
22
+ :issue_prefix => '#### Closed issues:',
23
+ :bug_prefix => '#### Fixed bugs:',
24
+ :enhancement_prefix => '#### Implemented enhancements:',
25
+ :author => true,
26
+ :filter_issues_by_milestone => true,
27
+ :compare_link => true,
28
+ :unreleased => true
29
+ }
30
+ options = hash
10
31
 
11
32
  parser = OptionParser.new { |opts|
12
33
  opts.banner = 'Usage: changelog_generator [options]'
@@ -25,15 +46,15 @@ module GitHubChangelogGenerator
25
46
  opts.on('-o', '--output [NAME]', 'Output file. Default is CHANGELOG.md') do |last|
26
47
  options[:output] = last
27
48
  end
28
- opts.on('--[no-]verbose', 'Run verbosely. Default is true') do |v|
29
- options[:verbose] = v
30
- end
31
49
  opts.on('--[no-]issues', 'Include closed issues to changelog. Default is true') do |v|
32
50
  options[:issues] = v
33
51
  end
34
- opts.on('--[no-]issues-wo-labels', 'Include closed issues without any labels to changelog. Default is true') do |v|
52
+ opts.on('--[no-]issues-wo-labels', 'Include closed issues without labels to changelog. Default is true') do |v|
35
53
  options[:add_issues_wo_labels] = v
36
54
  end
55
+ opts.on('--[no-]pr-wo-labels', 'Include pull requests without labels to changelog. Default is true') do |v|
56
+ options[:add_pr_wo_labels] = v
57
+ end
37
58
  opts.on('--[no-]pull-requests', 'Include pull-requests to changelog. Default is true') do |v|
38
59
  options[:pulls] = v
39
60
  end
@@ -41,16 +62,22 @@ module GitHubChangelogGenerator
41
62
  options[:filter_issues_by_milestone] = last
42
63
  end
43
64
  opts.on('--[no-]author', 'Add author of pull-request in the end. Default is true') do |author|
44
- options[:last] = author
65
+ options[:author] = author
66
+ end
67
+ opts.on('--unreleased-only', 'Generate log from unreleased closed issues only.') do |v|
68
+ options[:unreleased_only] = v
45
69
  end
46
- opts.on('--[no-]compare-link', 'Include compare link between older version and newer version. Default is true') do |v|
70
+ opts.on('--[no-]unreleased', 'Add to log unreleased closed issues. Default is true') do |v|
71
+ options[:unreleased] = v
72
+ end
73
+ opts.on('--[no-]compare-link', 'Include compare link (Full Changelog) between older version and newer version. Default is true') do |v|
47
74
  options[:compare_link] = v
48
75
  end
49
- opts.on('--labels x,y,z', Array, 'Issues with that labels will be included to changelog. Default is \'bug,enhancement\'') do |list|
50
- options[:labels] = list
76
+ opts.on('--include-labels x,y,z', Array, 'Issues only with that labels will be included to changelog. Default is \'bug,enhancement\'') do |list|
77
+ options[:include_labels] = list
51
78
  end
52
- opts.on('--labels-pr x,y,z', Array, 'Only pull requests with specified labels will be included to changelog. Default is nil') do |list|
53
- options[:pull_request_labels] = list
79
+ opts.on('--exclude-labels x,y,z', Array, 'Issues with that labels will be always excluded from changelog. Default is \'duplicate,question,invalid,wontfix\'') do |list|
80
+ options[:exclude_labels] = list
54
81
  end
55
82
  opts.on('--github-site [URL]', 'The Enterprise Github site on which your project is hosted.') do |last|
56
83
  options[:github_site] = last
@@ -58,6 +85,12 @@ module GitHubChangelogGenerator
58
85
  opts.on('--github-api [URL]', 'The enterprise endpoint to use for your Github API.') do |last|
59
86
  options[:github_endpoint] = last
60
87
  end
88
+ opts.on('--simple-list', 'Create simple list from issues and pull requests. Default is false.') do |v|
89
+ options[:simple_list] = v
90
+ end
91
+ opts.on('--[no-]verbose', 'Run verbosely. Default is true') do |v|
92
+ options[:verbose] = v
93
+ end
61
94
  opts.on('-v', '--version', 'Print version number') do |v|
62
95
  puts "Version: #{GitHubChangelogGenerator::VERSION}"
63
96
  exit
@@ -76,7 +109,7 @@ module GitHubChangelogGenerator
76
109
  match = /(?:.+#{Regexp.escape(github_site)}\/)?(.+)\/(.+)/.match(ARGV[0])
77
110
 
78
111
  begin
79
- param = match[2].nil?
112
+ param = match[2].nil?
80
113
  rescue
81
114
  puts "Can't detect user and name from first parameter: '#{ARGV[0]}' -> exit'"
82
115
  exit
@@ -1,3 +1,3 @@
1
1
  module GitHubChangelogGenerator
2
- VERSION = '1.2.8'
2
+ VERSION = '1.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_changelog_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.8
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Petr Korolev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-18 00:00:00.000000000 Z
11
+ date: 2015-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  requirements: []
110
110
  rubyforge_project:
111
- rubygems_version: 2.4.3
111
+ rubygems_version: 2.4.4
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Script, that automatically generate change-log from your tags and pull-requests.