chef-utils 16.10.17 → 17.10.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +201 -201
  3. data/Rakefile +15 -15
  4. data/chef-utils.gemspec +50 -46
  5. data/lib/chef-utils/dist.rb +151 -98
  6. data/lib/chef-utils/dsl/architecture.rb +150 -150
  7. data/lib/chef-utils/dsl/cloud.rb +155 -144
  8. data/lib/chef-utils/dsl/default_paths.rb +60 -60
  9. data/lib/chef-utils/dsl/introspection.rb +134 -123
  10. data/lib/chef-utils/dsl/os.rb +58 -58
  11. data/lib/chef-utils/dsl/path_sanity.rb +39 -39
  12. data/lib/chef-utils/dsl/platform.rb +387 -372
  13. data/lib/chef-utils/dsl/platform_family.rb +355 -344
  14. data/lib/chef-utils/dsl/platform_version.rb +41 -41
  15. data/lib/chef-utils/dsl/service.rb +112 -112
  16. data/lib/chef-utils/dsl/train_helpers.rb +87 -87
  17. data/lib/chef-utils/dsl/virtualization.rb +272 -250
  18. data/lib/chef-utils/dsl/which.rb +123 -123
  19. data/lib/chef-utils/dsl/windows.rb +86 -86
  20. data/lib/chef-utils/internal.rb +114 -114
  21. data/lib/chef-utils/mash.rb +263 -240
  22. data/lib/chef-utils/parallel_map.rb +131 -0
  23. data/lib/chef-utils/version.rb +20 -20
  24. data/lib/chef-utils/version_string.rb +160 -160
  25. data/lib/chef-utils.rb +53 -53
  26. data/spec/spec_helper.rb +100 -100
  27. data/spec/unit/dsl/architecture_spec.rb +151 -151
  28. data/spec/unit/dsl/cloud_spec.rb +93 -89
  29. data/spec/unit/dsl/dsl_spec.rb +34 -34
  30. data/spec/unit/dsl/introspection_spec.rb +201 -189
  31. data/spec/unit/dsl/os_spec.rb +175 -175
  32. data/spec/unit/dsl/path_sanity_spec.rb +86 -86
  33. data/spec/unit/dsl/platform_family_spec.rb +235 -223
  34. data/spec/unit/dsl/platform_spec.rb +252 -238
  35. data/spec/unit/dsl/service_spec.rb +117 -117
  36. data/spec/unit/dsl/virtualization_spec.rb +75 -75
  37. data/spec/unit/dsl/which_spec.rb +171 -171
  38. data/spec/unit/dsl/windows_spec.rb +84 -84
  39. data/spec/unit/mash_spec.rb +51 -51
  40. data/spec/unit/parallel_map_spec.rb +156 -0
  41. metadata +26 -10
@@ -1,20 +1,20 @@
1
- # frozen_string_literal: true
2
- # Copyright:: Copyright (c) Chef Software Inc.
3
- # License:: Apache License, Version 2.0
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
- module ChefUtils
18
- CHEFUTILS_ROOT = File.expand_path("..", __dir__)
19
- VERSION = "16.10.17"
20
- end
1
+ # frozen_string_literal: true
2
+ # Copyright:: Copyright (c) Chef Software Inc.
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ module ChefUtils
18
+ CHEFUTILS_ROOT = File.expand_path("..", __dir__)
19
+ VERSION = "17.10.19"
20
+ end
@@ -1,160 +1,160 @@
1
- # frozen_string_literal: true
2
- # Copyright:: Copyright 2017, Noah Kantrowitz
3
- # License:: Apache License, Version 2.0
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
-
17
- module ChefUtils
18
- # String-like object for version strings.
19
- #
20
- # @since 13.2
21
- # @api internal
22
- class VersionString < String
23
- # Parsed version object for the string.
24
- # @return [Gem::Version]
25
- attr_reader :parsed_version
26
-
27
- # Create a new VersionString from an input String.
28
- #
29
- # @param val [String] Version string to parse.
30
- def initialize(val)
31
- val ||= ""
32
- super(val)
33
- begin
34
- @parsed_version = ::Gem::Version.create(self)
35
- rescue ArgumentError
36
- @parsed_version = nil
37
- end
38
- end
39
-
40
- # @!group Compat wrappers for String
41
-
42
- # Compat wrapper for + to behave like a normal String.
43
- #
44
- # @param other [String]
45
- # @return [String]
46
- def +(other)
47
- to_s + other
48
- end
49
-
50
- # Compat wrapper for * to behave like a normal String.
51
- #
52
- # @param other [Integer]
53
- # @return [String]
54
- def *(other)
55
- to_s * other
56
- end
57
-
58
- # @!group Comparison operators
59
-
60
- # Compare a VersionString to an object. If compared to another VersionString
61
- # then sort like `Gem::Version`, otherwise try to treat the other object as
62
- # a version but fall back to normal string comparison.
63
- #
64
- # @param other [Object]
65
- # @return [Integer]
66
- def <=>(other)
67
- other_ver = case other
68
- when VersionString
69
- other.parsed_version
70
- else
71
- begin
72
- Gem::Version.create(other.to_s)
73
- rescue ArgumentError
74
- # Comparing to a string that isn't a version.
75
- return super
76
- end
77
- end
78
- parsed_version <=> other_ver
79
- end
80
-
81
- # Compat wrapper for == based on <=>.
82
- #
83
- # @param other [Object]
84
- # @return [Boolean]
85
- def ==(other)
86
- (self <=> other) == 0
87
- end
88
-
89
- # Compat wrapper for != based on <=>.
90
- #
91
- # @param other [Object]
92
- # @return [Boolean]
93
- def !=(other)
94
- (self <=> other) != 0
95
- end
96
-
97
- # Compat wrapper for < based on <=>.
98
- #
99
- # @param other [Object]
100
- # @return [Boolean]
101
- def <(other)
102
- (self <=> other) < 0
103
- end
104
-
105
- # Compat wrapper for <= based on <=>.
106
- #
107
- # @param other [Object]
108
- # @return [Boolean]
109
- def <=(other)
110
- (self <=> other) < 1
111
- end
112
-
113
- # Compat wrapper for > based on <=>.
114
- #
115
- # @param other [Object]
116
- # @return [Boolean]
117
- def >(other)
118
- (self <=> other) > 0
119
- end
120
-
121
- # Compat wrapper for >= based on <=>.
122
- #
123
- # @param other [Object]
124
- # @return [Boolean]
125
- def >=(other)
126
- (self <=> other) > -1
127
- end
128
-
129
- # @!group Matching operators
130
-
131
- # Matching operator to support checking against a requirement string.
132
- #
133
- # @param other [Regexp, String]
134
- # @return [Boolean]
135
- # @example Match against a Regexp
136
- # ChefUtils::VersionString.new('1.0.0') =~ /^1/
137
- # @example Match against a requirement
138
- # ChefUtils::VersionString.new('1.0.0') =~ '~> 1.0'
139
- def =~(other)
140
- case other
141
- when Regexp
142
- super
143
- else
144
- begin
145
- Gem::Requirement.create(other) =~ parsed_version
146
- rescue ArgumentError
147
- # one side of the comparison wasn't parsable
148
- super
149
- end
150
- end
151
- end
152
-
153
- # Back-compat API for chef-sugar. The other APIs are preferable.
154
- #
155
- # @api private
156
- def satisfies?(*constraints)
157
- Gem::Requirement.new(*constraints).satisfied_by?(@parsed_version)
158
- end
159
- end
160
- end
1
+ # frozen_string_literal: true
2
+ # Copyright:: Copyright 2017, Noah Kantrowitz
3
+ # License:: Apache License, Version 2.0
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ module ChefUtils
18
+ # String-like object for version strings.
19
+ #
20
+ # @since 13.2
21
+ # @api internal
22
+ class VersionString < String
23
+ # Parsed version object for the string.
24
+ # @return [Gem::Version]
25
+ attr_reader :parsed_version
26
+
27
+ # Create a new VersionString from an input String.
28
+ #
29
+ # @param val [String] Version string to parse.
30
+ def initialize(val)
31
+ val ||= ""
32
+ super(val)
33
+ begin
34
+ @parsed_version = ::Gem::Version.create(self)
35
+ rescue ArgumentError
36
+ @parsed_version = nil
37
+ end
38
+ end
39
+
40
+ # @!group Compat wrappers for String
41
+
42
+ # Compat wrapper for + to behave like a normal String.
43
+ #
44
+ # @param other [String]
45
+ # @return [String]
46
+ def +(other)
47
+ to_s + other
48
+ end
49
+
50
+ # Compat wrapper for * to behave like a normal String.
51
+ #
52
+ # @param other [Integer]
53
+ # @return [String]
54
+ def *(other)
55
+ to_s * other
56
+ end
57
+
58
+ # @!group Comparison operators
59
+
60
+ # Compare a VersionString to an object. If compared to another VersionString
61
+ # then sort like `Gem::Version`, otherwise try to treat the other object as
62
+ # a version but fall back to normal string comparison.
63
+ #
64
+ # @param other [Object]
65
+ # @return [Integer]
66
+ def <=>(other)
67
+ other_ver = case other
68
+ when VersionString
69
+ other.parsed_version
70
+ else
71
+ begin
72
+ Gem::Version.create(other.to_s)
73
+ rescue ArgumentError
74
+ # Comparing to a string that isn't a version.
75
+ return super
76
+ end
77
+ end
78
+ parsed_version <=> other_ver
79
+ end
80
+
81
+ # Compat wrapper for == based on <=>.
82
+ #
83
+ # @param other [Object]
84
+ # @return [Boolean]
85
+ def ==(other)
86
+ (self <=> other) == 0
87
+ end
88
+
89
+ # Compat wrapper for != based on <=>.
90
+ #
91
+ # @param other [Object]
92
+ # @return [Boolean]
93
+ def !=(other)
94
+ (self <=> other) != 0
95
+ end
96
+
97
+ # Compat wrapper for < based on <=>.
98
+ #
99
+ # @param other [Object]
100
+ # @return [Boolean]
101
+ def <(other)
102
+ (self <=> other) < 0
103
+ end
104
+
105
+ # Compat wrapper for <= based on <=>.
106
+ #
107
+ # @param other [Object]
108
+ # @return [Boolean]
109
+ def <=(other)
110
+ (self <=> other) < 1
111
+ end
112
+
113
+ # Compat wrapper for > based on <=>.
114
+ #
115
+ # @param other [Object]
116
+ # @return [Boolean]
117
+ def >(other)
118
+ (self <=> other) > 0
119
+ end
120
+
121
+ # Compat wrapper for >= based on <=>.
122
+ #
123
+ # @param other [Object]
124
+ # @return [Boolean]
125
+ def >=(other)
126
+ (self <=> other) > -1
127
+ end
128
+
129
+ # @!group Matching operators
130
+
131
+ # Matching operator to support checking against a requirement string.
132
+ #
133
+ # @param other [Regexp, String]
134
+ # @return [Boolean]
135
+ # @example Match against a Regexp
136
+ # ChefUtils::VersionString.new('1.0.0') =~ /^1/
137
+ # @example Match against a requirement
138
+ # ChefUtils::VersionString.new('1.0.0') =~ '~> 1.0'
139
+ def =~(other)
140
+ case other
141
+ when Regexp
142
+ super
143
+ else
144
+ begin
145
+ Gem::Requirement.create(other) =~ parsed_version
146
+ rescue ArgumentError
147
+ # one side of the comparison wasn't parsable
148
+ super
149
+ end
150
+ end
151
+ end
152
+
153
+ # Back-compat API for chef-sugar. The other APIs are preferable.
154
+ #
155
+ # @api private
156
+ def satisfies?(*constraints)
157
+ Gem::Requirement.new(*constraints).satisfied_by?(@parsed_version)
158
+ end
159
+ end
160
+ end
data/lib/chef-utils.rb CHANGED
@@ -1,53 +1,53 @@
1
- # frozen_string_literal: true
2
- #
3
- # Copyright:: Copyright (c) Chef Software Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- require_relative "chef-utils/dsl/architecture"
20
- require_relative "chef-utils/dsl/cloud"
21
- require_relative "chef-utils/dsl/introspection"
22
- require_relative "chef-utils/dsl/os"
23
- require_relative "chef-utils/dsl/default_paths"
24
- require_relative "chef-utils/dsl/path_sanity"
25
- require_relative "chef-utils/dsl/platform"
26
- require_relative "chef-utils/dsl/platform_family"
27
- require_relative "chef-utils/dsl/platform_version"
28
- require_relative "chef-utils/dsl/service"
29
- require_relative "chef-utils/dsl/train_helpers"
30
- require_relative "chef-utils/dsl/virtualization"
31
- require_relative "chef-utils/dsl/which"
32
- require_relative "chef-utils/dsl/windows"
33
- require_relative "chef-utils/mash"
34
-
35
- # This is the Chef Infra Client DSL, not everything needs to go in here
36
- module ChefUtils
37
- include ChefUtils::DSL::Architecture
38
- include ChefUtils::DSL::Cloud
39
- include ChefUtils::DSL::DefaultPaths
40
- include ChefUtils::DSL::Introspection
41
- include ChefUtils::DSL::OS
42
- include ChefUtils::DSL::Platform
43
- include ChefUtils::DSL::PlatformFamily
44
- include ChefUtils::DSL::PlatformVersion
45
- include ChefUtils::DSL::TrainHelpers
46
- include ChefUtils::DSL::Virtualization
47
- include ChefUtils::DSL::Which
48
- include ChefUtils::DSL::Windows
49
- # ChefUtils::DSL::Service is deliberately excluded
50
-
51
- CANARY = 1 # used as a guard for requires
52
- extend self
53
- end
1
+ # frozen_string_literal: true
2
+ #
3
+ # Copyright:: Copyright (c) Chef Software Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require_relative "chef-utils/dsl/architecture"
20
+ require_relative "chef-utils/dsl/cloud"
21
+ require_relative "chef-utils/dsl/introspection"
22
+ require_relative "chef-utils/dsl/os"
23
+ require_relative "chef-utils/dsl/default_paths"
24
+ require_relative "chef-utils/dsl/path_sanity"
25
+ require_relative "chef-utils/dsl/platform"
26
+ require_relative "chef-utils/dsl/platform_family"
27
+ require_relative "chef-utils/dsl/platform_version"
28
+ require_relative "chef-utils/dsl/service"
29
+ require_relative "chef-utils/dsl/train_helpers"
30
+ require_relative "chef-utils/dsl/virtualization"
31
+ require_relative "chef-utils/dsl/which"
32
+ require_relative "chef-utils/dsl/windows"
33
+ require_relative "chef-utils/mash"
34
+
35
+ # This is the Chef Infra Client DSL, not everything needs to go in here
36
+ module ChefUtils
37
+ include ChefUtils::DSL::Architecture
38
+ include ChefUtils::DSL::Cloud
39
+ include ChefUtils::DSL::DefaultPaths
40
+ include ChefUtils::DSL::Introspection
41
+ include ChefUtils::DSL::OS
42
+ include ChefUtils::DSL::Platform
43
+ include ChefUtils::DSL::PlatformFamily
44
+ include ChefUtils::DSL::PlatformVersion
45
+ include ChefUtils::DSL::TrainHelpers
46
+ include ChefUtils::DSL::Virtualization
47
+ include ChefUtils::DSL::Which
48
+ include ChefUtils::DSL::Windows
49
+ # ChefUtils::DSL::Service is deliberately excluded
50
+
51
+ CANARY = 1 # used as a guard for requires
52
+ extend self
53
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,100 +1,100 @@
1
- # frozen_string_literal: true
2
- require "chef-utils"
3
-
4
- # FIXME: dynamically generate this for accuracy
5
- HELPER_MODULES = [
6
- ChefUtils::DSL::Architecture,
7
- ChefUtils::DSL::Cloud,
8
- ChefUtils::DSL::Introspection,
9
- ChefUtils::DSL::OS,
10
- ChefUtils::DSL::DefaultPaths,
11
- ChefUtils::DSL::Platform,
12
- ChefUtils::DSL::PlatformFamily,
13
- ChefUtils::DSL::Service,
14
- ChefUtils::DSL::Virtualization,
15
- ChefUtils::DSL::Which,
16
- ChefUtils::DSL::Windows,
17
- ].freeze
18
-
19
- ARCH_HELPERS = (ChefUtils::DSL::Architecture.methods - Module.methods).freeze
20
- CLOUD_HELPERS = (ChefUtils::DSL::Cloud.methods - Module.methods).freeze
21
- INTROSPECTION_HELPERS = (ChefUtils::DSL::Introspection.methods - Module.methods).freeze
22
- OS_HELPERS = (ChefUtils::DSL::OS.methods - Module.methods).freeze
23
- PLATFORM_FAMILY_HELPERS = (ChefUtils::DSL::PlatformFamily.methods - Module.methods).freeze
24
- PLATFORM_HELPERS = (ChefUtils::DSL::Platform.methods - Module.methods).freeze
25
- VIRTUALIZATION_HELPERS = (ChefUtils::DSL::Virtualization.methods - Module.methods).freeze
26
- WINDOWS_HELPERS = (ChefUtils::DSL::Windows.methods - Module.methods).freeze
27
-
28
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
29
- RSpec.configure do |config|
30
- # rspec-expectations config goes here. You can use an alternate
31
- # assertion/expectation library such as wrong or the stdlib/minitest
32
- # assertions if you prefer.
33
- config.expect_with :rspec do |expectations|
34
- # This option will default to `true` in RSpec 4. It makes the `description`
35
- # and `failure_message` of custom matchers include text for helper methods
36
- # defined using `chain`, e.g.:
37
- # be_bigger_than(2).and_smaller_than(4).description
38
- # # => "be bigger than 2 and smaller than 4"
39
- # ...rather than:
40
- # # => "be bigger than 2"
41
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
42
- end
43
-
44
- # rspec-mocks config goes here. You can use an alternate test double
45
- # library (such as bogus or mocha) by changing the `mock_with` option here.
46
- config.mock_with :rspec do |mocks|
47
- # Prevents you from mocking or stubbing a method that does not exist on
48
- # a real object. This is generally recommended, and will default to
49
- # `true` in RSpec 4.
50
- mocks.verify_partial_doubles = true
51
- end
52
-
53
- # These two settings work together to allow you to limit a spec run
54
- # to individual examples or groups you care about by tagging them with
55
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
56
- # get run.
57
- config.filter_run :focus
58
- config.run_all_when_everything_filtered = true
59
-
60
- config.filter_run_excluding windows_only: true unless ChefUtils.windows?
61
- config.filter_run_excluding unix_only: true if ChefUtils.windows?
62
-
63
- # Limits the available syntax to the non-monkey patched syntax that is
64
- # recommended. For more details, see:
65
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
66
- # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
67
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
68
- config.disable_monkey_patching!
69
-
70
- # This setting enables warnings. It's recommended, but in some cases may
71
- # be too noisy due to issues in dependencies.
72
- config.warnings = true
73
-
74
- # Many RSpec users commonly either run the entire suite or an individual
75
- # file, and it's useful to allow more verbose output when running an
76
- # individual spec file.
77
- if config.files_to_run.one?
78
- # Use the documentation formatter for detailed output,
79
- # unless a formatter has already been configured
80
- # (e.g. via a command-line flag).
81
- config.default_formatter = "doc"
82
- end
83
-
84
- # Print the 10 slowest examples and example groups at the
85
- # end of the spec run, to help surface which specs are running
86
- # particularly slow.
87
- # config.profile_examples = 10
88
-
89
- # Run specs in random order to surface order dependencies. If you find an
90
- # order dependency and want to debug it, you can fix the order by providing
91
- # the seed, which is printed after each run.
92
- # --seed 1234
93
- config.order = :random
94
-
95
- # Seed global randomization in this process using the `--seed` CLI option.
96
- # Setting this allows you to use `--seed` to deterministically reproduce
97
- # test failures related to randomization by passing the same `--seed` value
98
- # as the one that triggered the failure.
99
- Kernel.srand config.seed
100
- end
1
+ # frozen_string_literal: true
2
+ require "chef-utils"
3
+
4
+ # FIXME: dynamically generate this for accuracy
5
+ HELPER_MODULES = [
6
+ ChefUtils::DSL::Architecture,
7
+ ChefUtils::DSL::Cloud,
8
+ ChefUtils::DSL::Introspection,
9
+ ChefUtils::DSL::OS,
10
+ ChefUtils::DSL::DefaultPaths,
11
+ ChefUtils::DSL::Platform,
12
+ ChefUtils::DSL::PlatformFamily,
13
+ ChefUtils::DSL::Service,
14
+ ChefUtils::DSL::Virtualization,
15
+ ChefUtils::DSL::Which,
16
+ ChefUtils::DSL::Windows,
17
+ ].freeze
18
+
19
+ ARCH_HELPERS = (ChefUtils::DSL::Architecture.methods - Module.methods).freeze
20
+ CLOUD_HELPERS = (ChefUtils::DSL::Cloud.methods - Module.methods).freeze
21
+ INTROSPECTION_HELPERS = (ChefUtils::DSL::Introspection.methods - Module.methods).freeze
22
+ OS_HELPERS = (ChefUtils::DSL::OS.methods - Module.methods).freeze
23
+ PLATFORM_FAMILY_HELPERS = (ChefUtils::DSL::PlatformFamily.methods - Module.methods).freeze
24
+ PLATFORM_HELPERS = (ChefUtils::DSL::Platform.methods - Module.methods).freeze
25
+ VIRTUALIZATION_HELPERS = (ChefUtils::DSL::Virtualization.methods - Module.methods).freeze
26
+ WINDOWS_HELPERS = (ChefUtils::DSL::Windows.methods - Module.methods).freeze
27
+
28
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
29
+ RSpec.configure do |config|
30
+ # rspec-expectations config goes here. You can use an alternate
31
+ # assertion/expectation library such as wrong or the stdlib/minitest
32
+ # assertions if you prefer.
33
+ config.expect_with :rspec do |expectations|
34
+ # This option will default to `true` in RSpec 4. It makes the `description`
35
+ # and `failure_message` of custom matchers include text for helper methods
36
+ # defined using `chain`, e.g.:
37
+ # be_bigger_than(2).and_smaller_than(4).description
38
+ # # => "be bigger than 2 and smaller than 4"
39
+ # ...rather than:
40
+ # # => "be bigger than 2"
41
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
42
+ end
43
+
44
+ # rspec-mocks config goes here. You can use an alternate test double
45
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
46
+ config.mock_with :rspec do |mocks|
47
+ # Prevents you from mocking or stubbing a method that does not exist on
48
+ # a real object. This is generally recommended, and will default to
49
+ # `true` in RSpec 4.
50
+ mocks.verify_partial_doubles = true
51
+ end
52
+
53
+ # These two settings work together to allow you to limit a spec run
54
+ # to individual examples or groups you care about by tagging them with
55
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
56
+ # get run.
57
+ config.filter_run :focus
58
+ config.run_all_when_everything_filtered = true
59
+
60
+ config.filter_run_excluding windows_only: true unless ChefUtils.windows?
61
+ config.filter_run_excluding unix_only: true if ChefUtils.windows?
62
+
63
+ # Limits the available syntax to the non-monkey patched syntax that is
64
+ # recommended. For more details, see:
65
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
66
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
67
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
68
+ config.disable_monkey_patching!
69
+
70
+ # This setting enables warnings. It's recommended, but in some cases may
71
+ # be too noisy due to issues in dependencies.
72
+ config.warnings = true
73
+
74
+ # Many RSpec users commonly either run the entire suite or an individual
75
+ # file, and it's useful to allow more verbose output when running an
76
+ # individual spec file.
77
+ if config.files_to_run.one?
78
+ # Use the documentation formatter for detailed output,
79
+ # unless a formatter has already been configured
80
+ # (e.g. via a command-line flag).
81
+ config.default_formatter = "doc"
82
+ end
83
+
84
+ # Print the 10 slowest examples and example groups at the
85
+ # end of the spec run, to help surface which specs are running
86
+ # particularly slow.
87
+ # config.profile_examples = 10
88
+
89
+ # Run specs in random order to surface order dependencies. If you find an
90
+ # order dependency and want to debug it, you can fix the order by providing
91
+ # the seed, which is printed after each run.
92
+ # --seed 1234
93
+ config.order = :random
94
+
95
+ # Seed global randomization in this process using the `--seed` CLI option.
96
+ # Setting this allows you to use `--seed` to deterministically reproduce
97
+ # test failures related to randomization by passing the same `--seed` value
98
+ # as the one that triggered the failure.
99
+ Kernel.srand config.seed
100
+ end