samovar 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/samovar/options.rb +2 -0
- data/lib/samovar/version.rb +1 -1
- data/spec/samovar/nested_spec.rb +12 -0
- data/spec/samovar/options_spec.rb +7 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b84967921a214bcd65328f937feca4b427c09fb07d29502726a4f1f336c4bca1
|
4
|
+
data.tar.gz: c744a006f8edf7923f7dac144677bb7ccad71ef766956ea8e8ab97caa408193a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f9d6a2dee6f8c9a7191fed4d51c3fef99202c3f75656014e9c076ee7e9f6d5520041329d02d3794b5abece10c9cab4834d70004706f7f7c54b72b8718e3a314
|
7
|
+
data.tar.gz: 45622ffd8225f5e09d7e041ebf904c307f61990ca88ab4239d1d6c499f8eb8774f6b58811896e807aba9a036948b522b353dbb5cc27164217f76e2bf0f035021
|
data/lib/samovar/options.rb
CHANGED
data/lib/samovar/version.rb
CHANGED
data/spec/samovar/nested_spec.rb
CHANGED
@@ -7,9 +7,16 @@ module Samovar::NestedSpec
|
|
7
7
|
end
|
8
8
|
|
9
9
|
class InnerB < Samovar::Command
|
10
|
+
options do
|
11
|
+
option '--help'
|
12
|
+
end
|
10
13
|
end
|
11
14
|
|
12
15
|
class Outer < Samovar::Command
|
16
|
+
options do
|
17
|
+
option '--help'
|
18
|
+
end
|
19
|
+
|
13
20
|
nested '<command>',
|
14
21
|
'inner-a' => InnerA,
|
15
22
|
'inner-b' => InnerB,
|
@@ -26,5 +33,10 @@ module Samovar::NestedSpec
|
|
26
33
|
outer = Outer['inner-a']
|
27
34
|
expect(outer.command).to be_kind_of(InnerA)
|
28
35
|
end
|
36
|
+
|
37
|
+
xit "should parse help option at outer level" do
|
38
|
+
outer = Outer['inner-a', '--help']
|
39
|
+
expect(outer.options[:help]).to_be truthy
|
40
|
+
end
|
29
41
|
end
|
30
42
|
end
|
@@ -4,6 +4,8 @@ RSpec.describe Samovar::Options do
|
|
4
4
|
described_class.parse do
|
5
5
|
option '-x <value>', "The x factor", default: 2
|
6
6
|
option '-y <value>', "The y factor"
|
7
|
+
|
8
|
+
option '--symbol <value>', "A symbol", type: Symbol
|
7
9
|
end
|
8
10
|
end
|
9
11
|
|
@@ -21,4 +23,9 @@ RSpec.describe Samovar::Options do
|
|
21
23
|
values = options.parse(['-x', 10], {x: 1, y: 2, z: 3})
|
22
24
|
expect(values).to be == {x: 10, y: 2, z: 3}
|
23
25
|
end
|
26
|
+
|
27
|
+
it "converts to symbol" do
|
28
|
+
values = options.parse(['--symbol', 'thing'], {})
|
29
|
+
expect(values[:symbol]).to eq :thing
|
30
|
+
end
|
24
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: samovar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mapping
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.6
|
138
|
+
rubygems_version: 2.7.6
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Samovar is a flexible option parser excellent support for sub-commands and
|