github_changelog_generator 1.3.11 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.hound.yml +2 -0
- data/.rspec +2 -0
- data/.rubocop.yml +8 -0
- data/.rubocop_todo.yml +81 -0
- data/.travis.yml +12 -10
- data/CHANGELOG.md +145 -113
- data/Gemfile +14 -4
- data/Gemfile.lock +75 -11
- data/README.md +17 -1
- data/Rakefile +5 -7
- data/bin/github_changelog_generator +2 -2
- data/bump_gemfile.rb +42 -48
- data/github_changelog_generator.gemspec +9 -10
- data/lib/CHANGELOG.md +2 -0
- data/lib/github_changelog_generator.rb +194 -346
- data/lib/github_changelog_generator/fetcher.rb +209 -0
- data/lib/github_changelog_generator/generator.rb +11 -8
- data/lib/github_changelog_generator/parser.rb +99 -86
- data/lib/github_changelog_generator/reader.rb +87 -0
- data/lib/github_changelog_generator/version.rb +1 -1
- data/spec/files/angular.js.md +9395 -0
- data/spec/files/bundler.md +1911 -0
- data/spec/files/github-changelog-generator.md +305 -0
- data/spec/spec_helper.rb +117 -0
- data/spec/unit/reader_spec.rb +113 -0
- metadata +22 -4
data/Gemfile
CHANGED
@@ -1,4 +1,14 @@
|
|
1
|
-
source
|
2
|
-
|
3
|
-
gem
|
4
|
-
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gem "rake"
|
4
|
+
|
5
|
+
gem "github_api"
|
6
|
+
gem "colorize"
|
7
|
+
|
8
|
+
group :test do
|
9
|
+
gem "rspec"
|
10
|
+
gem "rubocop"
|
11
|
+
gem "coveralls", require: false
|
12
|
+
gem "simplecov", require: false
|
13
|
+
gem "codeclimate-test-reporter"
|
14
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,28 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
addressable (2.3.
|
5
|
-
|
4
|
+
addressable (2.3.7)
|
5
|
+
ast (2.0.0)
|
6
|
+
astrolabe (1.3.0)
|
7
|
+
parser (>= 2.2.0.pre.3, < 3.0)
|
8
|
+
codeclimate-test-reporter (0.4.7)
|
9
|
+
simplecov (>= 0.7.1, < 1.0.0)
|
10
|
+
colorize (0.7.5)
|
11
|
+
coveralls (0.7.12)
|
12
|
+
multi_json (~> 1.10)
|
13
|
+
rest-client (>= 1.6.8, < 2)
|
14
|
+
simplecov (~> 0.9.1)
|
15
|
+
term-ansicolor (~> 1.3)
|
16
|
+
thor (~> 0.19.1)
|
6
17
|
descendants_tracker (0.0.4)
|
7
18
|
thread_safe (~> 0.3, >= 0.3.1)
|
8
|
-
|
19
|
+
diff-lcs (1.2.5)
|
20
|
+
docile (1.1.5)
|
21
|
+
domain_name (0.5.23)
|
22
|
+
unf (>= 0.0.5, < 1.0.0)
|
23
|
+
faraday (0.9.1)
|
9
24
|
multipart-post (>= 1.2, < 3)
|
10
|
-
github_api (0.12.
|
25
|
+
github_api (0.12.3)
|
11
26
|
addressable (~> 2.3)
|
12
27
|
descendants_tracker (~> 0.0.4)
|
13
28
|
faraday (~> 0.8, < 0.10)
|
@@ -15,13 +30,17 @@ GEM
|
|
15
30
|
multi_json (>= 1.7.5, < 2.0)
|
16
31
|
nokogiri (~> 1.6.3)
|
17
32
|
oauth2
|
18
|
-
hashie (3.
|
19
|
-
|
20
|
-
|
21
|
-
|
33
|
+
hashie (3.4.0)
|
34
|
+
http-cookie (1.0.2)
|
35
|
+
domain_name (~> 0.5)
|
36
|
+
jwt (1.4.1)
|
37
|
+
mime-types (2.4.3)
|
38
|
+
mini_portile (0.6.2)
|
39
|
+
multi_json (1.11.0)
|
22
40
|
multi_xml (0.5.5)
|
23
41
|
multipart-post (2.0.0)
|
24
|
-
|
42
|
+
netrc (0.10.3)
|
43
|
+
nokogiri (1.6.6.2)
|
25
44
|
mini_portile (~> 0.6.0)
|
26
45
|
oauth2 (1.0.0)
|
27
46
|
faraday (>= 0.8, < 0.10)
|
@@ -29,14 +48,59 @@ GEM
|
|
29
48
|
multi_json (~> 1.3)
|
30
49
|
multi_xml (~> 0.5)
|
31
50
|
rack (~> 1.2)
|
32
|
-
|
51
|
+
parser (2.2.0.3)
|
52
|
+
ast (>= 1.1, < 3.0)
|
53
|
+
powerpack (0.1.0)
|
54
|
+
rack (1.6.0)
|
55
|
+
rainbow (2.0.0)
|
33
56
|
rake (10.4.2)
|
34
|
-
|
57
|
+
rest-client (1.8.0)
|
58
|
+
http-cookie (>= 1.0.2, < 2.0)
|
59
|
+
mime-types (>= 1.16, < 3.0)
|
60
|
+
netrc (~> 0.7)
|
61
|
+
rspec (3.2.0)
|
62
|
+
rspec-core (~> 3.2.0)
|
63
|
+
rspec-expectations (~> 3.2.0)
|
64
|
+
rspec-mocks (~> 3.2.0)
|
65
|
+
rspec-core (3.2.2)
|
66
|
+
rspec-support (~> 3.2.0)
|
67
|
+
rspec-expectations (3.2.0)
|
68
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
69
|
+
rspec-support (~> 3.2.0)
|
70
|
+
rspec-mocks (3.2.1)
|
71
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
72
|
+
rspec-support (~> 3.2.0)
|
73
|
+
rspec-support (3.2.2)
|
74
|
+
rubocop (0.29.1)
|
75
|
+
astrolabe (~> 1.3)
|
76
|
+
parser (>= 2.2.0.1, < 3.0)
|
77
|
+
powerpack (~> 0.1)
|
78
|
+
rainbow (>= 1.99.1, < 3.0)
|
79
|
+
ruby-progressbar (~> 1.4)
|
80
|
+
ruby-progressbar (1.7.5)
|
81
|
+
simplecov (0.9.2)
|
82
|
+
docile (~> 1.1.0)
|
83
|
+
multi_json (~> 1.0)
|
84
|
+
simplecov-html (~> 0.9.0)
|
85
|
+
simplecov-html (0.9.0)
|
86
|
+
term-ansicolor (1.3.0)
|
87
|
+
tins (~> 1.0)
|
88
|
+
thor (0.19.1)
|
89
|
+
thread_safe (0.3.5)
|
90
|
+
tins (1.3.5)
|
91
|
+
unf (0.1.4)
|
92
|
+
unf_ext
|
93
|
+
unf_ext (0.0.6)
|
35
94
|
|
36
95
|
PLATFORMS
|
37
96
|
ruby
|
38
97
|
|
39
98
|
DEPENDENCIES
|
99
|
+
codeclimate-test-reporter
|
40
100
|
colorize
|
101
|
+
coveralls
|
41
102
|
github_api
|
42
103
|
rake
|
104
|
+
rspec
|
105
|
+
rubocop
|
106
|
+
simplecov
|
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
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
3
|
[![Build Status](https://travis-ci.org/skywinder/github-changelog-generator.svg?branch=master)](https://travis-ci.org/skywinder/github-changelog-generator)
|
4
|
+
[![Inline docs](http://inch-ci.org/github/skywinder/github-changelog-generator.svg)](http://inch-ci.org/github/skywinder/github-changelog-generator)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/skywinder/github-changelog-generator/badges/gpa.svg)](https://codeclimate.com/github/skywinder/github-changelog-generator)
|
6
|
+
[![Test Coverage](https://codeclimate.com/github/skywinder/github-changelog-generator/badges/coverage.svg)](https://codeclimate.com/github/skywinder/github-changelog-generator)
|
3
7
|
|
4
8
|
GitHub Changelog Generator ![GitHub Logo](../master/images/logo.jpg)
|
5
9
|
==================
|
@@ -96,6 +100,7 @@ Type `github_changelog_generator --help` for detailed usage.
|
|
96
100
|
--[no-]compare-link Include compare link between older version and newer version. Default is true
|
97
101
|
--include-labels x,y,z Issues only with that labels will be included to changelog. Default is 'bug,enhancement'
|
98
102
|
--exclude-labels x,y,z Issues with that labels will be always excluded from changelog. Default is 'duplicate,question,invalid,wontfix'
|
103
|
+
--max-issues [NUMBER] Max number of issues to fetch from GitHub. Default is unlimited.
|
99
104
|
--github-site [URL] The Enterprise Github site on which your project is hosted.
|
100
105
|
--github-api [URL] The enterprise endpoint to use for your Github API.
|
101
106
|
-v, --version Print version number
|
@@ -106,7 +111,7 @@ Type `github_changelog_generator --help` for detailed usage.
|
|
106
111
|
|
107
112
|
Since GitHub allows you to make only 50 requests without authentication it's recommended to run this script with a token (`-t, --token` option)
|
108
113
|
|
109
|
-
**You can easily [generate it here](https://github.com/settings/
|
114
|
+
**You can easily [generate it here](https://github.com/settings/tokens)**.
|
110
115
|
|
111
116
|
And:
|
112
117
|
|
@@ -151,6 +156,8 @@ Here is a [wikipage list of alternatives](https://github.com/skywinder/Github-Ch
|
|
151
156
|
### Projects using this library
|
152
157
|
[Wikipage with list of projects](https://github.com/skywinder/Github-Changelog-Generator/wiki/Projects-using-Github-Changelog-Generator)
|
153
158
|
|
159
|
+
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.
|
160
|
+
|
154
161
|
*If you are using `github_changelog_generator` for generation change log in your project or know another project that uses it, please add it to [this] (https://github.com/skywinder/Github-Changelog-Generator/wiki/Projects-using-Github-Changelog-Generator) list.*
|
155
162
|
|
156
163
|
## Am I missing some essential feature?
|
@@ -186,6 +193,15 @@ I think, that GitHub Releases is more for end-users.
|
|
186
193
|
But `CHANGELOG.md` could stay in the repo for developers with detailed list of changes.
|
187
194
|
And it's nothing bad to combine GitHub Releases and `CHANGELOG.md` file together in that manner.
|
188
195
|
|
196
|
+
- ***I received a warning: GitHub API rate limit exceed, what does this mean?***
|
197
|
+
|
198
|
+
GitHub [limits the number of API requests](https://developer.github.com/v3/#rate-limiting) you can make in an hour. You can make up to 5,000 requests per hour. For unauthenticated requests, the rate limit allows you to make up to 60 requests per hour. Unauthenticated requests are associated with your IP address, and not the user making requests.
|
199
|
+
|
200
|
+
If you're seeing this warning:
|
201
|
+
|
202
|
+
1. Make sure you're providing an OAuth token so you're not anonymously making requests. This will increase the number of requests from 60 to 5000 per hour.
|
203
|
+
2. You probably have a large repo with lots of issues/PRs. You can use the `--max-issues NUM` argument to limit the number of issues that are pulled back. For example: `--max-issues 1000`
|
204
|
+
|
189
205
|
## Contributing
|
190
206
|
|
191
207
|
1. Create an issue to discuss about your idea
|
data/Rakefile
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
require "
|
1
|
+
require "rubocop/rake_task"
|
2
|
+
require "rspec/core/rake_task"
|
2
3
|
|
3
|
-
|
4
|
+
RuboCop::RakeTask.new
|
5
|
+
RSpec::Core::RakeTask.new(:rspec)
|
4
6
|
|
5
|
-
|
6
|
-
t.verbose = true
|
7
|
-
t.libs.push("demo", "test")
|
8
|
-
t.pattern = "test/**/*_test.rb"
|
9
|
-
end
|
7
|
+
task default: [:rubocop, :rspec]
|
data/bump_gemfile.rb
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require
|
2
|
+
require "optparse"
|
3
3
|
|
4
|
-
SPEC_TYPE =
|
4
|
+
SPEC_TYPE = "gemspec"
|
5
5
|
|
6
6
|
:major
|
7
7
|
:minor
|
8
8
|
:patch
|
9
9
|
|
10
|
-
@options = {:
|
10
|
+
@options = { dry_run: false, bump_number: :patch }
|
11
11
|
|
12
12
|
OptionParser.new { |opts|
|
13
|
-
opts.banner =
|
13
|
+
opts.banner = "Usage: bump.rb [options]"
|
14
14
|
|
15
|
-
opts.on(
|
15
|
+
opts.on("-d", "--dry-run", "Dry run") do |v|
|
16
16
|
@options[:dry_run] = v
|
17
17
|
end
|
18
|
-
opts.on(
|
18
|
+
opts.on("-a", "--major", "Bump major version") do |_v|
|
19
19
|
@options[:bump_number] = :major
|
20
20
|
end
|
21
|
-
opts.on(
|
21
|
+
opts.on("-m", "--minor", "Bump minor version") do |_v|
|
22
22
|
@options[:bump_number] = :minor
|
23
23
|
end
|
24
|
-
opts.on(
|
24
|
+
opts.on("-p", "--patch", "Bump patch version") do |_v|
|
25
25
|
@options[:bump_number] = :patch
|
26
26
|
end
|
27
|
-
opts.on(
|
27
|
+
opts.on("-r", "--revert", "Revert last bump") do |v|
|
28
28
|
@options[:revert] = v
|
29
29
|
end
|
30
30
|
}.parse!
|
@@ -32,26 +32,25 @@ OptionParser.new { |opts|
|
|
32
32
|
p @options
|
33
33
|
|
34
34
|
def check_repo_is_clean_or_dry_run
|
35
|
-
value
|
35
|
+
value = `#{"git status --porcelain"}`
|
36
36
|
|
37
37
|
if value.empty?
|
38
|
-
puts
|
38
|
+
puts "Repo is clean -> continue"
|
39
39
|
else
|
40
40
|
if @options[:dry_run]
|
41
41
|
puts 'Repo not clean, "Dry run" enabled -> continue'
|
42
42
|
else
|
43
|
-
puts
|
43
|
+
puts "Repository not clean -> exit"
|
44
44
|
exit
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
|
50
49
|
def find_spec_file
|
51
50
|
list_of_specs = execute_line("find . -name '*.#{SPEC_TYPE}'")
|
52
51
|
arr = list_of_specs.split("\n")
|
53
52
|
|
54
|
-
spec_file =
|
53
|
+
spec_file = ""
|
55
54
|
|
56
55
|
case arr.count
|
57
56
|
when 0
|
@@ -60,26 +59,25 @@ def find_spec_file
|
|
60
59
|
when 1
|
61
60
|
spec_file = arr[0]
|
62
61
|
else
|
63
|
-
puts
|
64
|
-
arr.each_with_index { |file, index| puts "#{index+1}. #{file}" }
|
62
|
+
puts "Which spec should be used?"
|
63
|
+
arr.each_with_index { |file, index| puts "#{index + 1}. #{file}" }
|
65
64
|
input_index = Integer(gets.chomp)
|
66
|
-
spec_file = arr[input_index-1]
|
65
|
+
spec_file = arr[input_index - 1]
|
67
66
|
end
|
68
67
|
|
69
|
-
if spec_file
|
68
|
+
if spec_file.nil?
|
70
69
|
puts "Can't find specified spec file -> exit"
|
71
70
|
exit
|
72
71
|
end
|
73
72
|
|
74
|
-
spec_file.sub(
|
75
|
-
|
73
|
+
spec_file.sub("./", "")
|
76
74
|
end
|
77
75
|
|
78
76
|
def find_current_gem_file
|
79
77
|
list_of_specs = execute_line("find . -name '*.gem'")
|
80
78
|
arr = list_of_specs.split("\n")
|
81
79
|
|
82
|
-
spec_file =
|
80
|
+
spec_file = ""
|
83
81
|
|
84
82
|
case arr.count
|
85
83
|
when 0
|
@@ -88,41 +86,40 @@ def find_current_gem_file
|
|
88
86
|
when 1
|
89
87
|
spec_file = arr[0]
|
90
88
|
else
|
91
|
-
puts
|
92
|
-
arr.each_with_index { |file, index| puts "#{index+1}. #{file}" }
|
89
|
+
puts "Which spec should be used?"
|
90
|
+
arr.each_with_index { |file, index| puts "#{index + 1}. #{file}" }
|
93
91
|
input_index = Integer(gets.chomp)
|
94
|
-
spec_file = arr[input_index-1]
|
92
|
+
spec_file = arr[input_index - 1]
|
95
93
|
end
|
96
94
|
|
97
|
-
if spec_file
|
95
|
+
if spec_file.nil?
|
98
96
|
puts "Can't find specified spec file -> exit"
|
99
97
|
exit
|
100
98
|
end
|
101
99
|
|
102
|
-
spec_file.sub(
|
103
|
-
|
100
|
+
spec_file.sub("./", "")
|
104
101
|
end
|
105
102
|
|
106
103
|
def find_version_in_podspec(podspec)
|
107
104
|
readme = File.read(podspec)
|
108
105
|
|
109
|
-
#try to find version in format 1.22.333
|
106
|
+
# try to find version in format 1.22.333
|
110
107
|
re = /(\d+)\.(\d+)\.(\d+)/m
|
111
108
|
|
112
109
|
match_result = re.match(readme)
|
113
110
|
|
114
111
|
unless match_result
|
115
|
-
puts
|
112
|
+
puts "Not found any versions"
|
116
113
|
exit
|
117
114
|
end
|
118
115
|
|
119
116
|
puts "Found version #{match_result[0]}"
|
120
|
-
|
117
|
+
[match_result[0], match_result.captures]
|
121
118
|
end
|
122
119
|
|
123
120
|
def bump_version(versions_array)
|
124
121
|
bumped_result = versions_array.dup
|
125
|
-
bumped_result.map!
|
122
|
+
bumped_result.map!(&:to_i)
|
126
123
|
|
127
124
|
case @options[:bump_number]
|
128
125
|
when :major
|
@@ -135,11 +132,10 @@ def bump_version(versions_array)
|
|
135
132
|
when :patch
|
136
133
|
bumped_result[2] += 1
|
137
134
|
else
|
138
|
-
|
135
|
+
fail("unknown bump_number")
|
139
136
|
end
|
140
137
|
|
141
|
-
|
142
|
-
bumped_version = bumped_result.join('.')
|
138
|
+
bumped_version = bumped_result.join(".")
|
143
139
|
puts "Bump version: #{versions_array.join('.')} -> #{bumped_version}"
|
144
140
|
bumped_version
|
145
141
|
end
|
@@ -157,7 +153,7 @@ def execute_line_if_not_dry_run(line)
|
|
157
153
|
nil
|
158
154
|
else
|
159
155
|
puts line
|
160
|
-
value =
|
156
|
+
value = `#{line}`
|
161
157
|
puts value
|
162
158
|
check_exit_status(value)
|
163
159
|
value
|
@@ -165,24 +161,23 @@ def execute_line_if_not_dry_run(line)
|
|
165
161
|
end
|
166
162
|
|
167
163
|
def check_exit_status(output)
|
168
|
-
if
|
169
|
-
puts "Output:\n#{output}\nExit status = #{
|
164
|
+
if $CHILD_STATUS.exitstatus != 0
|
165
|
+
puts "Output:\n#{output}\nExit status = #{$CHILD_STATUS.exitstatus} ->Terminate script."
|
170
166
|
exit
|
171
167
|
end
|
172
168
|
end
|
173
169
|
|
174
170
|
def run_bumping_script
|
175
|
-
|
176
171
|
check_repo_is_clean_or_dry_run
|
177
172
|
spec_file = find_spec_file
|
178
173
|
result, versions_array = find_version_in_podspec(spec_file)
|
179
174
|
bumped_version = bump_version(versions_array)
|
180
175
|
|
181
176
|
unless @options[:dry_run]
|
182
|
-
puts
|
177
|
+
puts "Are you sure? Press Y to continue:"
|
183
178
|
str = gets.chomp
|
184
|
-
if str !=
|
185
|
-
puts
|
179
|
+
if str != "Y"
|
180
|
+
puts "-> exit"
|
186
181
|
exit
|
187
182
|
end
|
188
183
|
end
|
@@ -191,14 +186,13 @@ def run_bumping_script
|
|
191
186
|
execute_line_if_not_dry_run("sed -i \"\" \"s/#{result}/#{bumped_version}/\" #{spec_file}")
|
192
187
|
execute_line_if_not_dry_run("git commit --all -m \"Update #{$SPEC_TYPE} to version #{bumped_version}\"")
|
193
188
|
execute_line_if_not_dry_run("git tag #{bumped_version}")
|
194
|
-
execute_line_if_not_dry_run(
|
195
|
-
execute_line_if_not_dry_run(
|
189
|
+
execute_line_if_not_dry_run("git push")
|
190
|
+
execute_line_if_not_dry_run("git push --tags")
|
196
191
|
execute_line_if_not_dry_run("gem build #{spec_file}")
|
197
192
|
|
198
193
|
gem = find_current_gem_file
|
199
194
|
execute_line_if_not_dry_run("gem push #{gem}")
|
200
195
|
# execute_line_if_not_dry_run("pod trunk push #{spec_file}")
|
201
|
-
|
202
196
|
end
|
203
197
|
|
204
198
|
def revert_last_bump
|
@@ -207,16 +201,16 @@ def revert_last_bump
|
|
207
201
|
|
208
202
|
puts "DELETE tag #{result} and HARD reset HEAD~1?\nPress Y to continue:"
|
209
203
|
str = gets.chomp
|
210
|
-
if str !=
|
211
|
-
puts
|
204
|
+
if str != "Y"
|
205
|
+
puts "-> exit"
|
212
206
|
exit
|
213
207
|
end
|
214
208
|
execute_line_if_not_dry_run("git tag -d #{result}")
|
215
|
-
execute_line_if_not_dry_run(
|
209
|
+
execute_line_if_not_dry_run("git reset --hard HEAD~1")
|
216
210
|
execute_line_if_not_dry_run("git push --delete origin #{result}")
|
217
211
|
end
|
218
212
|
|
219
|
-
if __FILE__ == $
|
213
|
+
if __FILE__ == $PROGRAM_NAME
|
220
214
|
|
221
215
|
if @options[:revert]
|
222
216
|
revert_last_bump
|