rspec-puppet-facts 1.9.1 → 1.9.2

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: 7dbd52f624b211b89fe821e11bb4b0b06f027990544d3fcab0670ed43649dc04
4
- data.tar.gz: 590ab056e1834379ff220aa28bd0f84dd3190f52b9bca2d0621432c29c7333ec
3
+ metadata.gz: 3cc1e0c2d29c71210af4d52cd12eb0cf9be062dedd4a6eb59f931379acb12b57
4
+ data.tar.gz: b16313f97d45b158fec32cabf3e69519c28b64739964b9856249c24786f595a3
5
5
  SHA512:
6
- metadata.gz: ae3e87f28130b1729435a68bd58573e091a0be404e0c666f5eba49c319308374f183b5312d3336ea37a684764b100696d32970cc0d45b16fb404c5eef7f7b967
7
- data.tar.gz: 7c44c5f98f60b92b117129c52f1acedd4b355196db417267547be85cee91f261fe0703f3861b380360af1c2e75589bfb28084d29e8c90ad4cb736f3bfa1ccb7e
6
+ metadata.gz: 0b3e3465f50d1a9b2b2043aede40cfdc4345c9bf3c6be392b7c9dd7b898b9f4a6352bfde02c5e74761b737a55cb20af6a60cb781c359d2d0108c959bf18be755
7
+ data.tar.gz: f5935b8d432442845fa5cd64490cc480ee46ebd341f6be3041f76e20dadc259395d41a28cbcf382531c1a4e27014d850751800afe4a6824f86d41ea773e03615
@@ -1,3 +1,6 @@
1
+ ## 2018-10-24 - Release 1.9.2
2
+ - Catch the right `LoadError` on missing augeas gem. Thanks to [baurmatt](https://github.com/baurmatt) for the quick fix, and [rodjek](https://github.com/rodjek) for dealing with the testing
3
+
1
4
  ## 2018-10-24 - Release 1.9.1
2
5
  - Do not rely on features of Augeas because Puppet 6
3
6
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ require 'bundler/gem_tasks'
2
+
1
3
  begin
2
4
  require 'rspec/core/rake_task'
3
5
  require 'yard'
@@ -216,15 +216,25 @@ module RspecPuppetFacts
216
216
  :rubysitedir => RbConfig::CONFIG['sitelibdir'],
217
217
  :rubyversion => RUBY_VERSION,
218
218
  }
219
- begin
220
- require 'augeas'
219
+
220
+ if augeas?
221
221
  @common_facts[:augeasversion] = Augeas.open(nil, nil, Augeas::NO_MODL_AUTOLOAD).get('/augeas/version')
222
- rescue => e
223
- RspecPuppetFacts.warning "Failed to retrieve Augeas version: #{e}"
224
222
  end
223
+
225
224
  @common_facts
226
225
  end
227
226
 
227
+ # Determine if the Augeas gem is available.
228
+ # @api private
229
+ # @return [Boolean] true if the augeas gem could be loaded.
230
+ def self.augeas?
231
+ require 'augeas'
232
+ true
233
+ rescue LoadError => e
234
+ RspecPuppetFacts.warning "Failed to retrieve Augeas version: #{e}"
235
+ false
236
+ end
237
+
228
238
  # Get the "operatingsystem_support" structure from
229
239
  # the parsed metadata.json file
230
240
  # @raise [StandardError] if there is no "operatingsystem_support"
@@ -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 = '1.9.1'
5
+ STRING = '1.9.2'
6
6
  end
7
7
  end
@@ -618,7 +618,7 @@ describe RspecPuppetFacts do
618
618
  end
619
619
 
620
620
  it 'should not add "augeasversion" if Augeas is supported' do
621
- allow(Puppet.features).to receive(:augeas?).and_return(false)
621
+ allow(described_class).to receive(:augeas?).and_return(false)
622
622
  RspecPuppetFacts.reset
623
623
  expect(subject.common_facts).not_to include :augeasversion
624
624
  end
@@ -634,7 +634,7 @@ describe RspecPuppetFacts do
634
634
  end
635
635
  end
636
636
 
637
- allow(Puppet.features).to receive(:augeas?).and_return(true)
637
+ allow(described_class).to receive(:augeas?).and_return(true)
638
638
  stub_const('Augeas', Augeas_stub)
639
639
  RspecPuppetFacts.reset
640
640
  expect(subject.common_facts[:augeasversion]).to eq 'my_version'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-puppet-facts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 1.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mickaël Canévet