structured_changelog 0.8.0 → 0.8.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 664aee7c11b7b9ca26529a0a8b2e008598684c74
4
- data.tar.gz: e5178e0f57a8b66084b0ddf231f78b6d32867c09
3
+ metadata.gz: ac7ccb6be19c589aa19a3be4b9fff1a6638b0d43
4
+ data.tar.gz: aea678c0d73cc03e5062eeef2a3cada42a976596
5
5
  SHA512:
6
- metadata.gz: 0ca2f2a8cbf4b9f17f62fc49a552e6f861ed338d08017e73291d95cb0196c671f28be902a3b0848468237df5a777f1cf9be6927c8a8bf8c197aa684000fa1651
7
- data.tar.gz: 01f883a91e896e01e5d4306f0c1d0e7f5f71daa418bd027c689beda1d43c422a66b7eb2e5d6cea7d95976edd204c912358f5f00fb8fe8482a931529ea99dc13e
6
+ metadata.gz: 09ad392a6b20c6f3394ee69cbbd073f98618b63ee3cb64efad0207520191cfd22f96c12fbfd0920c6d870427f70af00c68684cf92ebaed84c668d191417b0623
7
+ data.tar.gz: 6f8423680af8a11ec95674b8e001e5a765b17f80938e01ebf2ab29f4f303368b081288e0815e7e79cdacf21943d79f3da6698a9cb4ab8cdc624b038daabd95f0
data/CHANGELOG.md CHANGED
@@ -11,6 +11,10 @@
11
11
  * require release block lines to be ordered in descending severity
12
12
  * disable strict semver version validation before 1.0.0
13
13
 
14
+ ## RELEASE 0.8.1
15
+
16
+ * FIX: `rake changelog:commit` wasn't allowing Gemfile.lock to change version.
17
+
14
18
  ## RELEASE 0.8.0
15
19
 
16
20
  * FEATURE: `rake changelog:sync` will update your gem's VERSION constant to your changelog's latest release version. This will let devs stop requiring `structured_changelog` to be installed before they can bundle their projects.
@@ -5,25 +5,40 @@ desc 'Commit changes to the Changelog & version files as necessary'
5
5
  task 'changelog:commit', [:repo_path, :changelog_path, :version_path] do |_task, arguments|
6
6
  repo_path = arguments.to_h.fetch(:repo_path) { Pathname.pwd }
7
7
  changelog_path = arguments.to_h.fetch(:changelog_path) { "CHANGELOG.md" }
8
- version_path = arguments.to_h.fetch(:version_path) { "lib/#{Pathname.pwd.basename}/version.rb"}
8
+ version_path = arguments.to_h.fetch(:version_path) { "lib/#{Pathname.pwd.basename}/version.rb" }
9
9
 
10
10
  changelog = StructuredChangelog.new(changelog_path)
11
- repo = Git.open(repo_path)
11
+ git = Git.open(repo_path)
12
12
 
13
- if repo.status.deleted.any?
13
+ if git.status.deleted.any?
14
14
  abort "Please commit all file deletions before bumping the version."
15
15
  end
16
16
 
17
- if repo.status.added.any?
17
+ if git.status.added.any?
18
18
  abort "Please commit all new files before bumping the version."
19
19
  end
20
20
 
21
- if repo.status.changed.keys.sort != [changelog_path, version_path].sort
22
- abort "Please commit all files that aren't #{changelog_path} or #{version_path} before bumping the version."
21
+ diff = git.diff('HEAD').stats[:files]
22
+ acceptable_changes = [changelog_path, version_path, 'Gemfile.lock']
23
+
24
+ only_release_changes = (diff.keys - acceptable_changes).empty?
25
+
26
+ unless only_release_changes
27
+ abort "Please commit all files that aren't #{acceptable_changes.join(' or ')} before bumping the version."
28
+ end
29
+
30
+ if diff.key?('Gemfile.lock')
31
+ lockfile_only_changed_version = diff['Gemfile.lock'][:deletions] == 1 && diff['Gemfile.lock'][:insertions] == 1
32
+
33
+ unless lockfile_only_changed_version
34
+ abort "Please commit all Gemfile.lock changes not related to this version bump."
35
+ end
36
+
37
+ git.add(['Gemfile.lock'])
23
38
  end
24
39
 
25
- repo.add([changelog_path, version_path])
26
- repo.commit("Version bump to #{changelog.version}")
40
+ git.add([changelog_path, version_path])
41
+ git.commit("Version bump to #{changelog.version}")
27
42
 
28
43
  puts "Commited 'Version bumped to #{changelog.version}'"
29
44
  end
@@ -1,3 +1,3 @@
1
1
  class StructuredChangelog
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
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.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Hoffman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-19 00:00:00.000000000 Z
11
+ date: 2017-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler