github_changelog_generator 1.8.0 → 1.9.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 14e8beb89ae2f1803f59aa8dc82b7ec4bab97861
4
- data.tar.gz: 6002f6306a1532fc8ff36403923f34a6698e89fa
3
+ metadata.gz: 948686ef4f1a5836227cc06e225a9a396b58b665
4
+ data.tar.gz: d0c2c3d99e20dd16c2f649ceb82f321c67364bff
5
5
  SHA512:
6
- metadata.gz: 8ab2b56f72ca7a624bd626f2ffed3624139d44f36dea500172bc0b155037ee0327bd2bc0a6d597c0038608c7bcfd0bd03d0a64d53bb194eb73e9d1f9d64d4ba2
7
- data.tar.gz: 3fd4f8006c2af2f89ee23838ecf81b618ef6107847340cef98fead5e0be4434944ea479a9aca503125a03bf3894aa7aa7043b9e8402e9888261ef3ad3f55fc0f
6
+ metadata.gz: d74933a7c4ca8db21f9de2549954397cad5ab316a0150b34fd1f84297acdfd1ac987ba6bf741494eaec5061780a256a041e9c20568d448794e3232cc9e0dd474
7
+ data.tar.gz: 3fe8ffd4448569664696ed546dfcccb09ce45a61690f346849c3196aae4877a20677bf61551e7d56d856b7143777aaa4a2cebb1546b29809646364659b377288
data/.travis.yml CHANGED
@@ -1,6 +1,5 @@
1
- sudo: false
2
- cache: bundler
3
1
  language: ruby
2
+ before_install: gem update --system
4
3
  rvm:
5
4
  - 2.1.0
6
5
  script:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,65 @@
1
1
  # Change Log
2
2
 
3
+ ## [1.8.5](https://github.com/skywinder/github-changelog-generator/tree/1.8.5) (2015-09-15)
4
+ [Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.8.4...1.8.5)
5
+
6
+ **Merged pull requests:**
7
+
8
+ - Rake task: Be able to set false value in config [\#279](https://github.com/skywinder/github-changelog-generator/pull/279) ([olleolleolle](https://github.com/olleolleolle))
9
+
10
+ ## [1.8.4](https://github.com/skywinder/github-changelog-generator/tree/1.8.4) (2015-09-01)
11
+ [Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.8.3...1.8.4)
12
+
13
+ **Fixed bugs:**
14
+
15
+ - Sending OATH through -t fails [\#274](https://github.com/skywinder/github-changelog-generator/issues/274)
16
+
17
+ ## [1.8.3](https://github.com/skywinder/github-changelog-generator/tree/1.8.3) (2015-08-31)
18
+ [Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.8.2...1.8.3)
19
+
20
+ **Merged pull requests:**
21
+
22
+ - Do not alter pull\_requests while iterating on it [\#271](https://github.com/skywinder/github-changelog-generator/pull/271) ([raphink](https://github.com/raphink))
23
+
24
+ ## [1.8.2](https://github.com/skywinder/github-changelog-generator/tree/1.8.2) (2015-08-26)
25
+ [Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.8.1...1.8.2)
26
+
27
+ **Closed issues:**
28
+
29
+ - Output should not include security information [\#270](https://github.com/skywinder/github-changelog-generator/issues/270)
30
+
31
+ **Merged pull requests:**
32
+
33
+ - This PRi will fix \#274. [\#275](https://github.com/skywinder/github-changelog-generator/pull/275) ([skywinder](https://github.com/skywinder))
34
+
35
+ ## [1.8.1](https://github.com/skywinder/github-changelog-generator/tree/1.8.1) (2015-08-25)
36
+ [Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.8.0...1.8.1)
37
+
38
+ **Implemented enhancements:**
39
+
40
+ - Honor labels for Pull Requests [\#266](https://github.com/skywinder/github-changelog-generator/pull/266) ([raphink](https://github.com/raphink))
41
+
42
+ **Merged pull requests:**
43
+
44
+ - 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))
45
+ - Use since\_tag as default for older\_tag [\#267](https://github.com/skywinder/github-changelog-generator/pull/267) ([raphink](https://github.com/raphink))
46
+
47
+ ## [1.8.0](https://github.com/skywinder/github-changelog-generator/tree/1.8.0) (2015-08-24)
48
+ [Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.7.0...1.8.0)
49
+
50
+ **Implemented enhancements:**
51
+
52
+ - Generate change log since/due specific tag [\#254](https://github.com/skywinder/github-changelog-generator/issues/254)
53
+ - Add --base option [\#258](https://github.com/skywinder/github-changelog-generator/pull/258) ([raphink](https://github.com/raphink))
54
+
55
+ **Merged pull requests:**
56
+
57
+ - Add `--due-tag` option [\#265](https://github.com/skywinder/github-changelog-generator/pull/265) ([skywinder](https://github.com/skywinder))
58
+ - Add release\_url to rake task options [\#264](https://github.com/skywinder/github-changelog-generator/pull/264) ([raphink](https://github.com/raphink))
59
+ - Add a rake task [\#260](https://github.com/skywinder/github-changelog-generator/pull/260) ([raphink](https://github.com/raphink))
60
+ - Add release\_url option [\#259](https://github.com/skywinder/github-changelog-generator/pull/259) ([raphink](https://github.com/raphink))
61
+ - Add --since-tag [\#257](https://github.com/skywinder/github-changelog-generator/pull/257) ([raphink](https://github.com/raphink))
62
+
3
63
  ## [1.7.0](https://github.com/skywinder/github-changelog-generator/tree/1.7.0) (2015-07-16)
4
64
  [Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.6.2...1.7.0)
5
65
 
@@ -79,6 +139,7 @@
79
139
 
80
140
  - Parsing of existing Change Log file [\#212](https://github.com/skywinder/github-changelog-generator/issues/212)
81
141
  - Warn users about 0 tags in repo. [\#208](https://github.com/skywinder/github-changelog-generator/issues/208)
142
+ - Cleanup [\#220](https://github.com/skywinder/github-changelog-generator/pull/220) ([tuexss](https://github.com/tuexss))
82
143
 
83
144
  **Closed issues:**
84
145
 
@@ -88,7 +149,6 @@
88
149
 
89
150
  - Implement fetcher class [\#227](https://github.com/skywinder/github-changelog-generator/pull/227) ([skywinder](https://github.com/skywinder))
90
151
  - Add coveralls integration [\#223](https://github.com/skywinder/github-changelog-generator/pull/223) ([skywinder](https://github.com/skywinder))
91
- - Cleanup [\#220](https://github.com/skywinder/github-changelog-generator/pull/220) ([tuexss](https://github.com/tuexss))
92
152
  - Rspec & rubocop integration [\#217](https://github.com/skywinder/github-changelog-generator/pull/217) ([skywinder](https://github.com/skywinder))
93
153
  - Implement Reader class to parse ChangeLog.md [\#216](https://github.com/skywinder/github-changelog-generator/pull/216) ([estahn](https://github.com/estahn))
94
154
  - Relatively require github\_changelog\_generator library [\#207](https://github.com/skywinder/github-changelog-generator/pull/207) ([sneal](https://github.com/sneal))
@@ -104,7 +164,7 @@
104
164
  ## [1.3.10](https://github.com/skywinder/github-changelog-generator/tree/1.3.10) (2015-03-18)
105
165
  [Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.3.9...1.3.10)
106
166
 
107
- **Merged pull requests:**
167
+ **Fixed bugs:**
108
168
 
109
169
  - Fix termination in case of empty unreleased section with `--unreleased-only` option. [\#70](https://github.com/skywinder/github-changelog-generator/pull/70) ([skywinder](https://github.com/skywinder))
110
170
 
@@ -115,7 +175,7 @@
115
175
 
116
176
  - Improve method of detecting owner and repository [\#63](https://github.com/skywinder/github-changelog-generator/issues/63)
117
177
 
118
- **Merged pull requests:**
178
+ **Fixed bugs:**
119
179
 
120
180
  - Resolved concurrency problem in case of issues \> 2048 [\#65](https://github.com/skywinder/github-changelog-generator/pull/65) ([skywinder](https://github.com/skywinder))
121
181
 
@@ -189,7 +249,7 @@
189
249
  ## [1.2.7](https://github.com/skywinder/github-changelog-generator/tree/1.2.7) (2015-01-26)
190
250
  [Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.2.6...1.2.7)
191
251
 
192
- **Merged pull requests:**
252
+ **Implemented enhancements:**
193
253
 
194
254
  - Add compare link between older version and newer version [\#46](https://github.com/skywinder/github-changelog-generator/pull/46) ([sue445](https://github.com/sue445))
195
255
 
@@ -206,15 +266,12 @@
206
266
  **Implemented enhancements:**
207
267
 
208
268
  - Use milestone to specify in which version bug was fixed [\#22](https://github.com/skywinder/github-changelog-generator/issues/22)
269
+ - support enterprise github via command line options [\#42](https://github.com/skywinder/github-changelog-generator/pull/42) ([glenlovett](https://github.com/glenlovett))
209
270
 
210
271
  **Fixed bugs:**
211
272
 
212
273
  - Error when trying to generate log for repo without tags [\#32](https://github.com/skywinder/github-changelog-generator/issues/32)
213
-
214
- **Merged pull requests:**
215
-
216
274
  - PrettyPrint class is included using lowercase 'pp' [\#43](https://github.com/skywinder/github-changelog-generator/pull/43) ([schwing](https://github.com/schwing))
217
- - support enterprise github via command line options [\#42](https://github.com/skywinder/github-changelog-generator/pull/42) ([glenlovett](https://github.com/glenlovett))
218
275
 
219
276
  ## [1.2.4](https://github.com/skywinder/github-changelog-generator/tree/1.2.4) (2014-12-16)
220
277
  [Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.2.3...1.2.4)
@@ -323,6 +380,7 @@
323
380
 
324
381
  - Add support for fixed issues and implemented enchanments. [\#6](https://github.com/skywinder/github-changelog-generator/issues/6)
325
382
  - Implement option to specify output filename [\#4](https://github.com/skywinder/github-changelog-generator/issues/4)
383
+ - Implement support of different tags. [\#8](https://github.com/skywinder/github-changelog-generator/pull/8) ([skywinder](https://github.com/skywinder))
326
384
 
327
385
  **Fixed bugs:**
328
386
 
@@ -330,7 +388,6 @@
330
388
 
331
389
  **Merged pull requests:**
332
390
 
333
- - Implement support of different tags. [\#8](https://github.com/skywinder/github-changelog-generator/pull/8) ([skywinder](https://github.com/skywinder))
334
391
  - Add support for issues in CHANGELOG [\#7](https://github.com/skywinder/github-changelog-generator/pull/7) ([skywinder](https://github.com/skywinder))
335
392
 
336
393
  ## [0.1.0](https://github.com/skywinder/github-changelog-generator/tree/0.1.0) (2014-11-07)
data/Gemfile.lock CHANGED
@@ -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.5)
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
@@ -1,5 +1,5 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/github_changelog_generator.svg)](http://badge.fury.io/rb/github_changelog_generator)
2
- [![Dependency Status](https://gemnasium.com/skywinder/github-changelog-generator.svg)](https://gemnasium.com/skywinder/github-changelog-generator)
2
+ [![Dependency Status](https://gemnasium.com/skywinder/github-changelog-generator.svg)](https://gemnasium.com/skywinder/github-changelog-generator)
3
3
  [![Build Status](https://travis-ci.org/skywinder/github-changelog-generator.svg?branch=master)](https://travis-ci.org/skywinder/github-changelog-generator)
4
4
  [![Inline docs](http://inch-ci.org/github/skywinder/github-changelog-generator.svg)](http://inch-ci.org/github/skywinder/github-changelog-generator)
5
5
  [![Code Climate](https://codeclimate.com/github/skywinder/github-changelog-generator/badges/gpa.svg)](https://codeclimate.com/github/skywinder/github-changelog-generator)
@@ -20,7 +20,7 @@ GitHub Changelog Generator ![GitHub Logo](../master/images/logo.jpg)
20
20
  - [Contributing](#contributing)
21
21
  - [License](#license)
22
22
 
23
-
23
+
24
24
  ### Changelog generation has never been so easy:
25
25
 
26
26
  **Fully automate changelog generation** - This gem generates change log file based on **tags**, **issues** and merged **pull requests** (and splits them into separate lists according labels) from :octocat: GitHub Issue Tracker.
@@ -48,26 +48,26 @@ Because software tools are for people. If you don’t care, why are you contribu
48
48
  - In general it looks like this:
49
49
 
50
50
  > ## [1.2.5](https://github.com/skywinder/Github-Changelog-Generator/tree/1.2.5) (2015-01-15)
51
- >
51
+ >
52
52
  > [Full Changelog](https://github.com/skywinder/Github-Changelog-Generator/compare/1.2.4...1.2.5)
53
- >
53
+ >
54
54
  > **Implemented enhancements:**
55
- >
55
+ >
56
56
  > - Use milestone to specify in which version bug was fixed [\#22](https://github.com/skywinder/Github-Changelog-Generator/issues/22)
57
- >
57
+ >
58
58
  > **Fixed bugs:**
59
- >
59
+ >
60
60
  > - Error when trying to generate log for repo without tags [\#32](https://github.com/skywinder/Github-Changelog-Generator/issues/32)
61
- >
61
+ >
62
62
  > **Merged pull requests:**
63
- >
63
+ >
64
64
  > - PrettyPrint class is included using lowercase 'pp' [\#43](https://github.com/skywinder/Github-Changelog-Generator/pull/43) ([schwing](https://github.com/schwing))
65
- >
65
+ >
66
66
  > - support enterprise github via command line options [\#42](https://github.com/skywinder/Github-Changelog-Generator/pull/42) ([glenlovett](https://github.com/glenlovett))
67
67
 
68
68
 
69
69
  ## Usage
70
- **It's really simple**:
70
+ **It's really simple**:
71
71
 
72
72
  - If your **git remote** `origin` refers to your GitHub repo, then just go to your project folder and run:
73
73
 
@@ -76,7 +76,7 @@ Because software tools are for people. If you don’t care, why are you contribu
76
76
  - or from anywhere:
77
77
  - `github_changelog_generator -u github_username -p github_project`
78
78
  - `github_changelog_generator github_username/github_project`
79
-
79
+
80
80
  As output you will get `CHANGELOG.md` file with pretty *Markdown-formatted* changelog.
81
81
 
82
82
  ### Params
@@ -84,6 +84,16 @@ Type `github_changelog_generator --help` for details.
84
84
 
85
85
  More detailed info about params you can find in Wiki page: [**Advanced change log generation examples**](https://github.com/skywinder/github-changelog-generator/wiki/Advanced-change-log-generation-examples)
86
86
 
87
+ ### Params File
88
+ You can put Params in a .github_changelog_generator file in Project Root to override default params:
89
+
90
+ Example:
91
+ ```
92
+ unreleased=false
93
+ future-release=5.0.0
94
+ since-tag=1.0.0
95
+ ```
96
+
87
97
  ### GitHub token
88
98
 
89
99
  Since GitHub allows you to make only 50 requests without authentication it's recommended to run this script with a token (`-t, --token` option)
@@ -92,9 +102,9 @@ Since GitHub allows you to make only 50 requests without authentication it's rec
92
102
 
93
103
  And:
94
104
 
95
- - Run with key `-t [your-40-digit-token]`
96
- - Or set environment variable `CHANGELOG_GITHUB_TOKEN` and specify there your token.
97
-
105
+ - Run with key `-t [your-40-digit-token]`
106
+ - Or set environment variable `CHANGELOG_GITHUB_TOKEN` and specify there your token.
107
+
98
108
  i.e. add to your `~/.bash_profile` or `~/.zshrc` or any other place to load ENV variables string :
99
109
 
100
110
  export CHANGELOG_GITHUB_TOKEN="your-40-digit-github-token"
@@ -139,10 +149,10 @@ All command line options can be passed to the Rake task as `config` parameters.
139
149
  - Merged pull requests (all `merged` pull-requests) :twisted_rightwards_arrows:
140
150
  - Bug fixes (by label `bug` in issue) :beetle:
141
151
  - Enhancements (by label `enhancement` in issue) :star2:
142
- - Issues (closed issues `w/o any labels`) :non-potable_water:
152
+ - Issues (closed issues `w/o any labels`) :non-potable_water:
143
153
 
144
154
  - You can manually set which labels should be included/excluded. :wrench:
145
- - Apply a lot of other customisations, to fit changelog for your personal style :tophat:
155
+ - Apply a lot of other customisations, to fit changelog for your personal style :tophat:
146
156
  (*look `github_changelog_generator --help` for details)*
147
157
 
148
158
 
@@ -153,7 +163,7 @@ Here is a [wikipage list of alternatives](https://github.com/skywinder/Github-Ch
153
163
 
154
164
 
155
165
  ### Projects using this library
156
- [Wikipage with list of projects](https://github.com/skywinder/Github-Changelog-Generator/wiki/Projects-using-Github-Changelog-Generator)
166
+ [Wikipage with list of projects](https://github.com/skywinder/Github-Changelog-Generator/wiki/Projects-using-Github-Changelog-Generator)
157
167
 
158
168
  If you've used this project in a live app, please let me know! Nothing makes me happier than seeing someone else take my work and go wild with it.
159
169
 
@@ -161,9 +171,9 @@ If you've used this project in a live app, please let me know! Nothing makes me
161
171
 
162
172
  ## Am I missing some essential feature?
163
173
 
164
- - **Nothing is impossible!**
174
+ - **Nothing is impossible!**
165
175
 
166
- - Open an [issue](https://github.com/skywinder/Github-Changelog-Generator/issues/new) and let's make generator better together!
176
+ - Open an [issue](https://github.com/skywinder/Github-Changelog-Generator/issues/new) and let's make generator better together!
167
177
 
168
178
  - *Bug reports, feature requests, patches, well-wishes are always welcome* :heavy_exclamation_mark:
169
179
 
@@ -211,6 +221,8 @@ If you're seeing this warning:
211
221
  6. Create a new Pull Request
212
222
  7. Profit! :white_check_mark:
213
223
 
224
+ *To test change log workflow you can use [test repo](https://github.com/skywinder/changelog_test/)*
225
+
214
226
  ## License
215
227
 
216
228
  Github Changelog Generator is released under the [MIT License](http://www.opensource.org/licenses/MIT).
data/lib/CHANGELOG.md CHANGED
@@ -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
+ added_pull_requests = []
124
+ pull_requests.each do |dict|
125
+ dict.labels.each do |label|
126
+ if @options[:bug_labels].include? label.name
127
+ bugs_a.push dict
128
+ added_pull_requests.push dict
129
+ next
130
+ end
131
+ if @options[:enhancement_labels].include? label.name
132
+ enhancement_a.push dict
133
+ added_pull_requests.push dict
134
+ next
135
+ end
136
+ end
137
+ end
138
+ added_pull_requests.each { |p| pull_requests.delete(p) }
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 }
@@ -130,16 +131,45 @@ module GitHubChangelogGenerator
130
131
  # @param [Array] all_tags all tags
131
132
  # @return [Array] filtered tags according :exclude_tags option
132
133
  def filter_excluded_tags(all_tags)
133
- filtered_tags = all_tags
134
- if @options[:exclude_tags]
135
- @options[:exclude_tags].each do |tag|
136
- unless all_tags.map(&:name).include? tag
137
- Helper.log.warn "Warning: can't find tag #{tag}, specified with --exclude-tags option."
138
- end
139
- end
140
- filtered_tags = all_tags.reject { |tag| @options[:exclude_tags].include? tag.name }
134
+ return all_tags unless @options[:exclude_tags]
135
+
136
+ apply_exclude_tags(all_tags)
137
+ end
138
+
139
+ private
140
+
141
+ def apply_exclude_tags(all_tags)
142
+ if @options[:exclude_tags].is_a?(Regexp)
143
+ filter_tags_with_regex(all_tags)
144
+ else
145
+ filter_exact_tags(all_tags)
146
+ end
147
+ end
148
+
149
+ def filter_tags_with_regex(all_tags)
150
+ warn_if_nonmatching_regex(all_tags)
151
+ all_tags.reject { |tag| @options[:exclude_tags] =~ tag.name }
152
+ end
153
+
154
+ def filter_exact_tags(all_tags)
155
+ @options[:exclude_tags].each do |tag|
156
+ warn_if_tag_not_found(all_tags, tag)
157
+ end
158
+ all_tags.reject { |tag| @options[:exclude_tags].include? tag.name }
159
+ end
160
+
161
+ def warn_if_nonmatching_regex(all_tags)
162
+ unless all_tags.map(&:name).any? { |t| @options[:exclude_tags] =~ t }
163
+ Helper.log.warn "Warning: unable to reject any tag, using regex "\
164
+ "#{@options[:exclude_tags].inspect} in --exclude-tags "\
165
+ "option."
166
+ end
167
+ end
168
+
169
+ def warn_if_tag_not_found(all_tags, tag)
170
+ unless all_tags.map(&:name).include? tag
171
+ Helper.log.warn "Warning: can't find tag #{tag}, specified with --exclude-tags option."
141
172
  end
142
- filtered_tags
143
173
  end
144
174
  end
145
175
  end
@@ -9,8 +9,10 @@ module GitHubChangelogGenerator
9
9
  def self.parse_options
10
10
  options = get_default_options
11
11
 
12
- parser = setup_parser(options)
12
+ parser_file = ParserFile.new options
13
+ parser_file.parse!
13
14
 
15
+ parser = setup_parser(options)
14
16
  parser.parse!
15
17
 
16
18
  if options[:user].nil? || options[:project].nil?
@@ -22,13 +24,20 @@ module GitHubChangelogGenerator
22
24
  exit
23
25
  end
24
26
 
27
+ print_options(options)
28
+
29
+ options
30
+ end
31
+
32
+ # @param [Hash] options to display
33
+ def self.print_options(options)
25
34
  if options[:verbose]
26
35
  Helper.log.info "Performing task with options:"
27
- pp options
36
+ options_to_display = options.clone
37
+ options_to_display[:token] = options_to_display[:token].nil? ? nil : "hidden value"
38
+ pp options_to_display
28
39
  puts ""
29
40
  end
30
-
31
- options
32
41
  end
33
42
 
34
43
  # setup parsing options
@@ -0,0 +1,36 @@
1
+ module GitHubChangelogGenerator
2
+ class ParserFile
3
+ def initialize(options)
4
+ @options = options
5
+ end
6
+
7
+ def file
8
+ File.expand_path(@options[:params_file] || ".github_changelog_generator")
9
+ end
10
+
11
+ def file?
12
+ File.exist?(file)
13
+ end
14
+
15
+ def file_open
16
+ File.open(file)
17
+ end
18
+
19
+ def parse!
20
+ return unless file?
21
+ file_open.each do |line|
22
+ begin
23
+ key, value = line.split("=")
24
+ key_sym = key.sub("-", "_").to_sym
25
+ value = value.gsub(/[\n\r]+/, "")
26
+ value = true if value =~ (/^(true|t|yes|y|1)$/i)
27
+ value = false if value =~ (/^(false|f|no|n|0)$/i)
28
+ @options[key_sym] = value
29
+ rescue
30
+ raise "File #{file} is incorrect in line \"#{line.gsub(/[\n\r]+/, '')}\""
31
+ end
32
+ end
33
+ @options
34
+ end
35
+ end
36
+ end
@@ -51,7 +51,7 @@ module GitHubChangelogGenerator
51
51
 
52
52
  OPTIONS.each do |o|
53
53
  v = instance_variable_get("@#{o}")
54
- options[o.to_sym] = v if v
54
+ options[o.to_sym] = v unless v.nil?
55
55
  end
56
56
 
57
57
  generator = Generator.new options
@@ -1,3 +1,3 @@
1
1
  module GitHubChangelogGenerator
2
- VERSION = "1.8.0"
2
+ VERSION = "1.9.0"
3
3
  end
@@ -7,6 +7,7 @@ require "benchmark"
7
7
 
8
8
  require_relative "github_changelog_generator/helper"
9
9
  require_relative "github_changelog_generator/parser"
10
+ require_relative "github_changelog_generator/parser_file"
10
11
  require_relative "github_changelog_generator/generator/generator"
11
12
  require_relative "github_changelog_generator/version"
12
13
  require_relative "github_changelog_generator/reader"
File without changes
@@ -0,0 +1,2 @@
1
+ unreleased_label: staging
2
+ unreleased: false
@@ -0,0 +1,2 @@
1
+ unreleased_label=staging
2
+ unreleased=false
data/spec/spec_helper.rb CHANGED
@@ -31,91 +31,25 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
31
31
  SimpleCov.start
32
32
 
33
33
  require "github_changelog_generator"
34
+ require "github_changelog_generator/task"
34
35
 
35
- # This file was generated by the `rspec --init` command. Conventionally, all
36
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
37
- # The generated `.rspec` file contains `--require spec_helper` which will cause
38
- # this file to always be loaded, without a need to explicitly require it in any
39
- # files.
40
- #
41
- # Given that it is always loaded, you are encouraged to keep this file as
42
- # light-weight as possible. Requiring heavyweight dependencies from this file
43
- # will add to the boot time of your test suite on EVERY test run, even for an
44
- # individual file that may not need all of that loaded. Instead, consider making
45
- # a separate helper file that requires the additional dependencies and performs
46
- # the additional setup, and require it from the spec files that actually need
47
- # it.
48
- #
49
- # The `.rspec` file also contains a few flags that are not defaults but that
50
- # users commonly want.
51
- #
52
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
53
36
  RSpec.configure do |config|
54
- # rspec-expectations config goes here. You can use an alternate
55
- # assertion/expectation library such as wrong or the stdlib/minitest
56
- # assertions if you prefer.
57
37
  config.expect_with :rspec do |expectations|
58
- # This option will default to `true` in RSpec 4. It makes the `description`
59
- # and `failure_message` of custom matchers include text for helper methods
60
- # defined using `chain`, e.g.:
61
- # be_bigger_than(2).and_smaller_than(4).description
62
- # # => "be bigger than 2 and smaller than 4"
63
- # ...rather than:
64
- # # => "be bigger than 2"
65
38
  expectations.include_chain_clauses_in_custom_matcher_descriptions = true
66
39
  end
67
40
 
68
- # rspec-mocks config goes here. You can use an alternate test double
69
- # library (such as bogus or mocha) by changing the `mock_with` option here.
70
41
  config.mock_with :rspec do |mocks|
71
- # Prevents you from mocking or stubbing a method that does not exist on
72
- # a real object. This is generally recommended, and will default to
73
- # `true` in RSpec 4.
74
42
  mocks.verify_partial_doubles = true
75
43
  end
76
44
 
77
- # These two settings work together to allow you to limit a spec run
78
- # to individual examples or groups you care about by tagging them with
79
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
80
- # get run.
81
45
  config.filter_run :focus
82
46
  config.run_all_when_everything_filtered = true
83
47
 
84
- # Limits the available syntax to the non-monkey patched syntax that is
85
- # recommended. For more details, see:
86
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
87
- # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
88
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
89
- # config.disable_monkey_patching!
90
-
91
- # This setting enables warnings. It's recommended, but in some cases may
92
- # be too noisy due to issues in dependencies.
93
48
  config.warnings = true
94
49
 
95
- # Many RSpec users commonly either run the entire suite or an individual
96
- # file, and it's useful to allow more verbose output when running an
97
- # individual spec file.
98
- if config.files_to_run.one?
99
- # Use the documentation formatter for detailed output,
100
- # unless a formatter has already been configured
101
- # (e.g. via a command-line flag).
102
- config.default_formatter = "doc"
103
- end
104
-
105
- # Print the 10 slowest examples and example groups at the
106
- # end of the spec run, to help surface which specs are running
107
- # particularly slow.
108
- # config.profile_examples = 10
50
+ config.default_formatter = "doc" if config.files_to_run.one?
109
51
 
110
- # Run specs in random order to surface order dependencies. If you find an
111
- # order dependency and want to debug it, you can fix the order by providing
112
- # the seed, which is printed after each run.
113
- # --seed 1234
114
52
  config.order = :random
115
53
 
116
- # Seed global randomization in this process using the `--seed` CLI option.
117
- # Setting this allows you to use `--seed` to deterministically reproduce
118
- # test failures related to randomization by passing the same `--seed` value
119
- # as the one that triggered the failure.
120
54
  Kernel.srand config.seed
121
55
  end
@@ -87,6 +87,18 @@ describe GitHubChangelogGenerator::Generator do
87
87
  it { is_expected.to be_a Array }
88
88
  it { is_expected.to match_array(tags_mash_from_strings(%w(1 2 3))) }
89
89
  end
90
+
91
+ context "with regex exclude_tags" do
92
+ let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: /[23]/) }
93
+ it { is_expected.to be_a Array }
94
+ it { is_expected.to match_array(tags_mash_from_strings(%w(1))) }
95
+ end
96
+
97
+ context "with non-matching regex in exclude_tags" do
98
+ let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: /[abc]/) }
99
+ it { is_expected.to be_a Array }
100
+ it { is_expected.to match_array(tags_mash_from_strings(%w(1 2 3))) }
101
+ end
90
102
  end
91
103
 
92
104
  describe "#filter_since_tag" do
@@ -0,0 +1,32 @@
1
+ describe GitHubChangelogGenerator::ParserFile do
2
+ describe ".github_changelog_generator" do
3
+ context "when no has file" do
4
+ let(:options) { {} }
5
+ let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }
6
+ subject { parse.parse! }
7
+ it { is_expected.to be_nil }
8
+ end
9
+
10
+ context "when file is empty" do
11
+ let(:options) { { params_file: "spec/files/github_changelog_params_empty" } }
12
+ let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }
13
+ subject { parse.parse! }
14
+ it { is_expected.to be_a(Hash) }
15
+ it { is_expected.to eq(options) }
16
+ end
17
+
18
+ context "when file is incorrect" do
19
+ let(:options) { { params_file: "spec/files/github_changelog_params_incorrect" } }
20
+ let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }
21
+ it { expect { fail.raise! }.to raise_error RuntimeError }
22
+ end
23
+
24
+ context "when override default values" do
25
+ let(:options) { { params_file: "spec/files/github_changelog_params_override" }.merge(GitHubChangelogGenerator::Parser.get_default_options) }
26
+ let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }
27
+ subject { parse.parse! }
28
+ it { is_expected.to be_a(Hash) }
29
+ it { is_expected.to eq(options.merge(unreleased_label: "staging", unreleased: false)) }
30
+ end
31
+ end
32
+ 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.9.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-08-24 00:00:00.000000000 Z
11
+ date: 2015-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github_api
@@ -101,15 +101,20 @@ files:
101
101
  - lib/github_changelog_generator/generator/generator_tags.rb
102
102
  - lib/github_changelog_generator/helper.rb
103
103
  - lib/github_changelog_generator/parser.rb
104
+ - lib/github_changelog_generator/parser_file.rb
104
105
  - lib/github_changelog_generator/reader.rb
105
106
  - lib/github_changelog_generator/task.rb
106
107
  - lib/github_changelog_generator/version.rb
107
108
  - spec/files/angular.js.md
108
109
  - spec/files/bundler.md
109
110
  - spec/files/github-changelog-generator.md
111
+ - spec/files/github_changelog_params_empty
112
+ - spec/files/github_changelog_params_incorrect
113
+ - spec/files/github_changelog_params_override
110
114
  - spec/spec_helper.rb
111
115
  - spec/unit/fetcher_spec.rb
112
116
  - spec/unit/generator/generator_tags_spec.rb
117
+ - spec/unit/parse_file_spec.rb
113
118
  - spec/unit/parser_spec.rb
114
119
  - spec/unit/reader_spec.rb
115
120
  homepage: https://github.com/skywinder/Github-Changelog-Generator
@@ -132,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
137
  version: '0'
133
138
  requirements: []
134
139
  rubyforge_project:
135
- rubygems_version: 2.4.4
140
+ rubygems_version: 2.4.8
136
141
  signing_key:
137
142
  specification_version: 4
138
143
  summary: Script, that automatically generate changelog from your tags, issues, labels
@@ -141,9 +146,13 @@ test_files:
141
146
  - spec/files/angular.js.md
142
147
  - spec/files/bundler.md
143
148
  - spec/files/github-changelog-generator.md
149
+ - spec/files/github_changelog_params_empty
150
+ - spec/files/github_changelog_params_incorrect
151
+ - spec/files/github_changelog_params_override
144
152
  - spec/spec_helper.rb
145
153
  - spec/unit/fetcher_spec.rb
146
154
  - spec/unit/generator/generator_tags_spec.rb
155
+ - spec/unit/parse_file_spec.rb
147
156
  - spec/unit/parser_spec.rb
148
157
  - spec/unit/reader_spec.rb
149
158
  has_rdoc: