changelog_grep 0.1.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 +15 -0
- data/.gitignore +20 -0
- data/.rspec +1 -0
- data/.rubocop.yml +21 -0
- data/CHANGELOG.md +2 -0
- data/Gemfile +2 -0
- data/LICENSE.md +13 -0
- data/README.md +94 -0
- data/Rakefile +8 -0
- data/changelog_grep.gemspec +30 -0
- data/lib/changelog_grep.rb +1 -0
- data/lib/changelog_grep/changelog.rb +109 -0
- data/lib/changelog_grep/release_ver.rb +41 -0
- data/lib/changelog_grep/version.rb +3 -0
- data/spec/changelog_spec.rb +139 -0
- data/spec/fixtures/base.md +6 -0
- data/spec/fixtures/changelog.md +93 -0
- data/spec/spec_helper.rb +13 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
Njg2NDRjYmFmNWIyOGRhMmNlMGE3OWRlMTAyZTFhNjk4ZjY3YTUxOQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NzZkNjM2MTFjZmUwY2M3YmQ2YTA0M2ZkMWI0Y2VkODRhYTcwMzg1YQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZTI3YjExNjMyYjZkOTUxNTk3NDk0YzMwMGNlOGM4ZTMxOTIxNjE1MDc3Y2Zj
|
10
|
+
ZGI5MjhlY2MyNDYwZjk1OWE2MzE3YTQ0MDc2MzY3NmNjODk4Mzc2ZDQ2ZWQ0
|
11
|
+
ZDY2MjVkMTk0ZDQ0Nzc3YzAwYzVmZjViZmQ4NzFkOWMwZjE5YTE=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
M2QxMDM1ODBmYjJjYjE2YjVkZmQ0NmJjMDYzZDRkNjkwY2JlMTE1NmZjNzJj
|
14
|
+
ZmM5Y2M0OTUzZjdkZTg4NzMyYTdiMmE0NDYyYTM2ZGU5YjYxOGMyMzAwMTM5
|
15
|
+
MGM2NDYzNGRmN2Y2MjkwMGFlNWVmODJmNDNiYTdjMGM2MTAwOGM=
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Encoding:
|
2
|
+
Enabled: false
|
3
|
+
|
4
|
+
CyclomaticComplexity:
|
5
|
+
Enabled: false
|
6
|
+
|
7
|
+
PerceivedComplexity:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Documentation:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
EmptyLinesAroundBody:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
LineLength:
|
17
|
+
Enabled: true
|
18
|
+
Max: 180
|
19
|
+
|
20
|
+
MethodLength:
|
21
|
+
Enabled: false
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2015, Opower
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
#changelog_grep
|
2
|
+
|
3
|
+
A Ruby tool to parse and grep changelog files in order to extract entries matching various criteria.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'changelog_grep'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle install
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install changelog_grep
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
#### Version line matching
|
22
|
+
|
23
|
+
The changelog parser always tries to match 2 elements: version number and release date.
|
24
|
+
The regexp used for parsing is expected to have 2 match groups corresponding to these elements:
|
25
|
+
`version_match_group` (default index: 0) and `date_match_group` (default index: 1).
|
26
|
+
You can specify a different order of elements by setting the index of the respective match group.
|
27
|
+
|
28
|
+
For example:
|
29
|
+
|
30
|
+
* `### 1.8.3 - 2015-06-01` - version_match_group: 0, date_match_group: 1 (default)
|
31
|
+
* `### 2015-06-01 (1.8.3)` - version_match_group: 1, date_match_group: 0
|
32
|
+
|
33
|
+
#### Examples
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
require 'changelog_grep'
|
37
|
+
|
38
|
+
str = File.read('lib/spec/fixtures/changelog.md')
|
39
|
+
chlog = ChangelogGrep::Changelog.new(changelog: str)
|
40
|
+
chlog.parse
|
41
|
+
rel_vers1 = chlog.find_all(from_date: '2015-10-01')
|
42
|
+
rel_vers2 = chlog.find_all(from_version: '1.0.0')
|
43
|
+
rel_vers3 = chlog.find_all(from_version: '1.0.0', to_date: '2015-10-01')
|
44
|
+
|
45
|
+
|
46
|
+
require 'open-uri'
|
47
|
+
str = open('https://raw.githubusercontent.com/erikhuda/thor/master/CHANGELOG.md').read
|
48
|
+
regex = Regexp.new('^#{0,3} (\d+\.\d+(?:\.\d+)?), released? (\d{4}-\d{2}-\d{2})\n?')
|
49
|
+
chlog = ChangelogGrep::Changelog.new(changelog: str, version_header_exp: regex)
|
50
|
+
chlog.parse
|
51
|
+
chlog.to_hash_html
|
52
|
+
```
|
53
|
+
|
54
|
+
#### Changelog conventions
|
55
|
+
|
56
|
+
* it must be in plain text format (github-flavored or plain markdown preferred)
|
57
|
+
* it must follow the format (recommended):
|
58
|
+
|
59
|
+
```
|
60
|
+
LEVEL 1-3 HEADER WITH VERSION AND RELEASE DATE
|
61
|
+
VERSION CHANGES
|
62
|
+
|
63
|
+
LEVEL 1-3 HEADER WITH VERSION AND RELEASE DATE
|
64
|
+
VERSION CHANGES
|
65
|
+
[...]
|
66
|
+
```
|
67
|
+
|
68
|
+
Example in Markdown:
|
69
|
+
|
70
|
+
```markdown
|
71
|
+
### [1.2.3] - 2015-12-12
|
72
|
+
* Fix bug #2
|
73
|
+
|
74
|
+
### [1.2.2] - 2015-10-11
|
75
|
+
* Update API
|
76
|
+
* Fix bug #1
|
77
|
+
```
|
78
|
+
|
79
|
+
+ `LEVEL 1-3 HEADER WITH VERSION` must contain at least the version number
|
80
|
+
+ If the release date is present, it must follow the form `<version_number> - <release_date>`
|
81
|
+
+ `<release_date>` is optional but if present it must follow one of these formats:
|
82
|
+
+ the ISO 8601 format: `'YYYY-MM-DD'`
|
83
|
+
+ the full english style format: `'December 14th, 2015'` (the ordinal suffix is optional)
|
84
|
+
+ the text `'Unreleased'`
|
85
|
+
+ `VERSION CHANGES` may contain more levels, but must follow the markup syntax
|
86
|
+
+ `<version_number>` should follow the [semver](http://semver.org/) conventions
|
87
|
+
+ `<version_number>` must contain at least one dot (ex: '1.2')
|
88
|
+
|
89
|
+
### Contributing
|
90
|
+
1. Fork it
|
91
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
92
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
93
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
94
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/changelog_grep/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = 'changelog_grep'
|
6
|
+
spec.version = ChangelogGrep::VERSION
|
7
|
+
spec.summary = 'A Ruby tool to parse and grep changelog files'
|
8
|
+
spec.description = 'Parse changelog files and extract entries matching various criteria'
|
9
|
+
spec.homepage = 'https://github.com/alpinweis/changelog_grep'
|
10
|
+
|
11
|
+
spec.authors = ['Adrian Kazaku']
|
12
|
+
spec.email = ['alpinweis@gmail.com']
|
13
|
+
|
14
|
+
spec.required_ruby_version = '>= 1.9.3'
|
15
|
+
|
16
|
+
spec.license = 'Apache 2'
|
17
|
+
|
18
|
+
spec.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
|
19
|
+
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
|
20
|
+
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
|
23
|
+
spec.add_development_dependency 'pry', '~> 0.10'
|
24
|
+
spec.add_development_dependency 'rake', '~> 10.1'
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.1'
|
26
|
+
spec.add_development_dependency 'rubocop', '= 0.26.1'
|
27
|
+
|
28
|
+
spec.add_runtime_dependency 'github-markup', '~> 1.3'
|
29
|
+
spec.add_runtime_dependency 'redcarpet'
|
30
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative 'changelog_grep/changelog'
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require_relative 'release_ver'
|
2
|
+
|
3
|
+
module ChangelogGrep
|
4
|
+
class Changelog
|
5
|
+
|
6
|
+
# changelog version header regex for matching strings like:
|
7
|
+
# '## 1.2.3 - 2015-12-31'
|
8
|
+
# '### [1.2.4] - 2015-12-31'
|
9
|
+
# '### [1.2.5](https://github.com/project/compare/v1.2.4...v1.2.5) - 2015-12-31'
|
10
|
+
# regex match groups: 0 => version number, 1 => release date
|
11
|
+
VERSION_HEADER = Regexp.new('^#{0,3} ?\[?([\w\d\.-]+\.[\w\d\.-]+[a-zA-Z0-9])\]?(?:\(\S*\))?(?: +\W +(\w+ \d{1,2}(?:st|nd|rd|th)?,\s\d{4}|\d{4}-\d{2}-\d{2}|\w+))?\n?[=-]*')
|
12
|
+
|
13
|
+
attr_accessor :changelog, :version_header_exp, :versions, :last_found_versions
|
14
|
+
|
15
|
+
# @param options [Hash] changelog parser options
|
16
|
+
# @option options [String] :changelog Full raw content of the changelog as a String
|
17
|
+
# @option options [Fixnum] :date_match_group Number of the regexp match group to use for date matching
|
18
|
+
# @option options [Fixnum] :version_match_group Number of the regexp match group to use for version matching
|
19
|
+
# @option options [String] :version_header_exp Regexp to match the versions lines in changelog
|
20
|
+
def initialize(options = {})
|
21
|
+
@changelog = options.fetch(:changelog)
|
22
|
+
regexp = options[:version_header_exp] || VERSION_HEADER
|
23
|
+
@version_header_exp = regexp.is_a?(Regexp) ? regexp : Regexp.new(/#{regexp}/)
|
24
|
+
@version_match_group = options[:version_match_group] || 0
|
25
|
+
@date_match_group = options[:date_match_group] || 1
|
26
|
+
@versions = []
|
27
|
+
@last_found_versions = []
|
28
|
+
end
|
29
|
+
|
30
|
+
# parse a changelog file content
|
31
|
+
# @return [Array<ReleaseVersion>]
|
32
|
+
# rubocop:disable SpecialGlobalVars
|
33
|
+
def parse
|
34
|
+
@changelog.scan(@version_header_exp) do |match|
|
35
|
+
version_content = $~.post_match # $LAST_MATCH_INFO
|
36
|
+
scanner = StringScanner.new(version_content)
|
37
|
+
scanner.scan_until(@version_header_exp)
|
38
|
+
version, date = match.values_at(@version_match_group, @date_match_group)
|
39
|
+
version.sub!(/^\D*/, '') # remove alpha prefix, e.g 'v1.2.3' => '1.2.3'
|
40
|
+
content = (scanner.pre_match || version_content).gsub(/(\A\n+|\n+\z)/, '')
|
41
|
+
@versions << ReleaseVersion.new(version: version, date: date, content: content)
|
42
|
+
end
|
43
|
+
@versions
|
44
|
+
end
|
45
|
+
|
46
|
+
# get all dates
|
47
|
+
def all_dates(arr_versions = versions)
|
48
|
+
arr_versions.map(&:date).compact.sort
|
49
|
+
end
|
50
|
+
|
51
|
+
# get all version numbers as strings
|
52
|
+
def all_versions(arr_versions = versions)
|
53
|
+
arr_versions.map(&:version).compact
|
54
|
+
end
|
55
|
+
|
56
|
+
def to_hash(arr_versions = versions)
|
57
|
+
{ versions: arr_versions.map(&:to_hash) }
|
58
|
+
end
|
59
|
+
|
60
|
+
def to_hash_html(arr_versions = versions)
|
61
|
+
{ versions: arr_versions.map(&:to_hash_html) }
|
62
|
+
end
|
63
|
+
|
64
|
+
# find all versions by date or version number
|
65
|
+
#
|
66
|
+
# @param options [Hash] filter options
|
67
|
+
# @option options [String] :from_date ('YYYY-MM-DD')
|
68
|
+
# @option options [String] :to_date
|
69
|
+
# @option options [String] :from_version ('1.2.3')
|
70
|
+
# @option options [String] :to_version
|
71
|
+
def find_all(options = {})
|
72
|
+
parse if versions.empty?
|
73
|
+
return versions if options.empty?
|
74
|
+
# symbolize options keys
|
75
|
+
options = Hash[options.map { |k, v| [k.to_sym, v] }]
|
76
|
+
|
77
|
+
from_date, to_date, from_version, to_version = options.values_at(:from_date, :to_date, :from_version, :to_version)
|
78
|
+
sorted = versions.sort
|
79
|
+
dates = all_dates
|
80
|
+
vers1 = vers2 = versions
|
81
|
+
|
82
|
+
if (from_version || to_version) && !versions.empty?
|
83
|
+
min = from_version ? ReleaseVersion.new(version: from_version) : sorted.first
|
84
|
+
max = to_version ? ReleaseVersion.new(version: to_version) : sorted.last
|
85
|
+
vers1 = versions.select { |v| v.between?(min, max) }
|
86
|
+
end
|
87
|
+
|
88
|
+
if from_date || to_date
|
89
|
+
if dates.empty?
|
90
|
+
vers2 = []
|
91
|
+
else
|
92
|
+
min = from_date ? from_date : dates.first
|
93
|
+
max = to_date ? to_date : dates.last
|
94
|
+
vdates = dates.select { |date| date.between?(min, max) }
|
95
|
+
if vdates.empty?
|
96
|
+
vers2 = []
|
97
|
+
else
|
98
|
+
# grab all versions with no dates that may be found in between
|
99
|
+
min = versions.find { |v| v.date == vdates.first }
|
100
|
+
max = versions.find { |v| v.date == vdates.last }
|
101
|
+
vers2 = versions.select { |v| v.between?(min, max) }
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
@last_found_versions = vers1 & vers2
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'github/markup'
|
2
|
+
|
3
|
+
module ChangelogGrep
|
4
|
+
class ReleaseVersion
|
5
|
+
include Comparable
|
6
|
+
attr_accessor :content, :date, :number, :version
|
7
|
+
|
8
|
+
# @param options [Hash] init options
|
9
|
+
# @option options [String] :version Version string ('0.1.0')
|
10
|
+
# @option options [String] :date Date of release ('YYYY-MM-DD')
|
11
|
+
# @option options [String] :content Content of release notes
|
12
|
+
def initialize(options = {})
|
13
|
+
@version = options[:version] || '0.0.0'
|
14
|
+
@content = options[:content]
|
15
|
+
@date = options[:date]
|
16
|
+
@number = numeric_version(@version)
|
17
|
+
end
|
18
|
+
|
19
|
+
# convert a version string to a numeric version (for correct sorting)
|
20
|
+
# @see http://ruby-doc.org/stdlib-2.0.0/libdoc/rubygems/rdoc/Gem/Version.html
|
21
|
+
def numeric_version(version_str)
|
22
|
+
Gem::Version.new(version_str)
|
23
|
+
end
|
24
|
+
|
25
|
+
def <=>(other)
|
26
|
+
number <=> other.number
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_html
|
30
|
+
GitHub::Markup.render('.md', content || '')
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_hash
|
34
|
+
{ version: version, date: date, content: content }
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_hash_html
|
38
|
+
to_hash.merge(content: to_html)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
require 'changelog_grep'
|
2
|
+
|
3
|
+
module ChangelogGrep
|
4
|
+
describe Changelog do
|
5
|
+
|
6
|
+
context 'version line with default regex' do
|
7
|
+
let(:version_hash) { { version: '1.2.3', date: '2015-12-31', content: '' } }
|
8
|
+
let(:version_lines) do
|
9
|
+
[
|
10
|
+
'# 1.2.3 - 2015-12-31',
|
11
|
+
'## v1.2.3 - 2015-12-31',
|
12
|
+
'## [1.2.3] - 2015-12-31',
|
13
|
+
'### [1.2.3] / 2015-12-31',
|
14
|
+
'### [1.2.3] / 2015-12-31',
|
15
|
+
'### [1.2.3](https://github.com/project/compare/v1.2.2...v1.2.3) - 2015-12-31'
|
16
|
+
]
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'parses version number and date' do
|
20
|
+
version_lines.each do |line|
|
21
|
+
vers = parse(line).versions
|
22
|
+
expect(vers.size).to eq(1)
|
23
|
+
expect(vers.first.to_hash).to eq(version_hash)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'content' do
|
29
|
+
let(:chlog) { parse(File.read('spec/fixtures/base.md')) }
|
30
|
+
|
31
|
+
let(:versions_text) do
|
32
|
+
[
|
33
|
+
{
|
34
|
+
version: '1.8.3',
|
35
|
+
date: '2015-06-01',
|
36
|
+
content: '* Fix potential memory leak'
|
37
|
+
},
|
38
|
+
{
|
39
|
+
version: '1.8.2',
|
40
|
+
date: '2015-01-08',
|
41
|
+
content: "* Some performance improvements\n* Fix to avoid mutation of JSON.dump_default_options"
|
42
|
+
}
|
43
|
+
]
|
44
|
+
end
|
45
|
+
|
46
|
+
let(:versions_html) do
|
47
|
+
[
|
48
|
+
{
|
49
|
+
version: '1.8.3',
|
50
|
+
date: '2015-06-01',
|
51
|
+
content: "<ul>\n<li>Fix potential memory leak</li>\n</ul>\n"
|
52
|
+
},
|
53
|
+
{
|
54
|
+
version: '1.8.2',
|
55
|
+
date: '2015-01-08',
|
56
|
+
content: "<ul>\n<li>Some performance improvements</li>\n<li>Fix to avoid mutation of JSON.dump<em>default</em>options</li>\n</ul>\n"
|
57
|
+
}
|
58
|
+
]
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'presents parsed content as plain text' do
|
62
|
+
expect(chlog.to_hash).to eq(versions: versions_text)
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'presents parsed content as html' do
|
66
|
+
expect(chlog.to_hash_html).to eq(versions: versions_html)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context 'find_all' do
|
71
|
+
let(:chlog) { parse(File.read('spec/fixtures/changelog.md')) }
|
72
|
+
let(:expected_vers) { ['2.12.0', '2.11.1', '2.11.0'] }
|
73
|
+
let(:expected_vers_2) { ['2.1.2', '2.1.1'] }
|
74
|
+
|
75
|
+
it 'finds all versions from_date' do
|
76
|
+
vers = chlog.find_all(from_date: '2015-12-01')
|
77
|
+
expect(chlog.all_versions(vers)).to eq(expected_vers)
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'finds all versions from_verison' do
|
81
|
+
vers = chlog.find_all(from_version: '2.11.0')
|
82
|
+
expect(chlog.all_versions(vers)).to eq(expected_vers)
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'finds all versions to_date' do
|
86
|
+
vers = chlog.find_all(to_date: '2015-06-30')
|
87
|
+
expect(chlog.all_versions(vers)).to eq(expected_vers_2)
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'finds all versions to_version' do
|
91
|
+
vers = chlog.find_all(to_version: '0.0.5')
|
92
|
+
expect(chlog.all_versions(vers)).to eq(['0.0.4', '0.0.3', '0.0.2', '0.0.1'])
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'finds all versions from_date to_date' do
|
96
|
+
vers = chlog.find_all(from_date: '2015-12-01', to_date: '2015-12-30')
|
97
|
+
expect(chlog.all_versions(vers)).to eq(expected_vers)
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'finds all versions from_verison to_version' do
|
101
|
+
['2.12.0', '2.12.1', '2.13.0', '3.0.0'].each do |to_version|
|
102
|
+
vers = chlog.find_all(from_version: '2.11.0', to_version: to_version)
|
103
|
+
expect(chlog.all_versions(vers)).to eq(expected_vers)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'finds all versions from_date to_version' do
|
108
|
+
['2.12.0', '2.12.1', '2.13.0', '3.0.0'].each do |to_version|
|
109
|
+
vers = chlog.find_all(from_date: '2015-12-01', to_version: to_version)
|
110
|
+
expect(chlog.all_versions(vers)).to eq(expected_vers)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'finds all versions from_version to_date' do
|
115
|
+
['1.0.0', '2.0.0', '2.0.2', '2.1.1'].each do |from_version|
|
116
|
+
vers = chlog.find_all(from_version: from_version, to_date: '2015-07-01')
|
117
|
+
expect(chlog.all_versions(vers)).to eq(expected_vers_2)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'finds nothing when using invalid search options' do
|
122
|
+
[
|
123
|
+
{ from_date: '2015-12-31' },
|
124
|
+
{ to_date: '2015-01-01' },
|
125
|
+
{ from_version: '3.0.0' },
|
126
|
+
{ to_version: '0.0.0' },
|
127
|
+
{ from_date: '2015-12-31', to_date: '2015-10-01' },
|
128
|
+
{ from_version: '2.12.0', to_version: '2.0.0' },
|
129
|
+
{ from_date: '2015-07-17', to_version: '1.0.0' },
|
130
|
+
{ from_version: '2.12.0', to_date: '2015-10-01' }
|
131
|
+
].each do |opts|
|
132
|
+
vers = chlog.find_all(opts)
|
133
|
+
expect(chlog.all_versions(vers)).to be_empty
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
### [2.12.0] - 2015-12-22
|
2
|
+
* Add project metadata file
|
3
|
+
|
4
|
+
### [2.11.1] - 2015-12-14
|
5
|
+
* Update docs
|
6
|
+
|
7
|
+
### [2.11.0] - 2015-12-02
|
8
|
+
* Remove reliance on semver gem
|
9
|
+
|
10
|
+
### [2.10.0] - 2015-11-10
|
11
|
+
* Remove rvm/rbenv from build scripts
|
12
|
+
|
13
|
+
### [2.9.0] - 2015-10-21
|
14
|
+
* Simplify gem versioning
|
15
|
+
|
16
|
+
### [2.8.2] - 2015-10-19
|
17
|
+
* Reorganize files under lib
|
18
|
+
|
19
|
+
### [2.8.1] - 2015-10-15
|
20
|
+
* Fix .jenkins.yml
|
21
|
+
|
22
|
+
### [2.8.0] - 2015-09-30
|
23
|
+
* Update constants
|
24
|
+
|
25
|
+
### [2.7.0] - 2015-09-14
|
26
|
+
* Add a release script
|
27
|
+
* Update docs
|
28
|
+
|
29
|
+
### [2.6.0] - 2015-08-21
|
30
|
+
* Add CLI options
|
31
|
+
|
32
|
+
### [2.5.0] - 2015-08-13
|
33
|
+
* Add a build status link to README
|
34
|
+
|
35
|
+
### [2.4.0] - 2015-08-12
|
36
|
+
* Fix the build script to work with rbenv
|
37
|
+
|
38
|
+
### [2.3.0] - 2015-07-24
|
39
|
+
* Remove dependency
|
40
|
+
|
41
|
+
### [2.2.1] - 2015-07-17
|
42
|
+
* Fix tests
|
43
|
+
|
44
|
+
### [2.2.0] - 2015-07-17
|
45
|
+
* Use a new build script
|
46
|
+
|
47
|
+
### [2.1.3] - 2015-07-04
|
48
|
+
* Update dependency
|
49
|
+
|
50
|
+
### [2.1.2] - 2015-06-15
|
51
|
+
* Update dependency
|
52
|
+
|
53
|
+
### [2.1.1] - 2015-05-19
|
54
|
+
* Fix versioning bug
|
55
|
+
|
56
|
+
### 2.1.0
|
57
|
+
* Switch to .jenkins.yml
|
58
|
+
* Rename views
|
59
|
+
|
60
|
+
### 2.0.2
|
61
|
+
* Add semver support
|
62
|
+
|
63
|
+
### 2.0.1
|
64
|
+
* Minor bugfix
|
65
|
+
|
66
|
+
### 2.0.0
|
67
|
+
* Clean up CLI
|
68
|
+
* Refactor project classes
|
69
|
+
|
70
|
+
### 1.3.0
|
71
|
+
* Switch from OptionParser to Thor
|
72
|
+
|
73
|
+
### 1.2.0
|
74
|
+
* Add configurations
|
75
|
+
|
76
|
+
### 1.1.0
|
77
|
+
* More bugfixes
|
78
|
+
|
79
|
+
### 1.0.0
|
80
|
+
* Marjor cleanup with multiple bugfixes
|
81
|
+
|
82
|
+
### 0.0.4
|
83
|
+
* Use Yard instead of Rdoc
|
84
|
+
* Enable rubocop
|
85
|
+
|
86
|
+
### 0.0.3
|
87
|
+
* Add CHANGELOG.md
|
88
|
+
|
89
|
+
### 0.0.2
|
90
|
+
* Clean up
|
91
|
+
|
92
|
+
### v0.0.1
|
93
|
+
* Initial version
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: changelog_grep
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adrian Kazaku
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.1'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.26.1
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.26.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: github-markup
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.3'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: redcarpet
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Parse changelog files and extract entries matching various criteria
|
98
|
+
email:
|
99
|
+
- alpinweis@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- .gitignore
|
105
|
+
- .rspec
|
106
|
+
- .rubocop.yml
|
107
|
+
- CHANGELOG.md
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE.md
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- changelog_grep.gemspec
|
113
|
+
- lib/changelog_grep.rb
|
114
|
+
- lib/changelog_grep/changelog.rb
|
115
|
+
- lib/changelog_grep/release_ver.rb
|
116
|
+
- lib/changelog_grep/version.rb
|
117
|
+
- spec/changelog_spec.rb
|
118
|
+
- spec/fixtures/base.md
|
119
|
+
- spec/fixtures/changelog.md
|
120
|
+
- spec/spec_helper.rb
|
121
|
+
homepage: https://github.com/alpinweis/changelog_grep
|
122
|
+
licenses:
|
123
|
+
- Apache 2
|
124
|
+
metadata: {}
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options: []
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 1.9.3
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
requirements: []
|
140
|
+
rubyforge_project:
|
141
|
+
rubygems_version: 2.4.8
|
142
|
+
signing_key:
|
143
|
+
specification_version: 4
|
144
|
+
summary: A Ruby tool to parse and grep changelog files
|
145
|
+
test_files:
|
146
|
+
- spec/changelog_spec.rb
|
147
|
+
- spec/fixtures/base.md
|
148
|
+
- spec/fixtures/changelog.md
|
149
|
+
- spec/spec_helper.rb
|