github_changelog_generator 1.8.0 → 1.8.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14e8beb89ae2f1803f59aa8dc82b7ec4bab97861
4
- data.tar.gz: 6002f6306a1532fc8ff36403923f34a6698e89fa
3
+ metadata.gz: f4045299c345bb4c35588ac19738c6a051e21492
4
+ data.tar.gz: 194f9175ddfa64ef9c20c22487a37a0883c03bfe
5
5
  SHA512:
6
- metadata.gz: 8ab2b56f72ca7a624bd626f2ffed3624139d44f36dea500172bc0b155037ee0327bd2bc0a6d597c0038608c7bcfd0bd03d0a64d53bb194eb73e9d1f9d64d4ba2
7
- data.tar.gz: 3fd4f8006c2af2f89ee23838ecf81b618ef6107847340cef98fead5e0be4434944ea479a9aca503125a03bf3894aa7aa7043b9e8402e9888261ef3ad3f55fc0f
6
+ metadata.gz: c838859c2aee00fb903f1a6b8862f13cd017fabdfb5b17f020d9ca570b49a289232b1c55788c4b10b80191aa67e113eebb347dc77e540dbc911cf09288e610c9
7
+ data.tar.gz: f5ceeae373fff4e8a85ea7fc2d95f4029ad72f67a5c59bc7aced2137059ec61f00ceb41c58f8f4a8c8778dd8181b7b04f520d1128401d439147dc9ab035612b6
@@ -1,5 +1,30 @@
1
1
  # Change Log
2
2
 
3
+ ## [Unreleased](https://github.com/skywinder/github-changelog-generator/tree/HEAD)
4
+
5
+ [Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.8.0...HEAD)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - Fix issue with missing events \(in case of events for issue \>30\) [\#268](https://github.com/skywinder/github-changelog-generator/pull/268) ([skywinder](https://github.com/skywinder))
10
+ - Use since\_tag as default for older\_tag [\#267](https://github.com/skywinder/github-changelog-generator/pull/267) ([raphink](https://github.com/raphink))
11
+
12
+ ## [1.8.0](https://github.com/skywinder/github-changelog-generator/tree/1.8.0) (2015-08-24)
13
+ [Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.7.0...1.8.0)
14
+
15
+ **Implemented enhancements:**
16
+
17
+ - Generate change log since/due specific tag [\#254](https://github.com/skywinder/github-changelog-generator/issues/254)
18
+
19
+ **Merged pull requests:**
20
+
21
+ - Add `--due-tag` option [\#265](https://github.com/skywinder/github-changelog-generator/pull/265) ([skywinder](https://github.com/skywinder))
22
+ - Add release\_url to rake task options [\#264](https://github.com/skywinder/github-changelog-generator/pull/264) ([raphink](https://github.com/raphink))
23
+ - Add a rake task [\#260](https://github.com/skywinder/github-changelog-generator/pull/260) ([raphink](https://github.com/raphink))
24
+ - Add release\_url option [\#259](https://github.com/skywinder/github-changelog-generator/pull/259) ([raphink](https://github.com/raphink))
25
+ - Add --base option [\#258](https://github.com/skywinder/github-changelog-generator/pull/258) ([raphink](https://github.com/raphink))
26
+ - Add --since-tag [\#257](https://github.com/skywinder/github-changelog-generator/pull/257) ([raphink](https://github.com/raphink))
27
+
3
28
  ## [1.7.0](https://github.com/skywinder/github-changelog-generator/tree/1.7.0) (2015-07-16)
4
29
  [Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.6.2...1.7.0)
5
30
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- github_changelog_generator (1.7.0)
4
+ github_changelog_generator (1.8.0)
5
5
  colorize (~> 0.7)
6
6
  github_api (~> 0.12)
7
7
 
@@ -29,13 +29,13 @@ GEM
29
29
  unf (>= 0.0.5, < 1.0.0)
30
30
  faraday (0.9.1)
31
31
  multipart-post (>= 1.2, < 3)
32
- github_api (0.12.3)
32
+ github_api (0.12.4)
33
33
  addressable (~> 2.3)
34
34
  descendants_tracker (~> 0.0.4)
35
35
  faraday (~> 0.8, < 0.10)
36
- hashie (>= 3.3)
36
+ hashie (>= 3.4)
37
37
  multi_json (>= 1.7.5, < 2.0)
38
- nokogiri (~> 1.6.3)
38
+ nokogiri (~> 1.6.6)
39
39
  oauth2
40
40
  hashie (3.4.2)
41
41
  http-cookie (1.0.2)
@@ -112,3 +112,6 @@ DEPENDENCIES
112
112
  rspec (~> 3.2)
113
113
  rubocop (~> 0.31)
114
114
  simplecov (~> 0.10)
115
+
116
+ BUNDLED WITH
117
+ 1.10.6
data/README.md CHANGED
@@ -211,6 +211,8 @@ If you're seeing this warning:
211
211
  6. Create a new Pull Request
212
212
  7. Profit! :white_check_mark:
213
213
 
214
+ *To test change log workflow you can use [test repo](https://github.com/skywinder/changelog_test/)*
215
+
214
216
  ## License
215
217
 
216
218
  Github Changelog Generator is released under the [MIT License](http://www.opensource.org/licenses/MIT).
@@ -7,6 +7,7 @@
7
7
  **Implemented enhancements:**
8
8
 
9
9
  - Enchancment [\#9](https://github.com/skywinder/changelog_test/issues/9)
10
+ - PR with enhancement label [\#16](https://github.com/skywinder/changelog_test/pull/16) ([skywinder](https://github.com/skywinder))
10
11
 
11
12
  **Fixed bugs:**
12
13
 
@@ -21,6 +22,7 @@
21
22
 
22
23
  **Merged pull requests:**
23
24
 
25
+ - This a PR with a lot of comments and events [\#17](https://github.com/skywinder/changelog_test/pull/17) ([skywinder](https://github.com/skywinder))
24
26
  - This PR closes 14 from commit [\#15](https://github.com/skywinder/changelog_test/pull/15) ([skywinder](https://github.com/skywinder))
25
27
  - This PR to close \#12 from body [\#13](https://github.com/skywinder/changelog_test/pull/13) ([skywinder](https://github.com/skywinder))
26
28
 
@@ -163,10 +163,13 @@ Make sure, that you push tags to remote repo via 'git push --tags'".yellow
163
163
  issues_slice.each do |issue|
164
164
  threads << Thread.new do
165
165
  begin
166
- obj = @github.issues.events.list user: @options[:user],
167
- repo: @options[:project],
168
- issue_number: issue["number"]
169
- issue[:events] = obj.body
166
+ response = @github.issues.events.list user: @options[:user],
167
+ repo: @options[:project],
168
+ issue_number: issue["number"]
169
+ issue[:events] = []
170
+ response.each_page do |page|
171
+ issue[:events].concat(page)
172
+ end
170
173
  rescue
171
174
  Helper.log.warn GH_RATE_LIMIT_EXCEEDED_MSG.yellow
172
175
  end
@@ -66,7 +66,7 @@ module GitHubChangelogGenerator
66
66
 
67
67
  if @options[:issues]
68
68
  # Generate issues:
69
- log += issues_to_log(issues)
69
+ log += issues_to_log(issues, pull_requests)
70
70
  end
71
71
 
72
72
  if @options[:pulls]
@@ -77,13 +77,14 @@ module GitHubChangelogGenerator
77
77
  log
78
78
  end
79
79
 
80
- # Generate ready-to-paste log from list of issues.
80
+ # Generate ready-to-paste log from list of issues and pull requests.
81
81
  #
82
82
  # @param [Array] issues
83
+ # @param [Array] pull_requests
83
84
  # @return [String] generated log for issues
84
- def issues_to_log(issues)
85
+ def issues_to_log(issues, pull_requests)
85
86
  log = ""
86
- bugs_a, enhancement_a, issues_a = parse_by_sections(issues)
87
+ bugs_a, enhancement_a, issues_a = parse_by_sections(issues, pull_requests)
87
88
 
88
89
  log += generate_sub_section(enhancement_a, @options[:enhancement_prefix])
89
90
  log += generate_sub_section(bugs_a, @options[:bug_prefix])
@@ -95,8 +96,9 @@ module GitHubChangelogGenerator
95
96
  # (bugs, features, or just closed issues) by labels
96
97
  #
97
98
  # @param [Array] issues
99
+ # @param [Array] pull_requests
98
100
  # @return [Array] tuple of filtered arrays: (Bugs, Enhancements Issues)
99
- def parse_by_sections(issues)
101
+ def parse_by_sections(issues, pull_requests)
100
102
  issues_a = []
101
103
  enhancement_a = []
102
104
  bugs_a = []
@@ -117,6 +119,24 @@ module GitHubChangelogGenerator
117
119
  end
118
120
  issues_a.push dict unless added
119
121
  end
122
+
123
+ pull_requests.each do |dict|
124
+ added = false
125
+ dict.labels.each do |label|
126
+ if @options[:bug_labels].include? label.name
127
+ bugs_a.push dict
128
+ added = true
129
+ next
130
+ end
131
+ if @options[:enhancement_labels].include? label.name
132
+ enhancement_a.push dict
133
+ added = true
134
+ next
135
+ end
136
+ end
137
+ pull_requests.delete(dict) if added
138
+ end
139
+
120
140
  [bugs_a, enhancement_a, issues_a]
121
141
  end
122
142
  end
@@ -48,11 +48,11 @@ module GitHubChangelogGenerator
48
48
  # Fill :actual_date parameter of specified issue by closed date of the commit, if it was closed by commit.
49
49
  # @param [Hash] issue
50
50
  def find_closed_date_by_commit(issue)
51
- unless issue["events"].nil?
51
+ unless issue[:events].nil?
52
52
  # if it's PR -> then find "merged event", in case of usual issue -> fond closed date
53
53
  compare_string = issue[:merged_at].nil? ? "closed" : "merged"
54
54
  # reverse! - to find latest closed event. (event goes in date order)
55
- issue["events"].reverse!.each do |event|
55
+ issue[:events].reverse!.each do |event|
56
56
  if event[:event].eql? compare_string
57
57
  set_date_from_event(event, issue)
58
58
  break
@@ -51,9 +51,8 @@ module GitHubChangelogGenerator
51
51
  def generate_sub_section(issues, prefix)
52
52
  log = ""
53
53
 
54
- log += "#{prefix}\n\n" if options[:simple_list] != true && issues.any?
55
-
56
54
  if issues.any?
55
+ log += "#{prefix}\n\n" unless options[:simple_list]
57
56
  issues.each do |issue|
58
57
  merge_string = get_string_for_issue(issue)
59
58
  log += "- #{merge_string}\n"
@@ -103,7 +102,7 @@ module GitHubChangelogGenerator
103
102
  def generate_log_between_tags(older_tag, newer_tag)
104
103
  filtered_issues, filtered_pull_requests = filter_issues_for_tags(newer_tag, older_tag)
105
104
 
106
- older_tag_name = older_tag.nil? ? nil : older_tag["name"]
105
+ older_tag_name = older_tag.nil? ? detect_since_tag : older_tag["name"]
107
106
 
108
107
  if newer_tag.nil? && filtered_issues.empty? && filtered_pull_requests.empty?
109
108
  # do not generate empty unreleased section
@@ -63,21 +63,21 @@ module GitHubChangelogGenerator
63
63
  end
64
64
 
65
65
  # Method filter issues, that belong only specified tag range
66
- # @param [Array] array of issues to filter
66
+ # @param [Array] issues issues to filter
67
67
  # @param [Symbol] hash_key key of date value default is :actual_date
68
68
  # @param [String] older_tag all issues before this tag date will be excluded. May be nil, if it's first tag
69
69
  # @param [String] newer_tag all issue after this tag will be excluded. May be nil for unreleased section
70
70
  # @return [Array] filtered issues
71
- def delete_by_time(array, hash_key = :actual_date, older_tag = nil, newer_tag = nil)
71
+ def delete_by_time(issues, hash_key = :actual_date, older_tag = nil, newer_tag = nil)
72
72
  # in case if not tags specified - return unchanged array
73
- return array if older_tag.nil? && newer_tag.nil?
73
+ return issues if older_tag.nil? && newer_tag.nil?
74
74
 
75
75
  newer_tag_time = newer_tag && get_time_of_tag(newer_tag)
76
76
  older_tag_time = older_tag && get_time_of_tag(older_tag)
77
77
 
78
- array.select do |req|
79
- if req[hash_key]
80
- time = Time.parse(req[hash_key]).utc
78
+ issues.select do |issue|
79
+ if issue[hash_key]
80
+ time = Time.parse(issue[hash_key]).utc
81
81
 
82
82
  tag_in_range_old = tag_newer_old_tag?(older_tag_time, time)
83
83
 
@@ -54,11 +54,13 @@ module GitHubChangelogGenerator
54
54
 
55
55
  # @return [Object] try to find newest tag using #Reader and :base option if specified otherwise returns nil
56
56
  def detect_since_tag
57
- if @options[:base] && File.file?(@options[:base])
57
+ @since_tag ||= @options[:since_tag]
58
+ if @since_tag.nil? && @options[:base] && File.file?(@options[:base])
58
59
  reader = GitHubChangelogGenerator::Reader.new
59
60
  content = reader.read(@options[:base])
60
- return content[0]["version"] if content
61
+ @since_tag = content[0]["version"] if content
61
62
  end
63
+ @since_tag
62
64
  end
63
65
 
64
66
  # Return tags after filtering tags in lists provided by option: --between-tags & --exclude-tags
@@ -74,8 +76,7 @@ module GitHubChangelogGenerator
74
76
  # @return [Array] filtered tags according :since_tag option
75
77
  def filter_since_tag(all_tags)
76
78
  filtered_tags = all_tags
77
- tag = @options[:since_tag]
78
- tag ||= detect_since_tag
79
+ tag = detect_since_tag
79
80
  if tag
80
81
  if all_tags.map(&:name).include? tag
81
82
  idx = all_tags.index { |t| t.name == tag }
@@ -1,3 +1,3 @@
1
1
  module GitHubChangelogGenerator
2
- VERSION = "1.8.0"
2
+ VERSION = "1.8.1"
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.8.0
4
+ version: 1.8.1
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-08-24 00:00:00.000000000 Z
11
+ date: 2015-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github_api