opt_parse_validator 0.0.17.0 → 0.0.17.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +5 -5
  2. data/lib/opt_parse_validator/config_files_loader_merger/base.rb +2 -0
  3. data/lib/opt_parse_validator/config_files_loader_merger/json.rb +2 -0
  4. data/lib/opt_parse_validator/config_files_loader_merger/yml.rb +2 -0
  5. data/lib/opt_parse_validator/config_files_loader_merger.rb +2 -0
  6. data/lib/opt_parse_validator/errors.rb +2 -0
  7. data/lib/opt_parse_validator/hacks.rb +2 -0
  8. data/lib/opt_parse_validator/opts/alias.rb +2 -0
  9. data/lib/opt_parse_validator/opts/array.rb +2 -0
  10. data/lib/opt_parse_validator/opts/base.rb +2 -0
  11. data/lib/opt_parse_validator/opts/boolean.rb +2 -0
  12. data/lib/opt_parse_validator/opts/choice.rb +3 -1
  13. data/lib/opt_parse_validator/opts/credentials.rb +2 -0
  14. data/lib/opt_parse_validator/opts/directory_path.rb +2 -0
  15. data/lib/opt_parse_validator/opts/file_path.rb +2 -0
  16. data/lib/opt_parse_validator/opts/headers.rb +2 -0
  17. data/lib/opt_parse_validator/opts/integer.rb +2 -0
  18. data/lib/opt_parse_validator/opts/integer_range.rb +2 -0
  19. data/lib/opt_parse_validator/opts/multi_choices.rb +3 -1
  20. data/lib/opt_parse_validator/opts/path.rb +2 -0
  21. data/lib/opt_parse_validator/opts/positive_integer.rb +2 -0
  22. data/lib/opt_parse_validator/opts/proxy.rb +2 -0
  23. data/lib/opt_parse_validator/opts/regexp.rb +2 -0
  24. data/lib/opt_parse_validator/opts/smart_list.rb +2 -0
  25. data/lib/opt_parse_validator/opts/string.rb +2 -0
  26. data/lib/opt_parse_validator/opts/uri.rb +5 -3
  27. data/lib/opt_parse_validator/opts/url.rb +2 -0
  28. data/lib/opt_parse_validator/opts.rb +2 -0
  29. data/lib/opt_parse_validator/version.rb +3 -1
  30. data/lib/opt_parse_validator.rb +2 -0
  31. metadata +5 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 315b683b0c51adbc5afc6087639680d8fdd7af7c
4
- data.tar.gz: 015f3118b80dbf817fafbbfd2f96479a05fa8223
2
+ SHA256:
3
+ metadata.gz: 5395143bb809bb24d61fb417e7833884059301bb105ce7048525f164091b28b1
4
+ data.tar.gz: 9678e2af54bb6fbdca0763277a2ddfb24c4760d29e545f2935c2413f2b1ae1a0
5
5
  SHA512:
6
- metadata.gz: 6dbf1eaf46c391923531d1eab92d0090c0ac574e617b2499c38ae5d5c55578621fd75bd2f9b62602d9c53eadf0c36588041c38d039896218b7b71002312f95be
7
- data.tar.gz: 8a6b2b370acc963c084e356edef00f64197d3ffa51263a3780898adb449202e789c299197f5259a629e9014747b52b19d30e5a19d3f5c5946b361cb4644d310a
6
+ metadata.gz: 1f1c685f63ba8ff70ad67a5df1678e72b898e06a7d5ea70f0d068afb7a30cb2b195f643a40daa1864efc7eeaaeb6d6473d3e9af240098b24f27cb1e62acbdf3b
7
+ data.tar.gz: 4b296611ecad07d1be4adee75685edfe4cb61dc7413bb734153c7fbbece7fbd1f04f56c15ef2a2916b214cf21670bed4316f710f2c7daf24af4ac24afab16e92
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  class ConfigFilesLoaderMerger < Array
3
5
  module ConfigFile
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  module OptParseValidator
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
 
3
5
  module OptParseValidator
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'config_files_loader_merger/base'
2
4
  require_relative 'config_files_loader_merger/json'
3
5
  require_relative 'config_files_loader_merger/yml'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  class Error < RuntimeError
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class OptionParser
2
4
  # Hack to suppress the completion (expect for the -h/--help) which was leading to
3
5
  # unwanted behaviours
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Implementation of the Alias Option
3
5
  class OptAlias < OptBase
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Implementation of the Array Option
3
5
  class OptArray < OptBase
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Base Option
3
5
  # This Option should not be called, children should be used.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Implementation of the Boolean Option
3
5
  class OptBoolean < OptBase
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Implementation of the Choice Option
3
5
  class OptChoice < OptBase
@@ -23,7 +25,7 @@ module OptParseValidator
23
25
  # If :case_sensitive if false (or nil), the downcased value of the choice
24
26
  # will be returned
25
27
  def validate(value)
26
- value = value.to_s
28
+ value = +value.to_s
27
29
 
28
30
  unless attrs[:case_sensitive]
29
31
  value.downcase!
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Implementation of the Credentials Option
3
5
  class OptCredentials < OptBase
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Implemetantion of the DirectoryPath Option
3
5
  class OptDirectoryPath < OptPath
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Implementation of the FilePath Option
3
5
  class OptFilePath < OptPath
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Implementation of the Headers Option
3
5
  class OptHeaders < OptBase
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Implementation of the Integer Option
3
5
  class OptInteger < OptBase
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Implementation of the Integer Range Option
3
5
  class OptIntegerRange < OptBase
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Implementation of the MultiChoices Option
3
5
  class OptMultiChoices < OptArray
@@ -37,7 +39,7 @@ module OptParseValidator
37
39
  end
38
40
 
39
41
  def help_message_for_default
40
- msg = ''
42
+ msg = +''
41
43
 
42
44
  default.each do |key, value|
43
45
  msg << if value == true
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Implementation of the Path Option
3
5
  class OptPath < OptBase
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Implementation of the Positive Integer Option
3
5
  class OptPositiveInteger < OptInteger
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Implementation of the Proxy Option
3
5
  class OptProxy < OptURI
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Implementation of the Regexp Option
3
5
  # See http://ruby-doc.org/core-2.2.1/Regexp.html#method-c-new for expected values in :options
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Implementation of the SmartList Option
3
5
  # Such option allow users to supply a list like
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Alias of OptBase
3
5
  # Used for convenience
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Implementation of the URI Option
3
5
  class OptURI < OptBase
@@ -11,12 +13,12 @@ module OptParseValidator
11
13
 
12
14
  # @return [ Array<String> ]
13
15
  def allowed_protocols
14
- @allowed_protocols ||= [*attrs[:protocols]]
16
+ @allowed_protocols ||= [*attrs[:protocols]].map(&:downcase)
15
17
  end
16
18
 
17
19
  # The default protocol (or scheme) to use if none was given
18
20
  def default_protocol
19
- @default_protocol ||= attrs[:default_protocol]
21
+ @default_protocol ||= attrs[:default_protocol]&.downcase
20
22
  end
21
23
 
22
24
  # @param [ String ] value
@@ -27,7 +29,7 @@ module OptParseValidator
27
29
 
28
30
  uri = Addressable::URI.parse("#{default_protocol}://#{value}") if !uri.scheme && default_protocol
29
31
 
30
- unless allowed_protocols.empty? || allowed_protocols.include?(uri.scheme)
32
+ unless allowed_protocols.empty? || allowed_protocols.include?(uri.scheme&.downcase)
31
33
  # For future refs: will have to check if the uri.scheme exists,
32
34
  # otherwise it means that the value was empty
33
35
  raise Addressable::URI::InvalidURIError
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OptParseValidator
2
4
  # Implementation of the URL Option
3
5
  class OptURL < OptURI
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  %w[
2
4
  base string integer positive_integer choice boolean uri url proxy credentials
3
5
  path file_path directory_path array integer_range multi_choices regexp headers
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Gem Version
2
4
  module OptParseValidator
3
- VERSION = '0.0.17.0'.freeze
5
+ VERSION = '0.0.17.1'
4
6
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Gems
2
4
  require 'addressable/uri'
3
5
  require 'active_support/inflector'
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: 0.0.17.0
4
+ version: 0.0.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - WPScanTeam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-02 00:00:00.000000000 Z
11
+ date: 2019-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -126,14 +126,14 @@ dependencies:
126
126
  requirements:
127
127
  - - "~>"
128
128
  - !ruby/object:Gem::Version
129
- version: 0.65.0
129
+ version: 0.66.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.65.0
136
+ version: 0.66.0
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: simplecov
139
139
  requirement: !ruby/object:Gem::Requirement
@@ -206,8 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  - !ruby/object:Gem::Version
207
207
  version: '0'
208
208
  requirements: []
209
- rubyforge_project:
210
- rubygems_version: 2.6.10
209
+ rubygems_version: 3.0.3
211
210
  signing_key:
212
211
  specification_version: 4
213
212
  summary: Ruby OptionParser Validators