rspec-puppet-facts 5.2.0 → 5.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fdaf2d116b0a1d982bd70b4948e66d506a05d1a7eab49fb308953cbb2788da23
4
- data.tar.gz: 1aa1e7c8af6ee17cdc146abb25cd1b8ea5296ff9798add299053b0a200efac33
3
+ metadata.gz: 8678116a3cc4e7c0f5d7c6658f33859c61f7ff9df4773b1140012895ca3c8c83
4
+ data.tar.gz: ad575c16065f79a93331fe1d6bfadce970345916ea41c0b02f26554e20fbb374
5
5
  SHA512:
6
- metadata.gz: e9a054fd3a64639a6ede9f837e508dbbb7029409d3f3e4b5d596786d154bbcf80ac4a7933287ab935a98cdd3f030884e18cdddd9b267fc25489cb080b74898cb
7
- data.tar.gz: 11dbcb1973cffbe6df4b2a826ba995b13f40ba89a6c611fbcc89473d293f4871f076e3c47e0f477ad40f140638cdce0ff03195488249bfe49b28e1944299542d
6
+ metadata.gz: 6268e78cce4f0e27253ef5ea590cd6a8e1a10da839c8a37259a2ec6598ff15956f0beb58e845e10753989e3214841883a3ffef738b3b082cc35bb1168571ac83
7
+ data.tar.gz: b3fc0a8a23741abbf153cf7ba937979911261a0ec89c09517ec1497d3523d637f8641cf8fc8d50a40b29d2b7055cebbd65cd259c050107cc4f5bb5b6d367896c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.3.0](https://github.com/voxpupuli/rspec-puppet-facts/tree/5.3.0) (2025-04-28)
4
+
5
+ [Full Changelog](https://github.com/voxpupuli/rspec-puppet-facts/compare/5.2.0...5.3.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Add Puppet 8.12 / Facter 4.12 [\#204](https://github.com/voxpupuli/rspec-puppet-facts/pull/204) ([bastelfreak](https://github.com/bastelfreak))
10
+ - Only store facter versions in JSON [\#203](https://github.com/voxpupuli/rspec-puppet-facts/pull/203) ([ekohl](https://github.com/ekohl))
11
+
3
12
  ## [5.2.0](https://github.com/voxpupuli/rspec-puppet-facts/tree/5.2.0) (2024-10-30)
4
13
 
5
14
  [Full Changelog](https://github.com/voxpupuli/rspec-puppet-facts/compare/5.1.0...5.2.0)
data/README.md CHANGED
@@ -572,7 +572,7 @@ When no facts are available for the specific facter/operating system combination
572
572
  ## Maintenance
573
573
 
574
574
  This gem uses information about puppet AIO component versions to build/test.
575
- They are vendored at `ext/puppet_agent_components.json`. If they are outdated,
575
+ They are stored at `ext/puppet_agent_facter_versions.json`. If they are outdated,
576
576
  the `puppet_versions:test` rake task will fail and they need to be updated.
577
577
  This is as easy as running: `bundle exec rake puppet_versions:update`
578
578
 
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- PUPPET_VERSIONS_PATH = File.join(__dir__, 'ext', 'puppet_agent_components.json')
1
+ PUPPET_VERSIONS_PATH = File.join(__dir__, 'ext', 'puppet_agent_facter_versions.json')
2
2
 
3
3
  begin
4
4
  require 'rspec/core/rake_task'
@@ -31,9 +31,14 @@ namespace :puppet_versions do
31
31
  response = http.request(request)
32
32
  raise unless response.is_a?(Net::HTTPSuccess)
33
33
 
34
- File.open(PUPPET_VERSIONS_PATH, 'wb:UTF-8') do |fd|
35
- fd.write(JSON.pretty_generate(JSON.parse(response.body)))
34
+ data = JSON.parse(response.body).filter_map do |_, versions|
35
+ if !versions['puppet'].nil? && !versions['facter'].nil?
36
+ [versions['puppet'], versions['facter']]
37
+ end
36
38
  end
39
+ data.sort_by! { |puppet, _facter| Gem::Version.new(puppet) }.reverse!
40
+
41
+ File.write(PUPPET_VERSIONS_PATH, "#{JSON.pretty_generate(data.to_h)}\n")
37
42
  end
38
43
 
39
44
  task :test do
@@ -0,0 +1,133 @@
1
+ {
2
+ "8.12.0": "4.12.0",
3
+ "8.11.0": "4.11.0",
4
+ "8.10.0": "4.10.0",
5
+ "8.9.0": "4.9.0",
6
+ "8.8.1": "4.8.0",
7
+ "8.8.0": "4.8.0",
8
+ "8.7.0": "4.7.1",
9
+ "8.6.0": "4.7.0",
10
+ "8.5.1": "4.6.1",
11
+ "8.5.0": "4.6.0",
12
+ "8.4.0": "4.5.2",
13
+ "8.3.1": "4.5.1",
14
+ "8.3.0": "4.5.1",
15
+ "8.2.0": "4.4.2",
16
+ "8.1.0": "4.4.1-2-g785cfa2ae",
17
+ "8.0.0": "4.4.0",
18
+ "7.35.0": "4.11.0",
19
+ "7.34.0": "4.10.0",
20
+ "7.33.0": "4.9.0",
21
+ "7.32.1": "4.8.0",
22
+ "7.32.0": "4.8.0",
23
+ "7.31.0": "4.7.1",
24
+ "7.30.0": "4.7.0",
25
+ "7.29.1": "4.6.1",
26
+ "7.29.0": "4.6.0",
27
+ "7.28.0": "4.5.2",
28
+ "7.27.0": "4.5.1",
29
+ "7.26.0": "4.4.2",
30
+ "7.25.0": "4.4.1",
31
+ "7.24.0": "4.3.1",
32
+ "7.23.0": "4.3.0",
33
+ "7.21.0": "4.2.14",
34
+ "7.20.0": "4.2.13",
35
+ "7.19.0": "4.2.12",
36
+ "7.18.0": "4.2.11",
37
+ "7.17.0": "4.2.10",
38
+ "7.16.0": "4.2.8",
39
+ "7.15.0": "4.2.8",
40
+ "7.14.0": "4.2.7",
41
+ "7.13.1": "4.2.6",
42
+ "7.13.0": "4.2.6",
43
+ "7.12.1": "4.2.5",
44
+ "7.12.0": "4.2.5",
45
+ "7.11.0": "4.2.4",
46
+ "7.10.0": "4.2.3",
47
+ "7.9.0": "4.2.2",
48
+ "7.8.0": "4.2.1",
49
+ "7.7.0": "4.2.0",
50
+ "7.6.1": "4.1.1",
51
+ "7.6.0": "4.1.0",
52
+ "7.5.0": "4.0.52",
53
+ "7.4.1": "4.0.51",
54
+ "7.4.0": "4.0.51",
55
+ "7.3.0": "4.0.49",
56
+ "7.1.0": "4.0.47",
57
+ "7.0.0": "4.0.46",
58
+ "6.28.0": "3.14.24",
59
+ "6.27.0": "3.14.23",
60
+ "6.26.0": "3.14.22",
61
+ "6.25.1": "3.14.21",
62
+ "6.25.0": "3.14.20",
63
+ "6.24.0": "3.14.19",
64
+ "6.23.0": "3.14.18",
65
+ "6.22.1": "3.14.17",
66
+ "6.22.0": "3.14.17",
67
+ "6.21.1": "3.14.16",
68
+ "6.21.0": "3.14.16",
69
+ "6.20.0": "3.14.15",
70
+ "6.19.1": "3.14.14",
71
+ "6.19.0": "3.14.14",
72
+ "6.18.0": "3.14.13",
73
+ "6.17.0": "3.14.12",
74
+ "6.16.0": "3.14.11",
75
+ "6.15.0": "3.14.10",
76
+ "6.14.0": "3.14.9",
77
+ "6.13.0": "3.14.8",
78
+ "6.12.0": "3.14.7",
79
+ "6.11.1": "3.14.6",
80
+ "6.11.0": "3.14.6",
81
+ "6.10.1": "3.14.5",
82
+ "6.10.0": "3.14.5",
83
+ "6.9.0": "3.14.4",
84
+ "6.8.1": "3.14.3",
85
+ "6.8.0": "3.14.3",
86
+ "6.7.2": "3.14.2",
87
+ "6.7.1": "3.14.2",
88
+ "6.7.0": "3.14.2",
89
+ "6.6.0": "3.14.1",
90
+ "6.5.0": "3.14.0",
91
+ "6.4.5": "3.13.5",
92
+ "6.4.4": "3.13.4",
93
+ "6.4.3": "3.13.3",
94
+ "6.4.2": "3.13.2",
95
+ "6.4.1": "3.13.2",
96
+ "6.4.0": "3.13.1",
97
+ "6.3.0": "3.13.0",
98
+ "6.2.0": "3.12.3",
99
+ "6.0.10": "3.12.5",
100
+ "6.0.9": "3.12.4",
101
+ "6.0.8": "3.12.4",
102
+ "6.0.7": "3.12.4",
103
+ "6.0.5": "3.12.3",
104
+ "5.5.22": "3.11.14",
105
+ "5.5.21": "3.11.14",
106
+ "5.5.20": "3.11.13",
107
+ "5.5.19": "3.11.12",
108
+ "5.5.18": "3.11.11",
109
+ "5.5.17": "3.11.10",
110
+ "5.5.16": "3.11.9",
111
+ "5.5.15": "3.11.9",
112
+ "5.5.14": "3.11.8",
113
+ "5.5.13": "3.11.8",
114
+ "5.5.12": "3.11.8",
115
+ "5.5.11": "3.11.8",
116
+ "5.5.10": "3.11.7",
117
+ "5.5.9": "3.11.7",
118
+ "5.4.0": "3.10.0",
119
+ "5.3.5": "3.9.5",
120
+ "5.3.4": "3.9.4",
121
+ "5.3.3": "3.9.3",
122
+ "5.3.2": "3.9.2",
123
+ "5.3.1": "3.9.2",
124
+ "5.3.0": "3.9.1",
125
+ "5.2.0": "3.9.0",
126
+ "5.1.0": "3.8.0",
127
+ "4.10.13": "3.6.11",
128
+ "4.10.10": "3.6.9",
129
+ "4.10.9": "3.6.8",
130
+ "4.10.8": "3.6.7",
131
+ "4.10.7": "3.6.7",
132
+ "4.10.6": "3.6.6"
133
+ }
@@ -2,6 +2,6 @@ module RspecPuppetFacts
2
2
  # This module contains the current version constant
3
3
  module Version
4
4
  # The current version of this gem
5
- STRING = '5.2.0'
5
+ STRING = '5.3.0'
6
6
  end
7
7
  end
@@ -57,7 +57,7 @@ module RspecPuppetFacts
57
57
  #
58
58
  # @api private
59
59
  def on_supported_os_implementation(opts = {})
60
- unless /\A\d+\.\d+(?:\.\d+)*\z/.match?((facterversion = opts[:facterversion]))
60
+ unless /\A\d+\.\d+(?:\.\d+)*\z/.match?(facterversion = opts[:facterversion])
61
61
  raise ArgumentError, ":facterversion must be in the format 'n.n' or 'n.n.n' (n is numeric), not '#{facterversion}'"
62
62
  end
63
63
 
@@ -391,22 +391,15 @@ module RspecPuppetFacts
391
391
  def self.facter_version_for_puppet_version(puppet_version)
392
392
  return Facter.version if puppet_version.nil?
393
393
 
394
- json_path = File.expand_path(File.join(__dir__, '..', 'ext', 'puppet_agent_components.json'))
394
+ json_path = File.expand_path(File.join(__dir__, '..', 'ext', 'puppet_agent_facter_versions.json'))
395
395
  unless File.file?(json_path) && File.readable?(json_path)
396
396
  warning "#{json_path} does not exist or is not readable, defaulting to Facter #{Facter.version}"
397
397
  return Facter.version
398
398
  end
399
399
 
400
- fd = File.open(json_path, 'rb:UTF-8')
401
- data = JSON.parse(fd.read)
402
-
403
- version_map = data.map do |_, versions|
404
- if versions['puppet'].nil? || versions['facter'].nil?
405
- nil
406
- else
407
- [Gem::Version.new(versions['puppet']), versions['facter']]
408
- end
409
- end.compact
400
+ version_map = JSON.load_file(json_path).map do |puppet, facter|
401
+ [Gem::Version.new(puppet), facter]
402
+ end
410
403
 
411
404
  puppet_gem_version = Gem::Version.new(puppet_version)
412
405
  applicable_versions = version_map.select { |p, _| puppet_gem_version >= p }
@@ -419,8 +412,6 @@ module RspecPuppetFacts
419
412
  rescue JSON::ParserError
420
413
  warning "#{json_path} contains invalid JSON, defaulting to Facter #{Facter.version}"
421
414
  Facter.version
422
- ensure
423
- fd.close if fd
424
415
  end
425
416
  end
426
417
 
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.add_development_dependency 'rspec', '~> 3.12'
24
24
  s.add_development_dependency 'yard', '~> 0.9.34'
25
25
 
26
- s.add_development_dependency 'voxpupuli-rubocop', '~> 3.0.0'
26
+ s.add_development_dependency 'voxpupuli-rubocop', '~> 3.1.0'
27
27
 
28
28
  s.add_dependency 'deep_merge', '~> 1.2'
29
29
  s.add_dependency 'facter', '< 5'
@@ -19,7 +19,7 @@ describe RspecPuppetFacts do
19
19
  end
20
20
 
21
21
  let(:component_json_path) do
22
- File.expand_path(File.join(__dir__, '..', 'ext', 'puppet_agent_components.json'))
22
+ File.expand_path(File.join(__dir__, '..', 'ext', 'puppet_agent_facter_versions.json'))
23
23
  end
24
24
 
25
25
  let(:puppet_version) { Puppet.version }
@@ -60,8 +60,7 @@ describe RspecPuppetFacts do
60
60
 
61
61
  context 'when the component JSON file is unparseable' do
62
62
  before do
63
- io = StringIO.new('this is not JSON!')
64
- allow(File).to receive(:open).with(component_json_path, anything).and_return(io)
63
+ allow(JSON).to receive(:load_file).with(component_json_path).and_raise(JSON::ParserError)
65
64
  allow(described_class).to receive(:warning)
66
65
  end
67
66
 
@@ -88,14 +87,11 @@ describe RspecPuppetFacts do
88
87
  let(:puppet_version) { '999.0.0' }
89
88
 
90
89
  it 'returns the Facter version for the highest known Puppet version' do
91
- known_facter_versions = JSON.parse(File.read(component_json_path)).map do |_, r|
92
- r['facter']
93
- end
94
- sorted_facter_versions = known_facter_versions.compact.sort do |a, b|
95
- Gem::Version.new(b) <=> Gem::Version.new(a)
90
+ expected = JSON.parse(File.read(component_json_path)).values.max_by do |version|
91
+ Gem::Version.new(version)
96
92
  end
97
93
 
98
- expect(facter_version).to eq(sorted_facter_versions.first)
94
+ expect(facter_version).to eq(expected)
99
95
  end
100
96
  end
101
97
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-puppet-facts
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.0
4
+ version: 5.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-30 00:00:00.000000000 Z
11
+ date: 2025-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types
@@ -78,14 +78,14 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: 3.0.0
81
+ version: 3.1.0
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: 3.0.0
88
+ version: 3.1.0
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: deep_merge
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -168,7 +168,7 @@ files:
168
168
  - LICENSE
169
169
  - README.md
170
170
  - Rakefile
171
- - ext/puppet_agent_components.json
171
+ - ext/puppet_agent_facter_versions.json
172
172
  - lib/rspec-puppet-facts.rb
173
173
  - lib/rspec-puppet-facts/version.rb
174
174
  - rspec-puppet-facts.gemspec
@@ -180,7 +180,7 @@ homepage: http://github.com/voxpupuli/rspec-puppet-facts
180
180
  licenses:
181
181
  - Apache-2.0
182
182
  metadata: {}
183
- post_install_message:
183
+ post_install_message:
184
184
  rdoc_options: []
185
185
  require_paths:
186
186
  - lib
@@ -195,8 +195,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
195
  - !ruby/object:Gem::Version
196
196
  version: '0'
197
197
  requirements: []
198
- rubygems_version: 3.5.16
199
- signing_key:
198
+ rubygems_version: 3.5.22
199
+ signing_key:
200
200
  specification_version: 4
201
201
  summary: Standard facts fixtures for Puppet
202
202
  test_files: []