libxml-ruby 0.5.4 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. data/LICENSE +23 -23
  2. data/README +144 -144
  3. data/ext/libxml/extconf.rb +26 -27
  4. data/ext/libxml/libxml.c +7 -37
  5. data/ext/libxml/{libxml.h → ruby_libxml.h} +93 -98
  6. data/ext/libxml/ruby_xml_attr.c +405 -387
  7. data/ext/libxml/ruby_xml_attr.h +19 -18
  8. data/ext/libxml/ruby_xml_document.c +1111 -1115
  9. data/ext/libxml/ruby_xml_document.h +27 -24
  10. data/ext/libxml/ruby_xml_dtd.c +168 -168
  11. data/ext/libxml/ruby_xml_html_parser.c +449 -450
  12. data/ext/libxml/ruby_xml_html_parser.h +1 -1
  13. data/ext/libxml/ruby_xml_input_cbg.c +158 -158
  14. data/ext/libxml/ruby_xml_node.c +2410 -2395
  15. data/ext/libxml/ruby_xml_node.h +1 -1
  16. data/ext/libxml/ruby_xml_node_set.c +170 -170
  17. data/ext/libxml/ruby_xml_node_set.h +1 -1
  18. data/ext/libxml/ruby_xml_ns.c +153 -153
  19. data/ext/libxml/ruby_xml_ns.h +1 -1
  20. data/ext/libxml/ruby_xml_parser.c +1425 -1422
  21. data/ext/libxml/ruby_xml_parser.h +1 -1
  22. data/ext/libxml/ruby_xml_parser_context.c +750 -716
  23. data/ext/libxml/ruby_xml_parser_context.h +1 -1
  24. data/ext/libxml/ruby_xml_reader.c +900 -896
  25. data/ext/libxml/ruby_xml_sax_parser.c +485 -485
  26. data/ext/libxml/ruby_xml_sax_parser.h +1 -1
  27. data/ext/libxml/ruby_xml_schema.c +146 -142
  28. data/ext/libxml/ruby_xml_state.c +5 -6
  29. data/ext/libxml/ruby_xml_state.h +1 -0
  30. data/ext/libxml/ruby_xml_tree.c +43 -43
  31. data/ext/libxml/ruby_xml_tree.h +1 -1
  32. data/ext/libxml/ruby_xml_xinclude.c +20 -20
  33. data/ext/libxml/ruby_xml_xinclude.h +1 -1
  34. data/ext/libxml/ruby_xml_xpath.c +243 -252
  35. data/ext/libxml/ruby_xml_xpath.h +1 -1
  36. data/ext/libxml/ruby_xml_xpath_context.c +118 -118
  37. data/ext/libxml/ruby_xml_xpath_context.h +1 -1
  38. data/ext/libxml/ruby_xml_xpath_object.c +43 -29
  39. data/ext/libxml/ruby_xml_xpath_object.h +0 -1
  40. data/ext/libxml/ruby_xml_xpointer.c +100 -100
  41. data/ext/libxml/ruby_xml_xpointer.h +1 -1
  42. data/ext/libxml/ruby_xml_xpointer_context.c +21 -21
  43. data/ext/libxml/ruby_xml_xpointer_context.h +1 -1
  44. data/ext/libxml/sax_parser_callbacks.inc +213 -213
  45. data/ext/libxml/version.h +9 -9
  46. data/lib/libxml.rb +24 -3
  47. data/mingw/libiconv-2.dll +0 -0
  48. data/mingw/libxml2-2.dll +0 -0
  49. data/mingw/libxml_ruby.so +0 -0
  50. data/mingw/mingw.rake +36 -0
  51. data/test/dtd-test.rb +24 -24
  52. data/test/etc_doc_to_s.rb +1 -3
  53. data/test/ets_copy_bug.rb +21 -21
  54. data/test/ets_copy_bug2.rb +32 -32
  55. data/test/ets_copy_bug3.rb +38 -0
  56. data/test/ets_doc_file.rb +1 -0
  57. data/test/{model/default_validation_bug.rb → gc.log} +0 -0
  58. data/test/merge_bug.rb +55 -55
  59. data/test/schema-test.rb +74 -74
  60. data/test/tc_well_formed.rb +11 -0
  61. data/test/tc_xml_document.rb +52 -52
  62. data/test/tc_xml_document_write.rb +24 -24
  63. data/test/tc_xml_document_write2.rb +54 -54
  64. data/test/tc_xml_document_write3.rb +96 -96
  65. data/test/tc_xml_html_parser.rb +63 -63
  66. data/test/tc_xml_node.rb +59 -59
  67. data/test/tc_xml_node2.rb +25 -25
  68. data/test/tc_xml_node3.rb +27 -27
  69. data/test/tc_xml_node4.rb +86 -86
  70. data/test/tc_xml_node5.rb +52 -52
  71. data/test/tc_xml_node6.rb +27 -27
  72. data/test/tc_xml_node7.rb +35 -35
  73. data/test/tc_xml_node8.rb +32 -32
  74. data/test/tc_xml_node9.rb +32 -32
  75. data/test/tc_xml_node_set.rb +24 -24
  76. data/test/tc_xml_node_set2.rb +37 -37
  77. data/test/tc_xml_node_xlink.rb +28 -28
  78. data/test/tc_xml_parser.rb +190 -178
  79. data/test/tc_xml_parser2.rb +16 -17
  80. data/test/tc_xml_parser3.rb +23 -23
  81. data/test/tc_xml_parser4.rb +33 -33
  82. data/test/tc_xml_parser5.rb +27 -27
  83. data/test/tc_xml_parser6.rb +23 -23
  84. data/test/tc_xml_parser7.rb +28 -28
  85. data/test/tc_xml_parser8.rb +32 -32
  86. data/test/tc_xml_parser9.rb +11 -0
  87. data/test/tc_xml_parser_context.rb +88 -88
  88. data/test/tc_xml_reader.rb +112 -109
  89. data/test/tc_xml_sax_parser.rb +104 -94
  90. data/test/tc_xml_sax_parser2.rb +51 -0
  91. data/test/tc_xml_xinclude.rb +30 -30
  92. data/test/tc_xml_xpath.rb +38 -38
  93. data/test/tc_xml_xpath2.rb +14 -0
  94. data/test/tc_xml_xpointer.rb +78 -78
  95. data/vc/libxml.sln +20 -0
  96. data/vc/libxml.vcproj +389 -0
  97. data/work/Rakefile +247 -0
  98. data/work/task/make +26 -0
  99. data/work/task/memory +37 -0
  100. data/work/task/rdoc +39 -0
  101. data/work/task/setup +1616 -0
  102. data/work/task/test +29 -0
  103. data/work/test/ets_runner.rb +33 -0
  104. data/work/test/libxml_test.rb +3 -0
  105. data/work/test/runner.rb +0 -0
  106. data/work/test/runner_ets.rb +33 -0
  107. data/work/vc/debug/libxml.exp +0 -0
  108. data/work/vc/debug/libxml.ilk +0 -0
  109. data/work/vc/debug/libxml.lib +0 -0
  110. data/work/vc/debug/libxml.pdb +0 -0
  111. data/work/vc/debug/libxml.so +0 -0
  112. metadata +158 -189
  113. data/MANIFEST +0 -138
  114. data/NOTES +0 -9
  115. data/Rakefile +0 -38
  116. data/TODO +0 -75
  117. data/VERSION +0 -1
  118. data/log/Changelog-0.txt +0 -426
  119. data/log/Changelog.txt +0 -435
  120. data/meta/project.yaml +0 -27
  121. data/meta/unixname +0 -1
  122. data/setup.rb +0 -1472
  123. data/site/css/normal.css +0 -182
  124. data/site/img/raze-tiny.png +0 -0
  125. data/site/img/red-cube.jpg +0 -0
  126. data/site/img/xml-ruby.png +0 -0
  127. data/site/index.xml +0 -43
  128. data/site/install.xml +0 -77
  129. data/site/layout.rhtml +0 -38
  130. data/site/layout.xsl +0 -67
  131. data/site/license.xml +0 -32
  132. data/site/log/changelog.xml +0 -1324
  133. data/site/log/changelog.xsl +0 -42
  134. data/test/model/merge_bug_data.xml +0 -58
  135. data/test/model/rubynet.xml +0 -78
  136. data/test/model/rubynet_project +0 -13
  137. data/test/model/saxtest.xml +0 -5
  138. data/test/model/simple.xml +0 -7
  139. data/test/model/xinclude.xml +0 -5
data/vc/libxml.vcproj ADDED
@@ -0,0 +1,389 @@
1
+ <?xml version="1.0" encoding="Windows-1252"?>
2
+ <VisualStudioProject
3
+ ProjectType="Visual C++"
4
+ Version="8.00"
5
+ Name="libxml_ruby"
6
+ ProjectGUID="{0B65CD1D-EEB9-41AE-93BB-75496E504152}"
7
+ RootNamespace="libxml"
8
+ Keyword="Win32Proj"
9
+ >
10
+ <Platforms>
11
+ <Platform
12
+ Name="Win32"
13
+ />
14
+ </Platforms>
15
+ <ToolFiles>
16
+ </ToolFiles>
17
+ <Configurations>
18
+ <Configuration
19
+ Name="Debug|Win32"
20
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
21
+ IntermediateDirectory="$(ConfigurationName)"
22
+ ConfigurationType="2"
23
+ CharacterSet="1"
24
+ >
25
+ <Tool
26
+ Name="VCPreBuildEventTool"
27
+ />
28
+ <Tool
29
+ Name="VCCustomBuildTool"
30
+ />
31
+ <Tool
32
+ Name="VCXMLDataGeneratorTool"
33
+ />
34
+ <Tool
35
+ Name="VCWebServiceProxyGeneratorTool"
36
+ />
37
+ <Tool
38
+ Name="VCMIDLTool"
39
+ />
40
+ <Tool
41
+ Name="VCCLCompilerTool"
42
+ Optimization="0"
43
+ AdditionalIncludeDirectories="&quot;C:\Development\ruby\lib\ruby\1.8\i386-mswin32&quot;;&quot;C:\Development\msys\src\libxml2-2.6.32\include&quot;;&quot;C:\Development\msys\src\libiconv-1.12\include&quot;"
44
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBXML_EXPORTS"
45
+ MinimalRebuild="true"
46
+ BasicRuntimeChecks="3"
47
+ RuntimeLibrary="3"
48
+ UsePrecompiledHeader="0"
49
+ WarningLevel="3"
50
+ Detect64BitPortabilityProblems="true"
51
+ DebugInformationFormat="4"
52
+ />
53
+ <Tool
54
+ Name="VCManagedResourceCompilerTool"
55
+ />
56
+ <Tool
57
+ Name="VCResourceCompilerTool"
58
+ />
59
+ <Tool
60
+ Name="VCPreLinkEventTool"
61
+ />
62
+ <Tool
63
+ Name="VCLinkerTool"
64
+ AdditionalDependencies="msvcrt-ruby18.lib libxml2.lib"
65
+ OutputFile="C:\Development\ruby\lib\ruby\gems\1.8\gems\libxml-ruby-0.6.0-x86-mswin32-60\lib\libxml.so"
66
+ LinkIncremental="2"
67
+ AdditionalLibraryDirectories="C:\Development\ruby\lib;&quot;C:\Development\msys\src\libxml2-2.6.32\win32\lib&quot;"
68
+ GenerateDebugInformation="true"
69
+ SubSystem="2"
70
+ TargetMachine="1"
71
+ />
72
+ <Tool
73
+ Name="VCALinkTool"
74
+ />
75
+ <Tool
76
+ Name="VCManifestTool"
77
+ />
78
+ <Tool
79
+ Name="VCXDCMakeTool"
80
+ />
81
+ <Tool
82
+ Name="VCBscMakeTool"
83
+ />
84
+ <Tool
85
+ Name="VCFxCopTool"
86
+ />
87
+ <Tool
88
+ Name="VCAppVerifierTool"
89
+ />
90
+ <Tool
91
+ Name="VCWebDeploymentTool"
92
+ />
93
+ <Tool
94
+ Name="VCPostBuildEventTool"
95
+ />
96
+ </Configuration>
97
+ <Configuration
98
+ Name="Release|Win32"
99
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
100
+ IntermediateDirectory="$(ConfigurationName)"
101
+ ConfigurationType="2"
102
+ CharacterSet="1"
103
+ WholeProgramOptimization="1"
104
+ >
105
+ <Tool
106
+ Name="VCPreBuildEventTool"
107
+ />
108
+ <Tool
109
+ Name="VCCustomBuildTool"
110
+ />
111
+ <Tool
112
+ Name="VCXMLDataGeneratorTool"
113
+ />
114
+ <Tool
115
+ Name="VCWebServiceProxyGeneratorTool"
116
+ />
117
+ <Tool
118
+ Name="VCMIDLTool"
119
+ />
120
+ <Tool
121
+ Name="VCCLCompilerTool"
122
+ AdditionalIncludeDirectories="&quot;C:\Development\ruby\lib\ruby\1.8\i386-mswin32&quot;;&quot;C:\Development\msys\src\libxml2-2.6.32\include&quot;;&quot;C:\Development\msys\src\libiconv-1.12\include&quot;"
123
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBXML_EXPORTS"
124
+ RuntimeLibrary="2"
125
+ UsePrecompiledHeader="0"
126
+ WarningLevel="3"
127
+ Detect64BitPortabilityProblems="true"
128
+ DebugInformationFormat="3"
129
+ />
130
+ <Tool
131
+ Name="VCManagedResourceCompilerTool"
132
+ />
133
+ <Tool
134
+ Name="VCResourceCompilerTool"
135
+ />
136
+ <Tool
137
+ Name="VCPreLinkEventTool"
138
+ />
139
+ <Tool
140
+ Name="VCLinkerTool"
141
+ AdditionalDependencies="msvcrt-ruby18.lib libxml2.lib"
142
+ OutputFile="$(OutDir)\$(ProjectName).so"
143
+ LinkIncremental="1"
144
+ AdditionalLibraryDirectories="C:\Development\ruby\lib;&quot;C:\Development\msys\src\libxml2-2.6.32\win32\lib&quot;"
145
+ GenerateDebugInformation="true"
146
+ SubSystem="2"
147
+ OptimizeReferences="2"
148
+ EnableCOMDATFolding="2"
149
+ TargetMachine="1"
150
+ />
151
+ <Tool
152
+ Name="VCALinkTool"
153
+ />
154
+ <Tool
155
+ Name="VCManifestTool"
156
+ />
157
+ <Tool
158
+ Name="VCXDCMakeTool"
159
+ />
160
+ <Tool
161
+ Name="VCBscMakeTool"
162
+ />
163
+ <Tool
164
+ Name="VCFxCopTool"
165
+ />
166
+ <Tool
167
+ Name="VCAppVerifierTool"
168
+ />
169
+ <Tool
170
+ Name="VCWebDeploymentTool"
171
+ />
172
+ <Tool
173
+ Name="VCPostBuildEventTool"
174
+ />
175
+ </Configuration>
176
+ </Configurations>
177
+ <References>
178
+ </References>
179
+ <Files>
180
+ <Filter
181
+ Name="Source Files"
182
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
183
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
184
+ >
185
+ <File
186
+ RelativePath="..\ext\libxml\cbg.c"
187
+ >
188
+ </File>
189
+ <File
190
+ RelativePath="..\ext\libxml\libxml.c"
191
+ >
192
+ </File>
193
+ <File
194
+ RelativePath="..\ext\libxml\ruby_xml_attr.c"
195
+ >
196
+ </File>
197
+ <File
198
+ RelativePath="..\ext\libxml\ruby_xml_document.c"
199
+ >
200
+ </File>
201
+ <File
202
+ RelativePath="..\ext\libxml\ruby_xml_dtd.c"
203
+ >
204
+ </File>
205
+ <File
206
+ RelativePath="..\ext\libxml\ruby_xml_html_parser.c"
207
+ >
208
+ </File>
209
+ <File
210
+ RelativePath="..\ext\libxml\ruby_xml_input_cbg.c"
211
+ >
212
+ </File>
213
+ <File
214
+ RelativePath="..\ext\libxml\ruby_xml_node.c"
215
+ >
216
+ </File>
217
+ <File
218
+ RelativePath="..\ext\libxml\ruby_xml_node_set.c"
219
+ >
220
+ </File>
221
+ <File
222
+ RelativePath="..\ext\libxml\ruby_xml_ns.c"
223
+ >
224
+ </File>
225
+ <File
226
+ RelativePath="..\ext\libxml\ruby_xml_parser.c"
227
+ >
228
+ </File>
229
+ <File
230
+ RelativePath="..\ext\libxml\ruby_xml_parser_context.c"
231
+ >
232
+ </File>
233
+ <File
234
+ RelativePath="..\ext\libxml\ruby_xml_reader.c"
235
+ >
236
+ </File>
237
+ <File
238
+ RelativePath="..\ext\libxml\ruby_xml_sax_parser.c"
239
+ >
240
+ </File>
241
+ <File
242
+ RelativePath="..\ext\libxml\ruby_xml_schema.c"
243
+ >
244
+ </File>
245
+ <File
246
+ RelativePath="..\ext\libxml\ruby_xml_state.c"
247
+ >
248
+ </File>
249
+ <File
250
+ RelativePath="..\ext\libxml\ruby_xml_tree.c"
251
+ >
252
+ </File>
253
+ <File
254
+ RelativePath="..\ext\libxml\ruby_xml_xinclude.c"
255
+ >
256
+ </File>
257
+ <File
258
+ RelativePath="..\ext\libxml\ruby_xml_xpath.c"
259
+ >
260
+ </File>
261
+ <File
262
+ RelativePath="..\ext\libxml\ruby_xml_xpath_context.c"
263
+ >
264
+ </File>
265
+ <File
266
+ RelativePath="..\ext\libxml\ruby_xml_xpath_object.c"
267
+ >
268
+ </File>
269
+ <File
270
+ RelativePath="..\ext\libxml\ruby_xml_xpointer.c"
271
+ >
272
+ </File>
273
+ <File
274
+ RelativePath="..\ext\libxml\ruby_xml_xpointer_context.c"
275
+ >
276
+ </File>
277
+ </Filter>
278
+ <Filter
279
+ Name="Header Files"
280
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
281
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
282
+ >
283
+ <File
284
+ RelativePath="..\ext\libxml\ruby_libxml.h"
285
+ >
286
+ </File>
287
+ <File
288
+ RelativePath="..\ext\libxml\ruby_xml_attr.h"
289
+ >
290
+ </File>
291
+ <File
292
+ RelativePath="..\ext\libxml\ruby_xml_document.h"
293
+ >
294
+ </File>
295
+ <File
296
+ RelativePath="..\ext\libxml\ruby_xml_dtd.h"
297
+ >
298
+ </File>
299
+ <File
300
+ RelativePath="..\ext\libxml\ruby_xml_html_parser.h"
301
+ >
302
+ </File>
303
+ <File
304
+ RelativePath="..\ext\libxml\ruby_xml_input_cbg.h"
305
+ >
306
+ </File>
307
+ <File
308
+ RelativePath="..\ext\libxml\ruby_xml_node.h"
309
+ >
310
+ </File>
311
+ <File
312
+ RelativePath="..\ext\libxml\ruby_xml_node_set.h"
313
+ >
314
+ </File>
315
+ <File
316
+ RelativePath="..\ext\libxml\ruby_xml_ns.h"
317
+ >
318
+ </File>
319
+ <File
320
+ RelativePath="..\ext\libxml\ruby_xml_parser.h"
321
+ >
322
+ </File>
323
+ <File
324
+ RelativePath="..\ext\libxml\ruby_xml_parser_context.h"
325
+ >
326
+ </File>
327
+ <File
328
+ RelativePath="..\ext\libxml\ruby_xml_reader.h"
329
+ >
330
+ </File>
331
+ <File
332
+ RelativePath="..\ext\libxml\ruby_xml_sax_parser.h"
333
+ >
334
+ </File>
335
+ <File
336
+ RelativePath="..\ext\libxml\ruby_xml_schema.h"
337
+ >
338
+ </File>
339
+ <File
340
+ RelativePath="..\ext\libxml\ruby_xml_state.h"
341
+ >
342
+ </File>
343
+ <File
344
+ RelativePath="..\ext\libxml\ruby_xml_tree.h"
345
+ >
346
+ </File>
347
+ <File
348
+ RelativePath="..\ext\libxml\ruby_xml_xinclude.h"
349
+ >
350
+ </File>
351
+ <File
352
+ RelativePath="..\ext\libxml\ruby_xml_xpath.h"
353
+ >
354
+ </File>
355
+ <File
356
+ RelativePath="..\ext\libxml\ruby_xml_xpath_context.h"
357
+ >
358
+ </File>
359
+ <File
360
+ RelativePath="..\ext\libxml\ruby_xml_xpath_object.h"
361
+ >
362
+ </File>
363
+ <File
364
+ RelativePath="..\ext\libxml\ruby_xml_xpointer.h"
365
+ >
366
+ </File>
367
+ <File
368
+ RelativePath="..\ext\libxml\ruby_xml_xpointer_context.h"
369
+ >
370
+ </File>
371
+ <File
372
+ RelativePath="..\ext\libxml\version.h"
373
+ >
374
+ </File>
375
+ </Filter>
376
+ <Filter
377
+ Name="Resource Files"
378
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
379
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
380
+ >
381
+ </Filter>
382
+ <File
383
+ RelativePath=".\ReadMe.txt"
384
+ >
385
+ </File>
386
+ </Files>
387
+ <Globals>
388
+ </Globals>
389
+ </VisualStudioProject>
data/work/Rakefile ADDED
@@ -0,0 +1,247 @@
1
+ require 'net/ftp'
2
+ require 'rake/clean'
3
+ require 'rake/testtask'
4
+ require 'rake/rdoctask'
5
+ require 'rake/gempackagetask'
6
+
7
+ CLEAN.include '**/*.o'
8
+ CLEAN.include '**/*.so'
9
+
10
+ CLOBBER.include 'doc/rdoc'
11
+ CLOBBER.include '**/*.log'
12
+ CLOBBER.include '**/Makefile'
13
+ CLOBBER.include '**/extconf.h'
14
+
15
+ desc "Default task (compile, test and memory test)"
16
+ task :default => [:compile, :test, :memory]
17
+
18
+ desc "Compile extensions."
19
+ task :compile do
20
+ sh "task/make"
21
+ end
22
+
23
+ desc "Run unit test suite."
24
+ task :test do
25
+ sh "task/test"
26
+ end
27
+
28
+ desc "Run memory test suite."
29
+ task :memory do
30
+ sh "task/memory"
31
+ end
32
+
33
+ desc "Generate rdoc documentation."
34
+ task :rdoc do
35
+ sh "task/rdoc"
36
+ end
37
+
38
+ desc "Install to local site directory."
39
+ task :setup do
40
+ sh "task/setup"
41
+ end
42
+
43
+ __END__
44
+
45
+ # THIS IS THE OLD RAKEFILE. WE LEAVE IT HERE FOR THE TIME BEING
46
+ # SO WE CAN REFERENCE IT TO IMPROVE THE NEW SCRIPTS IF NEEDED.
47
+
48
+ # Determine the current version of the software
49
+ if File.read('ext/xml/libxml.h') =~ /\s*RUBY_LIBXML_VERSION\s*['"](\d.+)['"]/
50
+ CURRENT_VERSION = $1
51
+ else
52
+ CURRENT_VERSION = "0.0.0"
53
+ end
54
+
55
+ if ENV['REL']
56
+ PKG_VERSION = ENV['REL']
57
+ else
58
+ PKG_VERSION = CURRENT_VERSION
59
+ end
60
+
61
+ task :test_ver do
62
+ puts PKG_VERSION
63
+ end
64
+
65
+ # Make tasks -----------------------------------------------------
66
+ MAKECMD = ENV['MAKE_CMD'] || 'make'
67
+ MAKEOPTS = ENV['MAKE_OPTS'] || ''
68
+
69
+ file 'ext/xml/Makefile' => 'ext/xml/extconf.rb' do
70
+ Dir.chdir('ext/xml') do
71
+ ruby 'extconf.rb'
72
+ end
73
+ end
74
+
75
+ def make(target = '')
76
+ Dir.chdir('ext/xml') do
77
+ pid = fork { exec "#{MAKECMD} #{MAKEOPTS} #{target}" }
78
+ Process.waitpid pid
79
+ end
80
+ $?.exitstatus
81
+ end
82
+
83
+ # Let make handle dependencies between c/o/so - we'll just run it.
84
+ file 'ext/xml/libxml.so' => 'ext/xml/Makefile' do
85
+ m = make
86
+ fail "Make failed (status #{m})" unless m == 0
87
+ end
88
+
89
+ desc "Compile the shared object"
90
+ task :compile => 'ext/xml/libxml.so'
91
+
92
+ desc "Install to your site_ruby directory"
93
+ task :install => :compile do
94
+ m = make 'install'
95
+ fail "Make install failed (status #{m})" unless m == 0
96
+ end
97
+
98
+ # Test Tasks ---------------------------------------------------------
99
+ task :ta => :alltests
100
+ task :tu => :unittests
101
+ task :test => :unittests
102
+ task :tm => :memtests
103
+
104
+ Rake::TestTask.new(:alltests) do |t|
105
+ t.test_files = FileList[
106
+ 'tests/runner.rb',
107
+ 'tests/contrib/*.rb',
108
+ ]
109
+ t.verbose = true
110
+ end
111
+
112
+ Rake::TestTask.new(:unittests) do |t|
113
+ t.test_files = FileList['tests/runner.rb']
114
+ t.verbose = false
115
+ end
116
+
117
+ Rake::TestTask.new(:memtests) do |t|
118
+ t.test_files = FileList[
119
+ 'tests/runner_ets.rb'
120
+ ]
121
+ t.verbose = true
122
+ end
123
+
124
+ #Rake::TestTask.new(:funtests) do |t|
125
+ # t.test_files = FileList['test/fun*.rb']
126
+ #t.warning = true
127
+ #t.warning = true
128
+ #end
129
+
130
+ task :unittests => :compile
131
+ task :alltests => :compile
132
+ task :memtests => :compile
133
+
134
+ # RDoc Tasks ---------------------------------------------------------
135
+ desc "Create the RDOC documentation tree"
136
+ rd = Rake::RDocTask.new(:doc) do |rdoc|
137
+ rdoc.rdoc_dir = 'html'
138
+ rdoc.title = "Libxml-Ruby API"
139
+ rdoc.options << '--main' << 'README'
140
+ rdoc.rdoc_files.include('README', 'LICENSE', 'TODO')
141
+ rdoc.rdoc_files.include('ext/xml/ruby_xml*.c', 'ext/xml/libxml.rb')
142
+ rdoc.rdoc_files.include('*.rdoc')
143
+ end
144
+
145
+ desc "Publish the RDoc documentation to project web site"
146
+ task :pubdoc => [ :doc ] do
147
+ unless ENV['RUBYFORGE_ACCT']
148
+ raise "Need to set RUBYFORGE_ACCT to your rubyforge.org user name (e.g. 'fred')"
149
+ end
150
+ require 'rake/contrib/sshpublisher'
151
+ Rake::SshDirPublisher.new(
152
+ "#{ENV['RUBYFORGE_ACCT']}@rubyforge.org",
153
+ "/var/www/gforge-projects/libxml/doc",
154
+ "html"
155
+ ).upload
156
+ end
157
+
158
+ # Packaging / Version number tasks -----------------------------------
159
+ # Used during release packaging if a REL is supplied
160
+ task :update_version do
161
+ unless PKG_VERSION == CURRENT_VERSION
162
+ pkg_vernum = PKG_VERSION.tr('.','').sub(/^0*/,'')
163
+ pkg_vernum << '0' until pkg_vernum.length > 2
164
+
165
+ File.open('ext/xml/libxml.h.new','w+') do |f|
166
+ maj, min, mic, patch = /(\d+)\.(\d+)(?:\.(\d+))?(?:\.(\d+))?/.match(PKG_VERSION).captures
167
+ f << File.read('ext/xml/libxml.h').
168
+ gsub(/RUBY_LIBXML_VERSION\s+"(\d.+)"/) { "RUBY_LIBXML_VERSION \"#{PKG_VERSION}\"" }.
169
+ gsub(/RUBY_LIBXML_VERNUM\s+\d+/) { "RUBY_LIBXML_VERNUM #{pkg_vernum}" }.
170
+ gsub(/RUBY_LIBXML_VER_MAJ\s+\d+/) { "RUBY_LIBXML_VER_MAJ #{maj}" }.
171
+ gsub(/RUBY_LIBXML_VER_MIN\s+\d+/) { "RUBY_LIBXML_VER_MIN #{min}" }.
172
+ gsub(/RUBY_LIBXML_VER_MIC\s+\d+/) { "RUBY_LIBXML_VER_MIC #{mic || 0}" }.
173
+ gsub(/RUBY_LIBXML_VER_PATCH\s+\d+/) { "RUBY_LIBXML_VER_PATCH #{patch || 0}" }
174
+ end
175
+ mv('ext/xml/libxml.h.new', 'ext/xml/libxml.h')
176
+ end
177
+ end
178
+
179
+ PKG_FILES = FileList[
180
+ 'ext/xml/*.rb',
181
+ 'ext/xml/extconf.rb',
182
+ '[A-Z]*',
183
+ 'ext/xml/*.c',
184
+ 'ext/xml/*.inc',
185
+ 'ext/xml/ruby_xml*.h',
186
+ 'ext/xml/libxml.h',
187
+ 'tests/**/*',
188
+ ]
189
+
190
+ if ! defined?(Gem)
191
+ warn "Package Target requires RubyGEMs"
192
+ else
193
+ spec = Gem::Specification.new do |s|
194
+
195
+ #### Basic information.
196
+
197
+ s.name = 'libxml-ruby'
198
+ s.version = PKG_VERSION
199
+ s.summary = "LibXML2 bindings for Ruby"
200
+ s.description = <<-EOF
201
+ C-language bindings for Gnome LibXML2 and Ruby. Supports
202
+ high-speed, feature rich XML processing in Ruby apps.
203
+ EOF
204
+ s.extensions = 'ext/xml/extconf.rb'
205
+
206
+ #### Which files are to be included in this gem?
207
+
208
+ s.files = PKG_FILES.to_a
209
+
210
+ #### Load-time details
211
+ s.require_path = 'lib'
212
+
213
+ #### Documentation and testing.
214
+ s.has_rdoc = true
215
+ s.extra_rdoc_files = rd.rdoc_files.to_a
216
+ s.rdoc_options <<
217
+ '--title' << 'Libxml-Ruby API' <<
218
+ '--main' << 'README'
219
+
220
+ s.test_files = Dir.glob('tests/*runner.rb')
221
+
222
+ #### Author and project details.
223
+
224
+ s.author = "Sean Chittenden"
225
+ s.email = "libxml-devel@rubyforge.org"
226
+ s.homepage = "http://libxml.rubyforge.org"
227
+ s.rubyforge_project = "libxml"
228
+ end
229
+
230
+ # Quick fix for Ruby 1.8.3 / YAML bug
231
+ if (RUBY_VERSION == '1.8.3')
232
+ def spec.to_yaml
233
+ out = super
234
+ out = '--- ' + out unless out =~ /^---/
235
+ out
236
+ end
237
+ end
238
+
239
+ package_task = Rake::GemPackageTask.new(spec) do |pkg|
240
+ pkg.need_zip = true
241
+ pkg.need_tar_gz = true
242
+ pkg.package_dir = 'pkg'
243
+ end
244
+
245
+ desc "Build a full release"
246
+ task :release => [:clobber, :update_version, :compile, :test, :package]
247
+ end
data/work/task/make ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ Dir.chdir("ext/libxml") do
4
+ unless File.exist?('Makefile')
5
+ system "ruby extconf.rb"
6
+ end
7
+
8
+ unless ARGV[0] == 'setup'
9
+ system "make #{ARGV.join(' ')}"
10
+ end
11
+ end
12
+
13
+
14
+ # Eric Hodel said NOT do this.
15
+ #
16
+ #cp "ext/xml/*.#{dlext}", "lib/xml/#{arch}/"
17
+ #
18
+ #
19
+ #def dlext
20
+ # Config::CONFIG['DLEXT']
21
+ #end
22
+ #
23
+ #def arch
24
+ # Config::CONFIG['arch']
25
+ #end
26
+
data/work/task/memory ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # TODO: Ensure compile first (but only if needed)
4
+ # system "task/make"
5
+
6
+ # Run memory tests
7
+
8
+ live = ARGV.include?('--live')
9
+
10
+ unless live
11
+ $LOAD_PATH.unshift(File.expand_path('ext/libxml'))
12
+ $LOAD_PATH.unshift(File.expand_path('lib'))
13
+ end
14
+ $LOAD_PATH.unshift('test') # NEEDED?
15
+
16
+ unless glob = ARGV.select{ |a| a !~ /^[-]/ }[0]
17
+ glob = 'test/ets_*.rb'
18
+ end
19
+
20
+ Dir[glob].each do |fn|
21
+ next if File.directory?(fn)
22
+ puts "test #{fn}"
23
+ f=Process.fork
24
+ if f.nil?
25
+ require fn
26
+ exit
27
+ end
28
+ rss_k=0
29
+ while (px=Process.wait2(f,Process::WNOHANG)).nil?
30
+ sleep 2
31
+ rss_k2=`ps -o rss= -p #{f}`.to_i
32
+ rss_k=(rss_k2>rss_k) ? rss_k2 : rss_k
33
+ end
34
+ pid,status=px
35
+ puts "\nProcess #{pid} exited status #{status.exitstatus}, max rss(k) #{rss_k}"
36
+ end
37
+