structured_changelog 0.8.3 → 0.10.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/CHANGELOG.md +10 -8
- data/README.md +67 -18
- data/lib/structured_changelog/core_ext/gem.rb +33 -0
- data/lib/structured_changelog/core_ext/string.rb +9 -0
- data/lib/structured_changelog/tasks/compile.rb +42 -0
- data/lib/structured_changelog/tasks/prep.rb +7 -0
- data/lib/structured_changelog/tasks/release.rb +1 -4
- data/lib/structured_changelog/tasks/sync.rb +1 -1
- data/lib/structured_changelog/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cfa0269a454722bb8144fee70626dbd4afddcb5
|
4
|
+
data.tar.gz: cd69bdcbdf0a54b210868bf7476b2fd92b759665
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb59d3cd247e5618d277e173d067b23037935d8c008ec84c7b907ffb39c1cdabf5e473caffb8bd8b23915dd3414503fcd8de3aed2b1972200a9891d2d0e10958
|
7
|
+
data.tar.gz: 43512333d80038357eeba472bfa991e33f3f35181474d13def7a716a526d980fd8c501ed3426cdef47c800cd7b86e7320bef427b2c76adc993385dfe450da470
|
data/CHANGELOG.md
CHANGED
@@ -1,16 +1,18 @@
|
|
1
|
-
## ROADMAP
|
1
|
+
## ROADMAP
|
2
2
|
|
3
3
|
* investigate partial parsing of a file if parsing slows down *too much* on large changelogs
|
4
|
-
|
5
|
-
## ROADMAP 1.0.0
|
6
|
-
|
7
|
-
* consider moving from BREAKING/FEATURE/FIX to MAJOR/MINOR/PATCH
|
8
|
-
* validate that each line starts with BREAKING:/FEATURE:/FIX:
|
9
|
-
* validate that each release has the appropriate version
|
10
|
-
* validate that release numbers increase monotonically
|
4
|
+
* validate that each line starts with BREAKING/FEATURE/FIX/ENHANCEMENT/DEPRECATION
|
11
5
|
* require release block lines to be ordered in descending severity
|
12
6
|
* disable strict semver version validation before 1.0.0
|
13
7
|
|
8
|
+
## RELEASE 0.10.0
|
9
|
+
|
10
|
+
* FEATURE: `changelog:compile` task that pulls all `[CHANGELOG]` commit messages since the last release, determines the minimum necessary release version, and appends a new section to the top of the releases in the changelog. See the README for more information.
|
11
|
+
|
12
|
+
## RELEASE 0.9.0
|
13
|
+
|
14
|
+
* FEATURE: `changelog:prep` task that performs `changelog:validate`, `changelog:sync`, and `changelog:commit`.
|
15
|
+
|
14
16
|
## RELEASE 0.8.3
|
15
17
|
|
16
18
|
* FIX: `Gemfile.lock` now gets updated with the new version before `changelog:commit` runs during `changelog:release`
|
data/README.md
CHANGED
@@ -8,40 +8,67 @@ Add this to your Rakefile:
|
|
8
8
|
require 'structured_changelog/tasks'
|
9
9
|
```
|
10
10
|
|
11
|
-
|
11
|
+
## With A Single Contributor
|
12
12
|
|
13
|
-
|
14
|
-
2. sets your gem's `VERSION` constant to the latest release version specified by your `CHANGELOG.md`
|
15
|
-
3. commits that version bump
|
16
|
-
4. runs `rake release`
|
13
|
+
If you have a single-contributor project, you can simply add release lines to `CHANGELOG.md`:
|
17
14
|
|
18
|
-
|
15
|
+
```
|
16
|
+
* FEATURE: we added a new thing
|
17
|
+
* FIX: we fixed a broken thing
|
18
|
+
```
|
19
19
|
|
20
|
-
|
20
|
+
then when you want to cut a release, add a `"## RELEASE X.Y.Z"` section, making the above look like:
|
21
21
|
|
22
|
-
|
22
|
+
```
|
23
|
+
## RELEASE X.Y.Z
|
23
24
|
|
24
|
-
|
25
|
+
* FEATURE: we added a new thing
|
26
|
+
* FIX: we fixed a broken thing
|
27
|
+
```
|
25
28
|
|
26
|
-
|
27
|
-
|
28
|
-
To update your gem's `VERSION` constant to the latest release in your Changelog:
|
29
|
+
and run
|
29
30
|
|
30
|
-
$ rake changelog:
|
31
|
+
$ rake changelog:release
|
31
32
|
|
32
|
-
|
33
|
+
This will:
|
33
34
|
|
34
|
-
|
35
|
+
1. validate your `CHANGELOG.md`
|
36
|
+
2. set your gem's `VERSION` constant to the latest release version specified by your `CHANGELOG.md`
|
37
|
+
3. commit that version bump
|
38
|
+
4. package your gem and push it to the specified gem server (rubygems.org by default)
|
35
39
|
|
36
|
-
|
40
|
+
## With Multiple Contributors
|
37
41
|
|
38
|
-
|
42
|
+
If you have multiple contributors, and you follow the single-contributor workflow, you'll end up with conflicts every time multiple people go to add a line to the changelog. We have a separate workflow for you.
|
43
|
+
|
44
|
+
When you want to add changelog lines, instead of adding it directly to the changelog, write a git commit:
|
45
|
+
|
46
|
+
```
|
47
|
+
[CHANGELOG]
|
48
|
+
|
49
|
+
* FEATURE: we added a new thing
|
50
|
+
* FIX: we fixed a thing that was broken
|
51
|
+
```
|
52
|
+
|
53
|
+
The commit message needs to start with `[CHANGELOG]\n\n` and each line should start with `* BREAKING: `, `* FEATURE: `, `* FIX: `, `* ENHANCEMENT: `, or `* DEPRECATION: `.
|
54
|
+
|
55
|
+
Then, when you're ready to cut a release, run:
|
56
|
+
|
57
|
+
$ rake changelog:compile
|
58
|
+
|
59
|
+
This will pull all the `[CHANGELOG]` commit message bodies you've written since the last release from the commit log, and create a new release section in your changelog. It will have the minimum version possible given the change types (BREAKING is a major bump, FEATURE is a minor bump, and FIX, ENHANCEMENT, and DEPRECATION are all patch bumps). Once the rake task has written the new section to the changelog, it's often beneficial to give it a look and make sure it's free of typos and any other mistakes. Then, run
|
60
|
+
|
61
|
+
$ rake changelog:release
|
62
|
+
|
63
|
+
as usual to actually release your gem.
|
64
|
+
|
65
|
+
## Viewing Release Notes
|
39
66
|
|
40
67
|
To view the release notes of the current release:
|
41
68
|
|
42
69
|
$ rake changelog:notes
|
43
70
|
$ rake changelog:notes[current]
|
44
|
-
|
71
|
+
|
45
72
|
To view the release notes of every release:
|
46
73
|
|
47
74
|
$ rake changelog:notes[all]
|
@@ -70,6 +97,28 @@ To view the last N releases:
|
|
70
97
|
|
71
98
|
$ rake changelog:recent[N]
|
72
99
|
|
100
|
+
## Other Rake Tasks
|
101
|
+
|
102
|
+
To determine the version of the latest release *according to the Changelog*:
|
103
|
+
|
104
|
+
$ rake changelog:version
|
105
|
+
|
106
|
+
To validate your changelog:
|
107
|
+
|
108
|
+
$ rake changelog:validate
|
109
|
+
|
110
|
+
To update your gem's `VERSION` constant to the latest release in your Changelog:
|
111
|
+
|
112
|
+
$ rake changelog:sync
|
113
|
+
|
114
|
+
To commit your version bump--and only your version bump:
|
115
|
+
|
116
|
+
$ rake changelog:commit
|
117
|
+
|
118
|
+
To do everything but release your code (so that it can go through a PR for CI, for instance):
|
119
|
+
|
120
|
+
$ rake changelog:prep
|
121
|
+
|
73
122
|
## Installation
|
74
123
|
|
75
124
|
Add this line to your application's Gemfile:
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class StructuredChangelog
|
2
|
+
module VersionInstanceMethods
|
3
|
+
def bump_major
|
4
|
+
bump_at_segment_index(0)
|
5
|
+
end
|
6
|
+
|
7
|
+
def bump_minor
|
8
|
+
bump_at_segment_index(1)
|
9
|
+
end
|
10
|
+
|
11
|
+
def bump_patch
|
12
|
+
bump_at_segment_index(2)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def bump_at_segment_index(index)
|
18
|
+
unbumped_segments = segments[0...index]
|
19
|
+
bumped_segment = [segments[index] + 1]
|
20
|
+
# zero out the remaining segments until we hit a non-numeric (rc, say) segment
|
21
|
+
trailing_zeroes = [0] * segments[(index + 1)..-1].take_while { |x| x.is_a?(Fixnum) }.size
|
22
|
+
|
23
|
+
bumped_segments =
|
24
|
+
unbumped_segments +
|
25
|
+
bumped_segment +
|
26
|
+
trailing_zeroes
|
27
|
+
|
28
|
+
self.class.new(bumped_segments.join('.'))
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
Gem::Version.send(:include, StructuredChangelog::VersionInstanceMethods)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'structured_changelog'
|
2
|
+
require 'structured_changelog/core_ext/string'
|
3
|
+
require 'structured_changelog/core_ext/gem'
|
4
|
+
require 'git'
|
5
|
+
|
6
|
+
task "changelog:compile", [:repo_path, :changelog_path] do |_task, arguments|
|
7
|
+
repo_path = arguments.to_h.fetch(:repo_path) { Pathname.pwd }
|
8
|
+
changelog_path = arguments.to_h.fetch(:changelog_path) { Pathname.pwd/"CHANGELOG.md" }
|
9
|
+
|
10
|
+
current_version = StructuredChangelog.new(changelog_path).version
|
11
|
+
|
12
|
+
repo = Git.open(repo_path)
|
13
|
+
|
14
|
+
commit_messages = repo.log.since("v#{current_version}").map(&:message).select do |message|
|
15
|
+
message.match?(/^\[CHANGELOG\]\n\n\*\ /)
|
16
|
+
end
|
17
|
+
|
18
|
+
abort("No [CHANGELOG] commits since the last release") if commit_messages.empty?
|
19
|
+
|
20
|
+
message = commit_messages.flat_map do |message|
|
21
|
+
message.sub(/^\[CHANGELOG\]\n\n/, "")
|
22
|
+
end.join("\n")
|
23
|
+
|
24
|
+
new_version = if message.match?(/^*\ BREAKING:/)
|
25
|
+
current_version.bump_major
|
26
|
+
elsif message.match?(/^*\ FEATURE:/)
|
27
|
+
current_version.bump_minor
|
28
|
+
elsif message.match?(/^*\ FIX:/)
|
29
|
+
current_version.bump_patch
|
30
|
+
elsif message.match?(/^*\ ENHANCEMENT:/)
|
31
|
+
current_version.bump_patch
|
32
|
+
elsif message.match?(/^*\ DEPRECATION:/)
|
33
|
+
current_version.bump_patch
|
34
|
+
end
|
35
|
+
|
36
|
+
changelog_path.write(
|
37
|
+
changelog_path.read.sub(
|
38
|
+
/^##\ RELEASE\ #{current_version}/,
|
39
|
+
"## RELEASE #{new_version}\n\n#{message}\n\n## RELEASE #{current_version}"
|
40
|
+
)
|
41
|
+
)
|
42
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
desc "Validates your Changelog, updates your VERSION constant, then commits that (when you want to PR releases)"
|
2
|
+
task "changelog:prep", [:repo_path, :changelog_path, :version_path] do |_task, arguments|
|
3
|
+
Rake::Task['changelog:validate'].execute(arguments)
|
4
|
+
Rake::Task['changelog:sync'].execute(arguments)
|
5
|
+
`bundle`
|
6
|
+
Rake::Task['changelog:commit'].execute(arguments)
|
7
|
+
end
|
@@ -1,9 +1,6 @@
|
|
1
1
|
desc "Validates your Changelog, updates your VERSION constant, commits that, then releases your gem."
|
2
2
|
task 'changelog:release', [:repo_path, :changelog_path, :version_path] do |_task, arguments|
|
3
|
-
Rake::Task['changelog:
|
4
|
-
Rake::Task['changelog:sync'].execute(arguments)
|
5
|
-
`bundle`
|
6
|
-
Rake::Task['changelog:commit'].execute(arguments)
|
3
|
+
Rake::Task['changelog:prep'].execute(arguments)
|
7
4
|
|
8
5
|
# Merely requiring `bundler/gem_tasks` instantiates & caches a gemspec. At this point in this code,
|
9
6
|
# it's already set and attached to the `Bundler::GemHelper` module. In fact, it's there before this
|
@@ -4,7 +4,7 @@ require 'structured_changelog/version_pattern'
|
|
4
4
|
desc "Set the gem's VERSION constant to be the changelog's version"
|
5
5
|
task 'changelog:sync', [:changelog_path, :version_path] do |_task, arguments|
|
6
6
|
changelog_path = arguments.to_h.fetch(:changelog_path) { "CHANGELOG.md" }
|
7
|
-
version_path = arguments.to_h.fetch(:version_path) { "lib/#{Pathname.pwd.basename}/version.rb"}
|
7
|
+
version_path = arguments.to_h.fetch(:version_path) { "lib/#{Pathname.pwd.basename}/version.rb" }
|
8
8
|
|
9
9
|
changelog = StructuredChangelog.new(changelog_path)
|
10
10
|
version_file = Pathname.new(version_path)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: structured_changelog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Hoffman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -126,6 +126,8 @@ files:
|
|
126
126
|
- bin/console
|
127
127
|
- bin/setup
|
128
128
|
- lib/structured_changelog.rb
|
129
|
+
- lib/structured_changelog/core_ext/gem.rb
|
130
|
+
- lib/structured_changelog/core_ext/string.rb
|
129
131
|
- lib/structured_changelog/release.rb
|
130
132
|
- lib/structured_changelog/release_filters.rb
|
131
133
|
- lib/structured_changelog/release_filters/base.rb
|
@@ -138,7 +140,9 @@ files:
|
|
138
140
|
- lib/structured_changelog/roadmap.rb
|
139
141
|
- lib/structured_changelog/tasks.rb
|
140
142
|
- lib/structured_changelog/tasks/commit.rb
|
143
|
+
- lib/structured_changelog/tasks/compile.rb
|
141
144
|
- lib/structured_changelog/tasks/notes.rb
|
145
|
+
- lib/structured_changelog/tasks/prep.rb
|
142
146
|
- lib/structured_changelog/tasks/recent.rb
|
143
147
|
- lib/structured_changelog/tasks/release.rb
|
144
148
|
- lib/structured_changelog/tasks/sync.rb
|
@@ -166,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
170
|
version: '0'
|
167
171
|
requirements: []
|
168
172
|
rubyforge_project:
|
169
|
-
rubygems_version: 2.6.
|
173
|
+
rubygems_version: 2.6.12
|
170
174
|
signing_key:
|
171
175
|
specification_version: 4
|
172
176
|
summary: A useful changelog, for a change.
|