facets 2.0.5 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/WHATSNEW +11 -0
  2. data/lib/core/facets/enumerable/collect.rb +7 -2
  3. data/lib/core/facets/enumerable/permutation.rb +7 -26
  4. data/lib/core/facets/module/alias.rb +36 -12
  5. data/lib/core/facets/module/attr.rb +83 -35
  6. data/lib/core/facets/module/include.rb +10 -0
  7. data/lib/methods/facets/module/alias_accessor.rb +1 -1
  8. data/lib/methods/facets/module/alias_reader.rb +1 -0
  9. data/lib/methods/facets/module/alias_setter.rb +1 -0
  10. data/lib/methods/facets/module/alias_switcher.rb +1 -0
  11. data/lib/methods/facets/module/alias_tester.rb +1 -0
  12. data/lib/methods/facets/module/alias_toggler.rb +1 -0
  13. data/lib/methods/facets/module/alias_validator.rb +1 -0
  14. data/lib/methods/facets/module/alias_writer.rb +1 -0
  15. data/lib/methods/facets/module/attr_accessor.rb +1 -0
  16. data/lib/methods/facets/module/attr_reader.rb +1 -0
  17. data/lib/methods/facets/module/attr_switcher.rb +1 -0
  18. data/lib/methods/facets/module/attr_writer.rb +1 -0
  19. data/lib/more/facets/arguments.rb +2 -1
  20. data/lib/more/facets/command.rb +258 -395
  21. data/lib/more/facets/crypt.rb +242 -28
  22. data/lib/more/facets/ziputils.rb +1 -1
  23. data/log/changelog.txt +0 -0
  24. data/log/history.txt +22 -0
  25. data/log/release.txt +10 -0
  26. data/log/todo.txt +4 -0
  27. data/meta/{facets-2.0.5.roll → facets-2.1.0.roll} +0 -0
  28. data/meta/google_ad.html +15 -0
  29. data/meta/icli.yaml +3 -3
  30. data/meta/manifest.txt +24 -3
  31. data/task/clobber/package +10 -0
  32. data/task/config/general.yaml +21 -3
  33. data/task/isotest +2 -1
  34. data/task/loadtest +2 -0
  35. data/task/prepare +4 -2
  36. data/task/rdoc +122 -73
  37. data/task/release +12 -0
  38. data/task/special/quickopts +15 -0
  39. data/task/syntax +2 -0
  40. data/task/test +3 -1
  41. data/test/unit/enumerable/test_collect.rb +17 -0
  42. data/test/unit/enumerable/test_permutation.rb +20 -30
  43. data/test/unit/test_crypt.rb +29 -36
  44. metadata +40 -12
  45. data/RELEASE +0 -12
  46. data/test/unit/test_command.rb +0 -286
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
2
+ rubygems_version: 0.9.4.6
3
+ specification_version: 2
4
4
  name: facets
5
5
  version: !ruby/object:Gem::Version
6
- version: 2.0.5
7
- date: 2007-11-05 00:00:00 -05:00
6
+ version: 2.1.0
7
+ date: 2007-11-10 00:00:00 -05:00
8
8
  summary: Premium Core Extensions and Standard Additions
9
9
  require_paths:
10
10
  - lib/methods
@@ -18,23 +18,31 @@ autorequire:
18
18
  default_executable:
19
19
  bindir: bin
20
20
  has_rdoc: false
21
- required_ruby_version: !ruby/object:Gem::Version::Requirement
21
+ required_ruby_version: !ruby/object:Gem::Requirement
22
22
  requirements:
23
- - - ">"
23
+ - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: 0.0.0
25
+ version: "0"
26
+ version:
27
+ required_rubygems_version: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: "0"
26
32
  version:
27
33
  platform: ruby
28
34
  signing_key:
29
- cert_chain:
35
+ cert_chain: []
36
+
30
37
  post_install_message:
38
+ extensions_fallback:
31
39
  authors:
32
40
  - Thomas Sawyer <transfire@gmail.com>
33
41
  files:
34
42
  - AUTHORS
35
43
  - LICENSE
36
44
  - README
37
- - RELEASE
45
+ - WHATSNEW
38
46
  - demo
39
47
  - demo/bench
40
48
  - demo/bench/enumerable
@@ -495,12 +503,23 @@ files:
495
503
  - lib/methods/facets/module/alias_accessor.rb
496
504
  - lib/methods/facets/module/alias_method_chain.rb
497
505
  - lib/methods/facets/module/alias_module_function.rb
506
+ - lib/methods/facets/module/alias_reader.rb
507
+ - lib/methods/facets/module/alias_setter.rb
508
+ - lib/methods/facets/module/alias_switcher.rb
509
+ - lib/methods/facets/module/alias_tester.rb
510
+ - lib/methods/facets/module/alias_toggler.rb
511
+ - lib/methods/facets/module/alias_validator.rb
512
+ - lib/methods/facets/module/alias_writer.rb
498
513
  - lib/methods/facets/module/all_instance_methods.rb
499
514
  - lib/methods/facets/module/ancestor.rb
515
+ - lib/methods/facets/module/attr_accessor.rb
516
+ - lib/methods/facets/module/attr_reader.rb
500
517
  - lib/methods/facets/module/attr_setter.rb
518
+ - lib/methods/facets/module/attr_switcher.rb
501
519
  - lib/methods/facets/module/attr_tester.rb
502
520
  - lib/methods/facets/module/attr_toggler.rb
503
521
  - lib/methods/facets/module/attr_validator.rb
522
+ - lib/methods/facets/module/attr_writer.rb
504
523
  - lib/methods/facets/module/basename.rb
505
524
  - lib/methods/facets/module/by_name.rb
506
525
  - lib/methods/facets/module/can.rb
@@ -758,12 +777,20 @@ files:
758
777
  - lib/more/facets/version.rb
759
778
  - lib/more/facets/yaml.rb
760
779
  - lib/more/facets/ziputils.rb
780
+ - log
781
+ - log/changelog.txt
782
+ - log/history.txt
783
+ - log/release.txt
784
+ - log/todo.txt
761
785
  - meta
762
- - meta/facets-2.0.5.roll
786
+ - meta/facets-2.1.0.roll
787
+ - meta/google_ad.html
763
788
  - meta/icli.yaml
764
789
  - meta/manifest.txt
765
790
  - task
766
791
  - task/clean
792
+ - task/clobber
793
+ - task/clobber/package
767
794
  - task/config
768
795
  - task/config/general.yaml
769
796
  - task/config/rdoc.yaml
@@ -777,6 +804,9 @@ files:
777
804
  - task/prepare
778
805
  - task/publish
779
806
  - task/rdoc
807
+ - task/release
808
+ - task/special
809
+ - task/special/quickopts
780
810
  - task/stats
781
811
  - task/syntax
782
812
  - task/test
@@ -918,7 +948,6 @@ files:
918
948
  - test/unit/test_bytes.rb
919
949
  - test/unit/test_class_extension.rb
920
950
  - test/unit/test_classmethods.rb
921
- - test/unit/test_command.rb
922
951
  - test/unit/test_compare_on.rb
923
952
  - test/unit/test_conversion.rb
924
953
  - test/unit/test_coroutine.rb
@@ -1103,7 +1132,6 @@ test_files:
1103
1132
  - test/unit/test_bytes.rb
1104
1133
  - test/unit/test_class_extension.rb
1105
1134
  - test/unit/test_classmethods.rb
1106
- - test/unit/test_command.rb
1107
1135
  - test/unit/test_compare_on.rb
1108
1136
  - test/unit/test_conversion.rb
1109
1137
  - test/unit/test_coroutine.rb
data/RELEASE DELETED
@@ -1,12 +0,0 @@
1
- Facets 2.0.5 is in the wild!
2
-
3
- This is an bug-fix release.
4
-
5
- * Fixes bug with Dictionary#initialize
6
- * Fixes bug with Hash#-
7
- * Also improves changelog production.
8
-
9
- Also included are some final methods, contributed
10
- by Noah Gibbs, that hadn't yet been adopted from
11
- Gavin Sinclair's Extensions project.
12
-
@@ -1,286 +0,0 @@
1
- require 'facets/command'
2
-
3
- require 'test/unit'
4
- require 'stringio'
5
-
6
- include Console
7
-
8
- class TestCommand < Test::Unit::TestCase
9
- Output = []
10
-
11
- def setup
12
- Output.clear
13
- $stderr = StringIO.new
14
- end
15
-
16
- # Base test command (in case we wnat ot share something).
17
-
18
- class TestCommand < Command
19
- end
20
-
21
- #
22
- # Test basic command.
23
- #
24
-
25
- class SimpleCommand < TestCommand
26
- def here! ; @here = true ; end
27
-
28
- def main(*args)
29
- Output.concat([@here] | args)
30
- end
31
- end
32
-
33
- def test_SimpleCommand
34
- cmd = SimpleCommand.new
35
- cmd.execute( '--here file1 file2' )
36
- assert_equal( [true, 'file1', 'file2'], Output )
37
- end
38
-
39
- #
40
- # Test missing subcommand.
41
- #
42
-
43
- class CommandWithMethodMissingSubcommand < TestCommand
44
- def here! ; @here = true ; end
45
-
46
- def method_missing(cmd, *args)
47
- Output.concat([@here, cmd] | args)
48
- end
49
- end
50
-
51
- def test_CommandWithMethodMissingSubcommand
52
- cmd = CommandWithMethodMissingSubcommand.new
53
- cmd.execute( '--here go file1' )
54
- assert_equal( [true, :go, 'file1'], Output )
55
- end
56
-
57
- #
58
- # Test simple subcommand.
59
- #
60
-
61
- class CommandWithSimpleSubcommand < TestCommand
62
- def here! ; @here = true ; end
63
-
64
- options :go do
65
- attr :i
66
- def i=(n)
67
- @i = n.to_i
68
- end
69
- end
70
-
71
- def go
72
- Output.concat([@here, @options.i])
73
- end
74
- end
75
-
76
- def test_CommandWithSimpleSubcommand
77
- cmd = CommandWithSimpleSubcommand.new
78
- cmd.execute( '--here go -i 1' )
79
- assert_equal( [true, 1], Output )
80
- end
81
-
82
- #
83
- # Global options can be anywhere, right? Even after subcommands?
84
- #
85
-
86
- class CommandWithGlobalOptionsAfterSubcommand < TestCommand
87
- global_option :x
88
-
89
- def x! ; @x = true ; end
90
-
91
- options :go do
92
- attr :i
93
- def i=(n)
94
- @i = n.to_i
95
- end
96
- end
97
-
98
- def go ; Output.concat([@x, @options.i]) ; end
99
- end
100
-
101
- def test_CommandWithGlobalOptionsAfterSubcommand_01
102
- cmd = CommandWithGlobalOptionsAfterSubcommand.new
103
- cmd.execute( 'go -x -i 1' )
104
- assert_equal( [true, 1], Output )
105
- end
106
-
107
- def test_CommandWithGlobalOptionsAfterSubcommand_02
108
- cmd = CommandWithGlobalOptionsAfterSubcommand.new
109
- cmd.execute( 'go -i 1 -x' )
110
- assert_equal( [true, 1], Output )
111
- end
112
-
113
- #
114
- #
115
- #
116
-
117
- class GivingUnrecognizedOptions < TestCommand
118
- def x! ; @x = true ; end
119
- def go ; Output.concat([@x, @p]) ; end
120
- end
121
-
122
- def test_GivingUnrecognizedOptions
123
- cmd = GivingUnrecognizedOptions.new
124
- assert_raise(InvalidOptionError) do
125
- cmd.execute( '--an-option-that-wont-be-recognized -x go' )
126
- end
127
- #assert_equal "Unknown option '--an-option-that-wont-be-recognized'.\n", $stderr.string
128
- assert_equal( [], Output )
129
- end
130
-
131
- #
132
- #
133
- #
134
-
135
- class PassingMultipleSingleCharOptionsAsOneOption < TestCommand
136
- def x! ; @x = true ; end
137
- def y! ; @y = true ; end
138
- def z=(n) ; @z = n ; end
139
-
140
- global_option :x
141
-
142
- options :go do
143
- attr :i
144
- def i=(n)
145
- @i = n.to_i
146
- end
147
- end
148
-
149
- def go ; Output.concat([@x, @y, @z, @options.i]) ; end
150
- end
151
-
152
- def test_PassingMultipleSingleCharOptionsAsOneOption
153
- cmd = PassingMultipleSingleCharOptionsAsOneOption.new
154
- cmd.execute( '-xy -z HERE go -i 1' )
155
- assert_equal( [true, true, 'HERE', 1], Output )
156
- end
157
-
158
- # #
159
- #
160
- # class CommandWithOptionUsingEquals < TestCommand
161
- # subcommand :go do
162
- # def __mode(mode) ; @mode = mode ; end
163
- # def main ; Output.concat([@mode]) ; end
164
- # end
165
- # end
166
- #
167
- # def test_CommandWithOptionUsingEquals
168
- # cmd = CommandWithOptionUsingEquals.new
169
- # cmd.execute( 'go --mode smart' )
170
- # assert_equal( ['smart'], Output )
171
- #
172
- # # I would expect this to work too, but currently it doesn't.
173
- # #assert_nothing_raised { CommandWithOptionUsingEquals.execute( 'go --mode=smart' ) }
174
- # #assert_equal( ['smart'], Output )
175
- # end
176
-
177
- #
178
-
179
- class CommandWithSubcommandThatTakesArgs < TestCommand
180
- def go(arg1, *args) ; Output.concat([arg1] | args) ; end
181
- end
182
-
183
- def test_CommandWithSubcommandThatTakesArgs
184
- cmd = CommandWithSubcommandThatTakesArgs.new
185
- cmd.execute( 'go file1 file2 file3' )
186
- assert_equal( ['file1', 'file2', 'file3'], Output )
187
- end
188
-
189
- #
190
-
191
- class CommandWith2OptionalArgs < TestCommand
192
- def here! ; @here = true ; end
193
-
194
- options :go do
195
- attr :i
196
- def i=(n)
197
- @i = n.to_i
198
- end
199
- end
200
-
201
- def go(required1 = nil, optional2 = nil)
202
- Output.concat [@here, @options.i, required1, optional2]
203
- end
204
- end
205
-
206
- def test_CommandWith2OptionalArgs
207
- cmd = CommandWith2OptionalArgs.new
208
- cmd.execute( '--here go -i 1 to' )
209
- assert_equal( [true, 1, 'to', nil], Output )
210
- end
211
-
212
- #
213
-
214
- class CommandWithVariableArgs < TestCommand
215
- def here! ; @here = true ; end
216
-
217
- options :go do
218
- attr :i
219
- def i=(n)
220
- @i = n.to_i
221
- end
222
- end
223
-
224
- def go(*args) ; Output.concat([@here, @options.i] | args) ; end
225
- end
226
-
227
- def test_CommandWithVariableArgs
228
- cmd = CommandWithVariableArgs.new
229
- cmd.execute( '--here go -i 1 to bed' )
230
- assert_equal( [true, 1, 'to', 'bed'], Output )
231
- end
232
-
233
- #
234
-
235
- class CommandWithOptionMissing < TestCommand
236
- def here! ; @here = true ; end
237
-
238
- options :go do
239
- attr :i
240
- def option_missing(opt, value)
241
- case opt
242
- when '-i'
243
- @i = value.to_i
244
- true
245
- else
246
- super
247
- end
248
- end
249
- end
250
-
251
- def go(*args) ; Output.concat([@here, @options.i] | args) ; end
252
- end
253
-
254
- def test_CommandWithOptionMissing
255
- cmd = CommandWithOptionMissing.new
256
- cmd.execute( '--here go -i 1 to bed right now' )
257
- assert_equal( [true, 1, 'to', 'bed', 'right', 'now'], Output )
258
- end
259
-
260
- end
261
-
262
-
263
- class TestCommandOptions < Test::Unit::TestCase
264
-
265
- class MyOptions < Command::Options
266
- attr_reader :a, :b
267
- def a! ; @a = true ; end
268
- def b=(x) ; @b = x ; end
269
- end
270
-
271
- def test_myoptions1
272
- opts = MyOptions.parse("-a -b hi")
273
- assert_equal( true, opts.a)
274
- end
275
-
276
- def test_myoptions2
277
- opts = MyOptions.parse("-a -b hi")
278
- assert_equal('hi', opts.b)
279
- end
280
-
281
- def test_usage
282
- opts = MyOptions.parse("-a -b hi")
283
- assert_equal('[-a] [-b value]', opts.usage)
284
- end
285
-
286
- end