crystalizer 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. data/Changelog +27 -0
  2. data/README +79 -0
  3. data/Rakefile +24 -0
  4. data/TODO +14 -0
  5. data/VERSION +1 -0
  6. data/benchmarks/bench.rb +129 -0
  7. data/benchmarks/concretize_test.rb +26 -0
  8. data/benchmarks/extconf.rb +10 -0
  9. data/benchmarks/tak_rb.rb +7 -0
  10. data/benchmarks/tak_so.rb +7 -0
  11. data/benchmarks/tak_source.rb +16 -0
  12. data/bin/rb2cx +162 -0
  13. data/doc/eval2c.txt +246 -0
  14. data/doc/gen_html.rb +26 -0
  15. data/doc/html_template +10 -0
  16. data/doc/index.txt +169 -0
  17. data/doc/limitations.txt +529 -0
  18. data/doc/optimizations.txt +185 -0
  19. data/doc/rb2cx.txt +130 -0
  20. data/doc/style.css +27 -0
  21. data/lib/concretizer.rb +3 -0
  22. data/lib/ruby2cext/c_function.rb +617 -0
  23. data/lib/ruby2cext/common_node_comp.rb +1412 -0
  24. data/lib/ruby2cext/compiler.rb +311 -0
  25. data/lib/ruby2cext/concretize.rb +269 -0
  26. data/lib/ruby2cext/error.rb +15 -0
  27. data/lib/ruby2cext/eval2c.rb +126 -0
  28. data/lib/ruby2cext/parser.rb +36 -0
  29. data/lib/ruby2cext/plugin.rb +24 -0
  30. data/lib/ruby2cext/plugins/builtin_methods.rb +817 -0
  31. data/lib/ruby2cext/plugins/cache_call.rb +293 -0
  32. data/lib/ruby2cext/plugins/case_optimize.rb +102 -0
  33. data/lib/ruby2cext/plugins/const_cache.rb +36 -0
  34. data/lib/ruby2cext/plugins/direct_self_call.rb +70 -0
  35. data/lib/ruby2cext/plugins/inline_builtin.rb +797 -0
  36. data/lib/ruby2cext/plugins/inline_methods.rb +68 -0
  37. data/lib/ruby2cext/plugins/ivar_cache.rb +147 -0
  38. data/lib/ruby2cext/plugins/require_include.rb +69 -0
  39. data/lib/ruby2cext/plugins/util.rb +154 -0
  40. data/lib/ruby2cext/plugins/warnings.rb +121 -0
  41. data/lib/ruby2cext/scopes.rb +225 -0
  42. data/lib/ruby2cext/str_to_c_strlit.rb +12 -0
  43. data/lib/ruby2cext/tools.rb +80 -0
  44. data/lib/ruby2cext/version.rb +22 -0
  45. data/results +68 -0
  46. data/setup.rb +1585 -0
  47. data/stuff/builtin_methods.rb +69 -0
  48. data/stuff/builtin_methods_test.rb +37 -0
  49. data/test/bootstrap.rb +10 -0
  50. data/test/causes_crash_all_opts.rb +1165 -0
  51. data/test/eval2c/test_eval2c.rb +37 -0
  52. data/test/temp_17.rb +16 -0
  53. data/test/temp_18.rb +8 -0
  54. data/test/temp_19.rb +8 -0
  55. data/test/temp_2.rb +7 -0
  56. data/test/temp_20.rb +5 -0
  57. data/test/temp_21.rb +161 -0
  58. data/test/temp_22.rb +7 -0
  59. data/test/temp_23.rb +7 -0
  60. data/test/temp_24.rb +219 -0
  61. data/test/temp_25.rb +7 -0
  62. data/test/temp_26.rb +11 -0
  63. data/test/temp_27.rb +11 -0
  64. data/test/temp_28.rb +9 -0
  65. data/test/temp_29.rb +9 -0
  66. data/test/temp_3.rb +0 -0
  67. data/test/temp_30.rb +0 -0
  68. data/test/temp_31.rb +10 -0
  69. data/test/temp_32.rb +10 -0
  70. data/test/temp_33.rb +15 -0
  71. data/test/temp_34.rb +15 -0
  72. data/test/temp_35.rb +7 -0
  73. data/test/temp_36.rb +7 -0
  74. data/test/temp_37.rb +10 -0
  75. data/test/temp_38.rb +10 -0
  76. data/test/temp_39.rb +0 -0
  77. data/test/temp_4.rb +7 -0
  78. data/test/temp_40.rb +50 -0
  79. data/test/temp_41.rb +50 -0
  80. data/test/temp_42.rb +8 -0
  81. data/test/temp_43.rb +8 -0
  82. data/test/temp_44.rb +0 -0
  83. data/test/temp_48.rb +7 -0
  84. data/test/temp_49.rb +7 -0
  85. data/test/temp_5.rb +7 -0
  86. data/test/temp_59.rb +7 -0
  87. data/test/temp_6.rb +7 -0
  88. data/test/temp_60.rb +7 -0
  89. data/test/temp_68.rb +239 -0
  90. data/test/temp_7.rb +7 -0
  91. data/test/temp_70.rb +7 -0
  92. data/test/temp_71.rb +7 -0
  93. data/test/temp_72.rb +13 -0
  94. data/test/temp_73.rb +7 -0
  95. data/test/temp_74.rb +7 -0
  96. data/test/temp_76.rb +7 -0
  97. data/test/temp_77.rb +13 -0
  98. data/test/temp_79.rb +7 -0
  99. data/test/temp_8.rb +14 -0
  100. data/test/temp_81.rb +14 -0
  101. data/test/temp_83.rb +0 -0
  102. data/test/temp_84.rb +7 -0
  103. data/test/temp_85.rb +7 -0
  104. data/test/temp_86.rb +14 -0
  105. data/test/temp_87.rb +7 -0
  106. data/test/temp_88.rb +7 -0
  107. data/test/temp_89.rb +7 -0
  108. data/test/temp_9.rb +14 -0
  109. data/test/temp_90.rb +0 -0
  110. data/test/temp_91.rb +7 -0
  111. data/test/temp_92.rb +7 -0
  112. data/test/temp_93.rb +7 -0
  113. data/test/temp_94.rb +7 -0
  114. data/test/temp_95.rb +7 -0
  115. data/test/temp_96.rb +0 -0
  116. data/test/temp_97.rb +0 -0
  117. data/test/temp_98.rb +7 -0
  118. data/test/temp_99.rb +7 -0
  119. data/test/test_concretize.rb +132 -0
  120. data/test/test_concretize_all.rb +15 -0
  121. data/test/test_crystalize_block.rb +73 -0
  122. data/test/test_files/test.rb +615 -0
  123. data/test/test_files/vmode_test.rb +73 -0
  124. data/test/test_files/warn_test.rb +35 -0
  125. data/test/test_syntax.rb +25 -0
  126. metadata +268 -0
@@ -0,0 +1,7 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:36 -0700 2009
2
+ class Object
3
+ public
4
+ def assert(should_be_true, string = nil)
5
+ raise("assertion failed #{string}") unless should_be_true
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:37 -0700 2009
2
+ class Object
3
+ public
4
+ def to_yaml(opts = { })
5
+ YAML.quick_emit(self, opts) do |out|
6
+ out.map(taguri, to_yaml_style) do |map|
7
+ to_yaml_properties.each { |m| map.add(m[(1..-1)], instance_variable_get(m)) }
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:37 -0700 2009
2
+ class Object
3
+ public
4
+ def to_yaml(opts = { })
5
+ YAML.quick_emit(self, opts) do |out|
6
+ out.map(taguri, to_yaml_style) do |map|
7
+ to_yaml_properties.each { |m| map.add(m[(1..-1)], instance_variable_get(m)) }
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:37 -0700 2009
2
+ class Object
3
+ public
4
+ def singleton_class
5
+ class << self
6
+ self
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:37 -0700 2009
2
+ class Object
3
+ public
4
+ def singleton_class
5
+ class << self
6
+ self
7
+ end
8
+ end
9
+ end
File without changes
File without changes
@@ -0,0 +1,10 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:39 -0700 2009
2
+ module PP::ObjectMixin
3
+ public
4
+ def pretty_print_cycle(q)
5
+ q.object_address_group(self) do
6
+ q.breakable
7
+ q.text("...")
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:39 -0700 2009
2
+ module PP::ObjectMixin
3
+ public
4
+ def pretty_print_cycle(q)
5
+ q.object_address_group(self) do
6
+ q.breakable
7
+ q.text("...")
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:39 -0700 2009
2
+ module PP::ObjectMixin
3
+ public
4
+ def pretty_print(q)
5
+ if /\(Kernel\)#/ =~ method(:inspect).inspect then
6
+ if ((not /\(Kernel\)#/ =~ method(:to_s).inspect) and instance_variables.empty?) then
7
+ q.text(self.to_s)
8
+ else
9
+ q.pp_object(self)
10
+ end
11
+ else
12
+ q.text(self.inspect)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:39 -0700 2009
2
+ module PP::ObjectMixin
3
+ public
4
+ def pretty_print(q)
5
+ if /\(Kernel\)#/ =~ method(:inspect).inspect then
6
+ if ((not /\(Kernel\)#/ =~ method(:to_s).inspect) and instance_variables.empty?) then
7
+ q.text(self.to_s)
8
+ else
9
+ q.pp_object(self)
10
+ end
11
+ else
12
+ q.text(self.inspect)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:40 -0700 2009
2
+ module PP::ObjectMixin
3
+ public
4
+ def pretty_print_instance_variables
5
+ instance_variables.sort
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:40 -0700 2009
2
+ module PP::ObjectMixin
3
+ public
4
+ def pretty_print_instance_variables
5
+ instance_variables.sort
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:41 -0700 2009
2
+ module PP::ObjectMixin
3
+ public
4
+ def pretty_print_inspect
5
+ if /\(PP::ObjectMixin\)#/ =~ method(:pretty_print).inspect then
6
+ raise("pretty_print is not overridden for #{self.class}")
7
+ end
8
+ PP.singleline_pp(self, "")
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:41 -0700 2009
2
+ module PP::ObjectMixin
3
+ public
4
+ def pretty_print_inspect
5
+ if /\(PP::ObjectMixin\)#/ =~ method(:pretty_print).inspect then
6
+ raise("pretty_print is not overridden for #{self.class}")
7
+ end
8
+ PP.singleline_pp(self, "")
9
+ end
10
+ end
File without changes
@@ -0,0 +1,7 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:10:58 -0700 2009
2
+ class Object
3
+ public
4
+ def in?(collection)
5
+ collection.include?(self)
6
+ end
7
+ end
@@ -0,0 +1,50 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:42 -0700 2009
2
+ module RequireAll
3
+ public
4
+ def require_all(*args)
5
+ args = args.flatten
6
+ if (args.size > 1) then
7
+ files = args
8
+ else
9
+ arg = args.first
10
+ begin
11
+ (stat = File.stat(arg)
12
+ if stat.file? then
13
+ files = [arg]
14
+ else
15
+ if stat.directory? then
16
+ files = Dir.glob(File.join(arg, "**", "*.rb"))
17
+ else
18
+ raise(ArgumentError, "#{arg} isn't a file or directory")
19
+ end
20
+ end)
21
+ rescue Errno::ENOENT
22
+ files = Dir.glob(arg)
23
+ if File.file?((arg + ".rb")) then
24
+ require((arg + ".rb"))
25
+ return true
26
+ end
27
+ raise(LoadError, "no such file to load -- #{arg}") if files.empty?
28
+ end
29
+ end
30
+ files.map! { |file| File.expand_path(file) }
31
+ begin
32
+ (failed = []
33
+ first_name_error = nil
34
+ files.each do |file|
35
+ begin
36
+ require(file)
37
+ rescue NameError => ex
38
+ (failed << file)
39
+ first_name_error ||= ex
40
+ rescue ArgumentError => ex
41
+ raise unless ex.message["is not missing constant"]
42
+ STDERR.puts("Warning: require_all swallowed ActiveSupport 'is not missing constant' error")
43
+ STDERR.puts(ex.backtrace[(0..9)])
44
+ end
45
+ end
46
+ (failed.size == files.size) ? (raise(first_name_error)) : (files = failed))
47
+ end until failed.empty?
48
+ true
49
+ end
50
+ end
@@ -0,0 +1,50 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:42 -0700 2009
2
+ module RequireAll
3
+ public
4
+ def require_all(*args)
5
+ args = args.flatten
6
+ if (args.size > 1) then
7
+ files = args
8
+ else
9
+ arg = args.first
10
+ begin
11
+ (stat = File.stat(arg)
12
+ if stat.file? then
13
+ files = [arg]
14
+ else
15
+ if stat.directory? then
16
+ files = Dir.glob(File.join(arg, "**", "*.rb"))
17
+ else
18
+ raise(ArgumentError, "#{arg} isn't a file or directory")
19
+ end
20
+ end)
21
+ rescue Errno::ENOENT
22
+ files = Dir.glob(arg)
23
+ if File.file?((arg + ".rb")) then
24
+ require((arg + ".rb"))
25
+ return true
26
+ end
27
+ raise(LoadError, "no such file to load -- #{arg}") if files.empty?
28
+ end
29
+ end
30
+ files.map! { |file| File.expand_path(file) }
31
+ begin
32
+ (failed = []
33
+ first_name_error = nil
34
+ files.each do |file|
35
+ begin
36
+ require(file)
37
+ rescue NameError => ex
38
+ (failed << file)
39
+ first_name_error ||= ex
40
+ rescue ArgumentError => ex
41
+ raise unless ex.message["is not missing constant"]
42
+ STDERR.puts("Warning: require_all swallowed ActiveSupport 'is not missing constant' error")
43
+ STDERR.puts(ex.backtrace[(0..9)])
44
+ end
45
+ end
46
+ (failed.size == files.size) ? (raise(first_name_error)) : (files = failed))
47
+ end until failed.empty?
48
+ true
49
+ end
50
+ end
@@ -0,0 +1,8 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:43 -0700 2009
2
+ module RequireAll
3
+ public
4
+ def require_rel(path)
5
+ source_directory = File.dirname(caller.first.sub(/:\d+$/, ""))
6
+ require_all(File.join(source_directory, path))
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:43 -0700 2009
2
+ module RequireAll
3
+ public
4
+ def require_rel(path)
5
+ source_directory = File.dirname(caller.first.sub(/:\d+$/, ""))
6
+ require_all(File.join(source_directory, path))
7
+ end
8
+ end
File without changes
@@ -0,0 +1,7 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 13:59:15 -0700 2009
2
+ module Kernel
3
+ public
4
+ def pretty_inspect
5
+ PP.pp(self, "")
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 13:59:15 -0700 2009
2
+ module Kernel
3
+ public
4
+ def pretty_inspect
5
+ PP.pp(self, "")
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:10:58 -0700 2009
2
+ class Object
3
+ public
4
+ def in?(collection)
5
+ collection.include?(self)
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:45 -0700 2009
2
+ module Kernel
3
+ public
4
+ def pretty_inspect
5
+ PP.pp(self, "")
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:10:59 -0700 2009
2
+ class Object
3
+ public
4
+ def to_yaml_style
5
+ # do nothing
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:03:45 -0700 2009
2
+ module Kernel
3
+ public
4
+ def pretty_inspect
5
+ PP.pp(self, "")
6
+ end
7
+ end
@@ -0,0 +1,239 @@
1
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:29 -0700 2009
2
+ class F < Object
3
+ public
4
+ def go
5
+ # do nothing
6
+ end
7
+ end
8
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:29 -0700 2009
9
+ class Object
10
+ public
11
+ def in?(collection)
12
+ collection.include?(self)
13
+ end
14
+ end
15
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:29 -0700 2009
16
+ class Object
17
+ public
18
+ def to_yaml_style
19
+ # do nothing
20
+ end
21
+ end
22
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:29 -0700 2009
23
+ class Object
24
+ public
25
+ def _dbg
26
+ require("rubygems")
27
+ require("pp")
28
+ begin
29
+ (require("ruby-debug")
30
+ debugger)
31
+ rescue LoadError => e
32
+ throw("unable to load ruby-debug gem for _dbg... #{e}")
33
+ end
34
+ end
35
+ end
36
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:29 -0700 2009
37
+ class Object
38
+ public
39
+ def to_yaml_properties
40
+ instance_variables.sort
41
+ end
42
+ end
43
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:29 -0700 2009
44
+ class Object
45
+ public
46
+ def deep_clone
47
+ Marshal.load(Marshal.dump(self))
48
+ end
49
+ end
50
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:29 -0700 2009
51
+ class Object
52
+ public
53
+ def aliash(hash)
54
+ hash.each_pair { |new, old| alias_method(new, old) }
55
+ end
56
+ end
57
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:29 -0700 2009
58
+ class Object
59
+ public
60
+ def taguri
61
+ if respond_to?(:to_yaml_type) then
62
+ YAML.tagurize(to_yaml_type[(1..-1)])
63
+ else
64
+ return @taguri if (defined? @taguri and @taguri)
65
+ tag = "tag:ruby.yaml.org,2002:object"
66
+ if (self.class.yaml_tag_subclasses? and (not (self.class == YAML.tagged_classes[tag]))) then
67
+ tag = "#{tag}:#{self.class.yaml_tag_class_name}"
68
+ end
69
+ tag
70
+ end
71
+ end
72
+ end
73
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:29 -0700 2009
74
+ class Object
75
+ public
76
+ def sprint(*args)
77
+ print(*args)
78
+ puts
79
+ end
80
+ end
81
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:29 -0700 2009
82
+ class Object
83
+ public
84
+ attr_writer :taguri
85
+ end
86
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:29 -0700 2009
87
+ class Object
88
+ public
89
+ def concretize_ruby!
90
+ Ruby2CExtension::Concretize.concretize_all!
91
+ end
92
+ end
93
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:29 -0700 2009
94
+ class Object
95
+ public
96
+ def assert(should_be_true, string = nil)
97
+ raise("assertion failed #{string}") unless should_be_true
98
+ end
99
+ end
100
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:29 -0700 2009
101
+ class Object
102
+ public
103
+ def to_yaml(opts = { })
104
+ YAML.quick_emit(self, opts) do |out|
105
+ out.map(taguri, to_yaml_style) do |map|
106
+ to_yaml_properties.each { |m| map.add(m[(1..-1)], instance_variable_get(m)) }
107
+ end
108
+ end
109
+ end
110
+ end
111
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:29 -0700 2009
112
+ class Object
113
+ public
114
+ def singleton_class
115
+ class << self
116
+ self
117
+ end
118
+ end
119
+ end
120
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:30 -0700 2009
121
+ module PP::ObjectMixin
122
+ public
123
+ def pretty_print_cycle(q)
124
+ q.object_address_group(self) do
125
+ q.breakable
126
+ q.text("...")
127
+ end
128
+ end
129
+ end
130
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:30 -0700 2009
131
+ module PP::ObjectMixin
132
+ public
133
+ def pretty_print(q)
134
+ if /\(Kernel\)#/ =~ method(:inspect).inspect then
135
+ if ((not /\(Kernel\)#/ =~ method(:to_s).inspect) and instance_variables.empty?) then
136
+ q.text(self.to_s)
137
+ else
138
+ q.pp_object(self)
139
+ end
140
+ else
141
+ q.text(self.inspect)
142
+ end
143
+ end
144
+ end
145
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:30 -0700 2009
146
+ module PP::ObjectMixin
147
+ public
148
+ def pretty_print_instance_variables
149
+ instance_variables.sort
150
+ end
151
+ end
152
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:30 -0700 2009
153
+ module PP::ObjectMixin
154
+ public
155
+ def pretty_print_inspect
156
+ if /\(PP::ObjectMixin\)#/ =~ method(:pretty_print).inspect then
157
+ raise("pretty_print is not overridden for #{self.class}")
158
+ end
159
+ PP.singleline_pp(self, "")
160
+ end
161
+ end
162
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:32 -0700 2009
163
+ module RequireAll
164
+ public
165
+ def require_all(*args)
166
+ args = args.flatten
167
+ if (args.size > 1) then
168
+ files = args
169
+ else
170
+ arg = args.first
171
+ begin
172
+ (stat = File.stat(arg)
173
+ if stat.file? then
174
+ files = [arg]
175
+ else
176
+ if stat.directory? then
177
+ files = Dir.glob(File.join(arg, "**", "*.rb"))
178
+ else
179
+ raise(ArgumentError, "#{arg} isn't a file or directory")
180
+ end
181
+ end)
182
+ rescue Errno::ENOENT
183
+ files = Dir.glob(arg)
184
+ if File.file?((arg + ".rb")) then
185
+ require((arg + ".rb"))
186
+ return true
187
+ end
188
+ raise(LoadError, "no such file to load -- #{arg}") if files.empty?
189
+ end
190
+ end
191
+ files.map! { |file| File.expand_path(file) }
192
+ begin
193
+ (failed = []
194
+ first_name_error = nil
195
+ files.each do |file|
196
+ begin
197
+ require(file)
198
+ rescue NameError => ex
199
+ (failed << file)
200
+ first_name_error ||= ex
201
+ rescue ArgumentError => ex
202
+ raise unless ex.message["is not missing constant"]
203
+ STDERR.puts("Warning: require_all swallowed ActiveSupport 'is not missing constant' error")
204
+ STDERR.puts(ex.backtrace[(0..9)])
205
+ end
206
+ end
207
+ (failed.size == files.size) ? (raise(first_name_error)) : (files = failed))
208
+ end until failed.empty?
209
+ true
210
+ end
211
+ end
212
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:32 -0700 2009
213
+ module RequireAll
214
+ public
215
+ def require_rel(path)
216
+ source_directory = File.dirname(caller.first.sub(/:\d+$/, ""))
217
+ require_all(File.join(source_directory, path))
218
+ end
219
+ end
220
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:34 -0700 2009
221
+ module Kernel
222
+ public
223
+ def pretty_inspect
224
+ PP.pp(self, "")
225
+ end
226
+ end
227
+ # concretize temp file: autogenerated: Tue Nov 10 14:15:34 -0700 2009
228
+ module Kernel
229
+ public
230
+ def __DIR__
231
+ dir = if /^(.+)?:\d+/ =~ caller[0] then
232
+ File.expand_path(File.dirname($1), BASE_DIR)
233
+ else
234
+ nil
235
+ end
236
+ dir = (dir + "/") if dir
237
+ dir
238
+ end
239
+ end