checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
---
2
2
SHA256:
3
- metadata.gz: ae0d41c70e9cc074f903928dac214865c73e6aaed27bb25eeba8d503eedfc04b
4
- data.tar.gz: 8e8a26c56dfbd87be9cd0bccff5dbad22063bcd773bd0c83d8af707dc3f8e51a
3
+ metadata.gz: bfcde1ed88a3d3b41836d151c76a25e1f5c6f36e5e62a2910878d9463dc8bddd
4
+ data.tar.gz: 6d07487070338fb64622883ed0c7d5cc70cc90e50d0c32ef56e48ebab47bdb07
5
5
SHA512:
6
- metadata.gz: 571e52865cb5cb5ddafc9fb32547e07843ce8bd24a6dc5c6a3fd0aba6b3555e71a48215a05db62a01ba146015e931f37a3cf9c73218c782e3c990b68fc413ef0
7
- data.tar.gz: a002c206b49f4cf5dad2591dcd5133a6140463a64a07a03f9d5cdb84056874bdecc3ab4fdb1310e468d97dd8b61a267a0724b6304363b32cd920250c40cc53f7
6
+ metadata.gz: efc33f8e0cc1522c8d7b22d1bff81227f26bf67693c3ea14800d34e361bcf0a76d7b04aa656bfc5ce19c10b6a78a37d03b146ff75ac141b1db629ce90e95699d
7
+ data.tar.gz: 5dba47501b4d609120a4033e1531ffe7af505e4bbd72aaea5a5725b1d00d61eddde009aa94096656a1fab9346c98e433a74be58dda68d67ea1cbe2ebd1032cf4
data/lib/opt_parse_validator.rb CHANGED
@@ -130,7 +130,14 @@ module OptParseValidator
130
130
@opts.each do |opt|
131
131
next unless files_data.key?(opt.to_sym)
132
132
133
- @results[opt.to_sym] = opt.normalize(opt.validate(files_data[opt.to_sym].to_s))
133
+ begin
134
+ @results[opt.to_sym] = opt.normalize(opt.validate(files_data[opt.to_sym].to_s))
135
+ rescue StandardError => e
136
+ # Adds the long option name to the message
137
+ # And raises it as an OptParseValidator::Error if not already one
138
+ # e.g --proxy Invalid Scheme format.
139
+ raise e.is_a?(Error) ? e.class : Error, "#{opt.to_long} #{e}"
140
+ end
134
141
end
135
142
end
136
143
data/lib/opt_parse_validator/config_files_loader_merger.rb CHANGED
@@ -4,6 +4,18 @@ require_relative 'config_files_loader_merger/base'
4
4
require_relative 'config_files_loader_merger/json'
5
5
require_relative 'config_files_loader_merger/yml'
6
6
7
+ # :nocov:
8
+ # @param [ String ] path The path of the file to load
9
+ # @param [ Hash ] opts See https://ruby-doc.org/stdlib-2.6.3/libdoc/psych/rdoc/Psych.html#method-c-safe_load
10
+ def yaml_safe_load(path, opts = {})
11
+ if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0.pre1') # Ruby 2.6
12
+ YAML.safe_load(File.read(path), opts) || {}
13
+ else
14
+ YAML.safe_load(File.read(path), opts[:permitted_classes] || [], opts[:permitted_symbols] || [], opts[:aliases]) || {}
15
+ end
16
+ end
17
+ # :nocov:
18
+
7
19
module OptParseValidator
8
20
# Options Files container
9
21
class ConfigFilesLoaderMerger < Array
data/lib/opt_parse_validator/config_files_loader_merger/yml.rb CHANGED
@@ -8,11 +8,11 @@ module OptParseValidator
8
8
# Yaml Implementation
9
9
class YML < Base
10
10
# @params [ Hash ] opts
11
- # @option opts [ Array ] :yaml_arguments See https://ruby-doc.org/stdlib-2.3.1/libdoc/psych/rdoc/Psych.html#method-c-safe_load
11
+ # @option opts [ Hash ] :yaml_options See https://ruby-doc.org/stdlib-2.6.3/libdoc/psych/rdoc/Psych.html#method-c-safe_load
12
12
#
13
13
# @return [ Hash ] a { 'key' => value } hash
14
14
def parse(opts = {})
15
- YAML.safe_load(File.read(path), *opts[:yaml_arguments]) || {}
15
+ yaml_safe_load(path, opts[:yaml_options] || {})
16
16
end
17
17
end
18
18
end
data/lib/opt_parse_validator/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
3
3
# Gem Version
4
4
module OptParseValidator
5
- VERSION = '1.7.3'
5
+ VERSION = '1.7.4'
6
6
end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
--- !ruby/object:Gem::Specification
2
2
name: opt_parse_validator
3
3
version: !ruby/object:Gem::Version
4
- version: 1.7.3
4
+ version: 1.7.4
5
5
platform: ruby
6
6
authors:
7
7
- WPScanTeam
8
8
autorequire:
9
9
bindir: bin
10
10
cert_chain: []
11
- date: 2019-06-17 00:00:00.000000000 Z
11
+ date: 2019-07-31 00:00:00.000000000 Z
12
12
dependencies:
13
13
- !ruby/object:Gem::Dependency
14
14
name: activesupport
@@ -126,28 +126,28 @@ dependencies:
126
126
requirements:
127
127
- - "~>"
128
128
- !ruby/object:Gem::Version
129
- version: 0.71.0
129
+ version: 0.73.0
130
130
type: :development
131
131
prerelease: false
132
132
version_requirements: !ruby/object:Gem::Requirement
133
133
requirements:
134
134
- - "~>"
135
135
- !ruby/object:Gem::Version
136
- version: 0.71.0
136
+ version: 0.73.0
137
137
- !ruby/object:Gem::Dependency
138
138
name: rubocop-performance
139
139
requirement: !ruby/object:Gem::Requirement
140
140
requirements:
141
141
- - "~>"
142
142
- !ruby/object:Gem::Version
143
- version: 1.3.0
143
+ version: 1.4.0
144
144
type: :development
145
145
prerelease: false
146
146
version_requirements: !ruby/object:Gem::Requirement
147
147
requirements:
148
148
- - "~>"
149
149
- !ruby/object:Gem::Version
150
- version: 1.3.0
150
+ version: 1.4.0
151
151
- !ruby/object:Gem::Dependency
152
152
name: simplecov
153
153
requirement: !ruby/object:Gem::Requirement