mirror of
https://github.com/inspec/inspec
synced 2024-11-26 22:50:36 +00:00
Merge pull request #4680 from inspec/btm/warn-objects
Deprecate inspec/object/* classes
This commit is contained in:
commit
e4a096ba83
10 changed files with 58 additions and 1 deletions
|
@ -116,6 +116,10 @@
|
|||
"wmi_non_hash_usage": {
|
||||
"action": "fail_control",
|
||||
"suffix": "This property was removed in InSpec 4.0."
|
||||
},
|
||||
"object_classes": {
|
||||
"action": "warn",
|
||||
"suffix": "These classes will be removed in InSpec 5.0."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
# This class is deprecated and will be removed in the next major release of InSpec.
|
||||
# Use the Inspec::Object classes from the inspec-objects rubygem instead.
|
||||
|
||||
require "inspec/utils/deprecation"
|
||||
|
||||
module Inspec
|
||||
class Control
|
||||
attr_accessor :id, :title, :descriptions, :impact, :tests, :tags, :refs, :only_if
|
||||
|
@ -6,6 +11,8 @@ module Inspec
|
|||
@tags = []
|
||||
@refs = []
|
||||
@descriptions = {}
|
||||
|
||||
Inspec.deprecate(:object_classes, "The Inspec::Control class is deprecated. Use the Inspec::Object::Control class from the inspec-objects Ruby library.")
|
||||
end
|
||||
|
||||
def add_test(t)
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
# This class is deprecated and will be removed in the next major release of InSpec.
|
||||
# Use the Inspec::Object classes from the inspec-objects rubygem instead.
|
||||
|
||||
require "inspec/utils/deprecation"
|
||||
|
||||
module Inspec
|
||||
class Describe
|
||||
# Internal helper to structure test objects.
|
||||
|
@ -53,6 +58,8 @@ module Inspec
|
|||
@qualifier = []
|
||||
@tests = []
|
||||
@variables = []
|
||||
|
||||
Inspec.deprecate(:object_classes, "The Inspec::Describe class is deprecated. Use the Inspec::Object::Describe class from the inspec-objects Ruby library.")
|
||||
end
|
||||
|
||||
def add_test(its, matcher, expectation, opts = {})
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
# This class is deprecated and will be removed in the next major release of InSpec.
|
||||
# Use the Inspec::Object classes from the inspec-objects rubygem instead.
|
||||
|
||||
require "inspec/utils/deprecation"
|
||||
|
||||
module Inspec
|
||||
class EachLoop < List
|
||||
attr_reader :variables
|
||||
|
@ -6,6 +11,8 @@ module Inspec
|
|||
super
|
||||
@tests = []
|
||||
@variables = []
|
||||
|
||||
Inspec.deprecate(:object_classes, "The Inspec::EachLoop class is deprecated. Use the Inspec::Object::EachLoop class from the inspec-objects Ruby library.")
|
||||
end
|
||||
|
||||
def add_test(t = nil)
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
# This file is deprecated and will be removed in the next major release of InSpec.
|
||||
# The Inspec::Input class will remain but these methods will be removed.
|
||||
# Use the Inspec::Object::Input class from the inspec-objects rubygem instead.
|
||||
|
||||
require "inspec/input"
|
||||
|
||||
module Inspec
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
# This class is deprecated and will be removed in the next major release of InSpec.
|
||||
# Use the Inspec::Object classes from the inspec-objects rubygem instead.
|
||||
|
||||
require "inspec/utils/deprecation"
|
||||
|
||||
module Inspec
|
||||
class OrTest
|
||||
attr_reader :tests
|
||||
def initialize(tests)
|
||||
@tests = tests
|
||||
@negated = false
|
||||
|
||||
Inspec.deprecate(:object_classes, "The Inspec::OrTest class is deprecated. Use the Inspec::Object::OrTest class from the inspec-objects Ruby library.")
|
||||
end
|
||||
|
||||
def skip
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
# This class is deprecated and will be removed in the next major release of InSpec.
|
||||
# Use the Inspec::Object classes from the inspec-objects rubygem instead.
|
||||
|
||||
require "inspec/utils/deprecation"
|
||||
|
||||
module Inspec
|
||||
class Tag
|
||||
attr_accessor :key, :value
|
||||
|
@ -5,6 +10,8 @@ module Inspec
|
|||
def initialize(key, value)
|
||||
@key = key
|
||||
@value = value
|
||||
|
||||
Inspec.deprecate(:object_classes, "The Inspec::Tag class is deprecated. Use the Inspec::Object::Tag class from the inspec-objects Ruby library.")
|
||||
end
|
||||
|
||||
def to_hash
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
# This class is deprecated and will be removed in the next major release of InSpec.
|
||||
# Use the Inspec::Object classes from the inspec-objects rubygem instead.
|
||||
|
||||
require "inspec/utils/deprecation"
|
||||
|
||||
module Inspec
|
||||
class Test
|
||||
attr_accessor :qualifier, :matcher, :expectation, :skip, :negated, :variables, :only_if
|
||||
|
@ -7,6 +12,8 @@ module Inspec
|
|||
@qualifier = []
|
||||
@negated = false
|
||||
@variables = []
|
||||
|
||||
Inspec.deprecate(:object_classes, "The Inspec::Test class is deprecated. Use the Inspec::Object::Test class from the inspec-objects Ruby library.")
|
||||
end
|
||||
|
||||
def negate!
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
# This class is deprecated and will be removed in the next major release of InSpec.
|
||||
# Use the Inspec::Object classes from the inspec-objects rubygem instead.
|
||||
|
||||
require "inspec/utils/deprecation"
|
||||
|
||||
module Inspec
|
||||
class Value
|
||||
include ::Inspec::RubyHelper
|
||||
|
@ -9,6 +14,8 @@ module Inspec
|
|||
def initialize(qualifiers = [])
|
||||
@qualifier = qualifiers
|
||||
@variable = nil
|
||||
|
||||
Inspec.deprecate(:object_classes, "The Inspec::Value class is deprecated. Use the Inspec::Object::Value class from the inspec-objects Ruby library.")
|
||||
end
|
||||
|
||||
def to_ruby
|
||||
|
|
|
@ -105,7 +105,7 @@ def handle_deprecations(opts_in, &block)
|
|||
expectations[group_name] = expectations[:all_others]
|
||||
end
|
||||
|
||||
# Wire up Insepc.deprecator accordingly using mocha stubbing
|
||||
# Wire up Inspec.deprecator accordingly using mocha stubbing
|
||||
expectations.each do |group_name, expectation|
|
||||
inst = Inspec::Deprecation::Deprecator.any_instance
|
||||
case expectation
|
||||
|
|
Loading…
Reference in a new issue