optitron 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- optitron (0.1.7)
5
- callsite (= 0.0.4)
6
- ruby2ruby (= 1.2.4)
7
- ruby_parser (>= 2.0)
8
- sexp_processor (= 3.0.4)
4
+ optitron (0.1.8)
5
+ callsite (~> 0.0.4)
6
+ ruby2ruby (~> 1.2.4)
7
+ ruby_parser (~> 2.0)
8
+ sexp_processor (~> 3.0.4)
9
9
 
10
10
  GEM
11
11
  remote: http://rubygems.org/
@@ -13,22 +13,22 @@ GEM
13
13
  callsite (0.0.4)
14
14
  rake (0.8.7)
15
15
  rspec (1.3.0)
16
- ruby2ruby (1.2.4)
16
+ ruby2ruby (1.2.5)
17
17
  ruby_parser (~> 2.0)
18
18
  sexp_processor (~> 3.0)
19
- ruby_parser (2.0.4)
19
+ ruby_parser (2.0.5)
20
20
  sexp_processor (~> 3.0)
21
- sexp_processor (3.0.4)
21
+ sexp_processor (3.0.5)
22
22
 
23
23
  PLATFORMS
24
24
  ruby
25
25
 
26
26
  DEPENDENCIES
27
- bundler (>= 1.0.0.rc.3)
28
- callsite (= 0.0.4)
27
+ bundler (~> 1.0.0)
28
+ callsite (~> 0.0.4)
29
29
  optitron!
30
30
  rake
31
31
  rspec
32
- ruby2ruby (= 1.2.4)
33
- ruby_parser (>= 2.0)
34
- sexp_processor (= 3.0.4)
32
+ ruby2ruby (~> 1.2.4)
33
+ ruby_parser (~> 2.0)
34
+ sexp_processor (~> 3.0.4)
@@ -25,9 +25,26 @@ class Optitron
25
25
 
26
26
  def process_class(exp)
27
27
  exp.shift
28
- @current_class << exp.first.to_sym
29
- process(exp)
30
- @current_class.pop
28
+ current_class_size = @current_class.size
29
+ case exp.first
30
+ when Symbol
31
+ @current_class << exp.first.to_sym
32
+ process(exp)
33
+ else
34
+ if exp.first.first == :colon2
35
+ exp.first.shift
36
+ class_exp = exp.shift
37
+ class_exp[0, class_exp.size - 1].each do |const|
38
+ @current_class << const.last
39
+ end
40
+ @current_class << class_exp.last
41
+ else
42
+ raise
43
+ end
44
+ exp.shift
45
+ process(exp.first)
46
+ end
47
+ @current_class.slice!(current_class_size, @current_class.size)
31
48
  exp.clear
32
49
  exp
33
50
  end
@@ -1,3 +1,3 @@
1
1
  class Optitron
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
@@ -15,11 +15,11 @@ Gem::Specification.new do |s|
15
15
  s.required_rubygems_version = ">= 1.3.6"
16
16
  s.rubyforge_project = "optitron"
17
17
 
18
- s.add_dependency "ruby_parser", ">= 2.0"
19
- s.add_dependency "callsite", "= 0.0.4"
20
- s.add_dependency "ruby2ruby", "= 1.2.4"
21
- s.add_dependency "sexp_processor", "= 3.0.4"
22
- s.add_development_dependency "bundler", ">= 1.0.0.rc.3"
18
+ s.add_dependency "ruby_parser", "~> 2.0"
19
+ s.add_dependency "callsite", "~> 0.0.4"
20
+ s.add_dependency "ruby2ruby", "~> 1.2.4"
21
+ s.add_dependency "sexp_processor", "~> 3.0.4"
22
+ s.add_development_dependency "bundler", "~> 1.0.0"
23
23
  s.add_development_dependency "rake"
24
24
  s.add_development_dependency "rspec"
25
25
 
@@ -77,6 +77,18 @@ class CLIExampleWithArgHinting < Optitron::CLI
77
77
  end
78
78
  end
79
79
 
80
+ module Nested; end
81
+ class Nested::NestedExample < Optitron::CLI
82
+
83
+ class_opt 'verbose'
84
+
85
+ desc "Use this too"
86
+ opt 'another_opt'
87
+ def use_too(one, two = 'three')
88
+ puts "using this too #{one} #{two} #{params['another_opt']} #{@env}"
89
+ end
90
+ end
91
+
80
92
 
81
93
  describe "Optitron::Parser defaults" do
82
94
  it "should generate the correct help" do
@@ -118,4 +130,9 @@ describe "Optitron::Parser defaults" do
118
130
  AModule::CLIInAModule.build
119
131
  AModule::CLIInAModule.optitron_parser.help.should == "Commands\n\nmethod [arg1] # a method\n\nGlobal options\n\n-?/--help # Print help message"
120
132
  end
133
+
134
+ it "should dispatch from within a different sort of module" do
135
+ Nested::NestedExample.build
136
+ AModule::CLIInAModule.optitron_parser.help.should == "Commands\n\nmethod [arg1] # a method\n\nGlobal options\n\n-?/--help # Print help message"
137
+ end
121
138
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optitron
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 8
10
- version: 0.1.8
9
+ - 9
10
+ version: 0.1.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joshua Hull
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-29 00:00:00 -07:00
18
+ date: 2010-10-02 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -24,7 +24,7 @@ dependencies:
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ">="
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  hash: 3
30
30
  segments:
@@ -39,7 +39,7 @@ dependencies:
39
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
- - - "="
42
+ - - ~>
43
43
  - !ruby/object:Gem::Version
44
44
  hash: 23
45
45
  segments:
@@ -55,7 +55,7 @@ dependencies:
55
55
  requirement: &id003 !ruby/object:Gem::Requirement
56
56
  none: false
57
57
  requirements:
58
- - - "="
58
+ - - ~>
59
59
  - !ruby/object:Gem::Version
60
60
  hash: 23
61
61
  segments:
@@ -71,7 +71,7 @@ dependencies:
71
71
  requirement: &id004 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
- - - "="
74
+ - - ~>
75
75
  - !ruby/object:Gem::Version
76
76
  hash: 15
77
77
  segments:
@@ -87,16 +87,14 @@ dependencies:
87
87
  requirement: &id005 !ruby/object:Gem::Requirement
88
88
  none: false
89
89
  requirements:
90
- - - ">="
90
+ - - ~>
91
91
  - !ruby/object:Gem::Version
92
- hash: 15424051
92
+ hash: 23
93
93
  segments:
94
94
  - 1
95
95
  - 0
96
96
  - 0
97
- - rc
98
- - 3
99
- version: 1.0.0.rc.3
97
+ version: 1.0.0
100
98
  type: :development
101
99
  version_requirements: *id005
102
100
  - !ruby/object:Gem::Dependency