inspec-core 3.3.14 → 3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/etc/deprecations.json +4 -0
- data/lib/inspec/objects/attribute.rb +18 -7
- data/lib/inspec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd93e17059f4e6da1bd640c908688b009b7d851b33ac2c12227045d71a5a25a2
|
4
|
+
data.tar.gz: c4edad3d720f7db313a01f7eded6763de0d0b033d34770322496b4a282894e11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40cc89ad2cd53ecb0662985ff9901c953b00bae85e6313ba7bdf28b68b22acc4725cb871256c22107a552f6ea074e7d02e093b0a566cdded0addd0548f4a7314
|
7
|
+
data.tar.gz: 7bb582628c261148e8633bd1e3de49b0c8d7b009873e34458b2669b27af6e93a747b993a67a7acf513f7886e1c5c0d3d97b9e6b023a496d889c3a833a6e9fb90
|
data/README.md
CHANGED
data/etc/deprecations.json
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# encoding:utf-8
|
2
2
|
|
3
|
+
require 'utils/deprecation'
|
4
|
+
|
3
5
|
module Inspec
|
4
6
|
class Attribute
|
5
7
|
attr_accessor :name
|
@@ -21,8 +23,8 @@ module Inspec
|
|
21
23
|
# output warn message if we are in a exec call
|
22
24
|
Inspec::Log.warn(
|
23
25
|
"Attribute '#{@name}' does not have a value. "\
|
24
|
-
"Use --attrs to provide a value for '#{@name}' or specify a
|
25
|
-
"value with `attribute('#{@name}',
|
26
|
+
"Use --attrs to provide a value for '#{@name}' or specify a "\
|
27
|
+
"value with `attribute('#{@name}', value: 'somevalue', ...)`.",
|
26
28
|
) if Inspec::BaseCLI.inspec_cli_command == :exec
|
27
29
|
end
|
28
30
|
|
@@ -42,8 +44,17 @@ module Inspec
|
|
42
44
|
def initialize(name, options = {})
|
43
45
|
@name = name
|
44
46
|
@opts = options
|
45
|
-
|
46
|
-
|
47
|
+
if @opts.key?(:default)
|
48
|
+
Inspec.deprecate(:attrs_value_replaces_default, "attribute name: '#{name}'")
|
49
|
+
if @opts.key?(:value)
|
50
|
+
Inspec::Log.warn "Attribute #{@name} created using both :default and :value options - ignoring :default"
|
51
|
+
@opts.delete(:default)
|
52
|
+
else
|
53
|
+
@opts[:value] = @opts.delete(:default)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
@value = @opts[:value]
|
57
|
+
validate_value_type(@value) if @opts.key?(:type) && @opts.key?(:value)
|
47
58
|
end
|
48
59
|
|
49
60
|
def value=(new_value)
|
@@ -54,7 +65,7 @@ module Inspec
|
|
54
65
|
def value
|
55
66
|
if @value.nil?
|
56
67
|
validate_required(@value) if @opts[:required] == true
|
57
|
-
@value =
|
68
|
+
@value = value_or_dummy
|
58
69
|
else
|
59
70
|
@value
|
60
71
|
end
|
@@ -162,8 +173,8 @@ module Inspec
|
|
162
173
|
end
|
163
174
|
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
164
175
|
|
165
|
-
def
|
166
|
-
@opts.key?(:
|
176
|
+
def value_or_dummy
|
177
|
+
@opts.key?(:value) ? @opts[:value] : DEFAULT_ATTRIBUTE.new(@name)
|
167
178
|
end
|
168
179
|
end
|
169
180
|
end
|
data/lib/inspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inspec-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominik Richter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: train-core
|