slop 4.10.0 → 4.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d4b4855a341f5e05c71ec19242556039ea85f4d339560dec38c24beb8831691
4
- data.tar.gz: 95fcb3512ee937216387467758a05992d72bbfad627fd79b939277a204c941ad
3
+ metadata.gz: fcc0ed29ee91f506402b198ce02623ee1040f8031c327a657377aa80bbf5376e
4
+ data.tar.gz: fcd35281ea96cca322645275cb51ea3b828a340941d31a862c2f84c711d2c3fa
5
5
  SHA512:
6
- metadata.gz: c0ecc669117cf0c6336e3dfb1cf65c5019a0d638205a2497511121e102f7af7f48f175ded4c03d382257710da679970e4e405b84bee44a0613781d90b5bd4b63
7
- data.tar.gz: 867c2ef751092ce4fafe9010f1b6ddb9ec7ee9adcdd2d020353129e7189b3ea8224f33ac368b773cca1298c297b159054775fb71074691e8ce9e20f780a58388
6
+ metadata.gz: 793194abed9bad4d6c1c764685453078130caee0ad65065b94aac4759320391f4b45bc367311391afd2af55dcabc1b513ad82003a42dc85b6b8621559815e03d
7
+ data.tar.gz: 4954ca723cc9f0550938ba5e95cd7bf50f0586501da1ae957f035181fcbbbfdbdf2a053f0c7849c236a84bc156abc1d96b5046eee55b79d65f4b46d4517f626a
data/CHANGELOG.md CHANGED
@@ -1,7 +1,14 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ v4.10.1 (2023-02-26)
5
+ --------------------
6
+
7
+ Bug fixes
8
+ * Fix boolean flags from being invalid when followed by arguments #279
9
+
4
10
  v4.10.0 (2023-02-15)
11
+ --------------------
5
12
 
6
13
  Features:
7
14
  * Add support for optional type validation [#278](https://github.com/leejarvis/slop/pull/278) (Victor Gama)
data/lib/slop/types.rb CHANGED
@@ -26,6 +26,11 @@ module Slop
26
26
  VALID_VALUES = (FALSE_VALUES + TRUE_VALUES).freeze
27
27
 
28
28
  def valid?(value)
29
+ # If we don't want to validate the type, then we don't care if the value
30
+ # is valid or not. Otherwise we would prevent boolean flags followed by
31
+ # arguments from being parsed correctly.
32
+ return true unless config[:validate_type]
33
+
29
34
  return true if value.is_a?(String) && value.start_with?("--")
30
35
  value.nil? || VALID_VALUES.include?(value)
31
36
  end
data/lib/slop.rb CHANGED
@@ -6,7 +6,7 @@ require 'slop/types'
6
6
  require 'slop/error'
7
7
 
8
8
  module Slop
9
- VERSION = '4.10.0'
9
+ VERSION = '4.10.1'
10
10
 
11
11
  # Parse an array of options (defaults to ARGV). Accepts an
12
12
  # optional hash of configuration options and block.
data/slop.gemspec CHANGED
@@ -10,7 +10,6 @@ Gem::Specification.new do |s|
10
10
  s.email = 'ljjarvis@gmail.com'
11
11
  s.homepage = 'http://github.com/leejarvis/slop'
12
12
  s.files = `git ls-files`.split("\n")
13
- s.test_files = `git ls-files -- test/*`.split("\n")
14
13
  s.license = 'MIT'
15
14
 
16
15
  s.required_ruby_version = '>= 2.0.0'
data/test/types_test.rb CHANGED
@@ -66,6 +66,13 @@ describe Slop::BoolOption do
66
66
  @result.parser.parse %w(--verbose foo)
67
67
  end
68
68
  end
69
+
70
+ # Like above but without validate_type
71
+ it "returns true if used and ignores the value" do
72
+ @result.parser.parse %w(--quiet foo)
73
+
74
+ assert_equal true, @result[:quiet]
75
+ end
69
76
  end
70
77
 
71
78
  describe Slop::IntegerOption do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slop
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.10.0
4
+ version: 4.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Jarvis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-15 00:00:00.000000000 Z
11
+ date: 2023-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -90,12 +90,4 @@ rubygems_version: 3.3.7
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: Simple Lightweight Option Parsing
93
- test_files:
94
- - test/error_test.rb
95
- - test/option_test.rb
96
- - test/options_test.rb
97
- - test/parser_test.rb
98
- - test/result_test.rb
99
- - test/slop_test.rb
100
- - test/test_helper.rb
101
- - test/types_test.rb
93
+ test_files: []