pimpmychangelog 0.0.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +39 -2
- data/LICENSE +22 -0
- data/README.md +3 -0
- data/Rakefile +6 -0
- data/lib/pimpmychangelog/git_remote.rb +17 -5
- data/lib/pimpmychangelog/parser.rb +1 -1
- data/lib/pimpmychangelog/pimper.rb +6 -2
- data/lib/pimpmychangelog/version.rb +1 -1
- data/pimpmychangelog.gemspec +3 -0
- data/spec/git_remote_spec.rb +19 -1
- data/spec/parser_spec.rb +2 -2
- data/spec/pimper_spec.rb +13 -5
- data/spec/spec_helper.rb +2 -0
- metadata +84 -69
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 437b82b2e0edcee6e194382cb19a9733dd907564351aab59a9c4d30d1c2068a8
|
4
|
+
data.tar.gz: 236fd3beaccb0458a4500ce0efa6913ee3311181637a1e23918a720a69480ea6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3bd0471c3b529d85a2a87e06616e41704b6946a3e3093648121bebf66332e4cd8fa21475138c4edb791b2a534fa2dc8badeb1c1496bb72da75c8be90a908bd35
|
7
|
+
data.tar.gz: e2f9f90d6501b955cce7908674d6aba84c3965409c49f6be742c3e5ac0a33b42de5ee232e9dad8d5cd813020c9e99e3414a56e1595bec48804e5f7ea504ff6f4
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,15 +1,52 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## Version 0.1.3
|
4
|
+
|
5
|
+
* Retrieve git-remote from local configuration PR [#17][] by [@marcotc][].
|
6
|
+
|
7
|
+
## Version 0.1.2
|
8
|
+
|
9
|
+
* Add support for changelogs without extra new line at the end of file.
|
10
|
+
PR [#6][] by [@arangamani][].
|
11
|
+
|
12
|
+
## Version 0.1.1
|
13
|
+
|
14
|
+
* Add support for usernames with hyphens. Closes issue [#4][] reported by
|
15
|
+
[@miketheman][].
|
16
|
+
|
17
|
+
## Version 0.1.0
|
18
|
+
|
19
|
+
* Add support for git repos with HTTPS urls. PR [#3][] by
|
20
|
+
[@Maher4Ever][].
|
21
|
+
|
22
|
+
## Version 0.0.3
|
23
|
+
|
24
|
+
* Add support for Github nicknames with dashes. PR [#2][] by [@rymai][].
|
25
|
+
|
3
26
|
## Version 0.0.2
|
4
27
|
|
5
28
|
* CLI does not accept any options anymore
|
6
29
|
* Github user and projects are extracted from the origin remote fetch
|
7
30
|
url
|
8
|
-
* CHANGELOG.md is overwritten instead of printed out. #1
|
31
|
+
* CHANGELOG.md is overwritten instead of printed out. [#1][]
|
9
32
|
|
10
33
|
|
11
34
|
## Version 0.0.1
|
12
35
|
|
13
|
-
* Initial version by @pcreux
|
36
|
+
* Initial version by [@pcreux][]
|
14
37
|
* Usage: `pimpmychangelog gregbell activeadmin CHANGELOG.md`
|
15
38
|
This would output the pimped version of the changelog.
|
39
|
+
|
40
|
+
<!--- The following link definition list is generated by PimpMyChangelog --->
|
41
|
+
[#1]: https://github.com/pcreux/pimpmychangelog/issues/1
|
42
|
+
[#2]: https://github.com/pcreux/pimpmychangelog/issues/2
|
43
|
+
[#3]: https://github.com/pcreux/pimpmychangelog/issues/3
|
44
|
+
[#4]: https://github.com/pcreux/pimpmychangelog/issues/4
|
45
|
+
[#6]: https://github.com/pcreux/pimpmychangelog/issues/6
|
46
|
+
[#17]: https://github.com/pcreux/pimpmychangelog/issues/17
|
47
|
+
[@Maher4Ever]: https://github.com/Maher4Ever
|
48
|
+
[@arangamani]: https://github.com/arangamani
|
49
|
+
[@marcotc]: https://github.com/marcotc
|
50
|
+
[@miketheman]: https://github.com/miketheman
|
51
|
+
[@pcreux]: https://github.com/pcreux
|
52
|
+
[@rymai]: https://github.com/rymai
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Philippe Creux
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,8 +1,20 @@
|
|
1
1
|
class GitRemote
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
|
3
|
+
REPOSITORY_PATTERN = %r{
|
4
|
+
# Define recurring patterns
|
5
|
+
(?<part> [\w\d-]+ ){0}
|
6
|
+
|
7
|
+
(?<user>\g<part>)/(?<repo>\g<part>)(.git)?$
|
8
|
+
}x
|
9
|
+
|
10
|
+
def initialize(url = nil)
|
11
|
+
@url = url || fetch_url
|
12
|
+
|
13
|
+
match = @url.match(REPOSITORY_PATTERN)
|
14
|
+
|
15
|
+
@user = match[:user]
|
16
|
+
@project = match[:repo]
|
17
|
+
|
6
18
|
unless @user && @project
|
7
19
|
raise "Can't extract github user and project from origin remote"
|
8
20
|
end
|
@@ -17,6 +29,6 @@ class GitRemote
|
|
17
29
|
end
|
18
30
|
|
19
31
|
def run_command
|
20
|
-
|
32
|
+
`git config --get remote.origin.url`
|
21
33
|
end
|
22
34
|
end
|
@@ -21,7 +21,7 @@ module PimpMyChangelog
|
|
21
21
|
# @return [Array] ordered array of contributors found in the changelog
|
22
22
|
# Example: ['gregbell', 'pcreux', 'samvincent']
|
23
23
|
def contributors
|
24
|
-
changelog.scan(/@(\w+)/).flatten.uniq.sort
|
24
|
+
changelog.scan(/@([\w-]+)/).flatten.uniq.sort
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -18,7 +18,11 @@ module PimpMyChangelog
|
|
18
18
|
def better_changelog
|
19
19
|
parsed_changelog = Parser.new(changelog)
|
20
20
|
|
21
|
-
|
21
|
+
# If the file doesn't have an extra newline at the end the separator gets rendered
|
22
|
+
# as part of the changelog. So add an extra newline in that case.
|
23
|
+
extra_newline_if_required = parsed_changelog.content.match(/\n\n\Z/) ? "" : "\n"
|
24
|
+
|
25
|
+
linkify_changelog(parsed_changelog.content) + extra_newline_if_required +
|
22
26
|
links_definitions(parsed_changelog.issues, parsed_changelog.contributors)
|
23
27
|
end
|
24
28
|
|
@@ -38,7 +42,7 @@ module PimpMyChangelog
|
|
38
42
|
# The following regexp ensure that the issue or contributor is
|
39
43
|
# not wrapped between brackets (aka: is a link)
|
40
44
|
ISSUE_NUMBER_REGEXP = /(^|[^\[])#(\d+)($|[^\]])/
|
41
|
-
CONTRIBUTOR_REGEXP = /(^|[^\[])@(\w+)($|[^\]])/
|
45
|
+
CONTRIBUTOR_REGEXP = /(^|[^\[])@([\w-]+)($|[^\]])/
|
42
46
|
|
43
47
|
# @param [Array] issues An array of issue numbers
|
44
48
|
# @param [Array] contributors An array of contributors github ids
|
data/pimpmychangelog.gemspec
CHANGED
@@ -5,6 +5,7 @@ require "pimpmychangelog/version"
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "pimpmychangelog"
|
7
7
|
s.version = PimpMyChangelog::VERSION
|
8
|
+
s.license = 'MIT'
|
8
9
|
s.authors = ["Philippe Creux"]
|
9
10
|
s.email = ["pcreux@gmail.com"]
|
10
11
|
s.homepage = "https://github.com/pcreux/pimpmychangelog"
|
@@ -19,5 +20,7 @@ Gem::Specification.new do |s|
|
|
19
20
|
s.require_paths = ["lib"]
|
20
21
|
|
21
22
|
s.add_development_dependency "rspec"
|
23
|
+
s.add_development_dependency "rspec-its"
|
22
24
|
s.add_development_dependency "guard-rspec"
|
25
|
+
s.add_development_dependency "rake"
|
23
26
|
end
|
data/spec/git_remote_spec.rb
CHANGED
@@ -1,8 +1,26 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe GitRemote do
|
4
|
-
context "when
|
4
|
+
context "when passed a SSH url to a repo" do
|
5
|
+
subject { described_class.new('git@github.com:pcreux/pimpmychangelog.git') }
|
6
|
+
|
7
|
+
its(:user) { should == 'pcreux' }
|
8
|
+
its(:project) { should == 'pimpmychangelog' }
|
9
|
+
end
|
10
|
+
|
11
|
+
context "when passed a HTTPS url to a repo" do
|
12
|
+
subject { described_class.new('https://github.com/pcreux/pimpmychangelog.git') }
|
13
|
+
|
5
14
|
its(:user) { should == 'pcreux' }
|
6
15
|
its(:project) { should == 'pimpmychangelog' }
|
7
16
|
end
|
17
|
+
|
18
|
+
context "when no URL is passed" do
|
19
|
+
subject { described_class.new }
|
20
|
+
|
21
|
+
# We can't match an exact user, as this depends on who
|
22
|
+
# has checked out this repository.
|
23
|
+
its(:user) { should be_a(String) }
|
24
|
+
its(:project) { should == 'pimpmychangelog' }
|
25
|
+
end
|
8
26
|
end
|
data/spec/parser_spec.rb
CHANGED
@@ -49,8 +49,8 @@ EOS
|
|
49
49
|
|
50
50
|
describe "#contributors" do
|
51
51
|
it "should return a sorted list of unique contributors" do
|
52
|
-
Parser.new("@samvincent @pcreux @gregbell @pcreux").contributors.
|
53
|
-
should == ['gregbell', 'pcreux', 'samvincent']
|
52
|
+
Parser.new("@samvincent @pcreux @gregbell @pcreux @dash-and_underscore").contributors.
|
53
|
+
should == ['dash-and_underscore', 'gregbell', 'pcreux', 'samvincent']
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
data/spec/pimper_spec.rb
CHANGED
@@ -18,8 +18,16 @@ describe Pimper do
|
|
18
18
|
|
19
19
|
subject { better_changelog }
|
20
20
|
|
21
|
-
context "when the changelog does not contain any reference to issues or users" do
|
22
|
-
let(:changelog) {
|
21
|
+
context "when the changelog does not contain any reference to issues or users and no extra newline" do
|
22
|
+
let(:changelog) { "ChangeLog\n" }
|
23
|
+
|
24
|
+
it "should return the original changelog with an extra newline" do
|
25
|
+
better_changelog.should == changelog + "\n"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "when the changelog already includes an extra newline" do
|
30
|
+
let(:changelog) { "ChangeLog\n\n" }
|
23
31
|
|
24
32
|
it "should return the original changelog" do
|
25
33
|
better_changelog.should == changelog
|
@@ -39,14 +47,14 @@ describe Pimper do
|
|
39
47
|
end
|
40
48
|
|
41
49
|
context "when the changelog contains a contributor" do
|
42
|
-
let(:changelog) { 'New feature by @
|
50
|
+
let(:changelog) { 'New feature by @pc-re_ux' }
|
43
51
|
|
44
52
|
it "should wrap the issue number to make a link" do
|
45
|
-
better_changelog.should include("[@
|
53
|
+
better_changelog.should include("[@pc-re_ux][]")
|
46
54
|
end
|
47
55
|
|
48
56
|
it "should append the link definition at the end of the changelog" do
|
49
|
-
better_changelog.split("\n").last.should == "[@
|
57
|
+
better_changelog.split("\n").last.should == "[@pc-re_ux]: https://github.com/pc-re_ux"
|
50
58
|
end
|
51
59
|
end
|
52
60
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,64 +1,85 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: pimpmychangelog
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
version: 0.0.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Philippe Creux
|
14
|
-
autorequire:
|
8
|
+
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2021-01-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
22
21
|
prerelease: false
|
23
|
-
|
24
|
-
|
25
|
-
requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
26
24
|
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec-its
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
32
34
|
type: :development
|
33
|
-
|
34
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
35
42
|
name: guard-rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
36
49
|
prerelease: false
|
37
|
-
|
38
|
-
|
39
|
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
40
59
|
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
segments:
|
44
|
-
- 0
|
45
|
-
version: "0"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
46
62
|
type: :development
|
47
|
-
|
48
|
-
|
49
|
-
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Linkify issue numbers (#123) and github users (@gregbell) in markdown
|
70
|
+
changelogs.
|
71
|
+
email:
|
50
72
|
- pcreux@gmail.com
|
51
|
-
executables:
|
73
|
+
executables:
|
52
74
|
- pimpmychangelog
|
53
75
|
extensions: []
|
54
|
-
|
55
76
|
extra_rdoc_files: []
|
56
|
-
|
57
|
-
|
58
|
-
- .gitignore
|
77
|
+
files:
|
78
|
+
- ".gitignore"
|
59
79
|
- CHANGELOG.md
|
60
80
|
- Gemfile
|
61
81
|
- Guardfile
|
82
|
+
- LICENSE
|
62
83
|
- README.md
|
63
84
|
- Rakefile
|
64
85
|
- bin/pimpmychangelog
|
@@ -75,37 +96,31 @@ files:
|
|
75
96
|
- spec/pimper_spec.rb
|
76
97
|
- spec/spec_helper.rb
|
77
98
|
homepage: https://github.com/pcreux/pimpmychangelog
|
78
|
-
licenses:
|
79
|
-
|
80
|
-
|
99
|
+
licenses:
|
100
|
+
- MIT
|
101
|
+
metadata: {}
|
102
|
+
post_install_message:
|
81
103
|
rdoc_options: []
|
82
|
-
|
83
|
-
require_paths:
|
104
|
+
require_paths:
|
84
105
|
- lib
|
85
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
-
|
87
|
-
requirements:
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
88
108
|
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
version: "0"
|
94
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
|
-
requirements:
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
97
113
|
- - ">="
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
|
100
|
-
segments:
|
101
|
-
- 0
|
102
|
-
version: "0"
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
103
116
|
requirements: []
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
signing_key:
|
108
|
-
specification_version: 3
|
117
|
+
rubygems_version: 3.0.3
|
118
|
+
signing_key:
|
119
|
+
specification_version: 4
|
109
120
|
summary: Pimp your CHANGELOG.md
|
110
|
-
test_files:
|
111
|
-
|
121
|
+
test_files:
|
122
|
+
- spec/cli_spec.rb
|
123
|
+
- spec/git_remote_spec.rb
|
124
|
+
- spec/parser_spec.rb
|
125
|
+
- spec/pimper_spec.rb
|
126
|
+
- spec/spec_helper.rb
|