utilrb 1.6.6 → 2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/Manifest.txt +10 -9
  2. data/README.rd +23 -0
  3. data/Rakefile +40 -37
  4. data/ext/utilrb/extconf.rb +36 -0
  5. data/ext/{proc.cc → utilrb/proc.c} +7 -6
  6. data/ext/utilrb/ruby_allocator.hh +76 -0
  7. data/ext/{ruby_internals-1.8.h → utilrb/ruby_internals-1.8.h} +0 -0
  8. data/ext/{ruby_internals-1.9.h → utilrb/ruby_internals-1.9.h} +0 -0
  9. data/ext/{swap.cc → utilrb/swap.cc} +0 -0
  10. data/ext/utilrb/utilrb.cc +79 -0
  11. data/ext/{value_set.cc → utilrb/value_set.cc} +5 -5
  12. data/ext/{weakref.cc → utilrb/weakref.cc} +0 -0
  13. data/lib/utilrb/common.rb +7 -2
  14. data/lib/utilrb/doc/rake.rb +46 -15
  15. data/lib/utilrb/kernel/load_dsl_file.rb +2 -2
  16. data/lib/utilrb/kernel/options.rb +6 -0
  17. data/lib/utilrb/logger/forward.rb +7 -0
  18. data/lib/utilrb/logger/hierarchy.rb +100 -42
  19. data/lib/utilrb/logger/indent.rb +38 -3
  20. data/lib/utilrb/logger/log_pp.rb +1 -1
  21. data/lib/utilrb/logger/root.rb +27 -12
  22. data/lib/utilrb/module/inherited_enumerable.rb +2 -196
  23. data/lib/utilrb/objectstats.rb +4 -1
  24. data/lib/utilrb/pkgconfig.rb +42 -6
  25. data/lib/utilrb/rake_common.rb +12 -0
  26. data/lib/utilrb/ruby_object_graph.rb +195 -46
  27. data/lib/utilrb/yard.rb +89 -89
  28. data/test/test_array.rb +1 -1
  29. data/test/test_dir.rb +1 -1
  30. data/test/test_enumerable.rb +7 -1
  31. data/test/test_event_loop.rb +407 -0
  32. data/test/test_exception.rb +1 -1
  33. data/test/test_gc.rb +1 -1
  34. data/test/test_hash.rb +57 -1
  35. data/test/test_kernel.rb +52 -21
  36. data/test/test_logger.rb +150 -1
  37. data/test/test_misc.rb +1 -1
  38. data/test/test_models.rb +212 -0
  39. data/test/test_module.rb +41 -71
  40. data/test/test_object.rb +1 -1
  41. data/test/test_objectstats.rb +1 -1
  42. data/test/test_pkgconfig.rb +7 -5
  43. data/test/test_proc.rb +1 -1
  44. data/test/test_set.rb +1 -1
  45. data/test/test_thread_pool.rb +409 -0
  46. data/test/test_time.rb +6 -6
  47. data/test/test_unbound_method.rb +1 -1
  48. metadata +157 -131
  49. data/README.txt +0 -45
  50. data/ext/extconf.rb +0 -29
  51. data/ext/utilrb_ext.cc +0 -144
data/test/test_time.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'test_config'
1
+ require 'test/test_config'
2
2
  require 'utilrb/time'
3
3
 
4
4
  class TC_Time < Test::Unit::TestCase
@@ -6,8 +6,8 @@ class TC_Time < Test::Unit::TestCase
6
6
  assert_equal("0:00:00.000", Time.at(0).to_hms)
7
7
  assert_equal("0:00:00.100", Time.at(0.1).to_hms)
8
8
  assert_equal("0:00:34.100", Time.at(34.1).to_hms)
9
- assert_equal("0:21:34.100", Time.at(21 * 60 + 34.1).to_hms)
10
- assert_equal("236:21:34.100", Time.at(236 * 3600 + 21 * 60 + 34.1).to_hms)
9
+ assert("0:21:34.100" == Time.at(21 * 60 + 34, 100000).to_hms)
10
+ assert("236:21:34.100", Time.at(236 * 3600 + 21 * 60 + 34, 100000).to_hms)
11
11
  end
12
12
  def test_from_hms
13
13
  assert_equal([0, 0, 0, 1], Time.hms_decomposition('0:00:00.001'))
@@ -18,9 +18,9 @@ class TC_Time < Test::Unit::TestCase
18
18
  assert_equal([0, 0, 0, 100], Time.hms_decomposition('0:00:00.100'))
19
19
 
20
20
  assert_equal([0, 0, 0, 0], Time.hms_decomposition("0:00:00.000"))
21
- assert_equal(Time.at(34.1), Time.from_hms("0:00:34.100"))
22
- assert_equal(Time.at(21 * 60 + 34.1), Time.from_hms("0:21:34.100"))
23
- assert_equal(Time.at(236 * 3600 + 21 * 60 + 34.1), Time.from_hms("236:21:34.100"))
21
+ assert_equal(Time.at(34, 100000), Time.from_hms("0:00:34.100"))
22
+ assert_equal(Time.at(21 * 60 + 34, 100000), Time.from_hms("0:21:34.100"))
23
+ assert_equal(Time.at(236 * 3600 + 21 * 60 + 34, 100000), Time.from_hms("236:21:34.100"))
24
24
 
25
25
  assert_equal([329991, 0, 10, 0], Time.hms_decomposition("329991:00:10"))
26
26
  assert_equal([329991, 8, 8, 0], Time.hms_decomposition("329991:08:08"))
@@ -1,4 +1,4 @@
1
- require 'test_config'
1
+ require 'test/test_config'
2
2
  require 'utilrb/unbound_method'
3
3
  require 'flexmock'
4
4
 
metadata CHANGED
@@ -1,133 +1,159 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: utilrb
3
- version: !ruby/object:Gem::Version
4
- hash: 3
3
+ version: !ruby/object:Gem::Version
4
+ version: '2.0'
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 6
9
- - 6
10
- version: 1.6.6
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Sylvain Joyeux
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-09-18 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2013-09-19 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: facets
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 31
29
- segments:
30
- - 2
31
- - 4
32
- - 0
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
33
21
  version: 2.4.0
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 2.4.0
30
+ - !ruby/object:Gem::Dependency
37
31
  name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0.9'
38
+ type: :runtime
38
39
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
40
41
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 3
45
- segments:
46
- - 0
47
- version: "0"
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0.9'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake-compiler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 0.8.0
48
54
  type: :runtime
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: rdoc
52
55
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
54
57
  none: false
55
- requirements:
58
+ requirements:
56
59
  - - ~>
57
- - !ruby/object:Gem::Version
58
- hash: 19
59
- segments:
60
- - 3
61
- - 10
62
- version: "3.10"
63
- type: :development
64
- version_requirements: *id003
65
- - !ruby/object:Gem::Dependency
60
+ - !ruby/object:Gem::Version
61
+ version: 0.8.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: hoe-yard
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: 0.1.2
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 0.1.2
78
+ - !ruby/object:Gem::Dependency
66
79
  name: flexmock
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: 0.8.6
86
+ type: :development
67
87
  prerelease: false
68
- requirement: &id004 !ruby/object:Gem::Requirement
88
+ version_requirements: !ruby/object:Gem::Requirement
69
89
  none: false
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- hash: 51
74
- segments:
75
- - 0
76
- - 8
77
- - 6
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
78
93
  version: 0.8.6
94
+ - !ruby/object:Gem::Dependency
95
+ name: debugger-ruby_core_source
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
79
102
  type: :development
80
- version_requirements: *id004
81
- - !ruby/object:Gem::Dependency
82
- name: hoe
83
103
  prerelease: false
84
- requirement: &id005 !ruby/object:Gem::Requirement
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: hoe
112
+ requirement: !ruby/object:Gem::Requirement
85
113
  none: false
86
- requirements:
114
+ requirements:
87
115
  - - ~>
88
- - !ruby/object:Gem::Version
89
- hash: 7
90
- segments:
91
- - 3
92
- - 0
93
- version: "3.0"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.7'
94
118
  type: :development
95
- version_requirements: *id005
96
- description: |-
97
- This work is licensed under the BSD license. See License.txt for details
98
-
99
- == What is Utilrb ?
100
-
101
- Utilrb is yet another Ruby toolkit, in the spirit of facets. It includes all
102
- the standard class extensions I use in other projects.
103
- email:
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: '3.7'
126
+ description: ! 'Utilrb is yet another Ruby toolkit, in the spirit of facets. It includes
127
+ all
128
+
129
+ the standard class extensions I use in other projects.'
130
+ email:
104
131
  - sylvain.joyeux@m4x.org
105
132
  executables: []
106
-
107
- extensions:
108
- - ext/extconf.rb
109
- extra_rdoc_files:
133
+ extensions:
134
+ - ext/utilrb/extconf.rb
135
+ extra_rdoc_files:
110
136
  - History.txt
111
137
  - License.txt
112
138
  - Manifest.txt
113
- - README.txt
114
- files:
139
+ files:
115
140
  - .gemtest
116
141
  - History.txt
117
142
  - License.txt
118
143
  - Manifest.txt
119
- - README.txt
144
+ - README.rd
120
145
  - Rakefile
121
146
  - bm/allocation.rb
122
147
  - bm/speed.rb
123
- - ext/extconf.rb
124
- - ext/proc.cc
125
- - ext/ruby_internals-1.8.h
126
- - ext/ruby_internals-1.9.h
127
- - ext/swap.cc
128
- - ext/utilrb_ext.cc
129
- - ext/value_set.cc
130
- - ext/weakref.cc
148
+ - ext/utilrb/extconf.rb
149
+ - ext/utilrb/proc.c
150
+ - ext/utilrb/ruby_internals-1.8.h
151
+ - ext/utilrb/ruby_internals-1.9.h
152
+ - ext/utilrb/ruby_allocator.hh
153
+ - ext/utilrb/swap.cc
154
+ - ext/utilrb/utilrb.cc
155
+ - ext/utilrb/value_set.cc
156
+ - ext/utilrb/weakref.cc
131
157
  - lib/utilrb.rb
132
158
  - lib/utilrb/array.rb
133
159
  - lib/utilrb/array/to_s.rb
@@ -227,57 +253,57 @@ files:
227
253
  - test/test_time.rb
228
254
  - test/test_unbound_method.rb
229
255
  - test/test_weakref.rb
230
- homepage: http://utilrb.rubyforge.org
231
- licenses: []
232
-
256
+ - test/test_models.rb
257
+ - test/test_thread_pool.rb
258
+ - test/test_event_loop.rb
259
+ homepage: http://rock-robotics.org
260
+ licenses:
261
+ - BSD
233
262
  post_install_message:
234
- rdoc_options:
235
- - --main
236
- - README.txt
237
- require_paths:
263
+ rdoc_options:
264
+ - --title
265
+ - TestUtilrb Documentation
266
+ - --quiet
267
+ require_paths:
238
268
  - lib
239
- required_ruby_version: !ruby/object:Gem::Requirement
269
+ required_ruby_version: !ruby/object:Gem::Requirement
240
270
  none: false
241
- requirements:
242
- - - ">="
243
- - !ruby/object:Gem::Version
244
- hash: 3
245
- segments:
246
- - 0
247
- version: "0"
248
- required_rubygems_version: !ruby/object:Gem::Requirement
271
+ requirements:
272
+ - - ! '>='
273
+ - !ruby/object:Gem::Version
274
+ version: '0'
275
+ required_rubygems_version: !ruby/object:Gem::Requirement
249
276
  none: false
250
- requirements:
251
- - - ">="
252
- - !ruby/object:Gem::Version
253
- hash: 3
254
- segments:
255
- - 0
256
- version: "0"
277
+ requirements:
278
+ - - ! '>='
279
+ - !ruby/object:Gem::Version
280
+ version: '0'
257
281
  requirements: []
258
-
259
282
  rubyforge_project: utilrb
260
- rubygems_version: 1.8.15
283
+ rubygems_version: 1.8.23
261
284
  signing_key:
262
285
  specification_version: 3
263
- summary: Yet another Ruby toolkit
264
- test_files:
265
- - test/test_weakref.rb
286
+ summary: Utilrb is yet another Ruby toolkit, in the spirit of facets
287
+ test_files:
288
+ - test/test_models.rb
289
+ - test/test_kernel.rb
266
290
  - test/test_unbound_method.rb
267
- - test/test_enumerable.rb
291
+ - test/test_hash.rb
268
292
  - test/test_exception.rb
269
- - test/test_objectstats.rb
270
- - test/test_dir.rb
271
- - test/test_time.rb
272
- - test/test_misc.rb
273
- - test/test_set.rb
293
+ - test/test_thread_pool.rb
274
294
  - test/test_config.rb
295
+ - test/test_time.rb
296
+ - test/test_event_loop.rb
275
297
  - test/test_logger.rb
276
- - test/test_proc.rb
277
- - test/test_hash.rb
278
- - test/test_array.rb
279
- - test/test_object.rb
280
298
  - test/test_module.rb
281
- - test/test_kernel.rb
282
- - test/test_pkgconfig.rb
299
+ - test/test_objectstats.rb
300
+ - test/test_enumerable.rb
283
301
  - test/test_gc.rb
302
+ - test/test_misc.rb
303
+ - test/test_object.rb
304
+ - test/test_array.rb
305
+ - test/test_dir.rb
306
+ - test/test_weakref.rb
307
+ - test/test_proc.rb
308
+ - test/test_set.rb
309
+ - test/test_pkgconfig.rb
data/README.txt DELETED
@@ -1,45 +0,0 @@
1
- = Utilrb
2
- http://utilrb.rubyforge.org
3
- http://www.rubyforge.org/projects/utilrb
4
- http://github.com/doudou/util-rb (git repository)
5
-
6
- == License
7
-
8
- Copyright (c) 2006-2008
9
- Sylvain Joyeux <sylvain.joyeux@m4x.org>
10
- LAAS/CNRS <openrobots@laas.fr>
11
-
12
- This work is licensed under the BSD license. See License.txt for details
13
-
14
- == What is Utilrb ?
15
-
16
- Utilrb is yet another Ruby toolkit, in the spirit of facets. It includes all
17
- the standard class extensions I use in other projects.
18
-
19
- == Installation
20
-
21
- The only dependency Utilrb has is flexmock if you want to run tests. It is
22
- available as a gem, so you can run
23
-
24
- gem install flexmock
25
-
26
- == Utilrb's C extension
27
- Utilrb includes a C extension in ext/. It is optional, but some of the
28
- functionalities will be disabled if it is not present. Trying to require
29
- a file in which there is a C-only feature will yield a warning on STDOUT.
30
-
31
- * some features have a Ruby version, but a C version is provided for
32
- performance:
33
- - Enumerable#each_uniq
34
-
35
- * some features are C-only
36
- - ValueSet class
37
- - Kernel#swap!
38
-
39
- The environment variable <tt>UTILRB_FASTER_MODE</tt> controls the extension
40
- loading. Set it to +no+ to disable the extension, to +yes+ to force it
41
- (an error is generated if the extension is not available). If the variable
42
- is not set, the extension is loaded if available.
43
-
44
- == CHANGES
45
- :include: History.txt
data/ext/extconf.rb DELETED
@@ -1,29 +0,0 @@
1
- require 'mkmf'
2
-
3
- CONFIG['CC'] = "g++"
4
- if RUBY_VERSION >= "1.9"
5
- $CFLAGS += " -DRUBY_IS_19"
6
- end
7
-
8
- if ENV['RUBY_SOURCE_DIR']
9
- $CFLAGS += " -DHAS_RUBY_SOURCE -I#{ENV['RUBY_SOURCE_DIR']}"
10
- end
11
-
12
- if try_link("int main() { }", "-module")
13
- $LDFLAGS += " -module"
14
- end
15
- create_makefile("utilrb_ext")
16
-
17
- ## WORKAROUND a problem with mkmf.rb
18
- # It seems that the newest version do define an 'install' target. However, that
19
- # install target tries to install in the system directories
20
- #
21
- # The issue is that RubyGems *does* call make install. Ergo, gem install utilrb
22
- # is broken right now
23
- lines = File.readlines("Makefile")
24
- lines.delete_if { |l| l =~ /^install:/ }
25
- lines << "install:"
26
- File.open("Makefile", 'w') do |io|
27
- io.write lines.join("\n")
28
- end
29
-