ruby_ex 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/ChangeLog +177 -0
  2. data/NEWS +20 -11
  3. data/SPEC.dyn.yml +4 -4
  4. data/SPEC.gemspec +4 -4
  5. data/SPEC.yml +4 -1
  6. data/lib/cache.rb +2 -2
  7. data/lib/commands.rb +19 -1
  8. data/lib/commands/command.rb +5 -5
  9. data/lib/commands/datas/composite.rb +26 -4
  10. data/lib/commands/datas/data.rb +6 -5
  11. data/lib/commands/pipe.rb +55 -14
  12. data/lib/commands/runners/fork.rb +6 -2
  13. data/lib/commands/runners/{mock.rb → mockable.rb} +21 -22
  14. data/lib/commands/runners/runner.rb +13 -1
  15. data/lib/d_logger.rb +11 -5
  16. data/lib/diff_tools.rb +141 -0
  17. data/lib/drb/insecure_protected_methods.rb +2 -2
  18. data/lib/file_type.rb +29 -21
  19. data/lib/hookable.rb +17 -2
  20. data/lib/md5sum.rb +2 -2
  21. data/lib/module/autoload_tree.rb +2 -2
  22. data/lib/ordered_hash.rb +28 -1
  23. data/lib/regex_list.rb +192 -0
  24. data/lib/ruby_ex.rb +8 -5
  25. data/lib/sendmail.rb +8 -1
  26. data/lib/sym_tbl_gsub.rb +44 -18
  27. data/lib/uri/file.rb +2 -2
  28. data/lib/uri/ftp_ex.rb +2 -2
  29. data/lib/uri/http_ex.rb +2 -2
  30. data/lib/uri/ssh.rb +1 -1
  31. data/lib/uri/svn.rb +2 -2
  32. data/lib/uri_ex.rb +4 -7
  33. data/lib/yaml/chop_header.rb +1 -1
  34. data/test/check-pkg-ruby_ex.yml +5 -7
  35. data/test/check-ruby_ex.yml +6 -10
  36. data/test/{resources → fixtures}/autoload_tree/A.rb +0 -0
  37. data/test/{resources → fixtures}/autoload_tree/B.rb +0 -0
  38. data/test/{resources → fixtures}/autoload_tree/foo/C.rb +0 -0
  39. data/test/fixtures/foo.bz2 +0 -0
  40. data/test/fixtures/foo.gz.zip +0 -0
  41. data/test/fixtures/foo.rb.gz +0 -0
  42. data/test/fixtures/foo.tar +0 -0
  43. data/test/fixtures/foo.tar.bz2 +0 -0
  44. data/test/{resources → fixtures}/foo.tar.gz +0 -0
  45. data/test/{resources → fixtures}/foo.txt +0 -0
  46. data/test/fixtures/my_diff.patch +164 -0
  47. data/test/{resources → fixtures}/tar.gz.log +0 -0
  48. data/test/sanity/multiple-requires.yml +1 -1
  49. data/test/sanity/single-requires.yml +1 -1
  50. metadata +23 -16
data/ChangeLog CHANGED
@@ -1,3 +1,180 @@
1
+ 2005-10-03 Nicolas Pouillard <ertai@lrde.epita.fr>
2
+
3
+ Fix the SPEC.dyn.yml.
4
+
5
+ * SPEC.dyn.yml: Re-update.
6
+
7
+ 2005-10-03 Nicolas Pouillard <ertai@lrde.epita.fr>
8
+
9
+ Bump RubyEx to 0.3.
10
+
11
+ * SPEC.dyn.yml: Update.
12
+ * SPEC.yml: Update CoreEx dependency to 0.4.
13
+ * NEWS: Add an entry.
14
+
15
+ 2005-10-03 Nicolas Pouillard <ertai@lrde.epita.fr>
16
+
17
+ Little DLogger fix for ruby 1.8.2.
18
+
19
+ * lib/d_logger.rb: Suppress a warning with ruby 1.8.2.
20
+ Fix the test for ruby 1.8.2.
21
+
22
+ 2005-10-02 Nicolas Pouillard <ertai@lrde.epita.fr>
23
+
24
+ Upgrade RubyEx to ruby 1.8.3.
25
+
26
+ * lib/uri/file.rb, lib/uri/ftp_ex.rb, lib/uri/http_ex.rb: Make checkout
27
+ return an array.
28
+ * lib/ruby_ex.rb: Update the CoreEx require.
29
+ * lib/d_logger.rb: Update to Logger 1.2.6 in ruby 1.8.3.
30
+ * lib/drb/insecure_protected_methods.rb: Update the unit test suite.
31
+ * SPEC.yml: Use a hash for the CoreEx dependency.
32
+
33
+ 2005-09-30 Nicolas Pouillard <ertai@lrde.epita.fr>
34
+
35
+ Add DiffTool a module for the Diff manipulation.
36
+
37
+ * lib/diff_tools.rb: New. Provides DiffTools::Diff for set of chunks,
38
+ DiffTools::Chunk for diffs between just two files, and DiffTools::App
39
+ a basic command line application. Methods provided are: grep, negative,
40
+ and exclude.
41
+
42
+ 2005-09-30 Nicolas Pouillard <ertai@lrde.epita.fr>
43
+
44
+ Add RegexList a class to handle sorting with regular expressions.
45
+
46
+ * lib/regex_list.rb: New. Provides RegexList and a PathList extension
47
+ for ease the PathList sorting.
48
+
49
+ 2005-09-29 Nicolas Pouillard <ertai@lrde.epita.fr>
50
+
51
+ Rename TTK to Uttk.
52
+
53
+ * test/check-pkg-ruby_ex.yml, vcs/vcs_ruby_ex.rb: Update.
54
+
55
+ 2005-09-29 Nicolas Pouillard <ertai@lrde.epita.fr>
56
+
57
+ Rename resources to fixtures.
58
+
59
+ * test/functional: New.
60
+ * test/resources: Rename to ...
61
+ * test/fixtures: ... this.
62
+ * test/fixtures/my_diff.patch: New.
63
+ * lib/sym_tbl_gsub.rb,
64
+ * lib/md5sum.rb,
65
+ * lib/file_type.rb,
66
+ * lib/cache.rb,
67
+ * lib/module/autoload_tree.rb: Update.
68
+
69
+ 2005-09-29 Nicolas Pouillard <ertai@lrde.epita.fr>
70
+
71
+ Add an header option to Sendmail.
72
+
73
+ * lib/sendmail.rb: With this option you can easily add your fields to
74
+ the header.
75
+
76
+ 2005-09-29 Nicolas Pouillard <ertai@lrde.epita.fr>
77
+
78
+ Two fixes in Commands.
79
+
80
+ * lib/commands/runners/fork.rb: Clean TempPath before exec.
81
+ * lib/commands/runners/runner.rb: Flush outputs, after reopen.
82
+
83
+ 2005-09-25 Nicolas Pouillard <ertai@lrde.epita.fr>
84
+
85
+ More <<ruby>>.
86
+
87
+ * test/sanity/multiple-requires.yml, test/sanity/single-requires.yml:
88
+ Update.
89
+
90
+ 2005-09-25 Nicolas Pouillard <ertai@lrde.epita.fr>
91
+
92
+ Fix a test suite.
93
+
94
+ * core_ex/test/check-pkg-core_ex.yml: Add a weight 0.
95
+
96
+ 2005-09-25 Nicolas Pouillard <ertai@lrde.epita.fr>
97
+
98
+ Fix ruby_ex test suites.
99
+
100
+ * test/check-pkg-ruby_ex.yml: Add a missing !pathlist.
101
+ * test/check-ruby_ex.yml: Update to !S:: and add a weight 0.
102
+
103
+ 2005-09-24 Nicolas Pouillard <ertai@lrde.epita.fr>
104
+
105
+ Remove the inopportunely added .DS_Store.
106
+
107
+ * test/resources/.DS_Store: Remove.
108
+
109
+ 2005-09-24 Nicolas Pouillard <ertai@lrde.epita.fr>
110
+
111
+ Update vcs support and add some fixtures.
112
+
113
+ * test/check-ruby_ex.yml: Upgrade to Iterate and !S::.
114
+ * vcs/vcs_ruby_ex.rb: Upgarde to Vcs 0.4 protocol 0.1.
115
+ With just Vcs 0.4 just use `commit' or `ci'.
116
+ * NEWS: Typo.
117
+
118
+ Add some fixtures.
119
+ * test/resources/foo.bz2: New.
120
+ * test/resources/.DS_Store: New.
121
+ * test/resources/foo.gz.zip: New.
122
+ * test/resources/foo.rb.gz: New.
123
+ * test/resources/foo.tar.bz2: New.
124
+ * test/resources/foo.tar: New.
125
+
126
+ 2005-09-24 Nicolas Pouillard <ertai@lrde.epita.fr>
127
+
128
+ Symtbl gsub, FileType, OHash and Yaml...
129
+
130
+ * lib/sym_tbl_gsub.rb: Keep pattern not yet expansed in a list, and
131
+ re-inject them when the symtbl is defined.
132
+ * lib/file_type.rb: Remove the FIXME concerning the pipe issue which
133
+ is solved. Adapt tests to Runners::Mockable.
134
+ * lib/ruby_ex.rb: Add a missing `lib/'.
135
+ * lib/ordered_hash.rb: Now have a YamlExtension.
136
+ * lib/yaml/chop_header.rb: Typo on variable name.
137
+
138
+ 2005-09-24 Nicolas Pouillard <ertai@lrde.epita.fr>
139
+
140
+ Fix the Pipe support in Commands.
141
+
142
+ * lib/commands/pipe.rb: Reimplement.
143
+ * lib/commands/command.rb (sh_args): Generalize.
144
+ * lib/commands/datas/composite.rb: More methods to make it invisble.
145
+ * lib/commands/datas/data.rb: Some fixes.
146
+ * lib/commands/runners/mock.rb: Rename to ...
147
+ * lib/commands/runners/mockable.rb: ... this and make it a module.
148
+ * lib/commands/runners/runner.rb: Add Runner#initialize_copy.
149
+ * lib/commands.rb: Add a documention example.
150
+
151
+ 2005-09-24 Nicolas Pouillard <ertai@lrde.epita.fr>
152
+
153
+ [Hookable/Hooker] Support for hook disabling.
154
+
155
+ * lib/hookable.rb: Add Hookable#disable_hook and Hookable::disable_hook.
156
+
157
+ 2005-09-24 Nicolas Pouillard <ertai@lrde.epita.fr>
158
+
159
+ Fix a bug with checkout in URIs.
160
+
161
+ * lib/uri/ssh.rb, lib/uri/svn.rb: Also return the target.
162
+ * lib/uri_ex.rb: Use to yaml extensions.
163
+
164
+ 2005-09-24 Nicolas Pouillard <ertai@lrde.epita.fr>
165
+
166
+ Some portablity fixes.
167
+
168
+ * core_ex/Rakefile: More robust initialization.
169
+ * core_ex/lib/yaml_extension.rb: Better class conversion for the yaml
170
+ type, and suppress some Exceptions.
171
+ * core_ex/lib/core_ex/rakefile_base.rf: Use the !S:: Uttk style.
172
+ * core_ex/lib/core_ex/yaml.rb: Suppress some Exceptions, take care of
173
+ the emitter.
174
+ * core_ex/lib/core_ex.rb: Require 'English', load core_ex path.
175
+ * core_ex/lib/dumpable_proc.rb: Protect against code injection.
176
+ * core_ex/NEWS, core_ex/README: Typo.
177
+
1
178
  2005-09-16 Nicolas Pouillard <ertai@lrde.epita.fr>
2
179
 
3
180
  Bump RubyEx to 0.2.
data/NEWS CHANGED
@@ -1,14 +1,23 @@
1
- = New in 0.2, 2005-09-16:
1
+ = New in 0.3, 2005-10-03:
2
+
3
+ This release make RubyEx compatible with ruby 1.8.3!
4
+
5
+ * DiffTool:
6
+ Add DiffTool a module for the Diff manipulation.
7
+ * RegexList:
8
+ Add RegexList a class to handle sorting with regular expressions.
9
+ * Sendmail:
10
+ Add an header option to specify header fields on the fly.
2
11
 
3
- * Many many changes and new things for RubyEx.
12
+ = New in 0.2, 2005-09-16:
4
13
 
5
- * Remove many requires which are now useless, many are not yet
14
+ * Remove many requires which are now useless; many are not yet
6
15
  suppressed.
7
16
 
8
- * Renaming to follow the camelize/underscore convention.
17
+ * Rename classes and modules to follow the camelize/underscore convention.
9
18
 
10
19
  * Commands:
11
- Provides a object oriented way to manage, combine and run your commands.
20
+ Provides an object oriented way to manage, combine and run your commands.
12
21
 
13
22
  Example:
14
23
  require 'rubygems' ; require_gem 'ruby_ex' ; require 'ruby_ex'
@@ -21,13 +30,13 @@
21
30
  puts data.output.read
22
31
 
23
32
  (ls > STDOUT).system
24
-
33
+
25
34
  cmd = ls['*.rb'] | wc['-l'] > out
26
35
  cmd.system
27
36
 
28
37
  puts out.read
29
38
 
30
- * RPath: Add RPath, a basic (but powerful) way to search your ruby data.
39
+ * RPath: Add RPath, a simple way to search your ruby data.
31
40
 
32
41
  * BlankSlate, Mocks, VerboseObject, and AutoObject:
33
42
 
@@ -40,7 +49,7 @@
40
49
  - VerboseObject: Proxies that display received method calls and verbosify
41
50
  objects recursivly.
42
51
  - AutoObject: It's like a verbose object without a real object inside.
43
-
52
+
44
53
  * Text:
45
54
  A little text manipulation class.
46
55
  Transformation available are:
@@ -57,19 +66,19 @@
57
66
  - Add many unit tests.
58
67
  - Add gem filetype support (with the install method).
59
68
 
60
- * MetaFactory: A class that help to produce objects that
69
+ * MetaFactory: A class that help to produce objects which
61
70
  share the same initializion step.
62
71
 
63
72
  * Html encode: Support accent encoding for the iso latin1 charset.
64
73
 
65
- * URI: Support for Mysql and Pgsql.
74
+ * URI: Support for MySQL and PgSQL.
66
75
 
67
76
  * HashEval:
68
77
  Provides a block in which methods name are keys and arguments/blocks
69
78
  are values.
70
79
 
71
80
  * SymTbl (Symbol Table):
72
- Add symtbl_gsub methods to provide a global substitution sheme over any
81
+ Add symtbl_gsub methods which provide a global substitution sheme over any
73
82
  objects.
74
83
 
75
84
  = New in 0.1, 2005-05-31:
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:OpenStruct
2
2
  table:
3
3
  :version_id: ''
4
- :url: svn://svn.feydakins.org/ruby_ex/trunk
4
+ :date: "Mon, 03 Oct 2005"
5
5
  :version: !ruby/object:Version
6
6
  build: 0
7
7
  major: 0
8
- minor: 2
9
- revision: 360
10
- :date: "Fri, 16 Sep 2005"
8
+ minor: 3
9
+ revision: 390
10
+ :url: svn://svn.feydakins.org/ruby_ex/trunk
@@ -1,14 +1,14 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{ruby_ex}
3
- s.version = "0.2.0"
4
- s.date = %q{2005-09-16}
3
+ s.version = "0.3.0"
4
+ s.date = %q{2005-10-03}
5
5
  s.summary = %q{RubyEx contains general purpose Ruby extensions.}
6
6
  s.email = ["nicolas.despres@gmail.com", "ertai@feydakins.org"]
7
7
  s.homepage = %q{http://api.feydakins.org/ruby_ex}
8
8
  s.rubyforge_project = %q{ruby_ex}
9
9
  s.description = %q{}
10
10
  s.authors = ["Nicolas Despr\350s", "Nicolas Pouillard"]
11
- s.files = ["lib/abstract.rb", "lib/abstract_node.rb", "lib/attributed_class.rb", "lib/auto_object.rb", "lib/blank_slate.rb", "lib/cache.rb", "lib/choose.rb", "lib/commands.rb", "lib/config_file.rb", "lib/const_regexp.rb", "lib/d_logger.rb", "lib/daemon.rb", "lib/diff.rb", "lib/drb_ex.rb", "lib/file_type.rb", "lib/generate_id.rb", "lib/genpasswd.rb", "lib/hash_eval.rb", "lib/histogram.rb", "lib/hookable.rb", "lib/hooker.rb", "lib/html_encode.rb", "lib/indexed_node.rb", "lib/io_marshal.rb", "lib/ioo.rb", "lib/kill_all.rb", "lib/labeled_node.rb", "lib/logger_observer.rb", "lib/md5sum.rb", "lib/meta_factory.rb", "lib/method_call.rb", "lib/mocks.rb", "lib/node.rb", "lib/object_monitor.rb", "lib/object_monitor_activity.rb", "lib/observable.rb", "lib/observable_pool.rb", "lib/ordered_hash.rb", "lib/pp_hierarchy.rb", "lib/r_path.rb", "lib/random_generators.rb", "lib/regex_path.rb", "lib/ruby_ex.rb", "lib/safe_eval.rb", "lib/sendmail.rb", "lib/service_manager.rb", "lib/shuffle.rb", "lib/spring.rb", "lib/spring_set.rb", "lib/sym_tbl.rb", "lib/sym_tbl_gsub.rb", "lib/syn_flow.rb", "lib/text.rb", "lib/timeout_ex.rb", "lib/trace.rb", "lib/uri_ex.rb", "lib/verbose_object.rb", "lib/algorithms/simulated_annealing.rb", "lib/commands/command.rb", "lib/commands/datas.rb", "lib/commands/factory.rb", "lib/commands/helpers.rb", "lib/commands/pipe.rb", "lib/commands/runners.rb", "lib/commands/seq.rb", "lib/commands/datas/composite.rb", "lib/commands/datas/data.rb", "lib/commands/datas/factory.rb", "lib/commands/datas/temp.rb", "lib/commands/runners/exec.rb", "lib/commands/runners/fork.rb", "lib/commands/runners/mock.rb", "lib/commands/runners/runner.rb", "lib/commands/runners/system.rb", "lib/drb/drb_observable.rb", "lib/drb/drb_observable_pool.rb", "lib/drb/drb_service.rb", "lib/drb/drb_undumped_attributes.rb", "lib/drb/drb_undumped_indexed_object.rb", "lib/drb/insecure_protected_methods.rb", "lib/mocks/assertions.rb", "lib/mocks/method_logger.rb", "lib/mocks/mock.rb", "lib/mocks/object.rb", "lib/mocks/observer.rb", "lib/module/autoload_tree.rb", "lib/module/hierarchy.rb", "lib/module/instance_method_visibility.rb", "lib/random_generators/random_generator.rb", "lib/random_generators/ruby.rb", "lib/uri/druby.rb", "lib/uri/file.rb", "lib/uri/ftp_ex.rb", "lib/uri/http_ex.rb", "lib/uri/mysql.rb", "lib/uri/pgsql.rb", "lib/uri/ssh.rb", "lib/uri/svn.rb", "lib/yaml/chop_header.rb", "lib/yaml/transform.rb", "lib/yaml/yregexpath.rb", "test/algorithms", "test/check-pkg-ruby_ex.yml", "test/check-ruby_ex.yml", "test/resources", "test/sanity", "test/sanity-suite.yml", "test/stress-tests", "test/test-unit-setup.rb", "test/unit-suite.yml", "test/algorithms/simulated_annealing_test.rb", "test/resources/autoload_tree", "test/resources/foo.tar.gz", "test/resources/foo.txt", "test/resources/tar.gz.log", "test/resources/autoload_tree/A.rb", "test/resources/autoload_tree/B.rb", "test/resources/autoload_tree/foo", "test/resources/autoload_tree/foo/C.rb", "test/sanity/multiple-requires.yml", "test/sanity/single-requires.yml", "test/stress-tests/threads_and_exceptions.yml", "AUTHORS", "ChangeLog", "NEWS", "Rakefile", "README", "SPEC.dyn.yml", "SPEC.gemspec", "SPEC.yml"]
11
+ s.files = ["lib/abstract.rb", "lib/abstract_node.rb", "lib/attributed_class.rb", "lib/auto_object.rb", "lib/blank_slate.rb", "lib/cache.rb", "lib/choose.rb", "lib/commands.rb", "lib/config_file.rb", "lib/const_regexp.rb", "lib/d_logger.rb", "lib/daemon.rb", "lib/diff.rb", "lib/diff_tools.rb", "lib/drb_ex.rb", "lib/file_type.rb", "lib/generate_id.rb", "lib/genpasswd.rb", "lib/hash_eval.rb", "lib/histogram.rb", "lib/hookable.rb", "lib/hooker.rb", "lib/html_encode.rb", "lib/indexed_node.rb", "lib/io_marshal.rb", "lib/ioo.rb", "lib/kill_all.rb", "lib/labeled_node.rb", "lib/logger_observer.rb", "lib/md5sum.rb", "lib/meta_factory.rb", "lib/method_call.rb", "lib/mocks.rb", "lib/node.rb", "lib/object_monitor.rb", "lib/object_monitor_activity.rb", "lib/observable.rb", "lib/observable_pool.rb", "lib/ordered_hash.rb", "lib/pp_hierarchy.rb", "lib/r_path.rb", "lib/random_generators.rb", "lib/regex_list.rb", "lib/regex_path.rb", "lib/ruby_ex.rb", "lib/safe_eval.rb", "lib/sendmail.rb", "lib/service_manager.rb", "lib/shuffle.rb", "lib/spring.rb", "lib/spring_set.rb", "lib/sym_tbl.rb", "lib/sym_tbl_gsub.rb", "lib/syn_flow.rb", "lib/text.rb", "lib/timeout_ex.rb", "lib/trace.rb", "lib/uri_ex.rb", "lib/verbose_object.rb", "lib/algorithms/simulated_annealing.rb", "lib/commands/command.rb", "lib/commands/datas.rb", "lib/commands/factory.rb", "lib/commands/helpers.rb", "lib/commands/pipe.rb", "lib/commands/runners.rb", "lib/commands/seq.rb", "lib/commands/datas/composite.rb", "lib/commands/datas/data.rb", "lib/commands/datas/factory.rb", "lib/commands/datas/temp.rb", "lib/commands/runners/exec.rb", "lib/commands/runners/fork.rb", "lib/commands/runners/mockable.rb", "lib/commands/runners/runner.rb", "lib/commands/runners/system.rb", "lib/drb/drb_observable.rb", "lib/drb/drb_observable_pool.rb", "lib/drb/drb_service.rb", "lib/drb/drb_undumped_attributes.rb", "lib/drb/drb_undumped_indexed_object.rb", "lib/drb/insecure_protected_methods.rb", "lib/mocks/assertions.rb", "lib/mocks/method_logger.rb", "lib/mocks/mock.rb", "lib/mocks/object.rb", "lib/mocks/observer.rb", "lib/module/autoload_tree.rb", "lib/module/hierarchy.rb", "lib/module/instance_method_visibility.rb", "lib/random_generators/random_generator.rb", "lib/random_generators/ruby.rb", "lib/uri/druby.rb", "lib/uri/file.rb", "lib/uri/ftp_ex.rb", "lib/uri/http_ex.rb", "lib/uri/mysql.rb", "lib/uri/pgsql.rb", "lib/uri/ssh.rb", "lib/uri/svn.rb", "lib/yaml/chop_header.rb", "lib/yaml/transform.rb", "lib/yaml/yregexpath.rb", "test/algorithms", "test/check-pkg-ruby_ex.yml", "test/check-ruby_ex.yml", "test/fixtures", "test/functional", "test/sanity", "test/sanity-suite.yml", "test/stress-tests", "test/test-unit-setup.rb", "test/unit-suite.yml", "test/algorithms/simulated_annealing_test.rb", "test/fixtures/autoload_tree", "test/fixtures/foo.bz2", "test/fixtures/foo.gz.zip", "test/fixtures/foo.rb.gz", "test/fixtures/foo.tar", "test/fixtures/foo.tar.bz2", "test/fixtures/foo.tar.gz", "test/fixtures/foo.txt", "test/fixtures/my_diff.patch", "test/fixtures/tar.gz.log", "test/fixtures/autoload_tree/A.rb", "test/fixtures/autoload_tree/B.rb", "test/fixtures/autoload_tree/foo", "test/fixtures/autoload_tree/foo/C.rb", "test/sanity/multiple-requires.yml", "test/sanity/single-requires.yml", "test/stress-tests/threads_and_exceptions.yml", "AUTHORS", "ChangeLog", "NEWS", "Rakefile", "README", "SPEC.dyn.yml", "SPEC.gemspec", "SPEC.yml"]
12
12
  s.add_dependency(%q<highline>, ["~> 1.0.1"])
13
- s.add_dependency(%q<core_ex>, ["~> 0.3.1"])
13
+ s.add_dependency(%q<core_ex>, ["~> 0.4.0"])
14
14
  end
data/SPEC.yml CHANGED
@@ -30,7 +30,10 @@ pkg_files: !filelist
30
30
  - '[A-Z]*'
31
31
 
32
32
  dependencies:
33
- core_ex: [~> 0.3.1, 6077/core_ex-0.3.1.tar.gz]
33
+ core_ex:
34
+ gem: ~> 0.4.0
35
+ tarball: 6312/core_ex-0.4.0.tar.gz
36
+ vcs: svn://svn.feydakins.org/ruby_ex/trunk/core_ex
34
37
  highline: [~> 1.0.1, 5143/highline-1.0.1.tgz]
35
38
 
36
39
  ttk_version: ~> 0.3.0
@@ -3,7 +3,7 @@
3
3
  # License: Gnu General Public License.
4
4
 
5
5
  # $LastChangedBy: ertai $
6
- # $Id: cache.rb 339 2005-09-06 23:27:27Z ertai $
6
+ # $Id: cache.rb 376 2005-09-29 21:46:32Z ertai $
7
7
 
8
8
 
9
9
  require 'md5sum'
@@ -215,7 +215,7 @@ class CacheTest < Test::Unit::TestCase
215
215
  assert(! cache.present?('foo'))
216
216
 
217
217
  # FIXME man printf + Tempfile + File::md5sum
218
- # resources/foo.txt + TempPath + Path#md5sum
218
+ # fixtures/foo.txt + TempPath + Path#md5sum
219
219
  tmp_file = Tempfile.new('cache')
220
220
  system("man printf > #{tmp_file.path} 2> /dev/null")
221
221
  md5 = File.md5sum(tmp_file.path)
@@ -1,7 +1,7 @@
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: commands.rb 343 2005-09-08 01:32:57Z ertai $
4
+ # Revision:: $Id: commands.rb 365 2005-09-24 17:24:01Z ertai $
5
5
 
6
6
  AutoloadTree.import!
7
7
  require 'abstract'
@@ -12,6 +12,24 @@ require 'commands/datas'
12
12
  require 'commands/runners'
13
13
 
14
14
 
15
+ # Provides an object oriented way to manage, combine and run your commands.
16
+ #
17
+ # Example:
18
+ # require 'rubygems' ; require_gem 'ruby_ex' ; require 'ruby_ex'
19
+ # Commands.import!
20
+ # ls, wc, out = 'ls'.to_cmd, 'wc'.to_cmd, 'out'.to_path
21
+ #
22
+ # data = ls.system # other runners exist (exec, fork, sh...)
23
+ #
24
+ # p data.status
25
+ # puts data.output.read
26
+ #
27
+ # (ls > STDOUT).system
28
+ #
29
+ # cmd = ls['*.rb'] | wc['-l'] > out
30
+ # cmd.system
31
+ #
32
+ # puts out.read
15
33
  module Commands
16
34
 
17
35
  autoloaded_module(__FILE__, false)
@@ -1,7 +1,7 @@
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: command.rb 341 2005-09-07 00:01:43Z ertai $
4
+ # Revision:: $Id: command.rb 365 2005-09-24 17:24:01Z ertai $
5
5
 
6
6
  require 'commands'
7
7
 
@@ -240,9 +240,9 @@ module Commands
240
240
 
241
241
  def sh_args
242
242
  args = ''
243
- args += " < #{@input.to_s.dump}" if @input
244
- args += " > #{@output.to_s.dump}" if @output
245
- args += " 2> #{@error.to_s.dump}" if @error
243
+ [ ['<', input], ['>', output], ['2>', error] ].each do |str, io|
244
+ args += " #{str} #{io.to_s.dump}" if io and not (io.respond_to? :pipe? and io.pipe?)
245
+ end
246
246
  args
247
247
  end
248
248
 
@@ -496,7 +496,7 @@ module Commands
496
496
  assert_equal('"cp" > "ya"', (@cp > 'ya').to_sh)
497
497
  @cat << 'foo > bar' << '< baz'
498
498
  assert_equal(
499
- '(("cat" "foo > bar" "< baz" < "yay") | ("cp" > "yoy"))',
499
+ '("cat" "foo > bar" "< baz" < "yay") | ("cp" > "yoy")',
500
500
  ((@cat | @cp) < 'yay' > 'yoy').to_sh)
501
501
  @wc.error = 'foo'
502
502
  assert_equal('"wc" 2> "foo"', @wc.to_sh)
@@ -1,7 +1,7 @@
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: composite.rb 358 2005-09-16 09:54:04Z ertai $
4
+ # Revision:: $Id: composite.rb 365 2005-09-24 17:24:01Z ertai $
5
5
 
6
6
  require 'commands'
7
7
 
@@ -11,13 +11,15 @@ module Commands
11
11
 
12
12
  class Composite < Data
13
13
 
14
- def initialize ( *cmd )
14
+ attr_accessor :contents
15
+
16
+ def initialize ( *contents )
15
17
  super()
16
- @commands = cmd.flatten
18
+ @contents = contents.flatten
17
19
  end
18
20
 
19
21
  def each ( &block )
20
- @commands.each(&block)
22
+ @contents.each(&block)
21
23
  end
22
24
 
23
25
  def waitpid
@@ -28,6 +30,26 @@ module Commands
28
30
  each { |x| x.kill(*a, &b) }
29
31
  end
30
32
 
33
+ def << ( data )
34
+ @contents << data
35
+ end
36
+
37
+ def status
38
+ @contents.last.status
39
+ end
40
+
41
+ def output
42
+ @contents.last.output
43
+ end
44
+
45
+ def error
46
+ @contents.last.error
47
+ end
48
+
49
+ def input
50
+ @contents.first.input
51
+ end
52
+
31
53
  end # class Composite
32
54
 
33
55
  end # module Datas
@@ -1,7 +1,7 @@
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: data.rb 360 2005-09-16 12:17:16Z ertai $
4
+ # Revision:: $Id: data.rb 365 2005-09-24 17:24:01Z ertai $
5
5
 
6
6
  require 'commands'
7
7
 
@@ -84,7 +84,7 @@ module Commands
84
84
  def output= ( anObject )
85
85
  if anObject.is_a? Pathname
86
86
  anObject = anObject.dup
87
- anObject.open_mode = @open_mode
87
+ anObject.open_mode = @open_mode
88
88
  end
89
89
  @output = anObject
90
90
  end
@@ -93,7 +93,7 @@ module Commands
93
93
  def error= ( anObject )
94
94
  if anObject.is_a? Pathname
95
95
  anObject = anObject.dup
96
- anObject.open_mode = @open_mode
96
+ anObject.open_mode = @open_mode
97
97
  end
98
98
  @error = anObject
99
99
  end
@@ -137,7 +137,8 @@ module Commands
137
137
 
138
138
  def clean
139
139
  kill
140
- [@input, @output, @error].each do |stream|
140
+ [input, output, error].each do |stream|
141
+ next if stream.nil? or stream.is_a? IO
141
142
  if stream.is_a? File
142
143
  stream.close
143
144
  stream = stream.path.to_path
@@ -150,7 +151,7 @@ module Commands
150
151
  end
151
152
 
152
153
  def self.clean_all
153
- @@datas.dup.each { |data| data.kill }
154
+ @@datas.dup.each { |data| data.clean }
154
155
  end
155
156
 
156
157
  at_exit { clean_all }