knife-changelog 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8be4794cbe4a60468b7bb2ff5ad22bd741ef974e3580b1cca57bb2d6aae48ed6
4
- data.tar.gz: 7a1a688801825095a4ed8e5dc1ac5bf66fe6cf54276fc02be6539ed36df84a02
3
+ metadata.gz: ac3be8ff1b8cf7b08329253913b46a0ff46f5c1d997093f00e06f2142ee9f236
4
+ data.tar.gz: f7ab4788ef5381e77f46ef47f3f54e194f50674e663c2b901109db0755f85ca3
5
5
  SHA512:
6
- metadata.gz: a99aeeed6a9505f636e0c1c8df1b8775d9f1e6dfd839240d3680e6c4526a15c568f8a14a1bd02133bd5f22f4bc6f95e093e581702c45ec50a71d41593715a939
7
- data.tar.gz: bb700c5d7f199a831692f154f02fa7c64038f8b508e4069f309682b1546defbceeedc7a1dffcea4d20290d8966b869ae07037f9ad0c52e86558e027d28efc6cd
6
+ metadata.gz: b2317057716149eef467ab3ea30d6a34d58515d6dcb8af7b3309e25a238888384f4f0b44f7671df8cbb2d8f656fca1a433a06561866d70de3f5976368e36fcf5
7
+ data.tar.gz: f1ce18ea422aef699f9bf9475299b6324bda6bf492197aa066dd61ab2c956235d9983629395bfbc3c85130cc72723eb4c96671fe5a5bddd79b5a49bfc8f4a96e
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'knife-changelog'
8
- spec.version = '1.4.0'
8
+ spec.version = '1.4.1'
9
9
  spec.authors = ['Gregoire Seux']
10
10
  spec.email = ['kamaradclimber@gmail.com']
11
11
  spec.summary = 'Facilitate access to cookbooks changelog'
@@ -11,6 +11,9 @@ require 'rest-client'
11
11
 
12
12
  class PolicyChangelog
13
13
  TMP_PREFIX = 'knife-changelog'
14
+ # Regex matching Chef cookbook version syntax
15
+ # See https://docs.chef.io/cookbook_versioning.html#syntax
16
+ VERSION_REGEX = /^[1-9]*[0-9](\.[0-9]+){1,2}$/
14
17
 
15
18
  # Initialzes Helper class
16
19
  #
@@ -178,7 +181,11 @@ class PolicyChangelog
178
181
 
179
182
  # Search for cookbook downgrade and raise an error if any
180
183
  def validate_downgrade!(data)
181
- downgrade = data.select { |_, ck| ::Gem::Version.new(ck['target_version']) < ::Gem::Version.new(ck['current_version']) }
184
+ downgrade = data.select do |_, ck|
185
+ # Do not try to validate downgrade on non-sementic versions (e.g. git revision)
186
+ ck['target_version'] =~ VERSION_REGEX && ck['current_version'] =~ VERSION_REGEX &&
187
+ ::Gem::Version.new(ck['target_version']) < ::Gem::Version.new(ck['current_version'])
188
+ end
182
189
 
183
190
  return if downgrade.empty?
184
191
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-changelog
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregoire Seux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-07 00:00:00.000000000 Z
11
+ date: 2020-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler