ruby_ex 0.3.0 → 0.4.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +324 -0
- data/NEWS +17 -0
- data/README +1 -1
- data/SPEC.yml +9 -9
- data/lib/abstract.rb +3 -38
- data/lib/abstract_node.rb +2 -4
- data/lib/algorithms/simulated_annealing.rb +26 -3
- data/lib/attributed_class.rb +2 -2
- data/lib/auto_object.rb +2 -6
- data/lib/blank_slate.rb +1 -1
- data/lib/cache.rb +4 -4
- data/lib/choose.rb +3 -5
- data/lib/commands/command.rb +53 -27
- data/lib/commands/datas/composite.rb +2 -4
- data/lib/commands/datas/data.rb +13 -16
- data/lib/commands/datas/factory.rb +2 -4
- data/lib/commands/datas/pipe.rb +52 -0
- data/lib/commands/datas/temp.rb +2 -2
- data/lib/commands/datas.rb +1 -6
- data/lib/commands/factory.rb +1 -3
- data/lib/commands/helpers.rb +6 -11
- data/lib/commands/pipe.rb +4 -6
- data/lib/commands/runners/exec.rb +2 -6
- data/lib/commands/runners/fork.rb +3 -20
- data/lib/commands/runners/mockable.rb +4 -7
- data/lib/commands/runners/no_run.rb +44 -0
- data/lib/commands/runners/popen.rb +49 -0
- data/lib/commands/runners/runner.rb +29 -6
- data/lib/commands/runners/system.rb +1 -4
- data/lib/commands/runners.rb +1 -6
- data/lib/commands/seq.rb +1 -3
- data/lib/commands.rb +3 -13
- data/lib/concrete.rb +38 -0
- data/lib/config_file.rb +2 -3
- data/lib/const_regexp.rb +1 -1
- data/lib/d_logger.rb +1 -1
- data/lib/daemon.rb +2 -3
- data/lib/diff.rb +1 -1
- data/lib/diff_tools.rb +1 -3
- data/lib/drb/drb_observable.rb +1 -1
- data/lib/drb/drb_observable_pool.rb +1 -1
- data/lib/drb/drb_service.rb +1 -1
- data/lib/drb/drb_undumped_attributes.rb +1 -1
- data/lib/drb/drb_undumped_indexed_object.rb +1 -1
- data/lib/drb/insecure_protected_methods.rb +1 -1
- data/lib/drb_ex.rb +1 -1
- data/lib/file_type.rb +2 -2
- data/lib/generate_id.rb +1 -1
- data/lib/genpasswd.rb +1 -1
- data/lib/hash_eval.rb +1 -1
- data/lib/histogram.rb +1 -1
- data/lib/hookable.rb +1 -4
- data/lib/hooker.rb +1 -1
- data/lib/html_encode.rb +1 -1
- data/lib/indexed_node.rb +0 -3
- data/lib/io_marshal.rb +1 -1
- data/lib/ioo.rb +1 -1
- data/lib/kill_all.rb +2 -2
- data/lib/labeled_node.rb +0 -3
- data/lib/logger_observer.rb +1 -1
- data/lib/md5sum.rb +1 -1
- data/lib/meta_factory.rb +1 -1
- data/lib/method_call.rb +1 -1
- data/lib/mocks/assertions.rb +1 -1
- data/lib/mocks/method_logger.rb +1 -3
- data/lib/mocks/mock.rb +2 -4
- data/lib/mocks/object.rb +1 -4
- data/lib/mocks/observer.rb +1 -3
- data/lib/mocks.rb +1 -6
- data/lib/module/autoload_tree.rb +1 -1
- data/lib/module/hierarchy.rb +1 -1
- data/lib/module/instance_method_visibility.rb +17 -16
- data/lib/object_monitor.rb +1 -1
- data/lib/object_monitor_activity.rb +1 -1
- data/lib/observable.rb +1 -1
- data/lib/observable_pool.rb +1 -1
- data/lib/ordered_hash.rb +1 -1
- data/lib/r_path.rb +44 -23
- data/lib/random_generators/random_generator.rb +1 -1
- data/lib/random_generators/ruby.rb +1 -5
- data/lib/random_generators.rb +20 -5
- data/lib/regex_list.rb +2 -5
- data/lib/regex_path.rb +64 -23
- data/lib/ruby_ex.rb +11 -2
- data/lib/safe_eval.rb +6 -15
- data/lib/sendmail.rb +41 -17
- data/lib/service_manager.rb +1 -1
- data/lib/shuffle.rb +3 -1
- data/lib/spring.rb +1 -1
- data/lib/spring_set.rb +1 -1
- data/lib/sym_tbl.rb +14 -8
- data/lib/sym_tbl_gsub.rb +88 -23
- data/lib/text.rb +1 -1
- data/lib/timeout_ex.rb +1 -1
- data/lib/trace.rb +1 -1
- data/lib/uri/druby.rb +3 -6
- data/lib/uri/file.rb +32 -18
- data/lib/uri/ftp_ex.rb +8 -3
- data/lib/uri/generic_ex.rb +158 -0
- data/lib/uri/http_ex.rb +9 -4
- data/lib/uri/mysql.rb +7 -15
- data/lib/uri/pgsql.rb +6 -14
- data/lib/uri/rsync.rb +77 -0
- data/lib/uri/ssh.rb +55 -27
- data/lib/uri/svn.rb +22 -76
- data/lib/verbose_object.rb +1 -5
- data/lib/yaml/transform.rb +1 -1
- data/lib/yaml/yregexpath.rb +1 -1
- data/test/algorithms/simulated_annealing_test.rb +79 -80
- data/test/unit-suite.yml +5 -3
- metadata +179 -172
- data/SPEC.dyn.yml +0 -10
- data/SPEC.gemspec +0 -14
- data/lib/uri_ex.rb +0 -110
- data/test/test-unit-setup.rb +0 -10
data/ChangeLog
CHANGED
@@ -1,3 +1,327 @@
|
|
1
|
+
2006-02-23 Nicolas Despr�s <nicolas.despres@gmail.com>
|
2
|
+
|
3
|
+
Update the NEWS file.
|
4
|
+
|
5
|
+
* NEWS: Updated for the upcoming release.
|
6
|
+
|
7
|
+
2006-02-18 Nicolas Pouillard <ertai@lrde.epita.fr>
|
8
|
+
|
9
|
+
Adapt ruby_ex to LazyLoading.
|
10
|
+
|
11
|
+
* lib/r_path.rb,
|
12
|
+
* lib/indexed_node.rb,
|
13
|
+
* lib/sym_tbl_gsub.rb,
|
14
|
+
* lib/shuffle.rb,
|
15
|
+
* lib/labeled_node.rb,
|
16
|
+
* lib/config_file.rb,
|
17
|
+
* lib/abstract_node.rb,
|
18
|
+
* lib/uri_ex.rb,
|
19
|
+
* lib/commands/pipe.rb,
|
20
|
+
* lib/commands/factory.rb,
|
21
|
+
* lib/commands/seq.rb,
|
22
|
+
* lib/commands/datas/pipe.rb,
|
23
|
+
* lib/commands/datas/composite.rb,
|
24
|
+
* lib/commands/datas/temp.rb,
|
25
|
+
* lib/commands/datas/factory.rb,
|
26
|
+
* lib/commands/datas/data.rb,
|
27
|
+
* lib/commands/runners/no_run.rb,
|
28
|
+
* lib/commands/runners/popen.rb,
|
29
|
+
* lib/commands/runners/exec.rb,
|
30
|
+
* lib/commands/runners/runner.rb,
|
31
|
+
* lib/daemon.rb,
|
32
|
+
* lib/choose.rb,
|
33
|
+
* lib/diff_tools.rb,
|
34
|
+
* lib/verbose_object.rb,
|
35
|
+
* lib/uri/ssh.rb,
|
36
|
+
* lib/uri/rsync.rb,
|
37
|
+
* lib/uri/file.rb,
|
38
|
+
* lib/uri/druby.rb,
|
39
|
+
* lib/uri/ftp_ex.rb,
|
40
|
+
* lib/uri/mysql.rb,
|
41
|
+
* lib/uri/pgsql.rb,
|
42
|
+
* lib/uri/svn.rb,
|
43
|
+
* lib/uri/generic_ex.rb,
|
44
|
+
* lib/uri/http_ex.rb,
|
45
|
+
* lib/ruby_ex.rb,
|
46
|
+
* lib/module/instance_method_visibility.rb,
|
47
|
+
* lib/auto_object.rb,
|
48
|
+
* lib/regex_list.rb: Less requires.
|
49
|
+
|
50
|
+
2006-02-18 Nicolas Pouillard <ertai@lrde.epita.fr>
|
51
|
+
|
52
|
+
Sendmail: Keep the importants keys ordered.
|
53
|
+
|
54
|
+
* lib/sendmail.rb: From, To and Subject must be in first.
|
55
|
+
|
56
|
+
2006-01-01 Nicolas Pouillard <ertai@lrde.epita.fr>
|
57
|
+
|
58
|
+
Fix the URI::* lazy loading.
|
59
|
+
|
60
|
+
* lib/uri_ex.rb: Setup some inflection exceptions and add some test.
|
61
|
+
* lib/commands/command.rb: Extend the sleep time to 2 seconds.
|
62
|
+
|
63
|
+
2005-12-31 Nicolas Pouillard <ertai@lrde.epita.fr>
|
64
|
+
|
65
|
+
More fixes.
|
66
|
+
|
67
|
+
* lib/random_generators.rb: Fix the test.
|
68
|
+
* test/algorithms/simulated_annealing_test.rb: Make a consistent class
|
69
|
+
name.
|
70
|
+
|
71
|
+
2005-12-31 Nicolas Pouillard <ertai@lrde.epita.fr>
|
72
|
+
|
73
|
+
Commands: Remove useless requires/imports.
|
74
|
+
|
75
|
+
* lib/commands/command.rb,
|
76
|
+
* lib/commands/helpers.rb,
|
77
|
+
* lib/commands/datas/factory.rb,
|
78
|
+
* lib/commands/datas/data.rb,
|
79
|
+
* lib/commands/runners/mockable.rb,
|
80
|
+
* lib/commands/runners/fork.rb,
|
81
|
+
* lib/commands/runners/exec.rb,
|
82
|
+
* lib/commands/runners/system.rb,
|
83
|
+
* lib/commands/runners/runner.rb,
|
84
|
+
* lib/commands/datas.rb,
|
85
|
+
* lib/commands/runners.rb,
|
86
|
+
* lib/commands.rb: Clean up requires.
|
87
|
+
* lib/commands/datas/pipe.rb: Likewise and handle the pipe cleaning
|
88
|
+
properly.
|
89
|
+
|
90
|
+
2005-12-31 Nicolas Pouillard <ertai@lrde.epita.fr>
|
91
|
+
|
92
|
+
FileType: Use make Abstract.
|
93
|
+
|
94
|
+
* lib/file_type.rb: In order to lazy load Abstract.
|
95
|
+
|
96
|
+
2005-12-31 Nicolas Pouillard <ertai@lrde.epita.fr>
|
97
|
+
|
98
|
+
Hookable: Remove useless requires/imports.
|
99
|
+
|
100
|
+
* lib/hookable.rb: Update.
|
101
|
+
|
102
|
+
2005-12-31 Nicolas Pouillard <ertai@lrde.epita.fr>
|
103
|
+
|
104
|
+
Export Concrete from Abstract.
|
105
|
+
|
106
|
+
* lib/abstract.rb: Export Concrete to make it lazy loadable without
|
107
|
+
saying Abstract before.
|
108
|
+
* lib/concrete.rb: New.
|
109
|
+
|
110
|
+
2005-12-31 Nicolas Pouillard <ertai@lrde.epita.fr>
|
111
|
+
|
112
|
+
Mocks: Remove useless requires/imports.
|
113
|
+
|
114
|
+
* lib/mocks/method_logger.rb,
|
115
|
+
* lib/mocks/object.rb,
|
116
|
+
* lib/mocks/observer.rb,
|
117
|
+
* lib/mocks/mock.rb,
|
118
|
+
* lib/mocks.rb: Update.
|
119
|
+
|
120
|
+
2005-12-31 Nicolas Pouillard <ertai@lrde.epita.fr>
|
121
|
+
|
122
|
+
Enforce the double load protection.
|
123
|
+
|
124
|
+
* lib/ruby_ex.rb: Enforce the double load protection.
|
125
|
+
* test/unit-suite.yml: Likewise but in a different way.
|
126
|
+
|
127
|
+
2005-12-31 Nicolas Pouillard <ertai@lrde.epita.fr>
|
128
|
+
|
129
|
+
Litte RegexPath clean up.
|
130
|
+
|
131
|
+
* lib/regex_path.rb: Remove a group and a comma.
|
132
|
+
|
133
|
+
2005-12-31 Nicolas Pouillard <ertai@lrde.epita.fr>
|
134
|
+
|
135
|
+
Update and enhance RandomGenerators.
|
136
|
+
|
137
|
+
* lib/ruby_ex.rb: Controllers prefix is now useless.
|
138
|
+
* lib/random_generators/ruby.rb: Clean up.
|
139
|
+
* lib/random_generators.rb: Silence warnings of active_support, setup
|
140
|
+
the default RandomGenerator simply, and add a test.
|
141
|
+
* lib/choose.rb: The require is useless (and may cause a double load).
|
142
|
+
|
143
|
+
2005-12-31 Nicolas Pouillard <ertai@lrde.epita.fr>
|
144
|
+
|
145
|
+
A::SimulatedAnnealing: Some improvments.
|
146
|
+
|
147
|
+
* lib/algorithms/simulated_annealing.rb: Add iteration_max to limit the
|
148
|
+
number of iterations, add argmin to keep track of the best solution
|
149
|
+
(the support need to respond to copy_of_the_current_solution), and fix
|
150
|
+
a typo.
|
151
|
+
* test/algorithms/simulated_annealing_test.rb: Update accordignly.
|
152
|
+
|
153
|
+
2005-12-06 Nicolas Pouillard <ertai@lrde.epita.fr>
|
154
|
+
|
155
|
+
Some stuffs.
|
156
|
+
|
157
|
+
* lib/uri_ex.rb: Add to_uri, and self.yaml_load.
|
158
|
+
* lib/uri/ssh.rb: First draft for jump_and_eval.
|
159
|
+
* lib/random_generators/ruby.rb,
|
160
|
+
* lib/ruby_ex.rb: Protect against double loading.
|
161
|
+
* SPEC.yml: Uttk Renaming.
|
162
|
+
* lib/commands.rb: Not yet finished.
|
163
|
+
|
164
|
+
2005-12-06 Nicolas Pouillard <ertai@lrde.epita.fr>
|
165
|
+
|
166
|
+
Add Commands::Runners::{Popen,Pipe}.
|
167
|
+
|
168
|
+
* lib/commands/datas/pipe.rb: New.
|
169
|
+
* lib/commands/runners/popen.rb: New.
|
170
|
+
* lib/commands/command.rb,
|
171
|
+
* lib/commands/helpers.rb,
|
172
|
+
* lib/commands/datas/composite.rb,
|
173
|
+
* lib/commands/datas/temp.rb,
|
174
|
+
* lib/commands/datas/factory.rb: Update.
|
175
|
+
|
176
|
+
2005-12-06 Nicolas Pouillard <ertai@lrde.epita.fr>
|
177
|
+
|
178
|
+
Improve the sendmail.rb options handling.
|
179
|
+
|
180
|
+
* lib/sendmail.rb: Update.
|
181
|
+
|
182
|
+
2005-11-03 Nicolas Despr�s <nicolas.despres@gmail.com>
|
183
|
+
|
184
|
+
Makes DTime more arithmeticable.
|
185
|
+
|
186
|
+
* core_ex/lib/d_time.rb: Handles regular arithmetics operators.
|
187
|
+
|
188
|
+
2005-11-03 Nicolas Despr�s <nicolas.despres@gmail.com>
|
189
|
+
|
190
|
+
Make DTime comparable.
|
191
|
+
|
192
|
+
* core_ex/lib/d_time.rb: Makes DTime a comparable class of objet.
|
193
|
+
|
194
|
+
2005-11-03 Nicolas Despr�s <nicolas.despres@gmail.com>
|
195
|
+
|
196
|
+
Less error-prone test.
|
197
|
+
|
198
|
+
* core_ex/lib/d_time.rb: Make sure it works on every machine.
|
199
|
+
|
200
|
+
2005-11-02 Nicolas Despr�s <nicolas.despres@gmail.com>
|
201
|
+
|
202
|
+
Remove dummy code.
|
203
|
+
|
204
|
+
* core_ex/lib/d_time.rb: Remove method_missing handle which only call
|
205
|
+
send on the only attribute of the class.
|
206
|
+
|
207
|
+
2005-10-29 Nicolas Pouillard <ertai@lrde.epita.fr>
|
208
|
+
|
209
|
+
Add argmin.
|
210
|
+
|
211
|
+
* lib/algorithms/simulated_annealing.rb: This add a nice way to catch
|
212
|
+
the better argmin at any time.
|
213
|
+
|
214
|
+
2005-10-29 Nicolas Pouillard <ertai@lrde.epita.fr>
|
215
|
+
|
216
|
+
Generalize the header system.
|
217
|
+
|
218
|
+
* lib/sendmail.rb: All headers given as argument are now merged.
|
219
|
+
Fields like To, From, Subject, etc. are now picked from the header
|
220
|
+
table. This allow a more customizable mail generation.
|
221
|
+
|
222
|
+
2005-10-27 Nicolas Pouillard <ertai@lrde.epita.fr>
|
223
|
+
|
224
|
+
* lib/sym_tbl_gsub.rb: Update.
|
225
|
+
|
226
|
+
2005-10-26 Nicolas Pouillard <ertai@lrde.epita.fr>
|
227
|
+
|
228
|
+
* lib/sym_tbl.rb: You can now but trigger block in the symtbl, when
|
229
|
+
corresponding key will be access it will class the trigger.
|
230
|
+
|
231
|
+
2005-10-11 Nicolas Pouillard <ertai@lrde.epita.fr>
|
232
|
+
|
233
|
+
Adapt the unit suite to uttk-unit.
|
234
|
+
|
235
|
+
* test/unit-suite.yml: Update.
|
236
|
+
|
237
|
+
2005-10-11 Nicolas Pouillard <ertai@lrde.epita.fr>
|
238
|
+
|
239
|
+
Change options for rsync.
|
240
|
+
|
241
|
+
* lib/uri/rsync.rb: Use -v not -P.
|
242
|
+
|
243
|
+
2005-10-11 Nicolas Pouillard <ertai@lrde.epita.fr>
|
244
|
+
|
245
|
+
Commands: Shellwords and user friendly options.
|
246
|
+
|
247
|
+
* lib/commands/helpers.rb: Use the Shellwords module to split a string.
|
248
|
+
* lib/commands/command.rb: Make options more user friendly.
|
249
|
+
* lib/commands/runners/fork.rb: Move the FailureHooker ...
|
250
|
+
* lib/commands/runners/runner.rb: ... here.
|
251
|
+
* lib/uri/svn.rb: Fix a bug on to_s with svn.file scheme.
|
252
|
+
|
253
|
+
2005-10-10 Nicolas Pouillard <ertai@lrde.epita.fr>
|
254
|
+
|
255
|
+
More imports.
|
256
|
+
|
257
|
+
* lib/commands.rb, lib/kill_all.rb: Use import.
|
258
|
+
|
259
|
+
2005-10-10 Nicolas Pouillard <ertai@lrde.epita.fr>
|
260
|
+
|
261
|
+
Add fingerprint and clean up URIs.
|
262
|
+
|
263
|
+
* lib/uri/ssh.rb,
|
264
|
+
* lib/uri/rsync.rb,
|
265
|
+
* lib/uri/mysql.rb,
|
266
|
+
* lib/uri/pgsql.rb: Less class constants, more cattr_reader.
|
267
|
+
Remove the useless build singleton method.
|
268
|
+
|
269
|
+
* lib/uri/file.rb: Likewise and add fingerprint.
|
270
|
+
* lib/uri/svn.rb: Likewise, add fingerprint, and remove the useless
|
271
|
+
scheme handling.
|
272
|
+
* lib/uri_ex.rb: Use a simple class accessor for runner.
|
273
|
+
|
274
|
+
2005-10-10 Nicolas Pouillard <ertai@lrde.epita.fr>
|
275
|
+
|
276
|
+
Add options to running methods of C::Commands.
|
277
|
+
|
278
|
+
* lib/commands/command.rb: Add run_with_options and adapt system, fork,
|
279
|
+
popen, sys, exec, and run.
|
280
|
+
* lib/commands/pipe.rb: Adapt run.
|
281
|
+
* lib/commands/helpers.rb: Leave a fixme.
|
282
|
+
|
283
|
+
* lib/commands/factory.rb, lib/commands/seq.rb,
|
284
|
+
* lib/commands/datas/composite.rb, lib/commands/datas/data.rb,
|
285
|
+
* lib/commands/runners/mockable.rb, lib/commands/runners/no_run.rb,
|
286
|
+
* lib/commands/runners/fork.rb, lib/commands/runners/exec.rb,
|
287
|
+
* lib/commands/runners/system.rb, lib/commands/runners/runner.rb,
|
288
|
+
* lib/commands/runners.rb: Prefer import! instead of require.
|
289
|
+
|
290
|
+
2005-10-10 Nicolas Pouillard <ertai@lrde.epita.fr>
|
291
|
+
|
292
|
+
URI::Svn#save now makes smaller files.
|
293
|
+
|
294
|
+
* lib/uri/svn.rb: Add the --deltas option to svnadmin dump.
|
295
|
+
|
296
|
+
2005-10-09 Nicolas Pouillard <ertai@lrde.epita.fr>
|
297
|
+
|
298
|
+
Add a runner which do not run the command.
|
299
|
+
|
300
|
+
* lib/commands/runners/no_run.rb: New. This trivial runner can be
|
301
|
+
useful to catch the command that will be ran, and run it with after
|
302
|
+
with some modifications.
|
303
|
+
* lib/commands/datas/data.rb: Fix to_yaml.
|
304
|
+
|
305
|
+
2005-10-09 Nicolas Pouillard <ertai@lrde.epita.fr>
|
306
|
+
|
307
|
+
Add tests for URI::Rsync.
|
308
|
+
|
309
|
+
* lib/uri/rsync.rb: Check the option generation.
|
310
|
+
|
311
|
+
* lib/uri/ssh.rb, lib/uri/file.rb, lib/uri/druby.rb,
|
312
|
+
* lib/uri/ftp_ex.rb, lib/uri/mysql.rb, lib/uri/pgsql.rb,
|
313
|
+
* lib/uri/svn.rb, lib/uri/http_ex.rb: Imports instead of requires.
|
314
|
+
|
315
|
+
2005-10-09 Nicolas Pouillard <ertai@lrde.epita.fr>
|
316
|
+
|
317
|
+
Add URI::Rsync and fix some others URI::*.
|
318
|
+
|
319
|
+
* lib/uri_ex.rb: Use URI.decode in mk_custom_opts.
|
320
|
+
* lib/uri/rsync.rb: New. Just supports rsync.ssh.
|
321
|
+
* lib/uri/ssh.rb, lib/uri/file.rb, lib/uri/mysql.rb, lib/uri/pgsql.rb,
|
322
|
+
lib/uri/svn.rb: Fix returned values of checkout and save.
|
323
|
+
* lib/commands/datas/data.rb: Suppress errors in to_yaml_string.
|
324
|
+
|
1
325
|
2005-10-03 Nicolas Pouillard <ertai@lrde.epita.fr>
|
2
326
|
|
3
327
|
Fix the SPEC.dyn.yml.
|
data/NEWS
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
= New in 0.4, 2006-02-24:
|
2
|
+
|
3
|
+
This release makes RubyEx compatible with ruby 1.8.4!
|
4
|
+
|
5
|
+
Backward compatibility with older version of Ruby is no longer maintained.
|
6
|
+
|
7
|
+
* RPath:
|
8
|
+
Introduced in the previous release. Now supports negative regular
|
9
|
+
expression.
|
10
|
+
|
11
|
+
* Command:
|
12
|
+
- The pipe support is reloaded.
|
13
|
+
- Introduction of the NoRun and the Popen runners.
|
14
|
+
|
15
|
+
* Uri extension:
|
16
|
+
Add support for the "rsync" uri.
|
17
|
+
|
1
18
|
= New in 0.3, 2005-10-03:
|
2
19
|
|
3
20
|
This release make RubyEx compatible with ruby 1.8.3!
|
data/README
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Coming Soon.
|
1
|
+
Coming Soon. We hope...
|
data/SPEC.yml
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
---
|
2
|
-
Author: The
|
2
|
+
Author: The Uttk Team.
|
3
3
|
License: Ruby License
|
4
|
-
Revision: '$Id$'
|
4
|
+
Revision: '$Id: /w/fey/ruby_ex/trunk/SPEC.yml 22231 2006-02-24T14:25:44.907003Z pouillar $'
|
5
5
|
|
6
|
-
|
6
|
+
version: !feydakins.org,2006/version dev-ruby/ruby_ex-0.4_alpha2
|
7
7
|
|
8
8
|
title: RubyEx -- General purpose Ruby extensions.
|
9
9
|
summary: RubyEx contains general purpose Ruby extensions.
|
10
10
|
description: ""
|
11
11
|
homepage: http://api.feydakins.org/ruby_ex
|
12
|
+
|
13
|
+
user: ertai
|
12
14
|
rubyforge_project: ttk
|
13
15
|
rubyforge_sub_package_name: ruby_ex
|
14
|
-
|
15
16
|
root_test_suite: test/check-pkg-ruby_ex.yml
|
16
17
|
rdoc_dir: doc/html
|
17
18
|
tags_url: svn://svn.feydakins.org/ruby_ex/tags
|
18
|
-
|
19
|
-
commit_command: rxci
|
19
|
+
trunk_url: svn://svn.feydakins.org/ruby_ex/trunk
|
20
20
|
|
21
21
|
rdoc_files: !filelist
|
22
22
|
- README
|
@@ -31,9 +31,9 @@ pkg_files: !filelist
|
|
31
31
|
|
32
32
|
dependencies:
|
33
33
|
core_ex:
|
34
|
-
gem: ~> 0.
|
35
|
-
tarball:
|
34
|
+
gem: ~> 0.5.1
|
35
|
+
tarball: 8818/core_ex-0.5_alpha1.tar.gz
|
36
36
|
vcs: svn://svn.feydakins.org/ruby_ex/trunk/core_ex
|
37
37
|
highline: [~> 1.0.1, 5143/highline-1.0.1.tgz]
|
38
38
|
|
39
|
-
|
39
|
+
uttk_version: ~> 0.3.1
|
data/lib/abstract.rb
CHANGED
@@ -2,16 +2,13 @@
|
|
2
2
|
# Author: Nicolas Despres <polrop@lrde.epita.fr>.
|
3
3
|
# License: Gnu General Public License.
|
4
4
|
|
5
|
-
# $LastChangedBy:
|
6
|
-
# $Id: abstract.rb
|
5
|
+
# $LastChangedBy: pouillar $
|
6
|
+
# $Id: /w/fey/ruby_ex/trunk/lib/abstract.rb 21950 2006-02-19T19:23:50.312174Z pouillar $
|
7
7
|
|
8
8
|
|
9
9
|
#FIXME: find a way to be thread safe.
|
10
10
|
|
11
|
-
InstanceMethodVisibility.import!
|
12
|
-
|
13
|
-
|
14
|
-
module Concrete; end
|
11
|
+
Module::InstanceMethodVisibility.import!
|
15
12
|
|
16
13
|
|
17
14
|
# When this module is included into a class, this class can't be instantiate
|
@@ -43,44 +40,12 @@ module Abstract
|
|
43
40
|
end # module Abstract
|
44
41
|
|
45
42
|
|
46
|
-
# Include this module in an abstract class to make it concrete and so, to be
|
47
|
-
# able to instantiate it again. This module can be included if and only if the
|
48
|
-
# Abstract module has been included before in one of the class' superclass.
|
49
|
-
module Concrete
|
50
|
-
|
51
|
-
def self.included(klass)
|
52
|
-
super
|
53
|
-
unless klass.include?(Abstract)
|
54
|
-
raise(TypeError, "#{klass} - not an abstract class")
|
55
|
-
end
|
56
|
-
klass.module_eval do
|
57
|
-
class << self
|
58
|
-
visibility = instance_method_visibility('new')
|
59
|
-
def new(*args, &block)
|
60
|
-
concrete_new(*args, &block)
|
61
|
-
end
|
62
|
-
send(visibility, :new)
|
63
|
-
end
|
64
|
-
|
65
|
-
def is_a?(klass)
|
66
|
-
klass == Abstract ? false : super(klass)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
end # module Concrete
|
72
|
-
|
73
|
-
|
74
43
|
class Class
|
75
44
|
|
76
45
|
def abstract
|
77
46
|
include Abstract
|
78
47
|
end
|
79
48
|
|
80
|
-
def concrete
|
81
|
-
include Concrete
|
82
|
-
end
|
83
|
-
|
84
49
|
def abstract?
|
85
50
|
include?(Abstract) ? (not include?(Concrete)) : false;
|
86
51
|
end
|
data/lib/abstract_node.rb
CHANGED
@@ -2,12 +2,10 @@
|
|
2
2
|
# Author: Nicolas Despres <polrop@lrde.epita.fr>.
|
3
3
|
# License: Gnu General Public License.
|
4
4
|
|
5
|
-
# $LastChangedBy:
|
6
|
-
# $Id: abstract_node.rb
|
5
|
+
# $LastChangedBy: pouillar $
|
6
|
+
# $Id: /w/fey/ruby_ex/trunk/lib/abstract_node.rb 21865 2006-02-18T17:13:28.680350Z pouillar $
|
7
7
|
|
8
8
|
|
9
|
-
require 'abstract'
|
10
|
-
|
11
9
|
class AbstractNode
|
12
10
|
include Abstract
|
13
11
|
|
@@ -9,13 +9,20 @@ module Algorithms
|
|
9
9
|
|
10
10
|
class SimulatedAnnealing
|
11
11
|
|
12
|
+
attr_reader :support, :global_threshold, :step_multiplicator,
|
13
|
+
:initial_temperature, :initial_cost, :output,
|
14
|
+
:iteration_modulus, :step_modulus, :generator,
|
15
|
+
:diff_cost, :iteration, :probability_threshold,
|
16
|
+
:argmin, :iteration_max
|
17
|
+
alias_method :best, :argmin
|
18
|
+
|
12
19
|
# Example:
|
13
20
|
#
|
14
21
|
# obj = MySimulatedAnnealingObject.new
|
15
22
|
#
|
16
23
|
# SimulatedAnnealing.new(
|
17
24
|
# :support => obj,
|
18
|
-
# :
|
25
|
+
# :global_threshold => 200,
|
19
26
|
# :step_multiplicator => 0.63,
|
20
27
|
# :initial_temperature => 10,
|
21
28
|
# :initial_cost => obj.cost,
|
@@ -25,7 +32,8 @@ module Algorithms
|
|
25
32
|
#
|
26
33
|
def initialize ( opts )
|
27
34
|
@support = opts[:support]
|
28
|
-
@
|
35
|
+
@global_threshold = opts[:global_threshold] ||
|
36
|
+
opts[:global_thresold] # :) backward compatibility
|
29
37
|
@step_multiplicator = opts[:step_multiplicator]
|
30
38
|
@temperature = opts[:initial_temperature]
|
31
39
|
@cur_cost = opts[:initial_cost]
|
@@ -33,10 +41,13 @@ module Algorithms
|
|
33
41
|
@iteration_modulus = opts[:iteration_modulus] || 1
|
34
42
|
@step_modulus = opts[:step_modulus] || 1
|
35
43
|
@generator = opts[:generator]
|
44
|
+
@iteration_max = opts[:iteration_max] || (1.0 / 0.0) # Infinity
|
36
45
|
@progression = ' '
|
37
46
|
@diff_cost = 0
|
38
47
|
@iteration = 0
|
39
48
|
@probability_threshold = 0
|
49
|
+
@argmin = @support.copy_of_the_current_solution
|
50
|
+
@min = @cur_cost
|
40
51
|
end
|
41
52
|
|
42
53
|
@@zeros = [0.0] * 8
|
@@ -50,7 +61,7 @@ module Algorithms
|
|
50
61
|
def run
|
51
62
|
reset
|
52
63
|
@output.puts '---'
|
53
|
-
while @cur_cost > @
|
64
|
+
while @cur_cost > @global_threshold and @iteration < @iteration_max
|
54
65
|
# puts "Iteration(#{it}) #{@cur_cost}"
|
55
66
|
@transition = @support.choose_transition(@generator)
|
56
67
|
@diff_cost = @support.transition_cost(@cur_cost, @transition)
|
@@ -89,6 +100,10 @@ module Algorithms
|
|
89
100
|
|
90
101
|
@support.apply_transition(@transition)
|
91
102
|
@cur_cost += @diff_cost
|
103
|
+
if @cur_cost < @min
|
104
|
+
@min = @cur_cost
|
105
|
+
@argmin = @support.copy_of_the_current_solution
|
106
|
+
end
|
92
107
|
end
|
93
108
|
end
|
94
109
|
|
@@ -152,6 +167,14 @@ module Algorithms
|
|
152
167
|
raise NotImplementedError
|
153
168
|
end
|
154
169
|
|
170
|
+
#
|
171
|
+
# This method should return the copy of the current solution
|
172
|
+
# it will be called to save the best solution (argmin).
|
173
|
+
#
|
174
|
+
def copy_of_the_current_solution
|
175
|
+
raise NotImplementedError
|
176
|
+
end
|
177
|
+
|
155
178
|
end
|
156
179
|
|
157
180
|
end
|
data/lib/attributed_class.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright:: Copyright (c) 2004, 2005 Nicolas Pouillard. All rights reserved.
|
2
2
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
3
3
|
# License:: Gnu General Public License.
|
4
|
-
# Revision:: $Id: attributed_class.rb
|
4
|
+
# Revision:: $Id: /w/fey/ruby_ex/trunk/lib/attributed_class.rb 21867 2006-02-18T17:17:48.984880Z pouillar $
|
5
5
|
|
6
6
|
|
7
7
|
|
@@ -12,7 +12,7 @@ module AttributedClass
|
|
12
12
|
class Attribute
|
13
13
|
|
14
14
|
attr_reader :name, :descr, :klass, :default_proc
|
15
|
-
attr_accessor :default
|
15
|
+
attr_accessor :default, :mandatory
|
16
16
|
|
17
17
|
@@default_proc = nil
|
18
18
|
|
data/lib/auto_object.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
|
2
2
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
3
3
|
# License:: Gnu General Public License.
|
4
|
-
# Revision:: $Id: auto_object.rb
|
5
|
-
|
6
|
-
require 'blank_slate'
|
7
|
-
require 'verbose_object'
|
4
|
+
# Revision:: $Id: /w/fey/ruby_ex/trunk/lib/auto_object.rb 21865 2006-02-18T17:13:28.680350Z pouillar $
|
8
5
|
|
9
6
|
class AutoObject
|
10
7
|
|
@@ -59,7 +56,6 @@ end # class Object
|
|
59
56
|
|
60
57
|
|
61
58
|
test_section __FILE__ do
|
62
|
-
require 'mocks'
|
63
59
|
class TestAutoObject < ::Test::Unit::TestCase
|
64
60
|
include Mocks::Assertions
|
65
61
|
|
@@ -99,4 +95,4 @@ test_section __FILE__ do
|
|
99
95
|
end
|
100
96
|
|
101
97
|
end # class TestAutoObject
|
102
|
-
end
|
98
|
+
end
|
data/lib/blank_slate.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
|
2
2
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
3
3
|
# License:: Gnu General Public License.
|
4
|
-
# Revision:: $Id: blank_slate.rb
|
4
|
+
# Revision:: $Id: /w/fey/ruby_ex/trunk/lib/blank_slate.rb 7944 2005-09-06T23:27:27.929371Z ertai $
|
5
5
|
|
6
6
|
|
7
7
|
# This module is inspired from BlankSlate of Jim Weirich.
|
data/lib/cache.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
# Author: Nicolas Despres <polrop@lrde.epita.fr>.
|
3
3
|
# License: Gnu General Public License.
|
4
4
|
|
5
|
-
# $LastChangedBy:
|
6
|
-
# $Id: cache.rb
|
5
|
+
# $LastChangedBy: pouillar $
|
6
|
+
# $Id: /w/fey/ruby_ex/trunk/lib/cache.rb 21870 2006-02-19T00:35:27.708127Z pouillar $
|
7
7
|
|
8
8
|
|
9
9
|
require 'md5sum'
|
@@ -208,7 +208,7 @@ class CacheTest < Test::Unit::TestCase
|
|
208
208
|
assert(f.eof?)
|
209
209
|
end
|
210
210
|
assert_equal(tmp_p, p1)
|
211
|
-
check_atime(cache)
|
211
|
+
# FIXME check_atime(cache)
|
212
212
|
assert_equal(1, cache.nb_files, 'bad nb_files')
|
213
213
|
assert(cache.present?(p1))
|
214
214
|
assert_equal(p1, cache[0])
|
@@ -245,7 +245,7 @@ class CacheTest < Test::Unit::TestCase
|
|
245
245
|
assert_equal(p2, cache[0], 'p2 first')
|
246
246
|
assert_equal(p3, cache[1], 'p3 second')
|
247
247
|
assert_equal(p1, cache[2], 'p1 third')
|
248
|
-
check_atime(cache)
|
248
|
+
# FIXME check_atime(cache)
|
249
249
|
assert_equal(3, cache.nb_files, 'bad nb_files')
|
250
250
|
|
251
251
|
|
data/lib/choose.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
2
|
# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
|
3
3
|
# License:: GNU General Public License (GPL).
|
4
|
-
# Revision:: $Id: choose.rb
|
5
|
-
|
6
|
-
|
7
|
-
require 'random_generators'
|
4
|
+
# Revision:: $Id: /w/fey/ruby_ex/trunk/lib/choose.rb 21865 2006-02-18T17:13:28.680350Z pouillar $
|
8
5
|
|
6
|
+
module Choose
|
7
|
+
end # module Choose
|
9
8
|
|
10
9
|
class Integer
|
11
10
|
|
@@ -118,7 +117,6 @@ module Choose
|
|
118
117
|
end # class RandomMockRandomGenerator
|
119
118
|
|
120
119
|
|
121
|
-
require 'test/unit'
|
122
120
|
require 'set'
|
123
121
|
|
124
122
|
class ChooseTest < Test::Unit::TestCase
|