lucie-lib 0.0.20 → 0.0.21

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87f0e44f7eec657401b9a2c77468dc9c61f216c2
4
- data.tar.gz: 97b29ace94517aeff18c3398c93dc8f4659dff4f
3
+ metadata.gz: 6ba29b920b702de3ef30c503fd5443bdb17556b3
4
+ data.tar.gz: 942edb65990bb556630bc172c1708c538143972f
5
5
  SHA512:
6
- metadata.gz: aaaa30a83a84dce02f4025757df1d3f680a9496750fdd5d3343a8c75366c40bee0d8ec537db3361ad32b0339eec9554d300547088482f56f1e06f9536cc9ba46
7
- data.tar.gz: 0f6700a31e0a14f325c12a6ad73b6cc43407c9204060ced25b199f98e909a37e16528d35b6c69d75601f39f6039816f062352acfae28efa661dc62d7e59bdb28
6
+ metadata.gz: 332c09f53af5787823467ef1b4c91a5b18645ba3aea03cce020c6910920e6085e68f71590214281617c8778c19a3d83fce760f97711ec69cfd2680206300c5ab
7
+ data.tar.gz: 43d194c86db40c664b6b2e19f8707af182524fe7ece3b5cd5fde1c4df9c654af2a96a7a63811e59eaf0ba6a9bf84bb23a25249fc0029191e0387c6cf22534138
@@ -7,7 +7,10 @@ module Lucie
7
7
 
8
8
  class Validator < Base
9
9
  def apply(params)
10
- fail RequestError.new(self) unless params[:"#{short_option.gsub(/^-*/, '')}"]
10
+ if !params[:"#{short_option.gsub(/^-*/, '')}"] &&
11
+ !params[:"#{long_option.gsub(/^--*/, '')}"]
12
+ fail RequestError.new(self)
13
+ end
11
14
  end
12
15
  end
13
16
 
data/lib/lucie/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lucie
2
- VERSION = "0.0.20"
2
+ VERSION = "0.0.21"
3
3
  end
data/lucie-lib.gemspec CHANGED
@@ -22,4 +22,5 @@ Gem::Specification.new do |s|
22
22
  s.add_development_dependency "minitest", "4.6"
23
23
  s.add_development_dependency "mini_shoulda", "0.4.0"
24
24
  s.add_development_dependency "sdoc"
25
+ s.add_development_dependency "m", "~> 1.3.1"
25
26
  end
@@ -26,16 +26,28 @@ class OptionalMandatoryController < Controller::Base
26
26
  end
27
27
  end
28
28
 
29
- class ParameterPairingController < Controller::Base
30
- optional "-e", "--expression", "Search expression"
29
+ class ParameterPairingMandatoryController < Controller::Base
30
+ mandatory "-e", "--expression", "Search expression"
31
31
 
32
32
  def search_short
33
- print params[:expression]
33
+ print params[:e]
34
34
  end
35
35
 
36
36
  def search_long
37
+ print params[:expression]
38
+ end
39
+ end
40
+
41
+ class ParameterPairingOptionalController < Controller::Base
42
+ optional "-e", "--expression", "Search expression"
43
+
44
+ def search_short
37
45
  print params[:e]
38
46
  end
47
+
48
+ def search_long
49
+ print params[:expression]
50
+ end
39
51
  end
40
52
 
41
53
  class ExitValueController < Controller::Base
@@ -72,4 +84,5 @@ class MethodShouldBeRemovedController < Controller::Base
72
84
  def call_this_method
73
85
  print params[:args][0]
74
86
  end
75
- end
87
+ end
88
+
@@ -41,9 +41,18 @@ describe App do
41
41
  end
42
42
  end
43
43
 
44
- should "be able to pair parameters" do
45
- assert_output("some_string", nil) { TestApp.run("parameter_pairing search_short -e some_string") }
46
- assert_output("some_string", nil) { TestApp.run("parameter_pairing search_long --expression some_string") }
44
+ should "be able to pair optional parameters" do
45
+ assert_output("some_string", nil) { TestApp.run("parameter_pairing_optional search_short -e some_string") }
46
+ assert_output("some_string", nil) { TestApp.run("parameter_pairing_optional search_long -e some_string") }
47
+ assert_output("some_string", nil) { TestApp.run("parameter_pairing_optional search_short --expression some_string") }
48
+ assert_output("some_string", nil) { TestApp.run("parameter_pairing_optional search_long --expression some_string") }
49
+ end
50
+
51
+ should "be able to pair mandatory parameters" do
52
+ assert_output("some_string", nil) { TestApp.run("parameter_pairing_mandatory search_short -e some_string") }
53
+ assert_output("some_string", nil) { TestApp.run("parameter_pairing_mandatory search_long -e some_string") }
54
+ assert_output("some_string", nil) { TestApp.run("parameter_pairing_mandatory search_short --expression some_string") }
55
+ assert_output("some_string", nil) { TestApp.run("parameter_pairing_mandatory search_long --expression some_string") }
47
56
  end
48
57
 
49
58
  should "write to stderr that no controller found when controller is missing" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucie-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nucc
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: m
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 1.3.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 1.3.1
69
83
  description: Command line utility framework
70
84
  email:
71
85
  - nucc@bteam.hu