octocatalog-diff 1.5.2 → 1.5.3
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/.version +1 -1
- data/doc/CHANGELOG.md +8 -0
- data/doc/requirements.md +6 -2
- data/lib/octocatalog-diff/catalog.rb +17 -2
- data/lib/octocatalog-diff/util/util.rb +2 -0
- metadata +9 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d454b6d3a7fc5ec8ff2f55231e83fc2cad36d2a
|
4
|
+
data.tar.gz: 10dba5a6f4694bebd11fa01465fdbbdc1cb77774
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4edfbcd8f3d5e4508e7610ba47f93159608f6572c3585fc506eba2c2037a541193fe76d018afee365ddf6c0b6a27e7df32ff0145ded794e3cab5d9ed7d67115
|
7
|
+
data.tar.gz: 0053a799e8342b2df02d722502c1dc1ead513148ce78e9e1616a715e33af63cb1990b29afe1abae81ef18659295efbc6b14190db498215c8b4438bf5397eb9a3
|
data/.version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.5.
|
1
|
+
1.5.3
|
data/doc/CHANGELOG.md
CHANGED
@@ -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>
|
data/doc/requirements.md
CHANGED
@@ -2,10 +2,14 @@
|
|
2
2
|
|
3
3
|
To run `octocatalog-diff` you will need these basics:
|
4
4
|
|
5
|
-
-
|
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
|
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
|
-
|
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
|
-
|
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
|
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.
|
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:
|
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-
|
155
|
+
name: simplecov-erb
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
|
-
- - "
|
158
|
+
- - "~>"
|
159
159
|
- !ruby/object:Gem::Version
|
160
|
-
version:
|
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:
|
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.
|
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.
|
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
|