libxslt-ruby 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGES +161 -154
- data/LICENSE +21 -21
- data/README.rdoc +170 -160
- data/Rakefile +90 -90
- data/ext/libxslt/extconf.h +6 -0
- data/ext/libxslt/extconf.rb +112 -157
- data/ext/libxslt/libxslt.c +68 -69
- data/ext/libxslt/libxslt.h +37 -37
- data/ext/libxslt/ruby_exslt.c +149 -149
- data/ext/libxslt/ruby_exslt.h +8 -8
- data/ext/libxslt/ruby_xslt_stylesheet.c +302 -302
- data/ext/libxslt/ruby_xslt_stylesheet.h +10 -10
- data/ext/libxslt/version.h +5 -5
- data/ext/vc/libxslt_ruby.sln +12 -8
- data/ext/vc/libxslt_ruby.vcxproj +87 -3
- data/lib/libxslt-ruby.rb +14 -0
- data/lib/libxslt.rb +3 -16
- data/lib/libxslt/stylesheet.rb +32 -30
- data/lib/xslt.rb +15 -15
- data/libxslt-ruby.gemspec +45 -43
- data/setup.rb +1585 -1585
- data/test/files/commentary.dtd +34 -34
- data/test/files/fuzface.xml +154 -154
- data/test/files/fuzface.xsl +4 -4
- data/test/files/params.xml +2 -2
- data/test/files/params.xsl +10 -10
- data/test/files/ramblings.xsl +46 -46
- data/test/test_exslt.rb +69 -70
- data/test/test_helper.rb +5 -15
- data/test/test_libxslt.rb +20 -22
- data/test/test_stylesheet.rb +213 -214
- metadata +34 -10
- data/lib/libxslt/deprecated.rb +0 -68
- data/test/test_deprecated.rb +0 -100
- data/test/test_suite.rb +0 -11
data/Rakefile
CHANGED
@@ -1,90 +1,90 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'rake/extensiontask'
|
5
|
-
require 'rake/testtask'
|
6
|
-
require 'rdoc/task'
|
7
|
-
require 'yaml'
|
8
|
-
|
9
|
-
GEM_NAME = 'libxslt-ruby'
|
10
|
-
SO_NAME = 'libxslt_ruby'
|
11
|
-
|
12
|
-
# Read the spec file
|
13
|
-
spec = Gem::Specification.load("#{GEM_NAME}.gemspec")
|
14
|
-
|
15
|
-
# Setup compile tasks. Configuration can be passed via EVN.
|
16
|
-
# Example:
|
17
|
-
# rake compile with_xml2_include=C:/MinGW/local/include/libxml2
|
18
|
-
# with_xslt_include=C:/MinGW/local/include/libxslt
|
19
|
-
# with_exslt_include=C:/MinGW/local/include/libexslt
|
20
|
-
Rake::ExtensionTask.new do |ext|
|
21
|
-
ext.gem_spec = spec
|
22
|
-
ext.name = SO_NAME
|
23
|
-
ext.ext_dir = "ext/libxslt"
|
24
|
-
ext.lib_dir = "lib/#{RUBY_VERSION.sub(/\.\d$/, '')}"
|
25
|
-
|
26
|
-
ext.config_options << "--with-zlib-dir=C:/MinGW64/local"
|
27
|
-
ext.config_options << "--with-xml2-include=C:/MinGW64/local/include/libxml2"
|
28
|
-
ext.config_options << "--with-xslt-include=C:/MinGW64/local/include/libxslt"
|
29
|
-
ext.config_options << "--with-exslt-include=C:/MinGW64/local/include/libexslt"
|
30
|
-
|
31
|
-
ENV.each do |key, val|
|
32
|
-
next unless key =~ /\Awith_(\w+)\z/i
|
33
|
-
opt = $1.downcase.tr('_', '-')
|
34
|
-
if File.directory?(path = File.expand_path(val))
|
35
|
-
ext.config_options << "--with-#{opt}=#{path}"
|
36
|
-
else
|
37
|
-
warn "No such directory: #{opt}: #{path}"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# Setup generic gem
|
43
|
-
Gem::PackageTask.new(spec) do |pkg|
|
44
|
-
pkg.package_dir = 'pkg'
|
45
|
-
pkg.need_tar = false
|
46
|
-
end
|
47
|
-
|
48
|
-
# Setup Windows Gem
|
49
|
-
if RUBY_PLATFORM.match(/win32|mingw32/)
|
50
|
-
binaries = (FileList['lib/**/*.so',
|
51
|
-
'lib/**/*dll'])
|
52
|
-
|
53
|
-
# Windows specification
|
54
|
-
win_spec = spec.clone
|
55
|
-
win_spec.platform = Gem::Platform::CURRENT
|
56
|
-
win_spec.files += binaries.to_a
|
57
|
-
win_spec.instance_variable_set(:@cache_file, nil)
|
58
|
-
|
59
|
-
# Unset extensions
|
60
|
-
win_spec.extensions = nil
|
61
|
-
|
62
|
-
# Rake task to build the windows package
|
63
|
-
Gem::PackageTask.new(win_spec) do |pkg|
|
64
|
-
pkg.package_dir = 'pkg'
|
65
|
-
pkg.need_tar = false
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
# RDoc Task
|
70
|
-
desc "Generate rdoc documentation"
|
71
|
-
RDoc::Task.new("rdoc") do |rdoc|
|
72
|
-
rdoc.rdoc_dir = 'doc'
|
73
|
-
rdoc.title = "libxml-xslt"
|
74
|
-
# Show source inline with line numbers
|
75
|
-
rdoc.options << "--line-numbers"
|
76
|
-
# Make the readme file the start page for the generated html
|
77
|
-
rdoc.options << '--main' << 'README'
|
78
|
-
rdoc.rdoc_files.include('doc/*.rdoc',
|
79
|
-
'ext/**/*.c',
|
80
|
-
'lib/**/*.rb',
|
81
|
-
'CHANGES',
|
82
|
-
'README',
|
83
|
-
'LICENSE')
|
84
|
-
end
|
85
|
-
|
86
|
-
# Test Task
|
87
|
-
Rake::TestTask.new do |t|
|
88
|
-
t.libs << "test"
|
89
|
-
t.verbose = true
|
90
|
-
end
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rake/extensiontask'
|
5
|
+
require 'rake/testtask'
|
6
|
+
require 'rdoc/task'
|
7
|
+
require 'yaml'
|
8
|
+
|
9
|
+
GEM_NAME = 'libxslt-ruby'
|
10
|
+
SO_NAME = 'libxslt_ruby'
|
11
|
+
|
12
|
+
# Read the spec file
|
13
|
+
spec = Gem::Specification.load("#{GEM_NAME}.gemspec")
|
14
|
+
|
15
|
+
# Setup compile tasks. Configuration can be passed via EVN.
|
16
|
+
# Example:
|
17
|
+
# rake compile with_xml2_include=C:/MinGW/local/include/libxml2
|
18
|
+
# with_xslt_include=C:/MinGW/local/include/libxslt
|
19
|
+
# with_exslt_include=C:/MinGW/local/include/libexslt
|
20
|
+
Rake::ExtensionTask.new do |ext|
|
21
|
+
ext.gem_spec = spec
|
22
|
+
ext.name = SO_NAME
|
23
|
+
ext.ext_dir = "ext/libxslt"
|
24
|
+
ext.lib_dir = "lib/#{RUBY_VERSION.sub(/\.\d$/, '')}"
|
25
|
+
|
26
|
+
ext.config_options << "--with-zlib-dir=C:/MinGW64/local"
|
27
|
+
ext.config_options << "--with-xml2-include=C:/MinGW64/local/include/libxml2"
|
28
|
+
ext.config_options << "--with-xslt-include=C:/MinGW64/local/include/libxslt"
|
29
|
+
ext.config_options << "--with-exslt-include=C:/MinGW64/local/include/libexslt"
|
30
|
+
|
31
|
+
ENV.each do |key, val|
|
32
|
+
next unless key =~ /\Awith_(\w+)\z/i
|
33
|
+
opt = $1.downcase.tr('_', '-')
|
34
|
+
if File.directory?(path = File.expand_path(val))
|
35
|
+
ext.config_options << "--with-#{opt}=#{path}"
|
36
|
+
else
|
37
|
+
warn "No such directory: #{opt}: #{path}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Setup generic gem
|
43
|
+
Gem::PackageTask.new(spec) do |pkg|
|
44
|
+
pkg.package_dir = 'pkg'
|
45
|
+
pkg.need_tar = false
|
46
|
+
end
|
47
|
+
|
48
|
+
# Setup Windows Gem
|
49
|
+
if RUBY_PLATFORM.match(/win32|mingw32/)
|
50
|
+
binaries = (FileList['lib/**/*.so',
|
51
|
+
'lib/**/*dll'])
|
52
|
+
|
53
|
+
# Windows specification
|
54
|
+
win_spec = spec.clone
|
55
|
+
win_spec.platform = Gem::Platform::CURRENT
|
56
|
+
win_spec.files += binaries.to_a
|
57
|
+
win_spec.instance_variable_set(:@cache_file, nil)
|
58
|
+
|
59
|
+
# Unset extensions
|
60
|
+
win_spec.extensions = nil
|
61
|
+
|
62
|
+
# Rake task to build the windows package
|
63
|
+
Gem::PackageTask.new(win_spec) do |pkg|
|
64
|
+
pkg.package_dir = 'pkg'
|
65
|
+
pkg.need_tar = false
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# RDoc Task
|
70
|
+
desc "Generate rdoc documentation"
|
71
|
+
RDoc::Task.new("rdoc") do |rdoc|
|
72
|
+
rdoc.rdoc_dir = 'doc'
|
73
|
+
rdoc.title = "libxml-xslt"
|
74
|
+
# Show source inline with line numbers
|
75
|
+
rdoc.options << "--line-numbers"
|
76
|
+
# Make the readme file the start page for the generated html
|
77
|
+
rdoc.options << '--main' << 'README.rdoc'
|
78
|
+
rdoc.rdoc_files.include('doc/*.rdoc',
|
79
|
+
'ext/**/*.c',
|
80
|
+
'lib/**/*.rb',
|
81
|
+
'CHANGES',
|
82
|
+
'README.rdoc',
|
83
|
+
'LICENSE')
|
84
|
+
end
|
85
|
+
|
86
|
+
# Test Task
|
87
|
+
Rake::TestTask.new do |t|
|
88
|
+
t.libs << "test"
|
89
|
+
t.verbose = true
|
90
|
+
end
|
data/ext/libxslt/extconf.rb
CHANGED
@@ -1,157 +1,112 @@
|
|
1
|
-
#!/usr/local/bin/ruby -w
|
2
|
-
|
3
|
-
# See the LICENSE file for copyright and distribution information
|
4
|
-
|
5
|
-
require 'mkmf'
|
6
|
-
require 'rbconfig'
|
7
|
-
|
8
|
-
require 'rubygems'
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
unless (have_library('
|
59
|
-
have_library('
|
60
|
-
find_library('
|
61
|
-
(have_header('
|
62
|
-
find_header('
|
63
|
-
'/opt/include/
|
64
|
-
'/usr/local/include/
|
65
|
-
'/usr/include/
|
66
|
-
crash(<<-EOL)
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
--with-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
# Figure out where libxml-ruby is installed
|
114
|
-
unless gem_spec = Gem::Specification.find_by_name('libxml-ruby')
|
115
|
-
crash(<<-EOL)
|
116
|
-
libxml-ruby bindings must be installed
|
117
|
-
EOL
|
118
|
-
end
|
119
|
-
|
120
|
-
unless find_header("ruby_libxml.h", "#{gem_spec.full_gem_path}/ext/libxml")
|
121
|
-
crash(<<-EOL)
|
122
|
-
Need headers for libxml-ruby.
|
123
|
-
EOL
|
124
|
-
end
|
125
|
-
|
126
|
-
|
127
|
-
RUBY_VERSION =~ /(\d+.\d+)/
|
128
|
-
minor_version = $1
|
129
|
-
paths = ["#{gem_spec.full_gem_path}/lib",
|
130
|
-
"#{gem_spec.full_gem_path}/lib/#{minor_version}",
|
131
|
-
"#{gem_spec.full_gem_path}/ext/libxml"]
|
132
|
-
|
133
|
-
# No need to link xml_ruby on OS X
|
134
|
-
unless RbConfig::CONFIG['host_os'].match(/darwin/)
|
135
|
-
# Hack to make sure ruby library is *after* xml_ruby library
|
136
|
-
$LIBS = "#{$LIBRUBYARG_STATIC} #{$LIBS}"
|
137
|
-
|
138
|
-
libraries = ["xml_ruby", # Linux
|
139
|
-
":libxml_ruby.so", # mingw
|
140
|
-
"libxml_ruby-#{RbConfig::CONFIG["arch"]}"] # mswin
|
141
|
-
|
142
|
-
libxml_library = libraries.detect do |library|
|
143
|
-
find_library(library, "Init_libxml_ruby", *paths)
|
144
|
-
end
|
145
|
-
|
146
|
-
unless libxml_library
|
147
|
-
crash(<<-EOL)
|
148
|
-
Need libxml-ruby
|
149
|
-
Please install libxml-ruby or specify the path to the gem via:
|
150
|
-
--with-libxml-ruby=/path/to/libxml-ruby gem
|
151
|
-
EOL
|
152
|
-
end
|
153
|
-
$LIBS.gsub!($LIBRUBYARG_STATIC,'')
|
154
|
-
end
|
155
|
-
|
156
|
-
create_header()
|
157
|
-
create_makefile("libxslt_ruby")
|
1
|
+
#!/usr/local/bin/ruby -w
|
2
|
+
|
3
|
+
# See the LICENSE file for copyright and distribution information
|
4
|
+
|
5
|
+
require 'mkmf'
|
6
|
+
require 'rbconfig'
|
7
|
+
|
8
|
+
require 'rubygems'
|
9
|
+
|
10
|
+
def crash(str)
|
11
|
+
print(" extconf failure: %s\n", str)
|
12
|
+
exit 1
|
13
|
+
end
|
14
|
+
|
15
|
+
# Directories
|
16
|
+
dir_config('xml2')
|
17
|
+
dir_config('xslt')
|
18
|
+
dir_config('exslt')
|
19
|
+
|
20
|
+
unless (have_library('xml2', 'xmlXPtrNewRange') or
|
21
|
+
have_library('libxml2', 'xmlXPtrNewRange') or
|
22
|
+
find_library('xml2', 'xmlXPtrNewRange', '/opt/lib', '/usr/local/lib', '/usr/lib')) and
|
23
|
+
(have_header('libxml/xmlversion.h') or
|
24
|
+
find_header('libxml/xmlversion.h',
|
25
|
+
'/opt/include/libxml2',
|
26
|
+
'/usr/local/include/libxml2',
|
27
|
+
'/usr/include/libxml2'))
|
28
|
+
crash(<<-EOL)
|
29
|
+
Cannot find libxml2.
|
30
|
+
|
31
|
+
Install the library or try one of the following options to extconf.rb:
|
32
|
+
|
33
|
+
--with-xml2-dir=/path/to/libxml2
|
34
|
+
--with-xml2-lib=/path/to/libxml2/lib
|
35
|
+
--with-xml2-include=/path/to/libxml2/include
|
36
|
+
EOL
|
37
|
+
end
|
38
|
+
|
39
|
+
unless (have_library('xslt','xsltApplyStylesheet') or
|
40
|
+
have_library('libxslt','xsltApplyStylesheet') or
|
41
|
+
find_library('xslt', 'xsltApplyStylesheet', '/opt/lib', '/usr/local/lib', '/usr/lib')) and
|
42
|
+
(have_header('xslt.h') or
|
43
|
+
find_header('xslt.h',
|
44
|
+
'/opt/include/libxslt',
|
45
|
+
'/usr/local/include/libxslt',
|
46
|
+
'/usr/include/libxslt'))
|
47
|
+
crash(<<-EOL)
|
48
|
+
need libxslt.
|
49
|
+
|
50
|
+
Install the library or try one of the following options to extconf.rb:
|
51
|
+
|
52
|
+
--with-xslt-dir=/path/to/libxslt
|
53
|
+
--with-xslt-lib=/path/to/libxslt/lib
|
54
|
+
--with-xslt-include=/path/to/libxslt/include
|
55
|
+
EOL
|
56
|
+
end
|
57
|
+
|
58
|
+
unless (have_library('exslt','exsltRegisterAll') or
|
59
|
+
have_library('libexslt','exsltRegisterAll') or
|
60
|
+
find_library('exslt', 'exsltRegisterAll', '/opt/lib', '/usr/local/lib', '/usr/lib')) and
|
61
|
+
(have_header('exslt.h') or
|
62
|
+
find_header('exslt.h',
|
63
|
+
'/opt/include/libexslt',
|
64
|
+
'/usr/local/include/libexslt',
|
65
|
+
'/usr/include/libexslt'))
|
66
|
+
crash(<<-EOL)
|
67
|
+
Need libexslt.
|
68
|
+
Install the library or try one of the following options to extconf.rb:
|
69
|
+
--with-exslt-dir=/path/to/libexslt
|
70
|
+
--with-exslt-lib=/path/to/libexslt/lib
|
71
|
+
--with-exslt-include=/path/to/libexslt/include
|
72
|
+
EOL
|
73
|
+
end
|
74
|
+
|
75
|
+
# Figure out where libxml-ruby is installed
|
76
|
+
unless gem_spec = Gem::Specification.find_by_name('libxml-ruby')
|
77
|
+
crash(<<-EOL)
|
78
|
+
libxml-ruby gem must be installed
|
79
|
+
EOL
|
80
|
+
end
|
81
|
+
|
82
|
+
# Tell gcc where to find ruby_libxml.h
|
83
|
+
$INCFLAGS << " -I\"#{gem_spec.full_gem_path}/ext/libxml\""
|
84
|
+
|
85
|
+
RUBY_VERSION =~ /^(\d+.\d+)/
|
86
|
+
minor_version = $1
|
87
|
+
paths = ["#{gem_spec.full_gem_path}/lib",
|
88
|
+
"#{gem_spec.full_gem_path}/lib/#{minor_version}",
|
89
|
+
"#{gem_spec.full_gem_path}/ext/libxml"]
|
90
|
+
|
91
|
+
# No need to link xml_ruby on OS X
|
92
|
+
unless RbConfig::CONFIG['host_os'].match(/darwin|linux/)
|
93
|
+
libraries = ["xml_ruby", # Linux
|
94
|
+
":libxml_ruby.so", # mingw
|
95
|
+
"libxml_ruby-#{RbConfig::CONFIG["arch"]}"] # mswin
|
96
|
+
|
97
|
+
libxml_library = libraries.detect do |library|
|
98
|
+
find_library(library, "Init_libxml_ruby", *paths)
|
99
|
+
end
|
100
|
+
|
101
|
+
unless libxml_library
|
102
|
+
crash(<<-EOL)
|
103
|
+
Need libxml-ruby
|
104
|
+
Please install libxml-ruby or specify the path to the gem via:
|
105
|
+
--with-libxml-ruby=/path/to/libxml-ruby gem
|
106
|
+
EOL
|
107
|
+
end
|
108
|
+
$LIBS.gsub!($LIBRUBYARG_STATIC,'')
|
109
|
+
end
|
110
|
+
|
111
|
+
create_header()
|
112
|
+
create_makefile("libxslt_ruby")
|