choosy 0.4.9 → 0.4.10
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +13 -1
- data/README.md +259 -0
- data/Rakefile +28 -17
- data/lib/VERSION.yml +4 -4
- data/lib/choosy.rb +38 -10
- data/lib/choosy/argument.rb +0 -2
- data/lib/choosy/base_command.rb +9 -8
- data/lib/choosy/command.rb +0 -6
- data/lib/choosy/converter.rb +0 -5
- data/lib/choosy/dsl/argument_builder.rb +0 -5
- data/lib/choosy/dsl/base_builder.rb +0 -2
- data/lib/choosy/dsl/base_command_builder.rb +54 -42
- data/lib/choosy/dsl/command_builder.rb +0 -6
- data/lib/choosy/dsl/option_builder.rb +4 -6
- data/lib/choosy/dsl/super_command_builder.rb +0 -4
- data/lib/choosy/errors.rb +10 -2
- data/lib/choosy/option.rb +0 -3
- data/lib/choosy/parse_result.rb +0 -2
- data/lib/choosy/parser.rb +0 -4
- data/lib/choosy/printing/base_printer.rb +0 -3
- data/lib/choosy/printing/color.rb +21 -33
- data/lib/choosy/printing/erb_printer.rb +0 -2
- data/lib/choosy/printing/formatting_element.rb +0 -2
- data/lib/choosy/printing/help_printer.rb +0 -3
- data/lib/choosy/printing/manpage.rb +5 -2
- data/lib/choosy/printing/manpage_printer.rb +1 -6
- data/lib/choosy/rake.rb +33 -31
- data/lib/choosy/super_command.rb +1 -7
- data/lib/choosy/super_parser.rb +0 -6
- data/lib/choosy/terminal.rb +0 -3
- data/lib/choosy/verifier.rb +0 -3
- data/lib/choosy/version.rb +0 -2
- data/spec/choosy/argument_spec.rb +0 -3
- data/spec/choosy/base_command_spec.rb +0 -3
- data/spec/choosy/command_spec.rb +0 -4
- data/spec/choosy/converter_spec.rb +0 -4
- data/spec/choosy/dsl/argument_builder_spec.rb +0 -3
- data/spec/choosy/dsl/base_builder_spec.rb +0 -3
- data/spec/choosy/dsl/base_command_builder_spec.rb +18 -5
- data/spec/choosy/dsl/commmand_builder_spec.rb +0 -6
- data/spec/choosy/dsl/option_builder_spec.rb +0 -3
- data/spec/choosy/dsl/super_command_builder_spec.rb +0 -4
- data/spec/choosy/option_spec.rb +0 -3
- data/spec/choosy/parser_spec.rb +0 -5
- data/spec/choosy/printing/base_printer_spec.rb +0 -5
- data/spec/choosy/printing/color_spec.rb +1 -4
- data/spec/choosy/printing/help_printer_spec.rb +0 -5
- data/spec/choosy/printing/manpage_printer_spec.rb +0 -4
- data/spec/choosy/printing/manpage_spec.rb +2 -3
- data/spec/choosy/super_command_spec.rb +0 -3
- data/spec/choosy/super_parser_spec.rb +0 -5
- data/spec/choosy/terminal_spec.rb +0 -3
- data/spec/choosy/verifier_spec.rb +0 -7
- data/spec/choosy/version_spec.rb +0 -2
- metadata +127 -121
- data/README.markdown +0 -463
- data/lib/choosy/printing.rb +0 -1
- data/spec/integration/command-A_spec.rb +0 -37
data/lib/choosy/super_command.rb
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
require 'choosy/errors'
|
2
|
-
require 'choosy/parser'
|
3
|
-
require 'choosy/base_command'
|
4
|
-
require 'choosy/super_parser'
|
5
|
-
require 'choosy/dsl/super_command_builder'
|
6
|
-
|
7
1
|
module Choosy
|
8
2
|
class SuperCommand < BaseCommand
|
9
3
|
attr_accessor :metaname, :default_command
|
@@ -66,7 +60,7 @@ module Choosy
|
|
66
60
|
def handle_help(hc)
|
67
61
|
command_name = hc.message
|
68
62
|
|
69
|
-
if command_name == :
|
63
|
+
if command_name == :help || command_name == Choosy::DSL::SuperCommandBuilder::SUPER
|
70
64
|
printer.print!(self)
|
71
65
|
else
|
72
66
|
builder = command_builders[command_name]
|
data/lib/choosy/super_parser.rb
CHANGED
data/lib/choosy/terminal.rb
CHANGED
data/lib/choosy/verifier.rb
CHANGED
data/lib/choosy/version.rb
CHANGED
data/spec/choosy/command_spec.rb
CHANGED
@@ -1,8 +1,3 @@
|
|
1
|
-
require 'spec_helpers'
|
2
|
-
require 'choosy/dsl/base_command_builder'
|
3
|
-
require 'choosy/command'
|
4
|
-
require 'choosy/super_command'
|
5
|
-
|
6
1
|
module Choosy::DSL
|
7
2
|
describe BaseCommandBuilder do
|
8
3
|
before :each do
|
@@ -404,6 +399,24 @@ module Choosy::DSL
|
|
404
399
|
v = @builder.version "1.0"
|
405
400
|
v.cast_to.should eql(:boolean)
|
406
401
|
end
|
402
|
+
|
403
|
+
it "should create a singleton method for the actual version" do
|
404
|
+
v = @builder.version "1.0"
|
405
|
+
v.version.should eql("1.0")
|
406
|
+
end
|
407
407
|
end#version
|
408
|
+
|
409
|
+
describe :no_color do
|
410
|
+
it "should allow for a custom message" do
|
411
|
+
n = @builder.no_color "msg"
|
412
|
+
n.description.should eql("msg")
|
413
|
+
end
|
414
|
+
|
415
|
+
it "should turn off the printing" do
|
416
|
+
n = @builder.no_color "msg"
|
417
|
+
n.validation_step.call
|
418
|
+
@builder.entity.printer.color.should be_disabled
|
419
|
+
end
|
420
|
+
end
|
408
421
|
end
|
409
422
|
end
|
data/spec/choosy/option_spec.rb
CHANGED
data/spec/choosy/parser_spec.rb
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
require 'spec_helpers'
|
2
|
-
require 'choosy/printing/color'
|
3
|
-
|
4
1
|
module Choosy::Printing
|
5
2
|
describe Color do
|
6
3
|
before :each do
|
@@ -42,7 +39,7 @@ module Choosy::Printing
|
|
42
39
|
it "should fail on too many arguments" do
|
43
40
|
attempting {
|
44
41
|
@c.red("string", :foreground, "extra")
|
45
|
-
}.should raise_error(ArgumentError, /
|
42
|
+
}.should raise_error(ArgumentError, /max 2/)
|
46
43
|
end
|
47
44
|
|
48
45
|
it "should fail when setting a style not foreground or background" do
|
@@ -1,6 +1,3 @@
|
|
1
|
-
require 'choosy/printing/manpage'
|
2
|
-
require 'spec_helpers'
|
3
|
-
|
4
1
|
module Choosy::Printing
|
5
2
|
describe ManpageFormatter do
|
6
3
|
before :each do
|
@@ -184,6 +181,7 @@ module Choosy::Printing
|
|
184
181
|
@man.name = "blah"
|
185
182
|
@man.date = 'today'
|
186
183
|
|
184
|
+
@man.column_width = 100
|
187
185
|
@man.section_heading('description')
|
188
186
|
@man.paragraph('this is a line of text')
|
189
187
|
|
@@ -196,6 +194,7 @@ module Choosy::Printing
|
|
196
194
|
.nh
|
197
195
|
.\\" disable justification (adjust text to left margin only)
|
198
196
|
.ad l
|
197
|
+
.ll 100
|
199
198
|
.SH "DESCRIPTION"
|
200
199
|
.P
|
201
200
|
this is a line of text
|
data/spec/choosy/version_spec.rb
CHANGED
metadata
CHANGED
@@ -1,184 +1,190 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: choosy
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 4
|
8
|
-
- 9
|
9
|
-
version: 0.4.9
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.10
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Gabe McArthur
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-04-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rspec
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
- 0
|
30
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
31
22
|
type: :development
|
32
|
-
version_requirements: *id001
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: autotest
|
35
23
|
prerelease: false
|
36
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
25
|
none: false
|
38
|
-
requirements:
|
39
|
-
- -
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
|
42
|
-
|
43
|
-
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: autotest
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
44
38
|
type: :development
|
45
|
-
version_requirements: *id002
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: autotest-notification
|
48
39
|
prerelease: false
|
49
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
41
|
none: false
|
51
|
-
requirements:
|
52
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
|
55
|
-
|
56
|
-
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: autotest-notification
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
57
54
|
type: :development
|
58
|
-
|
59
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
60
63
|
name: ZenTest
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
61
71
|
prerelease: false
|
62
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
73
|
none: false
|
64
|
-
requirements:
|
65
|
-
- -
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
|
68
|
-
|
69
|
-
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: cucumber
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
70
86
|
type: :development
|
71
|
-
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
72
94
|
description: This is a DSL for creating more complicated command line tools.
|
73
|
-
email:
|
95
|
+
email:
|
74
96
|
- madeonamac@gmail.com
|
75
97
|
executables: []
|
76
|
-
|
77
98
|
extensions: []
|
78
|
-
|
79
99
|
extra_rdoc_files: []
|
80
|
-
|
81
|
-
|
82
|
-
- TODO.md
|
100
|
+
files:
|
101
|
+
- CHANGELOG.md
|
83
102
|
- Gemfile
|
84
|
-
- README.markdown
|
85
103
|
- Gemfile.lock
|
86
|
-
- CHANGELOG.md
|
87
104
|
- LICENSE
|
88
105
|
- Rakefile
|
89
|
-
-
|
90
|
-
-
|
91
|
-
- lib/choosy/errors.rb
|
92
|
-
- lib/choosy/printing.rb
|
93
|
-
- lib/choosy/rake.rb
|
94
|
-
- lib/choosy/converter.rb
|
95
|
-
- lib/choosy/parse_result.rb
|
96
|
-
- lib/choosy/verifier.rb
|
106
|
+
- README.md
|
107
|
+
- TODO.md
|
97
108
|
- lib/choosy/argument.rb
|
98
|
-
- lib/choosy/
|
99
|
-
- lib/choosy/option.rb
|
109
|
+
- lib/choosy/base_command.rb
|
100
110
|
- lib/choosy/command.rb
|
101
|
-
- lib/choosy/
|
102
|
-
- lib/choosy/super_command.rb
|
111
|
+
- lib/choosy/converter.rb
|
103
112
|
- lib/choosy/dsl/argument_builder.rb
|
104
|
-
- lib/choosy/dsl/super_command_builder.rb
|
105
113
|
- lib/choosy/dsl/base_builder.rb
|
114
|
+
- lib/choosy/dsl/base_command_builder.rb
|
106
115
|
- lib/choosy/dsl/command_builder.rb
|
107
116
|
- lib/choosy/dsl/option_builder.rb
|
108
|
-
- lib/choosy/dsl/
|
117
|
+
- lib/choosy/dsl/super_command_builder.rb
|
118
|
+
- lib/choosy/errors.rb
|
119
|
+
- lib/choosy/option.rb
|
109
120
|
- lib/choosy/parser.rb
|
110
|
-
- lib/choosy/
|
111
|
-
- lib/choosy/printing/manpage_printer.rb
|
121
|
+
- lib/choosy/parse_result.rb
|
112
122
|
- lib/choosy/printing/base_printer.rb
|
113
|
-
- lib/choosy/printing/formatting_element.rb
|
114
|
-
- lib/choosy/printing/manpage.rb
|
115
123
|
- lib/choosy/printing/color.rb
|
116
124
|
- lib/choosy/printing/erb_printer.rb
|
125
|
+
- lib/choosy/printing/formatting_element.rb
|
117
126
|
- lib/choosy/printing/help_printer.rb
|
127
|
+
- lib/choosy/printing/manpage.rb
|
128
|
+
- lib/choosy/printing/manpage_printer.rb
|
129
|
+
- lib/choosy/rake.rb
|
130
|
+
- lib/choosy/super_command.rb
|
118
131
|
- lib/choosy/super_parser.rb
|
119
|
-
-
|
120
|
-
-
|
121
|
-
-
|
122
|
-
-
|
123
|
-
-
|
124
|
-
- spec/integration/command-C_spec.rb
|
125
|
-
- spec/choosy/converter_spec.rb
|
126
|
-
- spec/choosy/option_spec.rb
|
127
|
-
- spec/choosy/version_spec.rb
|
132
|
+
- lib/choosy/terminal.rb
|
133
|
+
- lib/choosy/verifier.rb
|
134
|
+
- lib/choosy/version.rb
|
135
|
+
- lib/choosy.rb
|
136
|
+
- lib/VERSION.yml
|
128
137
|
- spec/choosy/argument_spec.rb
|
129
138
|
- spec/choosy/base_command_spec.rb
|
130
|
-
- spec/choosy/version.yml
|
131
|
-
- spec/choosy/terminal_spec.rb
|
132
139
|
- spec/choosy/command_spec.rb
|
133
|
-
- spec/choosy/
|
134
|
-
- spec/choosy/dsl/option_builder_spec.rb
|
135
|
-
- spec/choosy/dsl/base_builder_spec.rb
|
140
|
+
- spec/choosy/converter_spec.rb
|
136
141
|
- spec/choosy/dsl/argument_builder_spec.rb
|
137
|
-
- spec/choosy/dsl/
|
142
|
+
- spec/choosy/dsl/base_builder_spec.rb
|
138
143
|
- spec/choosy/dsl/base_command_builder_spec.rb
|
139
|
-
- spec/choosy/
|
140
|
-
- spec/choosy/
|
141
|
-
- spec/choosy/
|
142
|
-
- spec/choosy/
|
144
|
+
- spec/choosy/dsl/commmand_builder_spec.rb
|
145
|
+
- spec/choosy/dsl/option_builder_spec.rb
|
146
|
+
- spec/choosy/dsl/super_command_builder_spec.rb
|
147
|
+
- spec/choosy/option_spec.rb
|
148
|
+
- spec/choosy/parser_spec.rb
|
143
149
|
- spec/choosy/printing/base_printer_spec.rb
|
144
|
-
- spec/choosy/printing/manpage_printer_spec.rb
|
145
150
|
- spec/choosy/printing/color_spec.rb
|
151
|
+
- spec/choosy/printing/help_printer_spec.rb
|
152
|
+
- spec/choosy/printing/manpage_printer_spec.rb
|
146
153
|
- spec/choosy/printing/manpage_spec.rb
|
147
|
-
- spec/choosy/
|
154
|
+
- spec/choosy/super_command_spec.rb
|
155
|
+
- spec/choosy/super_parser_spec.rb
|
156
|
+
- spec/choosy/terminal_spec.rb
|
157
|
+
- spec/choosy/verifier_spec.rb
|
158
|
+
- spec/choosy/version.yml
|
159
|
+
- spec/choosy/version_spec.rb
|
160
|
+
- spec/integration/command-B_spec.rb
|
161
|
+
- spec/integration/command-C_spec.rb
|
162
|
+
- spec/integration/supercommand-A_spec.rb
|
163
|
+
- spec/integration/supercommand-B_spec.rb
|
164
|
+
- spec/integration/supercommand-C_spec.rb
|
148
165
|
- spec/spec_helpers.rb
|
149
|
-
has_rdoc: true
|
150
166
|
homepage: http://github.com/gabemc/choosy
|
151
167
|
licenses: []
|
152
|
-
|
153
168
|
post_install_message:
|
154
169
|
rdoc_options: []
|
155
|
-
|
156
|
-
require_paths:
|
170
|
+
require_paths:
|
157
171
|
- lib
|
158
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
172
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
159
173
|
none: false
|
160
|
-
requirements:
|
161
|
-
- -
|
162
|
-
- !ruby/object:Gem::Version
|
163
|
-
|
164
|
-
|
165
|
-
version: "0"
|
166
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
|
+
requirements:
|
175
|
+
- - ! '>='
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '0'
|
178
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
179
|
none: false
|
168
|
-
requirements:
|
169
|
-
- -
|
170
|
-
- !ruby/object:Gem::Version
|
171
|
-
segments:
|
172
|
-
- 1
|
173
|
-
- 3
|
174
|
-
- 6
|
180
|
+
requirements:
|
181
|
+
- - ! '>='
|
182
|
+
- !ruby/object:Gem::Version
|
175
183
|
version: 1.3.6
|
176
184
|
requirements: []
|
177
|
-
|
178
185
|
rubyforge_project:
|
179
|
-
rubygems_version: 1.
|
186
|
+
rubygems_version: 1.8.22
|
180
187
|
signing_key:
|
181
188
|
specification_version: 3
|
182
189
|
summary: Yet another option parsing library.
|
183
190
|
test_files: []
|
184
|
-
|