octocatalog-diff 1.5.2 → 1.5.3

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
  SHA1:
3
- metadata.gz: 154a03508f5cbae0bafaedf90773e5dc82624a4e
4
- data.tar.gz: 3dca1d51a606a0f31ee935eef370a7347a72af39
3
+ metadata.gz: 1d454b6d3a7fc5ec8ff2f55231e83fc2cad36d2a
4
+ data.tar.gz: 10dba5a6f4694bebd11fa01465fdbbdc1cb77774
5
5
  SHA512:
6
- metadata.gz: 961a4c0cf1677d9262010e17e88f7ca8387d548886c83ac7f34a86540d09fc864519d906a3172edaef8140f9505539a65437259f13d72257dfe1bd3f161561e2
7
- data.tar.gz: 2f822d309b8ebbd39f923c15b6849b02dd836b3bf8cb6d5354cea0fe873828196fac73af1ed801c6f96460339ca9032a27341e1eda2d090d8fa7f2f71a373654
6
+ metadata.gz: f4edfbcd8f3d5e4508e7610ba47f93159608f6572c3585fc506eba2c2037a541193fe76d018afee365ddf6c0b6a27e7df32ff0145ded794e3cab5d9ed7d67115
7
+ data.tar.gz: 0053a799e8342b2df02d722502c1dc1ead513148ce78e9e1616a715e33af63cb1990b29afe1abae81ef18659295efbc6b14190db498215c8b4438bf5397eb9a3
data/.version CHANGED
@@ -1 +1 @@
1
- 1.5.2
1
+ 1.5.3
@@ -8,6 +8,14 @@
8
8
  </tr>
9
9
  </thead><tbody>
10
10
 
11
+ <tr valign=top>
12
+ <td>1.5.3</td>
13
+ <td>2018-03-05</td>
14
+ <td>
15
+ <li><a href="https://github.com/github/octocatalog-diff/pull/176">#176</a>: (Enhancement) Normalize file resource titles in reference checks</li>
16
+ </td>
17
+ </tr>
18
+
11
19
  <tr valign=top>
12
20
  <td>1.5.2</td>
13
21
  <td>2017-12-19</td>
@@ -2,10 +2,14 @@
2
2
 
3
3
  To run `octocatalog-diff` you will need these basics:
4
4
 
5
- - Ruby 2.0 through 2.4 (we test octocatalog-diff with Ruby 2.0, 2.1, 2.2, 2.3, and 2.4)
5
+ - An appropriate Puppet version and [corresponding ruby version](https://puppet.com/docs/puppet/5.4/system_requirements.html)
6
+ - Puppet 5.x officially supports Ruby 2.4
7
+ - Puppet 4.x officially supports Ruby 2.1, but seems to work fine with later versions as well
8
+ - Puppet 3.8.7 -- we attempt to maintain compatibility in `octocatalog-diff` to facilitate upgrades even though this version is no longer supported by Puppet
9
+ - We don't officially support Puppet 3.8.6 or before
6
10
  - Mac OS, Linux, or other Unix-line operating system (Windows is not supported)
7
11
  - Ability to install gems, e.g. with [rbenv](https://github.com/rbenv/rbenv) or [rvm](https://rvm.io/), or root privileges to install into the system Ruby
8
- - Puppet agent for [Linux](https://docs.puppet.com/puppet/latest/reference/install_linux.html) or [Mac OS X](https://docs.puppet.com/puppet/latest/reference/install_osx.html), or installed as a gem (we support Puppet 3.8.7 and all versions of Puppet 4.x)
12
+ - Puppet agent for [Linux](https://docs.puppet.com/puppet/latest/reference/install_linux.html) or [Mac OS X](https://docs.puppet.com/puppet/latest/reference/install_osx.html), or installed as a gem
9
13
 
10
14
  We recommend that you also have the following to get the most out of `octocatalog-diff`, but these are not absolute requirements:
11
15
 
@@ -304,17 +304,32 @@ module OctocatalogDiff
304
304
  unless res =~ /\A([\w:]+)\[(.+)\]\z/
305
305
  raise ArgumentError, "Resource #{res} is not in the expected format"
306
306
  end
307
- resource(type: Regexp.last_match(1), title: Regexp.last_match(2)).nil?
307
+
308
+ type = Regexp.last_match(1)
309
+ title = normalized_title(Regexp.last_match(2), type)
310
+ resource(type: type, title: title).nil?
308
311
  end
309
312
  end
310
313
 
314
+ # Private method: Given a title string, normalize it according to the rules
315
+ # used by puppet 4.10.x for file resource title normalization:
316
+ # https://github.com/puppetlabs/puppet/blob/4.10.x/lib/puppet/type/file.rb#L42
317
+ def normalized_title(title_string, type)
318
+ return title_string if type != 'File'
319
+
320
+ matches = title_string.match(%r{^(?<normalized_path>/|.+:/|.*[^/])/*\Z}m)
321
+ matches[:normalized_path] || title_string
322
+ end
323
+
311
324
  # Private method: Build the resource hash to be used used for O(1) lookups by type and title.
312
325
  # This method is called the first time the resource hash is accessed.
313
326
  def build_resource_hash
314
327
  @resource_hash = {}
315
328
  resources.each do |resource|
316
329
  @resource_hash[resource['type']] ||= {}
317
- @resource_hash[resource['type']][resource['title']] = resource
330
+
331
+ title = normalized_title(resource['title'], resource['type'])
332
+ @resource_hash[resource['type']][title] = resource
318
333
 
319
334
  if resource.key?('parameters') && resource['parameters'].key?('alias')
320
335
  @resource_hash[resource['type']][resource['parameters']['alias']] = resource
@@ -27,7 +27,9 @@ module OctocatalogDiff
27
27
  def self.safe_dup(object)
28
28
  object.dup
29
29
  rescue TypeError
30
+ # :nocov:
30
31
  object
32
+ # :nocov:
31
33
  end
32
34
 
33
35
  # Utility Method!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octocatalog-diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub, Inc.
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-12-19 00:00:00.000000000 Z
12
+ date: 2018-03-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: diffy
@@ -152,47 +152,33 @@ dependencies:
152
152
  - !ruby/object:Gem::Version
153
153
  version: 0.14.1
154
154
  - !ruby/object:Gem::Dependency
155
- name: simplecov-json
155
+ name: simplecov-erb
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
- - - ">="
158
+ - - "~>"
159
159
  - !ruby/object:Gem::Version
160
- version: '0'
160
+ version: 0.1.1
161
161
  type: :development
162
162
  prerelease: false
163
163
  version_requirements: !ruby/object:Gem::Requirement
164
164
  requirements:
165
- - - ">="
165
+ - - "~>"
166
166
  - !ruby/object:Gem::Version
167
- version: '0'
167
+ version: 0.1.1
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: puppet
170
170
  requirement: !ruby/object:Gem::Requirement
171
171
  requirements:
172
172
  - - "~>"
173
173
  - !ruby/object:Gem::Version
174
- version: 4.10.8
174
+ version: 5.4.0
175
175
  type: :development
176
176
  prerelease: false
177
177
  version_requirements: !ruby/object:Gem::Requirement
178
178
  requirements:
179
179
  - - "~>"
180
180
  - !ruby/object:Gem::Version
181
- version: 4.10.8
182
- - !ruby/object:Gem::Dependency
183
- name: puppetdb-terminus
184
- requirement: !ruby/object:Gem::Requirement
185
- requirements:
186
- - - '='
187
- - !ruby/object:Gem::Version
188
- version: 3.2.4
189
- type: :development
190
- prerelease: false
191
- version_requirements: !ruby/object:Gem::Requirement
192
- requirements:
193
- - - '='
194
- - !ruby/object:Gem::Version
195
- version: 3.2.4
181
+ version: 5.4.0
196
182
  description: |
197
183
  Octocatalog-Diff assists with Puppet development and testing by enabling the user to
198
184
  compile 2 Puppet catalogs and compare them. It is possible to compare different