command-set 0.8.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.
data/doc/README ADDED
@@ -0,0 +1,2 @@
1
+ == This is a Really Cool Ruby Thing
2
+ === ( That deserves better documentation than this. )
@@ -0,0 +1,219 @@
1
+
2
+ Empty command set
3
+ - should_not be nil
4
+ - should be a CommandSet
5
+
6
+ A CommandSet without a root command
7
+ - should fail on missing commands
8
+
9
+ An established command set
10
+ - should add all properties to subject
11
+ - should return Command class on configured classes
12
+ - should find the root command with an argument
13
+ - should return subcommands
14
+ - should accept new commands in a subcommand
15
+ - should add Command objects
16
+ - should have Commands that know their own paths
17
+
18
+ Command::DSL::Argument
19
+ - should create an ArrayArgument from an array
20
+ - should create a StringArgument from a string
21
+ - should create a ProcArgument from a proc
22
+ - should create a NumberArgument from a range
23
+ - should raise a typeerror on an unhandled type
24
+ - should raise ArgumentError with missing based_on
25
+ - should decorate arguments as optional
26
+
27
+ A NumberArgument
28
+ - should complete arguments in range
29
+ - should validate zero
30
+ - should validate numbers
31
+ - should not validate numbers out of range
32
+ - should not validate non-numeric input
33
+ - should consume arguments properly
34
+
35
+ A FileArgument
36
+ - should complete with me
37
+ - should complete with list if prefix empty
38
+ - should validate me
39
+ - should validate absolute paths
40
+ - should not validate garbage
41
+ - should not validate directory
42
+
43
+ A ArrayArgument
44
+ - should consume legitimate values
45
+
46
+ A MultiArgument
47
+ - Should consume what it can, and put the rest back
48
+
49
+ Command::AlternatingArgument
50
+ - should consume to array
51
+ - should consume to number
52
+ - should raise with invalid arguments
53
+
54
+ Command::AlternatingArgument with reused subargument names
55
+ - should consume to array
56
+ - should consume to number
57
+ - should raise with invalid arguments
58
+
59
+ Command::CommandSetup
60
+ - should create Command from complete path
61
+ - should create Command from command path and arg hash
62
+ - should create Command from command path and arg hash (string keys)
63
+ - should create Command from incomplete path and arg hash
64
+ - should create Command from class and arg hash
65
+
66
+ Command::TextInterpreter
67
+ - should verify and return the subject that it's passed
68
+ - should set up and verify an actual subject
69
+ - should return the same command_set it's assigned
70
+ - should raise Runtime Error if told to start without subject
71
+ - should split line at spaces
72
+ - should split around quoted strings
73
+ - should not split escaped spaces
74
+ - should safely absorb wrapping spaces
75
+ - should ignore embedded quotes
76
+ - should ignore escaped quotes
77
+
78
+ Command::TextInterpreter all set up
79
+ - should complete words in the commmand-line
80
+ - should process a command-line
81
+
82
+ Command::TextInterpreter with a command with a named argument
83
+ - should complete words in the commmand-line
84
+ - should process a command-line
85
+
86
+ A fresh Subject
87
+ - should allow a field to be required
88
+ - should allow multiple fields to be required
89
+
90
+ A Subject with required fields
91
+ - should not verify if fields are not set
92
+ - should not verify if some fields are not set
93
+ - should verify if all fields are set
94
+ - should not respond to field read methods
95
+ - should spawn SubjectImage objects that do respond to readers
96
+
97
+ Command::Results::ListIterator
98
+ - should traverse list in tree order
99
+
100
+ Command::Results::List
101
+ - should compare to similar lists as similar
102
+ - should compare to different lists as different
103
+ - should filter lists by path
104
+ - should raise NoMatch for unmatched path
105
+ - should filter lists with wildcard list
106
+ - should treat lonely double-star as an identity
107
+ - should filter lists with double-star lists
108
+ - should filter lists with wildcard item
109
+
110
+ A fresh Command
111
+ - should return name properly
112
+ - should complete with empty arguments
113
+ - should raise NoMethodError if a required argument is defined after optionals
114
+
115
+ A Command with a required argument
116
+ - should complain if it's run without having been given arguments
117
+ - should complain if it's given fewer arguments than it requires
118
+ - should silently not complete extra arguments
119
+
120
+ A Command with a MultiArgument
121
+ - should complete with empty string
122
+ - should complete with Multi three times
123
+ - should complete with Multi and then Proc
124
+ - should complete with just Proc
125
+
126
+ A Command with an alternating argument
127
+ - should consume to array
128
+ - should consume to number
129
+ - should silently not complete extra arguments
130
+ - should raise with invalid arguments
131
+ - should successfully consume a hash of arguments
132
+
133
+ Command::Command with tasks
134
+ - should stop and return information for resuming
135
+ - should resume after the designated task
136
+
137
+ A chain of commands
138
+ - should chain with a complete command path
139
+ - should chain when an optional argument is omitted
140
+ - should chain with a path to the command and hashed args
141
+ - should chain with mixed and overlapping terms
142
+ - should chain with a class and an arg hash
143
+
144
+ Command::Results::Formatter
145
+ - should process into the correct list
146
+ - should allow explicit options to come through from command
147
+ - should allow explicit list options through
148
+ - should mark up items as directed by Command#format_advice
149
+ - should mark up items as directed by Command#format_advice
150
+
151
+ Command::Results::StrategyFormatter
152
+ 1
153
+ Two
154
+ Whoa!
155
+ missing
156
+ - should
157
+
158
+ A command set with the Set command
159
+ - should actually have the set command
160
+ - should reply to empty arguments with first level keys
161
+ - should reply to key with value
162
+ - should reply to subkeys with key list
163
+ - should silently modify values
164
+ - should modify deep values
165
+
166
+ A CommandSet with Set and Undo
167
+ - should actually have the set and undo commands
168
+ - should report an error on impossible undo
169
+ - should return to original value following undo
170
+
171
+ A CommandSet with Help
172
+ - should actually have the help command
173
+ - should return useful text in response to "help"
174
+ - should return useful text in response to "help help"
175
+ - should wrap to 78 characters on "help long_winded"
176
+ - should gracefully recover if a command has nil documentation
177
+ - should cope with nil command names in full help listing
178
+
179
+ Command::OutputStandin undispatched
180
+ - should return the base IO from getobj
181
+ - should pass puts unmolested
182
+
183
+ Command::OutputStandin dispatched to a collector
184
+ - should return the base IO from getobj
185
+ - should send #puts to the collector
186
+ - should send #p to the collector
187
+ - should go back to sending puts to IO if collector removed
188
+
189
+ Command::OutputStandin dispatched via thread
190
+ - should return the base IO from getobj
191
+ - should send #puts to the collector
192
+ - should send #p to the collector
193
+ - should go back to sending puts to IO if collector removed
194
+
195
+ Command::Results::Collector
196
+ - should spawn dispatchers
197
+
198
+ Command::Results::Collector sending messages
199
+ - should send simple #item calls to its presenter
200
+ - should send begin_list and end list calls to presenter
201
+ - should prefix items with list nesting
202
+
203
+ Command::Results::Presenter
204
+ - should collect items
205
+ - should nest lists
206
+ - should complain about lists not begun
207
+ - should complain about mis-nested item
208
+
209
+ Command::Results::Presenter driving a Formatter
210
+ - should emit #saw_item before #closed_item
211
+ - should emit #closed_item within known tree order
212
+ - should emit #closed_item only once per item
213
+
214
+ Command::Results::Presenter driving a strict Formatter
215
+ - should send notifications in correct order
216
+
217
+ Finished in 0.174402 seconds
218
+
219
+ 137 examples, 0 failures
data/doc/argumentDSL ADDED
@@ -0,0 +1,36 @@
1
+ There are two kinds of methods available for Command::DSL::Argument.
2
+ First there are decorators. They mark up arguments with extra
3
+ meaning, like being optional. The second are actual argument
4
+ creation calls, which are shorthand for something like
5
+ argument FiddlyArgument {}
6
+
7
+ In general, you'll use these something like
8
+
9
+ decorator.decorator.shorthand_argument "name"
10
+
11
+ For instance
12
+
13
+ named.optional.file_argument "config"
14
+
15
+ Decorator methods, and the classes they add:
16
+
17
+ +multi+:: AlternatingArgument
18
+ +named+:: Named
19
+ +optional+:: Optional
20
+ +alternating+:: AlternatingArgument
21
+
22
+ The shorthand argument methods are:
23
+
24
+ +regexp_argument+:: RegexpArgument
25
+ +multiword_argument+:: MultiArgument
26
+ +array_argument+:: ArrayArgument
27
+ +string_argument+:: StringArgument
28
+ +file_argument+:: FileArgument
29
+ +any_argument+:: StringArgument
30
+ +nonvalidating_proc_argument+:: NoValidateProcArgument
31
+ +number_argument+:: NumberArgument
32
+ +choose_argument+:: ArrayArgument
33
+ +proc_argument+:: ProcArgument
34
+ +regex_argument+:: RegexpArgument
35
+
36
+ Don't forget about #alternating_argument and #argument itself!