pimpmychangelog 0.0.1 → 0.0.2
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.
- data/CHANGELOG.md +15 -0
- data/README.md +32 -0
- data/bin/pimpmychangelog +1 -1
- data/lib/pimpmychangelog.rb +1 -1
- data/lib/pimpmychangelog/cli.rb +32 -13
- data/lib/pimpmychangelog/git_remote.rb +22 -0
- data/lib/pimpmychangelog/version.rb +1 -1
- data/spec/cli_spec.rb +5 -0
- data/spec/git_remote_spec.rb +8 -0
- data/spec/pimper_spec.rb +2 -2
- metadata +11 -8
data/CHANGELOG.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## Version 0.0.2
|
4
|
+
|
5
|
+
* CLI does not accept any options anymore
|
6
|
+
* Github user and projects are extracted from the origin remote fetch
|
7
|
+
url
|
8
|
+
* CHANGELOG.md is overwritten instead of printed out. #1
|
9
|
+
|
10
|
+
|
11
|
+
## Version 0.0.1
|
12
|
+
|
13
|
+
* Initial version by @pcreux
|
14
|
+
* Usage: `pimpmychangelog gregbell activeadmin CHANGELOG.md`
|
15
|
+
This would output the pimped version of the changelog.
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
## Pimp My Changelog
|
2
|
+
|
3
|
+
Add links to users and issues in your CHANGELOG.md.
|
4
|
+
|
5
|
+
### Example:
|
6
|
+
|
7
|
+
> Add Travis-CI support. (@pcreux, #181)
|
8
|
+
|
9
|
+
becomes:
|
10
|
+
|
11
|
+
> Add Travis-CI support. ([@pcreux][], [#181][])
|
12
|
+
<!--- The following link definition list is generated by PimpMyChangelog --->
|
13
|
+
[#181]: https://github.com/gregbell/active_admin/issues/181
|
14
|
+
[@pcreux]: https://github.com/pcreux
|
15
|
+
|
16
|
+
|
17
|
+
### Usage:
|
18
|
+
|
19
|
+
Install:
|
20
|
+
|
21
|
+
gem install pimpmychangelog
|
22
|
+
|
23
|
+
Go in your project directory and run:
|
24
|
+
|
25
|
+
pimpmychangelog
|
26
|
+
# => Your changelog is now pimped!
|
27
|
+
|
28
|
+
Notes:
|
29
|
+
|
30
|
+
* We assume the CHANGELOG file is `CHANGELOG.md`
|
31
|
+
* We assume origin points to the github repository that the issues
|
32
|
+
belong to.
|
data/bin/pimpmychangelog
CHANGED
data/lib/pimpmychangelog.rb
CHANGED
data/lib/pimpmychangelog/cli.rb
CHANGED
@@ -1,24 +1,43 @@
|
|
1
1
|
module PimpMyChangelog
|
2
2
|
class CLI
|
3
|
-
def self.run!
|
4
|
-
|
5
|
-
|
6
|
-
exit 1
|
7
|
-
end
|
3
|
+
def self.run!
|
4
|
+
new.run
|
5
|
+
end
|
8
6
|
|
9
|
-
|
7
|
+
def initialize
|
8
|
+
@git_remote = GitRemote.new
|
10
9
|
end
|
11
10
|
|
12
|
-
|
11
|
+
def run
|
12
|
+
changelog = read_changelog
|
13
|
+
puts changelog
|
14
|
+
puts ""
|
15
|
+
puts "In case something goes wrong we printed out your current #{changelog_path} above"
|
13
16
|
|
14
|
-
|
15
|
-
|
16
|
-
@project = project
|
17
|
-
@changelog_path = changelog_path
|
17
|
+
write_changelog(Pimper.new(user, project, changelog).better_changelog)
|
18
|
+
puts "Your changelog is now pimped!"
|
18
19
|
end
|
19
20
|
|
20
|
-
|
21
|
-
|
21
|
+
private
|
22
|
+
|
23
|
+
def user
|
24
|
+
@git_remote.user
|
25
|
+
end
|
26
|
+
|
27
|
+
def project
|
28
|
+
@git_remote.project
|
29
|
+
end
|
30
|
+
|
31
|
+
def changelog_path
|
32
|
+
"CHANGELOG.md"
|
33
|
+
end
|
34
|
+
|
35
|
+
def read_changelog
|
36
|
+
File.read(changelog_path)
|
37
|
+
end
|
38
|
+
|
39
|
+
def write_changelog(content)
|
40
|
+
File.open(changelog_path, 'w') { |f| f.write content }
|
22
41
|
end
|
23
42
|
end
|
24
43
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class GitRemote
|
2
|
+
def initialize
|
3
|
+
match = fetch_url.match(/(\w+)\/(\w+)/)
|
4
|
+
@user = match[1]
|
5
|
+
@project = match[2]
|
6
|
+
unless @user && @project
|
7
|
+
raise "Can't extract github user and project from origin remote"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
attr_reader :user, :project
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def fetch_url
|
16
|
+
@fetch_url ||= run_command.split(' ').last
|
17
|
+
end
|
18
|
+
|
19
|
+
def run_command
|
20
|
+
`git remote show origin | grep "Fetch URL"`
|
21
|
+
end
|
22
|
+
end
|
data/spec/cli_spec.rb
ADDED
data/spec/pimper_spec.rb
CHANGED
@@ -67,7 +67,7 @@ You know what? @pcreux closed issue #300!
|
|
67
67
|
You know what? [@pcreux][] closed issue [#123][].
|
68
68
|
And this is my link, don't touch it: [Adequate][http://adequatehq.com]
|
69
69
|
|
70
|
-
<!--- The following link
|
70
|
+
<!--- The following link definition list is generated by PimpMyChangelog --->
|
71
71
|
[#123]: https://github.com/gregbell/activeadmin/issues/123
|
72
72
|
[@pcreux]: https://github.com/pcreux
|
73
73
|
EOS
|
@@ -84,7 +84,7 @@ You know what? [@pcreux][] closed issue [#300][]!
|
|
84
84
|
You know what? [@pcreux][] closed issue [#123][].
|
85
85
|
And this is my link, don't touch it: [Adequate][http://adequatehq.com]
|
86
86
|
|
87
|
-
<!--- The following link
|
87
|
+
<!--- The following link definition list is generated by PimpMyChangelog --->
|
88
88
|
[#123]: https://github.com/gregbell/activeadmin/issues/123
|
89
89
|
[#300]: https://github.com/gregbell/activeadmin/issues/300
|
90
90
|
[@pcreux]: https://github.com/pcreux
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pimpmychangelog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Philippe Creux
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable: pimpmychangelog
|
18
|
+
date: 2011-12-12 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: rspec
|
@@ -57,20 +56,24 @@ extra_rdoc_files: []
|
|
57
56
|
|
58
57
|
files:
|
59
58
|
- .gitignore
|
59
|
+
- CHANGELOG.md
|
60
60
|
- Gemfile
|
61
61
|
- Guardfile
|
62
|
+
- README.md
|
62
63
|
- Rakefile
|
63
64
|
- bin/pimpmychangelog
|
64
65
|
- lib/pimpmychangelog.rb
|
65
66
|
- lib/pimpmychangelog/cli.rb
|
67
|
+
- lib/pimpmychangelog/git_remote.rb
|
66
68
|
- lib/pimpmychangelog/parser.rb
|
67
69
|
- lib/pimpmychangelog/pimper.rb
|
68
70
|
- lib/pimpmychangelog/version.rb
|
69
71
|
- pimpmychangelog.gemspec
|
72
|
+
- spec/cli_spec.rb
|
73
|
+
- spec/git_remote_spec.rb
|
70
74
|
- spec/parser_spec.rb
|
71
75
|
- spec/pimper_spec.rb
|
72
76
|
- spec/spec_helper.rb
|
73
|
-
has_rdoc: true
|
74
77
|
homepage: https://github.com/pcreux/pimpmychangelog
|
75
78
|
licenses: []
|
76
79
|
|
@@ -100,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
103
|
requirements: []
|
101
104
|
|
102
105
|
rubyforge_project:
|
103
|
-
rubygems_version: 1.
|
106
|
+
rubygems_version: 1.8.11
|
104
107
|
signing_key:
|
105
108
|
specification_version: 3
|
106
109
|
summary: Pimp your CHANGELOG.md
|