pr_changelog 0.2.0 → 0.3.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 +4 -4
- data/.pr_changelog.json +3 -0
- data/Gemfile.lock +1 -1
- data/README.md +34 -0
- data/lib/pr_changelog/cli/args.rb +35 -0
- data/lib/pr_changelog/cli.rb +28 -10
- data/lib/pr_changelog/git_proxy.rb +4 -0
- data/lib/pr_changelog/releases.rb +19 -0
- data/lib/pr_changelog/version.rb +1 -1
- data/lib/pr_changelog.rb +2 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f16ba9dc24c0c5dabc4c5fca81029b448cfe69b
|
4
|
+
data.tar.gz: e8741e1311983a40178e926ae136827b8dac9762
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc7720777b84d891f0c9c303389e31dc34027359a82e4498f4bacdadcaa01a1c44a88766846e00485f8d01c50d2684c0aa2e206270c090e47e4a8f80d66e3f65
|
7
|
+
data.tar.gz: d6e06054a145f429cb77d931734901ae457b9de5f36b0db45efac1ba6ca3735fbf6f7d44452171ecb38c89684c9ad91e00159f63beb7f9a6e9026ff14fd84672
|
data/.pr_changelog.json
ADDED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -100,6 +100,40 @@ Will produce:
|
|
100
100
|
- #60: 👨💻 Setup hockeyapp for crash reporting
|
101
101
|
```
|
102
102
|
|
103
|
+
It's also possible to not pass any git references if you have sorted git tags. For example, if currently in your project you have the following tags:
|
104
|
+
|
105
|
+
```
|
106
|
+
$ git tag -l
|
107
|
+
0.1.0
|
108
|
+
0.1.1
|
109
|
+
0.2.0
|
110
|
+
0.2.1
|
111
|
+
0.2.2
|
112
|
+
```
|
113
|
+
|
114
|
+
Then you can get the changes from the last release to `'master'` with:
|
115
|
+
|
116
|
+
```
|
117
|
+
$ pr_changelog
|
118
|
+
|
119
|
+
## Changes since 0.2.2 to master
|
120
|
+
|
121
|
+
...
|
122
|
+
```
|
123
|
+
|
124
|
+
If you want to get the changes for the last release (between `0.2.1` and `0.2.2`) you can execute:
|
125
|
+
|
126
|
+
```
|
127
|
+
$ pr_changelog --last-release
|
128
|
+
|
129
|
+
## Changes since 0.2.1 to 0.2.2
|
130
|
+
|
131
|
+
...
|
132
|
+
```
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
103
137
|
## Configuration
|
104
138
|
|
105
139
|
Change the emojis or add your own in a `.pr_changelog.json` file:
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PrChangelog
|
4
|
+
class CLI
|
5
|
+
# A simple wrapper over ARGV that is passed to the CLI class
|
6
|
+
class Args
|
7
|
+
def initialize(raw_args)
|
8
|
+
@raw_args = raw_args
|
9
|
+
end
|
10
|
+
|
11
|
+
def include?(flag)
|
12
|
+
raw_args.include?(flag)
|
13
|
+
end
|
14
|
+
|
15
|
+
def value_for(flag)
|
16
|
+
return nil unless raw_args.index(flag)
|
17
|
+
|
18
|
+
next_index = raw_args.index(flag) + 1
|
19
|
+
value = raw_args.delete_at(next_index)
|
20
|
+
raw_args.delete(flag)
|
21
|
+
value
|
22
|
+
end
|
23
|
+
|
24
|
+
def include_flags?(flag, flag_variation)
|
25
|
+
include?(flag) || include?(flag_variation)
|
26
|
+
end
|
27
|
+
|
28
|
+
def last(number)
|
29
|
+
raw_args.last(number)
|
30
|
+
end
|
31
|
+
|
32
|
+
attr_reader :raw_args
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/pr_changelog/cli.rb
CHANGED
@@ -9,13 +9,22 @@ module PrChangelog
|
|
9
9
|
[Options]
|
10
10
|
|
11
11
|
-h, --help\tShow this help
|
12
|
+
-l, --last-release\tSets from_reference and to_reference to the last release and the previous one
|
12
13
|
--format FORMAT_NAME\t(default "plain"), options ("pretty", "plain")
|
13
14
|
|
14
15
|
[Examples]
|
15
16
|
|
16
|
-
Listing the changes
|
17
|
+
Listing the unreleased changes
|
17
18
|
|
18
19
|
$ pr_changelog
|
20
|
+
|
21
|
+
Listing the changes from the last release
|
22
|
+
|
23
|
+
$ pr_changelog --last-release
|
24
|
+
|
25
|
+
Listing the changes between two given git references
|
26
|
+
|
27
|
+
$ pr_changelog reference_A reference_B
|
19
28
|
HELP
|
20
29
|
|
21
30
|
class InvalidInputs < StandardError
|
@@ -26,22 +35,31 @@ module PrChangelog
|
|
26
35
|
|
27
36
|
attr_reader :format, :from_reference, :to_reference
|
28
37
|
|
29
|
-
|
30
|
-
|
38
|
+
class CannotDetermineRelease < StandardError
|
39
|
+
end
|
31
40
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
41
|
+
def initialize(raw_args, releases = nil)
|
42
|
+
args = Args.new(raw_args)
|
43
|
+
raise HelpWanted if args.include_flags?('-h', '--help')
|
44
|
+
|
45
|
+
@format = args.value_for('--format') || PrChangelog.config.default_format
|
46
|
+
|
47
|
+
@releases = releases || Releases.new
|
38
48
|
|
39
49
|
@from_reference, @to_reference = args.last(2)
|
50
|
+
@from_reference ||= @releases.last_release
|
40
51
|
@to_reference ||= 'master'
|
41
52
|
|
53
|
+
if args.include_flags?('-l', '--last-release')
|
54
|
+
last_release_pair = @releases.last_release_pair
|
55
|
+
raise CannotDetermineRelease if last_release_pair.length != 2
|
56
|
+
|
57
|
+
@from_reference, @to_reference = last_release_pair
|
58
|
+
end
|
59
|
+
|
42
60
|
return if @from_reference && @to_reference
|
43
61
|
|
44
|
-
|
62
|
+
raise InvalidInputs
|
45
63
|
end
|
46
64
|
|
47
65
|
def run
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PrChangelog
|
4
|
+
class Releases
|
5
|
+
attr_reader :git_proxy
|
6
|
+
|
7
|
+
def initialize(git_proxy = GitProxy.new)
|
8
|
+
@git_proxy = git_proxy
|
9
|
+
end
|
10
|
+
|
11
|
+
def last_release
|
12
|
+
git_proxy.git_tags_list.last
|
13
|
+
end
|
14
|
+
|
15
|
+
def last_release_pair
|
16
|
+
git_proxy.git_tags_list.last(2)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/pr_changelog/version.rb
CHANGED
data/lib/pr_changelog.rb
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'pr_changelog/version'
|
4
4
|
require 'pr_changelog/config'
|
5
5
|
require 'pr_changelog/extensions/string'
|
6
|
+
require 'pr_changelog/releases'
|
7
|
+
require 'pr_changelog/cli/args'
|
6
8
|
require 'pr_changelog/cli'
|
7
9
|
require 'pr_changelog/git_proxy'
|
8
10
|
require 'pr_changelog/tag'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pr_changelog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felipe Espinoza
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -75,6 +75,7 @@ extensions: []
|
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
77
|
- ".gitignore"
|
78
|
+
- ".pr_changelog.json"
|
78
79
|
- ".travis.yml"
|
79
80
|
- CODE_OF_CONDUCT.md
|
80
81
|
- Gemfile
|
@@ -88,11 +89,13 @@ files:
|
|
88
89
|
- lib/pr_changelog.rb
|
89
90
|
- lib/pr_changelog/change_line.rb
|
90
91
|
- lib/pr_changelog/cli.rb
|
92
|
+
- lib/pr_changelog/cli/args.rb
|
91
93
|
- lib/pr_changelog/config.rb
|
92
94
|
- lib/pr_changelog/extensions/string.rb
|
93
95
|
- lib/pr_changelog/git_proxy.rb
|
94
96
|
- lib/pr_changelog/grouped_changes.rb
|
95
97
|
- lib/pr_changelog/not_released_changes.rb
|
98
|
+
- lib/pr_changelog/releases.rb
|
96
99
|
- lib/pr_changelog/tag.rb
|
97
100
|
- lib/pr_changelog/version.rb
|
98
101
|
- pr_changelog.gemspec
|