rroonga 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS.ja.rdoc +46 -0
- data/NEWS.rdoc +46 -0
- data/README.ja.rdoc +2 -2
- data/README.rdoc +2 -3
- data/Rakefile +148 -11
- data/example/bookmark.rb +94 -91
- data/ext/groonga/extconf.rb +25 -25
- data/ext/groonga/groonga.def +2 -0
- data/ext/groonga/mkmf.log +7 -7
- data/ext/groonga/rb-grn-column.c +66 -0
- data/ext/groonga/rb-grn-context.c +92 -5
- data/ext/groonga/rb-grn-database.c +24 -1
- data/ext/groonga/rb-grn-exception.c +15 -0
- data/ext/groonga/rb-grn-hash.c +2 -2
- data/ext/groonga/rb-grn-index-column.c +8 -4
- data/ext/groonga/rb-grn-object.c +4 -2
- data/ext/groonga/rb-grn-patricia-trie.c +2 -2
- data/ext/groonga/rb-grn-snippet.c +1 -0
- data/ext/groonga/rb-grn-table-key-support.c +22 -19
- data/ext/groonga/rb-grn-table.c +63 -5
- data/ext/groonga/rb-grn.h +1 -1
- data/ext/groonga/rb-groonga.c +1 -0
- data/extconf.rb +1 -1
- data/html/developer.html +8 -2
- data/html/favicon.ico +0 -0
- data/html/favicon.svg +591 -0
- data/html/index.html +71 -8
- data/html/logo.svg +612 -0
- data/html/ranguba.css +92 -7
- data/html/readme.svg +256 -0
- data/lib/groonga/expression-builder.rb +8 -4
- data/lib/groonga/record.rb +77 -7
- data/lib/groonga/schema.rb +429 -100
- data/rroonga-build.rb +1 -1
- data/test/run-test.rb +1 -1
- data/test/test-array.rb +4 -0
- data/test/test-context.rb +8 -0
- data/test/test-database.rb +8 -1
- data/test/test-expression-builder.rb +14 -0
- data/test/test-fix-size-column.rb +4 -0
- data/test/test-hash.rb +10 -4
- data/test/test-index-column.rb +11 -0
- data/test/test-patricia-trie.rb +7 -1
- data/test/test-record.rb +14 -0
- data/test/test-remote.rb +3 -2
- data/test/test-schema-create-table.rb +32 -2
- data/test/test-schema.rb +108 -11
- data/test/test-table-select-normalize.rb +7 -3
- data/test/test-table-select.rb +12 -0
- data/test/test-table.rb +7 -0
- data/test/test-variable-size-column.rb +4 -0
- data/test-unit/Rakefile +40 -0
- data/test-unit/TODO +5 -0
- data/test-unit/bin/testrb +5 -0
- data/test-unit/html/classic.html +15 -0
- data/test-unit/html/index.html +25 -0
- data/test-unit/html/index.html.ja +27 -0
- data/test-unit/lib/test/unit/assertionfailederror.rb +25 -0
- data/test-unit/lib/test/unit/assertions.rb +1230 -0
- data/test-unit/lib/test/unit/attribute.rb +125 -0
- data/test-unit/lib/test/unit/autorunner.rb +360 -0
- data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
- data/test-unit/lib/test/unit/collector/dir.rb +108 -0
- data/test-unit/lib/test/unit/collector/load.rb +144 -0
- data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
- data/test-unit/lib/test/unit/collector.rb +36 -0
- data/test-unit/lib/test/unit/color-scheme.rb +102 -0
- data/test-unit/lib/test/unit/color.rb +96 -0
- data/test-unit/lib/test/unit/diff.rb +724 -0
- data/test-unit/lib/test/unit/error.rb +130 -0
- data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
- data/test-unit/lib/test/unit/failure.rb +136 -0
- data/test-unit/lib/test/unit/fixture.rb +176 -0
- data/test-unit/lib/test/unit/notification.rb +129 -0
- data/test-unit/lib/test/unit/omission.rb +191 -0
- data/test-unit/lib/test/unit/pending.rb +150 -0
- data/test-unit/lib/test/unit/priority.rb +180 -0
- data/test-unit/lib/test/unit/runner/console.rb +52 -0
- data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
- data/test-unit/lib/test/unit/runner/tap.rb +8 -0
- data/test-unit/lib/test/unit/testcase.rb +476 -0
- data/test-unit/lib/test/unit/testresult.rb +89 -0
- data/test-unit/lib/test/unit/testsuite.rb +110 -0
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +466 -0
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +63 -0
- data/test-unit/lib/test/unit/ui/tap/testrunner.rb +92 -0
- data/test-unit/lib/test/unit/ui/testrunner.rb +28 -0
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
- data/test-unit/lib/test/unit/util/backtracefilter.rb +41 -0
- data/test-unit/lib/test/unit/util/method-owner-finder.rb +28 -0
- data/test-unit/lib/test/unit/util/observable.rb +90 -0
- data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
- data/test-unit/lib/test/unit/version.rb +7 -0
- data/test-unit/lib/test/unit.rb +323 -0
- data/test-unit/sample/adder.rb +13 -0
- data/test-unit/sample/subtracter.rb +12 -0
- data/test-unit/sample/test_adder.rb +20 -0
- data/test-unit/sample/test_subtracter.rb +20 -0
- data/test-unit/sample/test_user.rb +23 -0
- data/test-unit/test/collector/test-descendant.rb +133 -0
- data/test-unit/test/collector/test-load.rb +442 -0
- data/test-unit/test/collector/test_dir.rb +406 -0
- data/test-unit/test/collector/test_objectspace.rb +100 -0
- data/test-unit/test/run-test.rb +15 -0
- data/test-unit/test/test-attribute.rb +86 -0
- data/test-unit/test/test-color-scheme.rb +67 -0
- data/test-unit/test/test-color.rb +47 -0
- data/test-unit/test/test-diff.rb +518 -0
- data/test-unit/test/test-emacs-runner.rb +60 -0
- data/test-unit/test/test-fixture.rb +287 -0
- data/test-unit/test/test-notification.rb +33 -0
- data/test-unit/test/test-omission.rb +81 -0
- data/test-unit/test/test-pending.rb +70 -0
- data/test-unit/test/test-priority.rb +119 -0
- data/test-unit/test/test-testcase.rb +544 -0
- data/test-unit/test/test_assertions.rb +1151 -0
- data/test-unit/test/test_error.rb +26 -0
- data/test-unit/test/test_failure.rb +33 -0
- data/test-unit/test/test_testresult.rb +113 -0
- data/test-unit/test/test_testsuite.rb +129 -0
- data/test-unit/test/testunit-test-util.rb +14 -0
- data/test-unit/test/ui/test_testrunmediator.rb +20 -0
- data/test-unit/test/util/test-method-owner-finder.rb +38 -0
- data/test-unit/test/util/test_backtracefilter.rb +41 -0
- data/test-unit/test/util/test_observable.rb +102 -0
- data/test-unit/test/util/test_procwrapper.rb +36 -0
- data/text/{TUTORIAL.ja.rdoc → tutorial.ja.rdoc} +165 -126
- metadata +106 -16
- data/html/favicon.xcf +0 -0
- data/html/logo.xcf +0 -0
- data/license/GPL +0 -340
- data/license/RUBY +0 -59
- data/pkg-config.rb +0 -333
data/pkg-config.rb
DELETED
@@ -1,333 +0,0 @@
|
|
1
|
-
# Copyright 2008-2009 Kouhei Sutou <kou@cozmixng.org>
|
2
|
-
# This file is made available under the same terms as Ruby.
|
3
|
-
|
4
|
-
require "rbconfig"
|
5
|
-
|
6
|
-
require 'mkmf'
|
7
|
-
require 'shellwords'
|
8
|
-
require 'English'
|
9
|
-
require 'pathname'
|
10
|
-
|
11
|
-
class PackageConfig
|
12
|
-
@@default_prepend_paths = []
|
13
|
-
@@default_append_paths = []
|
14
|
-
|
15
|
-
class << self
|
16
|
-
def prepend_default_path(path)
|
17
|
-
@@default_prepend_paths.unshift(path)
|
18
|
-
end
|
19
|
-
|
20
|
-
def append_default_path(path)
|
21
|
-
@@default_append_paths << path
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
attr_accessor :msvc_syntax
|
26
|
-
def initialize(name, path=nil, msvc_syntax=false)
|
27
|
-
@name = name
|
28
|
-
@path = path || ENV["PKG_CONFIG_PATH"]
|
29
|
-
@path = [@path, guess_default_path].compact.join(separator)
|
30
|
-
@msvc_syntax = msvc_syntax
|
31
|
-
@variables = @declarations = nil
|
32
|
-
override_variables = with_config("override-variables", "")
|
33
|
-
@override_variables = parse_override_variables(override_variables)
|
34
|
-
end
|
35
|
-
|
36
|
-
def exist?
|
37
|
-
not pc.nil?
|
38
|
-
end
|
39
|
-
|
40
|
-
def requires
|
41
|
-
parse_requires(declaration("Requires"))
|
42
|
-
end
|
43
|
-
|
44
|
-
def requires_private
|
45
|
-
parse_requires(declaration("Requires.private"))
|
46
|
-
end
|
47
|
-
|
48
|
-
def cflags
|
49
|
-
path_flags, other_flags = collect_cflags
|
50
|
-
(other_flags + path_flags).join(" ")
|
51
|
-
end
|
52
|
-
|
53
|
-
def cflags_only_I
|
54
|
-
collect_cflags[0].join(" ")
|
55
|
-
end
|
56
|
-
|
57
|
-
def libs
|
58
|
-
path_flags, other_flags = collect_libs
|
59
|
-
(other_flags + path_flags).join(" ")
|
60
|
-
end
|
61
|
-
|
62
|
-
def libs_only_l
|
63
|
-
collect_libs[1].find_all do |arg|
|
64
|
-
if @msvc_syntax
|
65
|
-
/\.lib\z/ =~ arg
|
66
|
-
else
|
67
|
-
/\A-l/ =~ arg
|
68
|
-
end
|
69
|
-
end.join(" ")
|
70
|
-
end
|
71
|
-
|
72
|
-
def version
|
73
|
-
declaration("Version")
|
74
|
-
end
|
75
|
-
|
76
|
-
def variable(name)
|
77
|
-
parse_pc if @variables.nil?
|
78
|
-
expand_value(@override_variables[name] || @variables[name])
|
79
|
-
end
|
80
|
-
|
81
|
-
def declaration(name)
|
82
|
-
parse_pc if @declarations.nil?
|
83
|
-
expand_value(@declarations[name])
|
84
|
-
end
|
85
|
-
|
86
|
-
private
|
87
|
-
def paths
|
88
|
-
paths = @@default_prepend_paths
|
89
|
-
paths += @path.split(separator)
|
90
|
-
paths += @@default_append_paths
|
91
|
-
paths
|
92
|
-
end
|
93
|
-
|
94
|
-
def pc
|
95
|
-
paths.each do |path|
|
96
|
-
pc_name = File.join(path, "#{@name}.pc")
|
97
|
-
return pc_name if File.exist?(pc_name)
|
98
|
-
end
|
99
|
-
return nil
|
100
|
-
end
|
101
|
-
|
102
|
-
def separator
|
103
|
-
File.expand_path(".").index(":") ? ";" : ":"
|
104
|
-
end
|
105
|
-
|
106
|
-
def collect_cflags
|
107
|
-
all_cflags = (requires_private + requires.reverse).collect do |package|
|
108
|
-
self.class.new(package, @path, @msvc_syntax).cflags
|
109
|
-
end
|
110
|
-
all_cflags = [declaration("Cflags")] + all_cflags
|
111
|
-
all_cflags = all_cflags.join(" ").gsub(/-I /, '-I').split.uniq
|
112
|
-
path_flags, other_flags = all_cflags.partition {|flag| /\A-I/ =~ flag}
|
113
|
-
path_flags = path_flags.reject do |flag|
|
114
|
-
flag == "-I/usr/include"
|
115
|
-
end
|
116
|
-
if @msvc_syntax
|
117
|
-
path_flags = path_flags.collect do |flag|
|
118
|
-
flag.gsub(/\A-I/, "/I")
|
119
|
-
end
|
120
|
-
end
|
121
|
-
[path_flags, other_flags]
|
122
|
-
end
|
123
|
-
|
124
|
-
def collect_libs
|
125
|
-
all_libs = requires.collect do |package|
|
126
|
-
self.class.new(package, @path, @msvc_syntax).libs
|
127
|
-
end
|
128
|
-
all_libs = [declaration("Libs")] + all_libs
|
129
|
-
all_libs = all_libs.join(" ").gsub(/-([Ll]) /, '\1').split.uniq
|
130
|
-
path_flags, other_flags = all_libs.partition {|flag| /\A-L/ =~ flag}
|
131
|
-
path_flags = path_flags.reject do |flag|
|
132
|
-
/\A-L\/usr\/lib(?:64)?\z/ =~ flag
|
133
|
-
end
|
134
|
-
if @msvc_syntax
|
135
|
-
path_flags = path_flags.collect do |flag|
|
136
|
-
flag.gsub(/\A-L/, "/libpath:")
|
137
|
-
end
|
138
|
-
other_flags = other_flags.collect do |flag|
|
139
|
-
if /\A-l/ =~ flag
|
140
|
-
"#{$POSTMATCH}.lib"
|
141
|
-
else
|
142
|
-
flag
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
[path_flags, other_flags]
|
147
|
-
end
|
148
|
-
|
149
|
-
IDENTIFIER_RE = /[\w.]+/
|
150
|
-
def parse_pc
|
151
|
-
raise ".pc for #{@name} doesn't exist." unless exist?
|
152
|
-
@variables = {}
|
153
|
-
@declarations = {}
|
154
|
-
File.open(pc) do |input|
|
155
|
-
input.each_line do |line|
|
156
|
-
line = line.gsub(/#.*/, '').strip
|
157
|
-
next if line.empty?
|
158
|
-
case line
|
159
|
-
when /^(#{IDENTIFIER_RE})=/
|
160
|
-
@variables[$1] = $POSTMATCH.strip
|
161
|
-
when /^(#{IDENTIFIER_RE}):/
|
162
|
-
@declarations[$1] = $POSTMATCH.strip
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
def parse_requires(requires)
|
169
|
-
return [] if requires.nil?
|
170
|
-
requires_without_version = requires.gsub(/[<>]?=\s*[\d.]+\s*/, '')
|
171
|
-
requires_without_version.split(/[,\s]+/)
|
172
|
-
end
|
173
|
-
|
174
|
-
def parse_override_variables(override_variables)
|
175
|
-
variables = {}
|
176
|
-
override_variables.split(",").each do |variable|
|
177
|
-
name, value = variable.split("=", 2)
|
178
|
-
variables[name] = value
|
179
|
-
end
|
180
|
-
variables
|
181
|
-
end
|
182
|
-
|
183
|
-
def expand_value(value)
|
184
|
-
return nil if value.nil?
|
185
|
-
value.gsub(/\$\{(#{IDENTIFIER_RE})\}/) do
|
186
|
-
variable($1)
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
def search_pkg_config_from_path(pkg_config)
|
191
|
-
(ENV["PATH"] || "").split(separator).each do |path|
|
192
|
-
try_pkg_config = Pathname(path) + pkg_config
|
193
|
-
return try_pkg_config if try_pkg_config.exist?
|
194
|
-
end
|
195
|
-
nil
|
196
|
-
end
|
197
|
-
|
198
|
-
def search_pkg_config_by_dln_find_exe(pkg_config)
|
199
|
-
begin
|
200
|
-
require "dl/import"
|
201
|
-
rescue LoadError
|
202
|
-
return nil
|
203
|
-
end
|
204
|
-
dln = Module.new
|
205
|
-
dln.module_eval do
|
206
|
-
if DL.const_defined?(:Importer)
|
207
|
-
extend DL::Importer
|
208
|
-
else
|
209
|
-
extend DL::Importable
|
210
|
-
end
|
211
|
-
begin
|
212
|
-
dlload RbConfig::CONFIG["LIBRUBY"]
|
213
|
-
rescue RuntimeError
|
214
|
-
return nil if $!.message == "unknown error"
|
215
|
-
return nil if /: image not found\z/ =~ $!.message
|
216
|
-
raise
|
217
|
-
rescue DL::DLError
|
218
|
-
return nil
|
219
|
-
end
|
220
|
-
extern "const char *dln_find_exe(const char *, const char *)"
|
221
|
-
end
|
222
|
-
path = dln.dln_find_exe(pkg_config.to_s, nil)
|
223
|
-
if path and path.size.zero?
|
224
|
-
nil
|
225
|
-
else
|
226
|
-
Pathname(path.to_s)
|
227
|
-
end
|
228
|
-
end
|
229
|
-
|
230
|
-
def guess_default_path
|
231
|
-
default_path = ["/usr/local/lib64/pkgconfig",
|
232
|
-
"/usr/local/lib/pkgconfig",
|
233
|
-
"/usr/local/libdata/pkgconfig",
|
234
|
-
"/opt/local/lib/pkgconfig",
|
235
|
-
"/usr/lib64/pkgconfig",
|
236
|
-
"/usr/lib/pkgconfig",
|
237
|
-
"/usr/X11/lib/pkgconfig/",
|
238
|
-
"/usr/share/pkgconfig"].join(separator)
|
239
|
-
libdir = ENV["PKG_CONFIG_LIBDIR"]
|
240
|
-
default_path = [libdir, default_path].join(separator) if libdir
|
241
|
-
|
242
|
-
pkg_config = with_config("pkg-config", ENV["PKG_CONFIG"] || "pkg-config")
|
243
|
-
pkg_config = Pathname.new(pkg_config)
|
244
|
-
unless pkg_config.absolute?
|
245
|
-
found_pkg_config = search_pkg_config_from_path(pkg_config)
|
246
|
-
pkg_config = found_pkg_config if found_pkg_config
|
247
|
-
end
|
248
|
-
unless pkg_config.absolute?
|
249
|
-
found_pkg_config = search_pkg_config_by_dln_find_exe(pkg_config)
|
250
|
-
pkg_config = found_pkg_config if found_pkg_config
|
251
|
-
end
|
252
|
-
|
253
|
-
return default_path unless pkg_config.absolute?
|
254
|
-
[(pkg_config.parent.parent + "lib" + "pkgconfig").to_s,
|
255
|
-
(pkg_config.parent.parent + "libdata" + "pkgconfig").to_s,
|
256
|
-
default_path].join(separator)
|
257
|
-
end
|
258
|
-
end
|
259
|
-
|
260
|
-
module PKGConfig
|
261
|
-
module_function
|
262
|
-
def msvc?
|
263
|
-
/mswin32/.match(RUBY_PLATFORM) and /^cl\b/.match(Config::CONFIG['CC'])
|
264
|
-
end
|
265
|
-
|
266
|
-
def package_config(package)
|
267
|
-
PackageConfig.new(package, nil, msvc?)
|
268
|
-
end
|
269
|
-
|
270
|
-
def exist?(pkg)
|
271
|
-
package_config(pkg).exist?
|
272
|
-
end
|
273
|
-
|
274
|
-
def libs(pkg)
|
275
|
-
package_config(pkg).libs
|
276
|
-
end
|
277
|
-
|
278
|
-
def libs_only_l(pkg)
|
279
|
-
package_config(pkg).libs_only_l
|
280
|
-
end
|
281
|
-
|
282
|
-
def cflags(pkg)
|
283
|
-
package_config(pkg).cflags
|
284
|
-
end
|
285
|
-
|
286
|
-
def cflags_only_I(pkg)
|
287
|
-
package_config(pkg).cflags_only_I
|
288
|
-
end
|
289
|
-
|
290
|
-
def modversion(pkg)
|
291
|
-
package_config(pkg).version
|
292
|
-
end
|
293
|
-
|
294
|
-
def check_version?(pkg, major = 0, minor = 0, micro = 0)
|
295
|
-
return false unless exist?(pkg)
|
296
|
-
ver = modversion(pkg).split(".").collect{|item| item.to_i}
|
297
|
-
(0..2).each {|i| ver[i] = 0 unless ver[i]}
|
298
|
-
|
299
|
-
(ver[0] > major ||
|
300
|
-
(ver[0] == major && ver[1] > minor) ||
|
301
|
-
(ver[0] == major && ver[1] == minor &&
|
302
|
-
ver[2] >= micro))
|
303
|
-
end
|
304
|
-
|
305
|
-
def have_package(pkg, major = nil, minor = 0, micro = 0)
|
306
|
-
if major.nil?
|
307
|
-
STDOUT.print("checking for #{pkg}... ")
|
308
|
-
else
|
309
|
-
STDOUT.print("checking for #{pkg} version (>= #{major}.#{minor}.#{micro})... ")
|
310
|
-
end
|
311
|
-
major ||= 0
|
312
|
-
STDOUT.flush
|
313
|
-
if check_version?(pkg, major, minor, micro)
|
314
|
-
STDOUT.print "yes\n"
|
315
|
-
libraries = libs_only_l(pkg)
|
316
|
-
dldflags = libs(pkg)
|
317
|
-
dldflags = (Shellwords.shellwords(dldflags) -
|
318
|
-
Shellwords.shellwords(libraries))
|
319
|
-
dldflags = dldflags.map {|s| /\s/ =~ s ? "\"#{s}\"" : s }.join(' ')
|
320
|
-
$libs += ' ' + libraries
|
321
|
-
if /mswin32/ =~ RUBY_PLATFORM
|
322
|
-
$DLDFLAGS += ' ' + dldflags
|
323
|
-
else
|
324
|
-
$LDFLAGS += ' ' + dldflags
|
325
|
-
end
|
326
|
-
$CFLAGS += ' ' + cflags(pkg)
|
327
|
-
true
|
328
|
-
else
|
329
|
-
STDOUT.print "no\n"
|
330
|
-
false
|
331
|
-
end
|
332
|
-
end
|
333
|
-
end
|