fauxhai 4.0.2 → 4.1.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
  SHA1:
3
- metadata.gz: b40f0712d3762eca576ea67090ef41691e77d75e
4
- data.tar.gz: 53f17c72c666f8e97b05721b7a517a1435f1d1ca
3
+ metadata.gz: f97f791d89ebee00fc2f187f079adca999e35a89
4
+ data.tar.gz: 298293b4db5ea8f21c79ddcfd541d4a7b72ef21a
5
5
  SHA512:
6
- metadata.gz: 7067d42f4ddaf456e99936e364871a20f68e90cda94014a3258633b27d3a46e50c925d2a0b078dc001dd39304e30659de6ffa9f16b7412ec2968f51a2f26a0ce
7
- data.tar.gz: b6c618d69cbe64624d969ecb51965122cc87d18142abfbe5ededc70a69cc566c4e96f61d1f58ce27e6f1aec284561d6dae1f66d353784d4e6f046caf8aed524f
6
+ metadata.gz: 0127c1d004a5b2604438cfb5112b0eae809d5f3ca668e76d64a9d9ce06f0b48eeb03b0c7c333b9627ba372e8f83a5f9227c0b3c84032ca4ed4817ac4031b8d3c
7
+ data.tar.gz: 20977fc27869f251553f4899bc13a0f93f512d45b2ab79a5a39f2275007c5ef6fd8eec990f0a7c388118396a5108b7a24bd25f64a3e517547ff1f624ea07af54
@@ -1,5 +1,9 @@
1
1
  # Fauxhai Changelog
2
2
 
3
+ ## v4.1.0 (2017-03-27)
4
+
5
+ - Add a new config option "github_fetching" that disables fetching platform mocks from Github
6
+
3
7
  ## v4.0.2 (2017-03-20)
4
8
 
5
9
  - Link to the platforms.md file in the platform not found exception messages
data/README.md CHANGED
@@ -154,6 +154,20 @@ describe 'awesome_cookbook::default' do
154
154
  end
155
155
  ```
156
156
 
157
+ ### Disabling Fetching from Github
158
+
159
+ On environments that does not have access to the internet, you can disable fetching fauxhai data from github as follow:
160
+
161
+ ```ruby
162
+ require 'chefspec'
163
+
164
+ describe 'awesome_cookbook::default' do
165
+ before do
166
+ Fauxhai.mock(platform: 'ubuntu', version: '12.04', github_fetching: false)
167
+ end
168
+ end
169
+ ```
170
+
157
171
  ## Testing Multiple Versions
158
172
 
159
173
  It's a common use case to test multiple version of the same operating system. Here's a simple example to get your started. This is more rspec-related that fauxhai related, but here ya go:
@@ -23,8 +23,10 @@ module Fauxhai
23
23
  # the version of the platform to mock
24
24
  # @option options [String] :path
25
25
  # the path to a local JSON file
26
+ # @option options [Bool] :github_fetching
27
+ # whether to try loading from Github
26
28
  def initialize(options = {}, &override_attributes)
27
- @options = options
29
+ @options = { github_fetching: true }.merge(options)
28
30
 
29
31
  @data = fauxhai_data
30
32
  yield(@data) if block_given?
@@ -58,7 +60,7 @@ module Fauxhai
58
60
 
59
61
  if File.exist?(filepath)
60
62
  JSON.parse( File.read(filepath) )
61
- elsif
63
+ elsif !@options[:github_fetching]
62
64
  # Try loading from github (in case someone submitted a PR with a new file, but we haven't
63
65
  # yet updated the gem version). Cache the response locally so it's faster next time.
64
66
  begin
@@ -77,6 +79,8 @@ module Fauxhai
77
79
  else
78
80
  raise Fauxhai::Exception::InvalidPlatform.new("Could not find platform '#{platform}/#{version}' in any of the sources! #{PLATFORM_LIST_MESSAGE}")
79
81
  end
82
+ else
83
+ raise Fauxhai::Exception::InvalidPlatform.new("Could not find platform '#{platform}/#{version}' in any of the sources!")
80
84
  end
81
85
  end.call
82
86
  end
@@ -1,3 +1,3 @@
1
1
  module Fauxhai
2
- VERSION = '4.0.2'
2
+ VERSION = '4.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fauxhai
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.2
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Vargo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-21 00:00:00.000000000 Z
11
+ date: 2017-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -253,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
253
253
  version: '0'
254
254
  requirements: []
255
255
  rubyforge_project:
256
- rubygems_version: 2.6.10
256
+ rubygems_version: 2.6.11
257
257
  signing_key:
258
258
  specification_version: 4
259
259
  summary: Fauxhai provides an easy way to mock out your ohai data for testing with