clamp 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NGJhZjcxZjg4MjljZTZhODNlM2M0NzFhNGRmODFlMGQ1ZDdjYzFhNQ==
4
+ OTYzZmZkOGE1NTY4M2EyMjdlY2YzNGJmZjQzYTE4MDZiNzRiNGM2Nw==
5
5
  data.tar.gz: !binary |-
6
- NGVhZDMyYzU2ODk5MjY0NjY0YWZhYjRlODhkYzZhZGQ5MzlhZTUzMA==
6
+ YzYxZjkyZjUxNmFkYWNiNjk2NDJhYmZiZGVkYmExNDY2MDY4YzUzYQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZTJhZjg3NWJmYmNmNjE2ODZmMmRhOWFmNWUwNWVhNmFlMmMwZGFhMjZlZjU4
10
- NmM5ODRmNjIxNjU3MzRhNjAwY2YyZDk1YzcyNTU1OGUwMGQ1M2YxZGYwMmZl
11
- MWI3OTc0MWRlYjkxZjA2N2ZkNmEyNmE1OWNjMjRjN2QwNjczNDU=
9
+ NWVhZTIwZDkxNDg4ZDc4NGRkYTFiODc3ZWJlNjU2MGUzMzlkZTBhNjVmNGFl
10
+ ZWQ2OTY1NjgxODdmZDliZjhlYzBhNDVlNTQyZTkwYjk3ZThmMTVmZDg2ZWEw
11
+ MWI4NTYzZWQyZmQyOGFkMDUyNzJkM2Q0MGZhYmIyYWYxMDc0Mjk=
12
12
  data.tar.gz: !binary |-
13
- OTE5Y2Y0YWIyMzJmZmY5MGJjYzJiNTYyOGQ4NjQ4MjljNjRkM2M5YWE4NzU0
14
- OTE0NzY0MzkzNzBiNGY4YmMwYWFmNzhkZmZmOWJkZjEwMzExYzVlMzFjZmI5
15
- M2I2Y2MxM2Y5YzhiYmY4YjczMjVmY2Q5MzgxMmI0ZjQwNWQzN2I=
13
+ Yzk5NGY5OGMwNTY0MjMxNGM0ZGI1NzllYTE0NmRkMjZjYzE5OTlmMjMwYjZm
14
+ MWIyMjA3ODQxZDU0ODU3MTg2Y2ZkMjAwNjhiYzU2ZjJjNzFlZjk1Yjc3MTI3
15
+ NWYyYmM2NGRhYTZlMGI2NTgwYzc1MmFjOWE2YzMxMjY1Y2E4OWI=
data/CHANGES.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.2 (2013-11-06)
4
+
5
+ * Refactoring around multi-valued attributes.
6
+ * Allow injection of a custom help-builder.
7
+
8
+ ## 0.6.1 (2013-05-07)
9
+
10
+ * Signal a usage error when an environment_variable fails validation.
11
+ * Refactor setting, defaulting and inheritance of attributes.
12
+
3
13
  ## 0.6.0 (2013-04-28)
4
14
 
5
15
  * Introduce "banner" to describe a command (replacing "self.description=").
data/README.md CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  Clamp [![Build Status](https://secure.travis-ci.org/mdub/clamp.png?branch=master)](http://travis-ci.org/mdub/clamp)
2
3
  =====
3
4
 
@@ -8,62 +9,67 @@ It handles boring stuff like parsing the command-line, and generating help, so y
8
9
  Not another one!
9
10
  ----------------
10
11
 
11
- Yeah, sorry. There are a bunch of existing command-line parsing libraries out there, and Clamp draws inspiration from a variety of sources, including [Thor], [optparse], and [Clip]. In the end, though, I wanted a slightly rounder wheel.
12
+ Yeah, sorry. There are a bunch of existing command-line parsing libraries out there, and Clamp draws inspiration from a variety of sources, including [Thor], [optparse], and [Clip]. In the end, though, I wanted a slightly rounder wheel. (Although, Clamp has a _lot_ in common with Ara T. Howard's [main.rb]. Had I been aware of that project at the time, I might not have written Clamp.)
12
13
 
13
14
  [optparse]: http://ruby-doc.org/stdlib/libdoc/optparse/rdoc/index.html
14
15
  [Thor]: http://github.com/wycats/thor
15
16
  [Clip]: http://clip.rubyforge.org/
17
+ [main.rb]: https://github.com/ahoward/main
16
18
 
17
19
  Quick Start
18
20
  -----------
19
21
 
20
22
  A typical Clamp script looks like this:
21
23
 
22
- require 'clamp'
23
-
24
- Clamp do
24
+ ```ruby
25
+ require 'clamp'
25
26
 
26
- option "--loud", :flag, "say it loud"
27
- option ["-n", "--iterations"], "N", "say it N times", :default => 1 do |s|
28
- Integer(s)
29
- end
27
+ Clamp do
30
28
 
31
- parameter "WORDS ...", "the thing to say", :attribute_name => :words
29
+ option "--loud", :flag, "say it loud"
30
+ option ["-n", "--iterations"], "N", "say it N times", :default => 1 do |s|
31
+ Integer(s)
32
+ end
32
33
 
33
- def execute
34
- the_truth = words.join(" ")
35
- the_truth.upcase! if loud?
36
- iterations.times do
37
- puts the_truth
38
- end
39
- end
34
+ parameter "WORDS ...", "the thing to say", :attribute_name => :words
40
35
 
36
+ def execute
37
+ the_truth = words.join(" ")
38
+ the_truth.upcase! if loud?
39
+ iterations.times do
40
+ puts the_truth
41
41
  end
42
+ end
42
43
 
43
- Internally, Clamp models a command as a Ruby class (a subclass of `Clamp::Command`), and a command execution as an instance of that class. The example above is really just syntax-sugar for:
44
+ end
45
+ ```
44
46
 
45
- require 'clamp'
47
+ Internally, Clamp models a command as a Ruby class (a subclass of `Clamp::Command`), and a command execution as an instance of that class. The example above is really just syntax-sugar for:
46
48
 
47
- class SpeakCommand < Clamp::Command
49
+ ```ruby
50
+ require 'clamp'
48
51
 
49
- option "--loud", :flag, "say it loud"
50
- option ["-n", "--iterations"], "N", "say it N times", :default => 1 do |s|
51
- Integer(s)
52
- end
52
+ class SpeakCommand < Clamp::Command
53
53
 
54
- parameter "WORDS ...", "the thing to say", :attribute_name => :words
54
+ option "--loud", :flag, "say it loud"
55
+ option ["-n", "--iterations"], "N", "say it N times", :default => 1 do |s|
56
+ Integer(s)
57
+ end
55
58
 
56
- def execute
57
- the_truth = words.join(" ")
58
- the_truth.upcase! if loud?
59
- iterations.times do
60
- puts the_truth
61
- end
62
- end
59
+ parameter "WORDS ...", "the thing to say", :attribute_name => :words
63
60
 
61
+ def execute
62
+ the_truth = words.join(" ")
63
+ the_truth.upcase! if loud?
64
+ iterations.times do
65
+ puts the_truth
64
66
  end
67
+ end
68
+
69
+ end
65
70
 
66
- SpeakCommand.run
71
+ SpeakCommand.run
72
+ ```
67
73
 
68
74
  Class-level methods like `option` and `parameter` declare attributes, in a similar way to `attr_accessor`, and arrange for them to be populated automatically based on command-line arguments. They are also used to generate `help` documentation.
69
75
 
@@ -82,36 +88,48 @@ Options are declared using the `option` method. The three required arguments ar
82
88
 
83
89
  For example:
84
90
 
85
- option "--flavour", "FLAVOUR", "ice-cream flavour"
91
+ ```ruby
92
+ option "--flavour", "FLAVOUR", "ice-cream flavour"
93
+ ```
86
94
 
87
95
  It works a little like `attr_accessor`, defining reader and writer methods on the command class. The attribute name is inferred from the switch (in this case, "`flavour`"). When you pass options to your command, Clamp will populate the attributes, which are then available for use in your `#execute` method.
88
96
 
89
- def execute
90
- puts "You chose #{flavour}. Excellent choice!"
91
- end
97
+ ```ruby
98
+ def execute
99
+ puts "You chose #{flavour}. Excellent choice!"
100
+ end
101
+ ```
92
102
 
93
103
  If you don't like the inferred attribute name, you can override it:
94
104
 
95
- option "--type", "TYPE", "type of widget", :attribute_name => :widget_type
96
- # to avoid clobbering Object#type
105
+ ```ruby
106
+ option "--type", "TYPE", "type of widget", :attribute_name => :widget_type
107
+ # to avoid clobbering Object#type
108
+ ```
97
109
 
98
110
  ### Short/long option switches
99
111
 
100
112
  The first argument to `option` can be an array, rather than a single string, in which case all the switches are treated as aliases:
101
113
 
102
- option ["-s", "--subject"], "SUBJECT", "email subject line"
114
+ ```ruby
115
+ option ["-s", "--subject"], "SUBJECT", "email subject line"
116
+ ```
103
117
 
104
118
  ### Flag options
105
119
 
106
120
  Some options are just boolean flags. Pass "`:flag`" as the second parameter to tell Clamp not to expect an option argument:
107
121
 
108
- option "--verbose", :flag, "be chatty"
122
+ ```ruby
123
+ option "--verbose", :flag, "be chatty"
124
+ ```
109
125
 
110
126
  For flag options, Clamp appends "`?`" to the generated reader method; ie. you get a method called "`#verbose?`", rather than just "`#verbose`".
111
127
 
112
128
  Negatable flags are easy to generate, too:
113
129
 
114
- option "--[no-]force", :flag, "be forceful (or not)"
130
+ ```ruby
131
+ option "--[no-]force", :flag, "be forceful (or not)"
132
+ ```
115
133
 
116
134
  Clamp will handle both "`--force`" and "`--no-force`" options, setting the value of "`#force?`" appropriately.
117
135
 
@@ -119,7 +137,9 @@ Clamp will handle both "`--force`" and "`--no-force`" options, setting the value
119
137
 
120
138
  Although 'required option' is a an oxymoron, Clamp lets you mark an option as required, and will verify that a value is provided:
121
139
 
122
- option "--password", "PASSWORD", "the secret password", :required => true
140
+ ```ruby
141
+ option "--password", "PASSWORD", "the secret password", :required => true
142
+ ```
123
143
 
124
144
  Note that it makes no sense to mark a `:flag` option, or one with a `:default`, as `:required`.
125
145
 
@@ -127,7 +147,9 @@ Note that it makes no sense to mark a `:flag` option, or one with a `:default`,
127
147
 
128
148
  Declaring an option "`:multivalued`" allows it to be specified multiple times on the command line.
129
149
 
130
- option "--format", "FORMAT", "output format", :multivalued => true
150
+ ```ruby
151
+ option "--format", "FORMAT", "output format", :multivalued => true
152
+ ```
131
153
 
132
154
  The underlying attribute becomes an Array, and the suffix "`_list`" is appended to the default attribute name. In this case, an attribute called "`format_list`" would be generated (unless you override the default by specifying an `:attribute_name`).
133
155
 
@@ -141,7 +163,9 @@ Positional parameters can be declared using `parameter`, specifying
141
163
 
142
164
  For example:
143
165
 
144
- parameter "SRC", "source file"
166
+ ```ruby
167
+ parameter "SRC", "source file"
168
+ ```
145
169
 
146
170
  Like options, parameters are implemented as attributes of the command, with the default attribute name derived from the parameter name (in this case, "`src`"). By convention, parameter names are specified in uppercase, to make them obvious in usage help.
147
171
 
@@ -149,14 +173,17 @@ Like options, parameters are implemented as attributes of the command, with the
149
173
 
150
174
  Wrapping a parameter name in square brackets indicates that it's optional, e.g.
151
175
 
152
- parameter "[TARGET_DIR]", "target directory"
176
+ ```ruby
177
+ parameter "[TARGET_DIR]", "target directory"
178
+ ```
153
179
 
154
180
  ### Multivalued (aka "greedy") parameters
155
181
 
156
182
  Three dots at the end of a parameter name makes it "greedy" - it will consume all remaining command-line arguments. For example:
157
183
 
158
- parameter "FILE ...", "input files", :attribute_name => :files
159
-
184
+ ```ruby
185
+ parameter "FILE ...", "input files", :attribute_name => :files
186
+ ```
160
187
 
161
188
  Like multivalued options, greedy parameters are backed by an Array attribute (named with a "`_list`" suffix, by default).
162
189
 
@@ -174,63 +201,77 @@ called with the raw string argument, and is expected to validate it. The value
174
201
 
175
202
  For example:
176
203
 
177
- option "--port", "PORT", "port to listen on" do |s|
178
- Integer(s)
179
- end
204
+ ```ruby
205
+ option "--port", "PORT", "port to listen on" do |s|
206
+ Integer(s)
207
+ end
208
+ ```
180
209
 
181
210
  If the block raises an ArgumentError, Clamp will catch it, and report that the value was bad:
182
211
 
183
- !!!plain
184
- ERROR: option '--port': invalid value for Integer: "blah"
212
+ ```ruby
213
+ !!!plain
214
+ ERROR: option '--port': invalid value for Integer: "blah"
215
+ ```
185
216
 
186
217
  For multivalued options and parameters, the validation block will be called for each value specified.
187
218
 
188
219
  More complex validation, e.g. those involving multiple options/parameters, should be performed within the `#execute` method. Use `#signal_usage_error` to tell the user what they did wrong, e.g.
189
220
 
190
- def execute
191
- if port < 1024 && user != 'root'
192
- signal_usage_error "port restricted for non-root users"
193
- end
194
- # ... carry on ...
195
- end
221
+ ```ruby
222
+ def execute
223
+ if port < 1024 && user != 'root'
224
+ signal_usage_error "port restricted for non-root users"
225
+ end
226
+ # ... carry on ...
227
+ end
228
+ ```
196
229
 
197
230
  ### Advanced option/parameter handling
198
231
 
199
232
  While Clamp provides an attribute-writer method for each declared option or parameter, you always have the option of overriding it to provide custom argument-handling logic, e.g.
200
233
 
201
- parameter "SERVER", "location of server"
234
+ ```ruby
235
+ parameter "SERVER", "location of server"
202
236
 
203
- def server=(server)
204
- @server_address, @server_port = server.split(":")
205
- end
237
+ def server=(server)
238
+ @server_address, @server_port = server.split(":")
239
+ end
240
+ ```
206
241
 
207
242
  ### Default values
208
243
 
209
244
  Default values can be specified for options, and optional parameters:
210
245
 
211
- option "--flavour", "FLAVOUR", "ice-cream flavour", :default => "chocolate"
246
+ ```ruby
247
+ option "--flavour", "FLAVOUR", "ice-cream flavour", :default => "chocolate"
212
248
 
213
- parameter "[HOST]", "server host", :default => "localhost"
249
+ parameter "[HOST]", "server host", :default => "localhost"
250
+ ```
214
251
 
215
252
  For more advanced cases, you can also specify default values by defining a method called "`default_#{attribute_name}`":
216
253
 
217
- option "--http-port", "PORT", "web-server port", :default => 9000
254
+ ```ruby
255
+ option "--http-port", "PORT", "web-server port", :default => 9000
218
256
 
219
- option "--admin-port", "PORT", "admin port"
257
+ option "--admin-port", "PORT", "admin port"
220
258
 
221
- def default_admin_port
222
- http_port + 1
223
- end
259
+ def default_admin_port
260
+ http_port + 1
261
+ end
262
+ ```
224
263
 
225
264
  ### Environment variable support
226
265
 
227
266
  Options (and optional parameters) can also be associated with environment variables:
228
267
 
229
- option "--port", "PORT", "the port to listen on", :environment_variable => "MYAPP_PORT" do |val|
230
- val.to_i
231
- end
268
+ ```ruby
269
+ option "--port", "PORT", "the port to listen on", :environment_variable => "MYAPP_PORT" do |val|
270
+ val.to_i
271
+ end
232
272
 
233
- parameter "[HOST]", "server address", :environment_variable => "MYAPP_HOST"
273
+ parameter "[HOST]", "server address", :environment_variable => "MYAPP_HOST"
274
+ ```
234
275
 
235
276
  Clamp will check the specified envariables in the absence of values supplied on the command line, before looking for a default value.
236
277
 
@@ -241,51 +282,57 @@ Subcommand support helps you wrap a number of related commands into a single scr
241
282
 
242
283
  Unsuprisingly, subcommands are declared using the `subcommand` method. e.g.
243
284
 
244
- Clamp do
285
+ ```ruby
286
+ Clamp do
245
287
 
246
- subcommand "init", "Initialize the repository" do
288
+ subcommand "init", "Initialize the repository" do
247
289
 
248
- def execute
249
- # ...
250
- end
290
+ def execute
291
+ # ...
292
+ end
251
293
 
252
- end
294
+ end
253
295
 
254
- end
296
+ end
297
+ ```
255
298
 
256
299
  Clamp generates an anonymous subclass of the current class, to represent the subcommand. Alternatively, you can provide an explicit subcommand class:
257
300
 
258
- class MainCommand < Clamp::Command
301
+ ```ruby
302
+ class MainCommand < Clamp::Command
259
303
 
260
- subcommand "init", "Initialize the repository", InitCommand
304
+ subcommand "init", "Initialize the repository", InitCommand
261
305
 
262
- end
306
+ end
263
307
 
264
- class InitCommand < Clamp::Command
308
+ class InitCommand < Clamp::Command
265
309
 
266
- def execute
267
- # ...
268
- end
310
+ def execute
311
+ # ...
312
+ end
269
313
 
270
- end
314
+ end
315
+ ```
271
316
 
272
317
  ### Default subcommand
273
318
 
274
319
  You can set a default subcommand, at the class level, as follows:
275
320
 
276
- Clamp do
321
+ ```ruby
322
+ Clamp do
277
323
 
278
- self.default_subcommand = "status"
324
+ self.default_subcommand = "status"
279
325
 
280
- subcommand "status", "Display current status" do
326
+ subcommand "status", "Display current status" do
281
327
 
282
- def execute
283
- # ...
284
- end
328
+ def execute
329
+ # ...
330
+ end
285
331
 
286
- end
332
+ end
287
333
 
288
- end
334
+ end
335
+ ```
289
336
 
290
337
  Then, if when no SUBCOMMAND argument is provided, the default will be selected.
291
338
 
@@ -300,17 +347,19 @@ Getting help
300
347
 
301
348
  All Clamp commands support a "`--help`" option, which outputs brief usage documentation, based on those seemingly useless extra parameters that you had to pass to `option` and `parameter`.
302
349
 
303
- $ speak --help
304
- Usage:
305
- speak [OPTIONS] WORDS ...
350
+ ```sh
351
+ $ speak --help
352
+ Usage:
353
+ speak [OPTIONS] WORDS ...
306
354
 
307
- Arguments:
308
- WORDS ... the thing to say
355
+ Arguments:
356
+ WORDS ... the thing to say
309
357
 
310
- Options:
311
- --loud say it loud
312
- -n, --iterations N say it N times (default: 1)
313
- -h, --help print help
358
+ Options:
359
+ --loud say it loud
360
+ -n, --iterations N say it N times (default: 1)
361
+ -h, --help print help
362
+ ```
314
363
 
315
364
  License
316
365
  -------
@@ -8,7 +8,12 @@ module Clamp
8
8
  def define_accessors_for(attribute, &block)
9
9
  define_reader_for(attribute)
10
10
  define_default_for(attribute)
11
- define_writer_for(attribute, &block)
11
+ if attribute.multivalued?
12
+ define_appender_for(attribute, &block)
13
+ define_multi_writer_for(attribute)
14
+ else
15
+ define_simple_writer_for(attribute, &block)
16
+ end
12
17
  end
13
18
 
14
19
  def define_reader_for(attribute)
@@ -23,12 +28,23 @@ module Clamp
23
28
  end
24
29
  end
25
30
 
26
- def define_writer_for(attribute, &block)
31
+ def define_simple_writer_for(attribute, &block)
27
32
  define_method(attribute.write_method) do |value|
28
- if block
29
- value = instance_exec(value, &block)
30
- end
31
- attribute.of(self)._write(value)
33
+ value = instance_exec(value, &block) if block
34
+ attribute.of(self).set(value)
35
+ end
36
+ end
37
+
38
+ def define_appender_for(attribute, &block)
39
+ define_method(attribute.append_method) do |value|
40
+ value = instance_exec(value, &block) if block
41
+ attribute.of(self)._append(value)
42
+ end
43
+ end
44
+
45
+ def define_multi_writer_for(attribute)
46
+ define_method(attribute.write_method) do |values|
47
+ attribute.of(self)._replace(values)
32
48
  end
33
49
  end
34
50
 
@@ -40,10 +40,12 @@ module Clamp
40
40
  end
41
41
 
42
42
  def write_method
43
+ "#{attribute_name}="
44
+ end
45
+
46
+ def append_method
43
47
  if multivalued?
44
48
  "append_to_#{attribute_name}"
45
- else
46
- "#{attribute_name}="
47
49
  end
48
50
  end
49
51
 
@@ -39,22 +39,28 @@ module Clamp
39
39
  end
40
40
  end
41
41
 
42
- # default implementation of write_method
43
- def _write(value)
44
- if attribute.multivalued?
45
- current_values = get || []
46
- set(current_values + [value])
47
- else
48
- set(value)
49
- end
42
+ # default implementation of append_method
43
+ def _append(value)
44
+ current_values = get || []
45
+ set(current_values + [value])
46
+ end
47
+
48
+ # default implementation of write_method for multi-valued attributes
49
+ def _replace(values)
50
+ set([])
51
+ Array(values).each { |value| take(value) }
50
52
  end
51
53
 
52
54
  def read
53
55
  command.send(attribute.read_method)
54
56
  end
55
57
 
56
- def write(value)
57
- command.send(attribute.write_method, value)
58
+ def take(value)
59
+ if attribute.multivalued?
60
+ command.send(attribute.append_method, value)
61
+ else
62
+ command.send(attribute.write_method, value)
63
+ end
58
64
  end
59
65
 
60
66
  def default_from_environment
@@ -64,7 +70,7 @@ module Clamp
64
70
  # Set the parameter value if it's environment variable is present
65
71
  value = ENV[attribute.environment_variable]
66
72
  begin
67
- write(value)
73
+ take(value)
68
74
  rescue ArgumentError => e
69
75
  command.send(:signal_usage_error, "$#{attribute.environment_variable}: #{e.message}")
70
76
  end
data/lib/clamp/help.rb CHANGED
@@ -36,8 +36,8 @@ module Clamp
36
36
  declared_usage_descriptions || [derived_usage_description]
37
37
  end
38
38
 
39
- def help(invocation_path)
40
- help = Builder.new
39
+ def help(invocation_path, builder = Builder.new)
40
+ help = builder
41
41
  help.add_usage(invocation_path, usage_descriptions)
42
42
  help.add_description(description)
43
43
  if has_parameters?
@@ -29,7 +29,7 @@ module Clamp
29
29
  value = option.extract_value(switch, remaining_arguments)
30
30
 
31
31
  begin
32
- option.of(self).write(value)
32
+ option.of(self).take(value)
33
33
  rescue ArgumentError => e
34
34
  signal_usage_error "option '#{switch}': #{e.message}"
35
35
  end
@@ -10,7 +10,7 @@ module Clamp
10
10
  self.class.parameters.each do |parameter|
11
11
  begin
12
12
  parameter.consume(remaining_arguments).each do |value|
13
- parameter.of(self).write(value)
13
+ parameter.of(self).take(value)
14
14
  end
15
15
  rescue ArgumentError => e
16
16
  signal_usage_error "parameter '#{parameter.name}': #{e.message}"
data/lib/clamp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Clamp
2
- VERSION = "0.6.1".freeze
2
+ VERSION = "0.6.2".freeze
3
3
  end
@@ -126,6 +126,18 @@ describe Clamp::Command do
126
126
  command.flavours.should == %w(chocolate vanilla)
127
127
  end
128
128
 
129
+ it "generates a single-value appender method" do
130
+ command.append_to_flavours("mud")
131
+ command.append_to_flavours("pie")
132
+ command.flavours.should == %w(mud pie)
133
+ end
134
+
135
+ it "generates a multi-value setter method" do
136
+ command.append_to_flavours("replaceme")
137
+ command.flavours = %w(mud pie)
138
+ command.flavours.should == %w(mud pie)
139
+ end
140
+
129
141
  end
130
142
 
131
143
  describe "with :environment_variable" do
@@ -209,10 +209,10 @@ describe Clamp::Option::Definition do
209
209
 
210
210
  end
211
211
 
212
- describe "#write_method" do
212
+ describe "#append_method" do
213
213
 
214
214
  it "is derived from the attribute_name" do
215
- option.write_method.should == "append_to_header_list"
215
+ option.append_method.should == "append_to_header_list"
216
216
  end
217
217
 
218
218
  end
@@ -113,10 +113,10 @@ describe Clamp::Parameter::Definition do
113
113
 
114
114
  end
115
115
 
116
- describe "#write_method" do
116
+ describe "#append_method" do
117
117
 
118
118
  it "is derived from the attribute_name" do
119
- parameter.write_method.should == "append_to_file_list"
119
+ parameter.append_method.should == "append_to_file_list"
120
120
  end
121
121
 
122
122
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clamp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-07 00:00:00.000000000 Z
11
+ date: 2013-11-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ! "Clamp provides an object-model for command-line utilities. \nIt handles
14
14
  parsing of command-line options, and generation of usage help.\n"
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  version: '0'
77
77
  requirements: []
78
78
  rubyforge_project:
79
- rubygems_version: 2.0.0
79
+ rubygems_version: 2.0.7
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: a minimal framework for command-line utilities