github_changelog_generator 1.9.0 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +4 -1
- data/CHANGELOG.md +27 -0
- data/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/lib/CHANGELOG.md +1 -0
- data/lib/github_changelog_generator/parser.rb +19 -21
- data/lib/github_changelog_generator/parser_file.rb +24 -21
- data/lib/github_changelog_generator/reader.rb +10 -13
- data/lib/github_changelog_generator/task.rb +3 -5
- data/lib/github_changelog_generator/version.rb +1 -1
- data/spec/files/github_changelog_params_override +1 -0
- data/spec/unit/parse_file_spec.rb +17 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59c84fc6b47537cdca06c26c80e84ba2173eb941
|
4
|
+
data.tar.gz: 23353066809d7171627bce5d6ae88d004f685383
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e62a0bcc2d7b58f4059b578dd2d5b8a3715768d29cc75b24e31660bae5f037551fdb2fa2d601e0c289b5eada5aad668d1e7dc38f93e482c2af998568eed06f0
|
7
|
+
data.tar.gz: bce9377b820a4cea95a2e209efa60e09b8abc3c0e2f6723b0b98a816fb18ea89880c508c2f437bc42a29dab6f950d75650a14c514bb26f06d476871fb27e931b
|
data/.gitignore
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
coverage/
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,32 @@
|
|
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.9.0...HEAD)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Rubocop: less complex methods in parser.rb [\#297](https://github.com/skywinder/github-changelog-generator/pull/297) ([olleolleolle](https://github.com/olleolleolle))
|
10
|
+
- Introduce ParserError exception class [\#296](https://github.com/skywinder/github-changelog-generator/pull/296) ([olleolleolle](https://github.com/olleolleolle))
|
11
|
+
- ParserFile: support values with equals signs [\#285](https://github.com/skywinder/github-changelog-generator/pull/285) ([olleolleolle](https://github.com/olleolleolle))
|
12
|
+
|
13
|
+
**Merged pull requests:**
|
14
|
+
|
15
|
+
- Update bundler [\#306](https://github.com/skywinder/github-changelog-generator/pull/306) ([SteveGilvarry](https://github.com/SteveGilvarry))
|
16
|
+
- Add options to def self.user\_and\_project\_from\_git to fix parser.rb:19… [\#303](https://github.com/skywinder/github-changelog-generator/pull/303) ([SteveGilvarry](https://github.com/SteveGilvarry))
|
17
|
+
- Git ignore coverage/ [\#300](https://github.com/skywinder/github-changelog-generator/pull/300) ([olleolleolle](https://github.com/olleolleolle))
|
18
|
+
- \[refactor\] Fix docblock datatype, use \#map [\#299](https://github.com/skywinder/github-changelog-generator/pull/299) ([olleolleolle](https://github.com/olleolleolle))
|
19
|
+
- \[refactor\] Reader: positive Boolean; unused \#map [\#298](https://github.com/skywinder/github-changelog-generator/pull/298) ([olleolleolle](https://github.com/olleolleolle))
|
20
|
+
- Add base option to RakeTask [\#287](https://github.com/skywinder/github-changelog-generator/pull/287) ([jkeiser](https://github.com/jkeiser))
|
21
|
+
|
22
|
+
## [1.9.0](https://github.com/skywinder/github-changelog-generator/tree/1.9.0) (2015-09-17)
|
23
|
+
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.8.5...1.9.0)
|
24
|
+
|
25
|
+
**Implemented enhancements:**
|
26
|
+
|
27
|
+
- Feature: exclude\_tags using regular expression [\#281](https://github.com/skywinder/github-changelog-generator/pull/281) ([olleolleolle](https://github.com/olleolleolle))
|
28
|
+
- Auto parse options from file .github\_changelog\_generator [\#278](https://github.com/skywinder/github-changelog-generator/pull/278) ([dlanileonardo](https://github.com/dlanileonardo))
|
29
|
+
|
3
30
|
## [1.8.5](https://github.com/skywinder/github-changelog-generator/tree/1.8.5) (2015-09-15)
|
4
31
|
[Full Changelog](https://github.com/skywinder/github-changelog-generator/compare/1.8.4...1.8.5)
|
5
32
|
|
data/Gemfile.lock
CHANGED
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)
|
@@ -32,7 +32,7 @@ To make it easier for users and contributors to see precisely what notable chang
|
|
32
32
|
### *Why should I care?*
|
33
33
|
Because software tools are for people. If you don’t care, why are you contributing to open source? Surely, there must be a kernel (ha!) of care somewhere in that lovely little brain of yours.
|
34
34
|
|
35
|
-
> :
|
35
|
+
> :arrow_right: *[http://keepachangelog.com](http://keepachangelog.com/)*
|
36
36
|
|
37
37
|
## Installation
|
38
38
|
|
@@ -117,7 +117,7 @@ It's time to create this token or wait for 1 hour before GitHub reset the counte
|
|
117
117
|
## Migrating from a manual changelog
|
118
118
|
|
119
119
|
Knowing how dedicated you are to your project, you probably haven't been waiting for github-changelog-generator to keep a changelog,
|
120
|
-
but you most likely
|
120
|
+
but you most likely wouldn't like to have to open issues and PRs for all past features listed in your historic changelog.
|
121
121
|
|
122
122
|
That's where `--base` comes handy. This option lets you pass a static changelog to be appended at the end of the generated entries.
|
123
123
|
|
data/lib/CHANGELOG.md
CHANGED
@@ -22,6 +22,7 @@
|
|
22
22
|
|
23
23
|
**Merged pull requests:**
|
24
24
|
|
25
|
+
- Merged PR to Develop [\#19](https://github.com/skywinder/changelog_test/pull/19) ([skywinder](https://github.com/skywinder))
|
25
26
|
- This a PR with a lot of comments and events [\#17](https://github.com/skywinder/changelog_test/pull/17) ([skywinder](https://github.com/skywinder))
|
26
27
|
- This PR closes 14 from commit [\#15](https://github.com/skywinder/changelog_test/pull/15) ([skywinder](https://github.com/skywinder))
|
27
28
|
- This PR to close \#12 from body [\#13](https://github.com/skywinder/changelog_test/pull/13) ([skywinder](https://github.com/skywinder))
|
@@ -7,22 +7,16 @@ module GitHubChangelogGenerator
|
|
7
7
|
class Parser
|
8
8
|
# parse options with optparse
|
9
9
|
def self.parse_options
|
10
|
-
options =
|
10
|
+
options = default_options
|
11
11
|
|
12
|
-
|
13
|
-
parser_file.parse!
|
12
|
+
ParserFile.new(options).parse!
|
14
13
|
|
15
14
|
parser = setup_parser(options)
|
16
15
|
parser.parse!
|
17
16
|
|
18
|
-
|
19
|
-
detect_user_and_project(options, ARGV[0], ARGV[1])
|
20
|
-
end
|
17
|
+
user_and_project_from_git(options)
|
21
18
|
|
22
|
-
|
23
|
-
puts parser.banner
|
24
|
-
exit
|
25
|
-
end
|
19
|
+
abort(parser.banner) unless options[:user] && options[:project]
|
26
20
|
|
27
21
|
print_options(options)
|
28
22
|
|
@@ -165,8 +159,8 @@ module GitHubChangelogGenerator
|
|
165
159
|
end
|
166
160
|
|
167
161
|
# just get default options
|
168
|
-
def self.
|
169
|
-
|
162
|
+
def self.default_options
|
163
|
+
{
|
170
164
|
tag1: nil,
|
171
165
|
tag2: nil,
|
172
166
|
date_format: "%Y-%m-%d",
|
@@ -194,21 +188,25 @@ module GitHubChangelogGenerator
|
|
194
188
|
enhancement_prefix: "**Implemented enhancements:**",
|
195
189
|
git_remote: "origin"
|
196
190
|
}
|
191
|
+
end
|
197
192
|
|
198
|
-
|
193
|
+
def self.user_and_project_from_git(options)
|
194
|
+
if options[:user].nil? || options[:project].nil?
|
195
|
+
detect_user_and_project(options, ARGV[0], ARGV[1])
|
196
|
+
end
|
199
197
|
end
|
200
198
|
|
201
199
|
# Detects user and project from git
|
202
200
|
def self.detect_user_and_project(options, arg0 = nil, arg1 = nil)
|
203
201
|
options[:user], options[:project] = user_project_from_option(arg0, arg1, options[:github_site])
|
204
|
-
if
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
202
|
+
return if options[:user] && options[:project]
|
203
|
+
|
204
|
+
if ENV["RUBYLIB"] =~ /ruby-debug-ide/
|
205
|
+
options[:user] = "skywinder"
|
206
|
+
options[:project] = "changelog_test"
|
207
|
+
else
|
208
|
+
remote = `git config --get remote.#{options[:git_remote]}.url`
|
209
|
+
options[:user], options[:project] = user_project_from_remote(remote)
|
212
210
|
end
|
213
211
|
end
|
214
212
|
|
@@ -1,36 +1,39 @@
|
|
1
1
|
module GitHubChangelogGenerator
|
2
|
+
ParserError = Class.new(StandardError)
|
3
|
+
|
2
4
|
class ParserFile
|
3
5
|
def initialize(options)
|
4
6
|
@options = options
|
5
7
|
end
|
6
8
|
|
7
|
-
def
|
8
|
-
File.
|
9
|
+
def parse!
|
10
|
+
return unless File.exist?(file)
|
11
|
+
|
12
|
+
File.readlines(file).each { |line| parse_line!(line) }
|
9
13
|
end
|
10
14
|
|
11
|
-
|
12
|
-
|
15
|
+
private
|
16
|
+
|
17
|
+
def file
|
18
|
+
@file ||= File.expand_path(@options[:params_file] || ".github_changelog_generator")
|
13
19
|
end
|
14
20
|
|
15
|
-
def
|
16
|
-
|
21
|
+
def parse_line!(line)
|
22
|
+
key_sym, value = extract_pair(line)
|
23
|
+
value = true if value =~ (/^(true|t|yes|y|1)$/i)
|
24
|
+
value = false if value =~ (/^(false|f|no|n|0)$/i)
|
25
|
+
@options[key_sym] = value
|
26
|
+
rescue
|
27
|
+
raise ParserError, "Config file #{file} is incorrect in line \"#{line.gsub(/[\n\r]+/, '')}\""
|
17
28
|
end
|
18
29
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
30
|
+
# Returns a the setting as a symbol and its string value sans newlines.
|
31
|
+
#
|
32
|
+
# @param line [String] unparsed line from config file
|
33
|
+
# @return [Array<Symbol, String>]
|
34
|
+
def extract_pair(line)
|
35
|
+
key, value = line.split("=", 2)
|
36
|
+
[key.sub("-", "_").to_sym, value.gsub(/[\n\r]+/, "")]
|
34
37
|
end
|
35
38
|
end
|
36
39
|
end
|
@@ -53,31 +53,28 @@ module GitHubChangelogGenerator
|
|
53
53
|
|
54
54
|
@heading_structures.each do |regexp|
|
55
55
|
matches = Regexp.new(regexp).match(heading)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
if matches
|
57
|
+
captures.merge!(Hash[matches.names.zip(matches.captures)])
|
58
|
+
break
|
59
|
+
end
|
60
60
|
end
|
61
61
|
|
62
62
|
captures
|
63
63
|
end
|
64
64
|
|
65
|
-
# Parse the given ChangeLog data into a
|
65
|
+
# Parse the given ChangeLog data into a list of Hashes
|
66
66
|
#
|
67
67
|
# @param [String] data File data from the ChangeLog.md
|
68
|
-
# @return [Hash] Parsed data, e.g. [{ 'version' => ..., 'url' => ..., 'date' => ..., 'content' => ...}, ...]
|
68
|
+
# @return [Array<Hash>] Parsed data, e.g. [{ 'version' => ..., 'url' => ..., 'date' => ..., 'content' => ...}, ...]
|
69
69
|
def parse(data)
|
70
70
|
sections = data.split(/^## .+?$/)
|
71
71
|
headings = data.scan(/^## .+?$/)
|
72
|
-
changelog = []
|
73
72
|
|
74
|
-
headings.each_with_index do |heading, index|
|
75
|
-
|
76
|
-
|
77
|
-
|
73
|
+
headings.each_with_index.map do |heading, index|
|
74
|
+
section = parse_heading(heading)
|
75
|
+
section["content"] = sections.at(index + 1)
|
76
|
+
section
|
78
77
|
end
|
79
|
-
|
80
|
-
changelog
|
81
78
|
end
|
82
79
|
|
83
80
|
def read(file_path)
|
@@ -16,7 +16,7 @@ module GitHubChangelogGenerator
|
|
16
16
|
bug_labels enhancement_labels
|
17
17
|
between_tags exclude_tags since_tag max_issues
|
18
18
|
github_site github_endpoint simple_list
|
19
|
-
future_release verbose release_url )
|
19
|
+
future_release verbose release_url base )
|
20
20
|
|
21
21
|
OPTIONS.each do |o|
|
22
22
|
attr_accessor o.to_sym
|
@@ -43,11 +43,9 @@ module GitHubChangelogGenerator
|
|
43
43
|
|
44
44
|
task @name do
|
45
45
|
# mimick parse_options
|
46
|
-
options = Parser.
|
46
|
+
options = Parser.default_options
|
47
47
|
|
48
|
-
|
49
|
-
Parser.detect_user_and_project(options)
|
50
|
-
end
|
48
|
+
Parser.user_and_project_from_git(options)
|
51
49
|
|
52
50
|
OPTIONS.each do |o|
|
53
51
|
v = instance_variable_get("@#{o}")
|
@@ -10,23 +10,32 @@ describe GitHubChangelogGenerator::ParserFile do
|
|
10
10
|
context "when file is empty" do
|
11
11
|
let(:options) { { params_file: "spec/files/github_changelog_params_empty" } }
|
12
12
|
let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }
|
13
|
-
|
14
|
-
it
|
15
|
-
|
13
|
+
|
14
|
+
it "does not change the options" do
|
15
|
+
expect { parse.parse! }.to_not change { options }
|
16
|
+
end
|
16
17
|
end
|
17
18
|
|
18
19
|
context "when file is incorrect" do
|
19
20
|
let(:options) { { params_file: "spec/files/github_changelog_params_incorrect" } }
|
21
|
+
let(:options_before_change) { options.dup }
|
20
22
|
let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }
|
21
|
-
it { expect {
|
23
|
+
it { expect { parse.parse! }.to raise_error(GitHubChangelogGenerator::ParserError) }
|
22
24
|
end
|
23
25
|
|
24
26
|
context "when override default values" do
|
25
|
-
let(:
|
27
|
+
let(:default_options) { GitHubChangelogGenerator::Parser.default_options }
|
28
|
+
let(:options) { { params_file: "spec/files/github_changelog_params_override" }.merge(default_options) }
|
29
|
+
let(:options_before_change) { options.dup }
|
26
30
|
let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }
|
27
|
-
|
28
|
-
it
|
29
|
-
|
31
|
+
|
32
|
+
it "changes the options" do
|
33
|
+
expect { parse.parse! }.to change { options }
|
34
|
+
.from(options_before_change)
|
35
|
+
.to(options_before_change.merge(unreleased_label: "staging",
|
36
|
+
unreleased: false,
|
37
|
+
header: "=== Changelog ==="))
|
38
|
+
end
|
30
39
|
end
|
31
40
|
end
|
32
41
|
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.
|
4
|
+
version: 1.10.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:
|
11
|
+
date: 2016-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: github_api
|