rroonga 0.9.2-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. data/AUTHORS +5 -0
  2. data/NEWS.ja.rdoc +114 -0
  3. data/NEWS.rdoc +116 -0
  4. data/README.ja.rdoc +65 -0
  5. data/README.rdoc +66 -0
  6. data/Rakefile +206 -0
  7. data/benchmark/common.rb +49 -0
  8. data/benchmark/read-write-many-small-items.rb +144 -0
  9. data/benchmark/write-many-small-items.rb +135 -0
  10. data/example/bookmark.rb +161 -0
  11. data/example/index-html.rb +89 -0
  12. data/example/search/config.ru +230 -0
  13. data/example/search/public/css/groonga.css +122 -0
  14. data/ext/.gitignore +2 -0
  15. data/ext/groonga/extconf.rb +93 -0
  16. data/ext/groonga/rb-grn-accessor.c +52 -0
  17. data/ext/groonga/rb-grn-array-cursor.c +36 -0
  18. data/ext/groonga/rb-grn-array.c +210 -0
  19. data/ext/groonga/rb-grn-column.c +573 -0
  20. data/ext/groonga/rb-grn-context.c +662 -0
  21. data/ext/groonga/rb-grn-database.c +472 -0
  22. data/ext/groonga/rb-grn-encoding-support.c +64 -0
  23. data/ext/groonga/rb-grn-encoding.c +257 -0
  24. data/ext/groonga/rb-grn-exception.c +1110 -0
  25. data/ext/groonga/rb-grn-expression-builder.c +75 -0
  26. data/ext/groonga/rb-grn-expression.c +731 -0
  27. data/ext/groonga/rb-grn-fix-size-column.c +166 -0
  28. data/ext/groonga/rb-grn-hash-cursor.c +38 -0
  29. data/ext/groonga/rb-grn-hash.c +294 -0
  30. data/ext/groonga/rb-grn-index-column.c +488 -0
  31. data/ext/groonga/rb-grn-logger.c +504 -0
  32. data/ext/groonga/rb-grn-object.c +1369 -0
  33. data/ext/groonga/rb-grn-operation.c +198 -0
  34. data/ext/groonga/rb-grn-patricia-trie-cursor.c +39 -0
  35. data/ext/groonga/rb-grn-patricia-trie.c +488 -0
  36. data/ext/groonga/rb-grn-procedure.c +52 -0
  37. data/ext/groonga/rb-grn-query.c +260 -0
  38. data/ext/groonga/rb-grn-record.c +40 -0
  39. data/ext/groonga/rb-grn-snippet.c +334 -0
  40. data/ext/groonga/rb-grn-table-cursor-key-support.c +69 -0
  41. data/ext/groonga/rb-grn-table-cursor.c +247 -0
  42. data/ext/groonga/rb-grn-table-key-support.c +714 -0
  43. data/ext/groonga/rb-grn-table.c +1977 -0
  44. data/ext/groonga/rb-grn-type.c +181 -0
  45. data/ext/groonga/rb-grn-utils.c +769 -0
  46. data/ext/groonga/rb-grn-variable-size-column.c +36 -0
  47. data/ext/groonga/rb-grn-variable.c +108 -0
  48. data/ext/groonga/rb-grn-view-accessor.c +53 -0
  49. data/ext/groonga/rb-grn-view-cursor.c +35 -0
  50. data/ext/groonga/rb-grn-view-record.c +41 -0
  51. data/ext/groonga/rb-grn-view.c +421 -0
  52. data/ext/groonga/rb-grn.h +698 -0
  53. data/ext/groonga/rb-groonga.c +107 -0
  54. data/extconf.rb +130 -0
  55. data/html/bar.svg +153 -0
  56. data/html/developer.html +117 -0
  57. data/html/developer.svg +469 -0
  58. data/html/download.svg +253 -0
  59. data/html/favicon.ico +0 -0
  60. data/html/favicon.xcf +0 -0
  61. data/html/footer.html.erb +28 -0
  62. data/html/head.html.erb +4 -0
  63. data/html/header.html.erb +17 -0
  64. data/html/index.html +147 -0
  65. data/html/install.svg +636 -0
  66. data/html/logo.xcf +0 -0
  67. data/html/ranguba.css +250 -0
  68. data/html/tutorial.svg +559 -0
  69. data/lib/1.8/groonga.so +0 -0
  70. data/lib/1.9/groonga.so +0 -0
  71. data/lib/groonga.rb +90 -0
  72. data/lib/groonga/context.rb +184 -0
  73. data/lib/groonga/expression-builder.rb +324 -0
  74. data/lib/groonga/patricia-trie.rb +85 -0
  75. data/lib/groonga/record.rb +311 -0
  76. data/lib/groonga/schema.rb +1191 -0
  77. data/lib/groonga/view-record.rb +56 -0
  78. data/license/GPL +340 -0
  79. data/license/LGPL +504 -0
  80. data/license/RUBY +59 -0
  81. data/misc/grnop2ruby.rb +49 -0
  82. data/pkg-config.rb +333 -0
  83. data/rroonga-build.rb +57 -0
  84. data/test-unit/Rakefile +40 -0
  85. data/test-unit/TODO +5 -0
  86. data/test-unit/bin/testrb +5 -0
  87. data/test-unit/html/classic.html +15 -0
  88. data/test-unit/html/index.html +25 -0
  89. data/test-unit/html/index.html.ja +27 -0
  90. data/test-unit/lib/test/unit.rb +323 -0
  91. data/test-unit/lib/test/unit/assertionfailederror.rb +25 -0
  92. data/test-unit/lib/test/unit/assertions.rb +1230 -0
  93. data/test-unit/lib/test/unit/attribute.rb +125 -0
  94. data/test-unit/lib/test/unit/autorunner.rb +360 -0
  95. data/test-unit/lib/test/unit/collector.rb +36 -0
  96. data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
  97. data/test-unit/lib/test/unit/collector/dir.rb +108 -0
  98. data/test-unit/lib/test/unit/collector/load.rb +144 -0
  99. data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
  100. data/test-unit/lib/test/unit/color-scheme.rb +102 -0
  101. data/test-unit/lib/test/unit/color.rb +96 -0
  102. data/test-unit/lib/test/unit/diff.rb +724 -0
  103. data/test-unit/lib/test/unit/error.rb +130 -0
  104. data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
  105. data/test-unit/lib/test/unit/failure.rb +136 -0
  106. data/test-unit/lib/test/unit/fixture.rb +176 -0
  107. data/test-unit/lib/test/unit/notification.rb +129 -0
  108. data/test-unit/lib/test/unit/omission.rb +191 -0
  109. data/test-unit/lib/test/unit/pending.rb +150 -0
  110. data/test-unit/lib/test/unit/priority.rb +180 -0
  111. data/test-unit/lib/test/unit/runner/console.rb +52 -0
  112. data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
  113. data/test-unit/lib/test/unit/runner/tap.rb +8 -0
  114. data/test-unit/lib/test/unit/testcase.rb +476 -0
  115. data/test-unit/lib/test/unit/testresult.rb +89 -0
  116. data/test-unit/lib/test/unit/testsuite.rb +110 -0
  117. data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
  118. data/test-unit/lib/test/unit/ui/console/testrunner.rb +466 -0
  119. data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +63 -0
  120. data/test-unit/lib/test/unit/ui/tap/testrunner.rb +92 -0
  121. data/test-unit/lib/test/unit/ui/testrunner.rb +28 -0
  122. data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
  123. data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
  124. data/test-unit/lib/test/unit/util/backtracefilter.rb +41 -0
  125. data/test-unit/lib/test/unit/util/method-owner-finder.rb +28 -0
  126. data/test-unit/lib/test/unit/util/observable.rb +90 -0
  127. data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
  128. data/test-unit/lib/test/unit/version.rb +7 -0
  129. data/test-unit/sample/adder.rb +13 -0
  130. data/test-unit/sample/subtracter.rb +12 -0
  131. data/test-unit/sample/test_adder.rb +20 -0
  132. data/test-unit/sample/test_subtracter.rb +20 -0
  133. data/test-unit/sample/test_user.rb +23 -0
  134. data/test-unit/test/collector/test-descendant.rb +133 -0
  135. data/test-unit/test/collector/test-load.rb +442 -0
  136. data/test-unit/test/collector/test_dir.rb +406 -0
  137. data/test-unit/test/collector/test_objectspace.rb +100 -0
  138. data/test-unit/test/run-test.rb +15 -0
  139. data/test-unit/test/test-attribute.rb +86 -0
  140. data/test-unit/test/test-color-scheme.rb +67 -0
  141. data/test-unit/test/test-color.rb +47 -0
  142. data/test-unit/test/test-diff.rb +518 -0
  143. data/test-unit/test/test-emacs-runner.rb +60 -0
  144. data/test-unit/test/test-fixture.rb +287 -0
  145. data/test-unit/test/test-notification.rb +33 -0
  146. data/test-unit/test/test-omission.rb +81 -0
  147. data/test-unit/test/test-pending.rb +70 -0
  148. data/test-unit/test/test-priority.rb +119 -0
  149. data/test-unit/test/test-testcase.rb +544 -0
  150. data/test-unit/test/test_assertions.rb +1151 -0
  151. data/test-unit/test/test_error.rb +26 -0
  152. data/test-unit/test/test_failure.rb +33 -0
  153. data/test-unit/test/test_testresult.rb +113 -0
  154. data/test-unit/test/test_testsuite.rb +129 -0
  155. data/test-unit/test/testunit-test-util.rb +14 -0
  156. data/test-unit/test/ui/test_testrunmediator.rb +20 -0
  157. data/test-unit/test/util/test-method-owner-finder.rb +38 -0
  158. data/test-unit/test/util/test_backtracefilter.rb +41 -0
  159. data/test-unit/test/util/test_observable.rb +102 -0
  160. data/test-unit/test/util/test_procwrapper.rb +36 -0
  161. data/test/.gitignore +1 -0
  162. data/test/groonga-test-utils.rb +134 -0
  163. data/test/run-test.rb +58 -0
  164. data/test/test-array.rb +90 -0
  165. data/test/test-column.rb +316 -0
  166. data/test/test-context-select.rb +93 -0
  167. data/test/test-context.rb +73 -0
  168. data/test/test-database.rb +113 -0
  169. data/test/test-encoding.rb +33 -0
  170. data/test/test-exception.rb +93 -0
  171. data/test/test-expression-builder.rb +217 -0
  172. data/test/test-expression.rb +134 -0
  173. data/test/test-fix-size-column.rb +65 -0
  174. data/test/test-gqtp.rb +72 -0
  175. data/test/test-hash.rb +305 -0
  176. data/test/test-index-column.rb +81 -0
  177. data/test/test-logger.rb +37 -0
  178. data/test/test-patricia-trie.rb +205 -0
  179. data/test/test-procedure.rb +37 -0
  180. data/test/test-query.rb +22 -0
  181. data/test/test-record.rb +243 -0
  182. data/test/test-remote.rb +54 -0
  183. data/test/test-schema-view.rb +90 -0
  184. data/test/test-schema.rb +459 -0
  185. data/test/test-snippet.rb +130 -0
  186. data/test/test-table-cursor.rb +153 -0
  187. data/test/test-table-offset-and-limit.rb +102 -0
  188. data/test/test-table-select-normalize.rb +53 -0
  189. data/test/test-table-select.rb +150 -0
  190. data/test/test-table.rb +594 -0
  191. data/test/test-type.rb +71 -0
  192. data/test/test-variable-size-column.rb +98 -0
  193. data/test/test-variable.rb +28 -0
  194. data/test/test-vector-column.rb +76 -0
  195. data/test/test-version.rb +31 -0
  196. data/test/test-view.rb +72 -0
  197. data/text/TUTORIAL.ja.rdoc +392 -0
  198. data/text/expression.rdoc +284 -0
  199. metadata +276 -0
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if ARGV.size < 2 or ARGV.find {|option| option == "-h" or option == "--help"}
4
+ puts "Usage: #{$0} DATABASE_FILE [FILE_OR_DIRECTORY ...]"
5
+ exit
6
+ end
7
+
8
+ require 'pathname'
9
+
10
+ base_directory = Pathname(__FILE__).dirname + ".."
11
+ $LOAD_PATH.unshift((base_directory + "ext").to_s)
12
+ $LOAD_PATH.unshift((base_directory + "lib").to_s)
13
+
14
+ require 'rubygems'
15
+ require 'groonga'
16
+ require 'nokogiri'
17
+
18
+ database_file, *targets = ARGV
19
+
20
+ database_file = Pathname(database_file)
21
+ database_directory = database_file.dirname
22
+ database_directory.mkpath unless database_directory.exist?
23
+
24
+ if database_file.exist?
25
+ Groonga::Database.open(database_file.to_s)
26
+ else
27
+ Groonga::Database.create(:path => database_file.to_s)
28
+ Groonga::Schema.define do |schema|
29
+ schema.create_table("documents") do |table|
30
+ table.string("title")
31
+ table.text("content")
32
+ table.string("path")
33
+ table.time("last-modified")
34
+ end
35
+
36
+ schema.create_table("terms",
37
+ :type => :patricia_trie,
38
+ :key_normalize => true,
39
+ :default_tokenizer => "TokenBigram") do |table|
40
+ table.index("documents.title")
41
+ table.index("documents.content")
42
+ end
43
+ end
44
+ end
45
+
46
+ documents = Groonga::Context.default["documents"]
47
+
48
+ targets.each do |target|
49
+ target = Pathname(target)
50
+ target.find do |path|
51
+ throw :prune if path.basename.to_s == ".svn"
52
+ if path.file? and path.extname == ".html"
53
+ path.open do |html|
54
+ values = {:path => path.relative_path_from(target).to_s}
55
+ _documents = documents.select do |record|
56
+ record["path"] == values[:path]
57
+ end
58
+ if _documents.size.zero?
59
+ document = documents.add
60
+ else
61
+ document = _documents.to_a[0].key
62
+ end
63
+
64
+ html_document = Nokogiri::HTML(html)
65
+ html_document.css("title").each do |title|
66
+ values[:title] = title.text
67
+ end
68
+ contents = []
69
+ html_document.css("body").each do |body|
70
+ contents << body.text
71
+ end
72
+ html_document.css("img").each do |image|
73
+ image_content = []
74
+ title = image['title']
75
+ alt = image['alt']
76
+ image_content << title if title and !title.empty?
77
+ image_content << alt if alt and !alt.empty?
78
+ contents.concat(image_content) unless image_content.empty?
79
+ end
80
+ values[:content] = contents.join("\n")
81
+ values["last-modified"] = path.mtime
82
+
83
+ values.each do |key, value|
84
+ document[key] = value
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,230 @@
1
+ # -*- mode: ruby; coding: utf-8 -*-
2
+
3
+ base_dir = File.join(File.dirname(__FILE__), "..", "..")
4
+ $LOAD_PATH.unshift(File.join(base_dir, "ext"))
5
+ $LOAD_PATH.unshift(File.join(base_dir, "lib"))
6
+
7
+ require 'rubygems'
8
+ require 'rack'
9
+ require 'groonga'
10
+
11
+ use Rack::CommonLogger
12
+ use Rack::Runtime
13
+ use Rack::Static, :urls => ["/css", "/images"], :root => "public"
14
+ use Rack::ContentLength
15
+
16
+ Groonga::Database.new("data/database")
17
+
18
+ class Searcher
19
+ include Rack::Utils
20
+
21
+ def initialize
22
+ @documents = Groonga::Context.default["documents"]
23
+ end
24
+
25
+ def call(env)
26
+ request = Rack::Request.new(env)
27
+ response = Rack::Response.new
28
+ response["Content-Type"] = "text/html; charset=UTF-8"
29
+
30
+ if request.post? or request['query']
31
+ query = request['query'] || ''
32
+ if query.empty?
33
+ request.path_info = "/"
34
+ else
35
+ request.path_info = "/#{escape(query)}/"
36
+ end
37
+ response.redirect(request.url.split(/\?/, 2)[0])
38
+ return response.to_a
39
+ end
40
+
41
+ search(request, response)
42
+ end
43
+
44
+ private
45
+ def search(request, response)
46
+ response.write(<<-EOH)
47
+ <?xml version="1.0" encoding="utf-8"?>
48
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
49
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
50
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
51
+ <head>
52
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
53
+ <meta name="robot" content="noindex,nofollow" />
54
+ <title>groongaで全文検索</title>
55
+ <link rel="stylesheet" href="#{path(request, 'css/groonga.css')}"
56
+ type="text/css" media="all" />
57
+ </head>
58
+ <body>
59
+ <div class="header">
60
+ <h1>groongaで全文検索</h1>
61
+ </div>
62
+
63
+ <div class="content">
64
+ EOH
65
+
66
+ render_search_box(request, response)
67
+ render_search_result(request, response)
68
+
69
+ response.write(<<-EOF)
70
+ </div>
71
+
72
+ <div class="footer">
73
+ <p class="powered-by-groonga">
74
+ <a href="http://groonga.org/">groonga</a>
75
+ #{Groonga::VERSION.join('.')}を使っています。
76
+ </p>
77
+ <p class="powered-by-ruby-groonga">
78
+ <a href="http://groonga.rubyforge.org/">Ruby/groonga</a>
79
+ #{Groonga::BINDINGS_VERSION.join('.')}を使っています。
80
+ </p>
81
+ </div>
82
+
83
+ </body>
84
+ </html>
85
+ EOF
86
+ response.to_a
87
+ end
88
+
89
+ def query(request)
90
+ unescape(request.path_info.gsub(/\A\/|\/\z/, ''))
91
+ end
92
+
93
+ def page(request)
94
+ (request['page'] || 0).to_i
95
+ end
96
+
97
+ def path(request, component='')
98
+ escape_html("#{request.script_name}/#{component}")
99
+ end
100
+
101
+ def render_search_box(request, response)
102
+ response.write(<<-EOF)
103
+ <form method="post" action="#{path(request, '')}">
104
+ <p>
105
+ <a href="#{path(request, '')}">
106
+ <img src="#{path(request, 'images/mini-groonga.png')}" alt="groonga" />
107
+ </a>
108
+ <input name="query" type="text" value="#{escape_html(query(request))}" />
109
+ <input type="submit" value="検索" />
110
+ </p>
111
+ </form>
112
+ EOF
113
+ end
114
+
115
+ def render_search_result(request, response)
116
+ _query = query(request)
117
+ _page = page(request)
118
+ limit = 20
119
+ if _query.empty?
120
+ records = []
121
+ response.write(<<-EOS)
122
+ <div class='search-summary'>
123
+ <p>Rubyでgroonga使って全文検索</p>
124
+ </div>
125
+ EOS
126
+ else
127
+ options = {}
128
+ before = Time.now
129
+ records = @documents.select do |record|
130
+ record["content"].match(_query)
131
+ end
132
+ total_records = records.size
133
+ records = records.sort([["_score", "descending"],
134
+ ["last-modified", "descending"]],
135
+ :offset => _page * limit,
136
+ :limit => limit)
137
+ elapsed = Time.now - before
138
+
139
+ response.write(<<-EOS)
140
+ <div class='search-summary'>
141
+ <p>
142
+ <span class="keyword">#{escape_html(query(request))}</span>の検索結果:
143
+ <span class="total-entries">#{total_records}</span>件中
144
+ <span class="display-range">
145
+ #{total_records.zero? ? 0 : (_page * limit) + 1}
146
+ -
147
+ #{(_page * limit) + records.size}
148
+ </span>
149
+ 件(#{elapsed}秒)
150
+ </p>
151
+ </div>
152
+ EOS
153
+ end
154
+
155
+ response.write(" <div class='records'>\n")
156
+ records.each do |record|
157
+ render_record(request, response, record)
158
+ end
159
+ response.write(" </div>\n")
160
+
161
+ render_pagination(request, response, _page, limit, total_records)
162
+ end
163
+
164
+ def render_record(request, response, record)
165
+ response.write(" <div class='record'>\n")
166
+ href = escape_html(record['.path'])
167
+ title = escape_html(record['.title'])
168
+ last_modified = escape_html(record['.last-modified'].iso8601)
169
+ score = record.score
170
+ response.write(" <h2><a href='#{href}'>#{title}</a>(#{score})</h2>\n")
171
+ render_snippet(request, response, record)
172
+ response.write(<<-EOM)
173
+ <p class="metadata">
174
+ <span class="url">#{unescape(href)}</span>
175
+ -
176
+ <span class="last-modified">#{last_modified}</span>
177
+ </p>
178
+ EOM
179
+ response.write(" </div>\n")
180
+ end
181
+
182
+ def render_snippet(request, response, record)
183
+ expression = record.table.expression
184
+ snippet = expression.snippet([["<span class=\"keyword\">", "</span>"]],
185
+ :width => 100,
186
+ :html_escape => true,
187
+ :normalize => true)
188
+ separator = "\n<span class='separator'>...</span>\n"
189
+ response.write(<<-EOS)
190
+ <p class="snippet">
191
+ #{snippet.execute(record[".content"]).join(separator)}
192
+ </p>
193
+ EOS
194
+ end
195
+
196
+ def render_pagination(request, response, page, limit, total_records)
197
+ _query = query(request)
198
+ return if _query.empty?
199
+
200
+ return if total_records < limit
201
+
202
+ last_page = (total_records / limit.to_f).ceil
203
+ response.write("<div class='pagination'>\n")
204
+ if page > 0
205
+ render_pagination_link(request, response, _query, page - 1, "<<")
206
+ end
207
+ last_page.times do |i|
208
+ if i == page
209
+ response.write(pagination_span(escape_html(i)))
210
+ else
211
+ render_pagination_link(request, response, _query, i, i)
212
+ end
213
+ end
214
+ if page < (last_page - 1)
215
+ render_pagination_link(request, response, _query, page + 1, ">>")
216
+ end
217
+ response.write("</div>\n")
218
+ end
219
+
220
+ def render_pagination_link(request, response, query, page, label)
221
+ href = "./?page=#{escape_html(page)}"
222
+ response.write(pagination_span("<a href='#{href}'>#{label}</a>"))
223
+ end
224
+
225
+ def pagination_span(content)
226
+ "<span class='pagination-link'>#{content}</span>\n"
227
+ end
228
+ end
229
+
230
+ run Searcher.new
@@ -0,0 +1,122 @@
1
+ body
2
+ {
3
+ background-color: #fff;
4
+ color: #000;
5
+ }
6
+
7
+ div.header
8
+ {
9
+ display: none;
10
+ }
11
+
12
+ div.search-box
13
+ {
14
+ width: 100%;
15
+ text-align: center;
16
+ }
17
+
18
+ div.re-search
19
+ {
20
+ }
21
+
22
+ div.search-summary
23
+ {
24
+ font-size: small;
25
+ border-top: 1px solid #fc3;
26
+ background-color: #ffd;
27
+ }
28
+
29
+ div.search-summary p
30
+ {
31
+ padding: 3px;
32
+ margin: 0;
33
+ }
34
+
35
+ div.records
36
+ {
37
+ font-size: smaller;
38
+ padding-top: 10px;
39
+ padding-left: 30px;
40
+ margin-right: 20%;
41
+ margin-bottom: 30px;
42
+ }
43
+
44
+ div.records h2
45
+ {
46
+ padding: 0;
47
+ margin-bottom: 5px;
48
+ }
49
+
50
+ div.records p
51
+ {
52
+ }
53
+
54
+ p.snippet
55
+ {
56
+ padding: 0;
57
+ margin: 0;
58
+ }
59
+
60
+ p.snippet span.separator
61
+ {
62
+ font-weight: bold;
63
+ }
64
+
65
+ span.keyword,
66
+ span.total-entries,
67
+ span.display-range
68
+ {
69
+ font-weight: bold;
70
+ }
71
+
72
+ div.pagination
73
+ {
74
+ text-align: center;
75
+ margin-bottom: 20px;
76
+ }
77
+
78
+ p.metadata
79
+ {
80
+ padding: 0;
81
+ margin: 0;
82
+ margin-top: 5px;
83
+ }
84
+
85
+ span.url
86
+ {
87
+ color: green;
88
+ }
89
+
90
+ pre
91
+ {
92
+ overflow: auto;
93
+ margin: 20px 30px;
94
+ padding: 10px;
95
+ border-top: 1px solid #fc3;
96
+ background-color: #ffd;
97
+ }
98
+
99
+ a img
100
+ {
101
+ border-style: none;
102
+ }
103
+
104
+ ul.sources li
105
+ {
106
+ display: inline;
107
+ }
108
+
109
+ div.footer
110
+ {
111
+ border-top: 1px solid #fc3;
112
+ background-color: #ffd;
113
+ margin-top: 5px;
114
+ text-align: right;
115
+ }
116
+
117
+ div.footer p
118
+ {
119
+ font-size: small;
120
+ padding: 0;
121
+ margin: 0;
122
+ }
data/ext/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ *.so
2
+ *.o
@@ -0,0 +1,93 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2009-2010 Kouhei Sutou <kou@clear-code.com>
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License version 2.1 as published by the Free Software Foundation.
8
+ #
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU Lesser General Public
15
+ # License along with this library; if not, write to the Free Software
16
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
+
18
+ require 'pathname'
19
+
20
+ base_dir = Pathname(__FILE__).dirname.parent.parent
21
+ $LOAD_PATH.unshift(base_dir.to_s)
22
+
23
+ require 'English'
24
+ require 'mkmf'
25
+ require 'pkg-config'
26
+ require 'rroonga-build'
27
+
28
+ include RroongaBuild
29
+
30
+ package_name = "groonga"
31
+ module_name = "groonga"
32
+ major, minor, micro = RequiredGroongaVersion::VERSION
33
+
34
+ unless PKGConfig.have_package(package_name, major, minor, micro)
35
+ have_local_groonga?(package_name, major, minor, micro) or exit 1
36
+ add_rpath_for_local_groonga
37
+ end
38
+
39
+ real_version = PKGConfig.modversion(package_name)
40
+ real_major, real_minor, real_micro = real_version.split(/\./)
41
+
42
+ $defs << "-DRB_GRN_COMPILATION"
43
+
44
+ $defs << "-DGRN_MAJOR_VERSION=#{real_major}"
45
+ $defs << "-DGRN_MINOR_VERSION=#{real_minor}"
46
+ $defs << "-DGRN_MICRO_VERSION=#{real_micro}"
47
+
48
+ checking_for(checking_message("GCC")) do
49
+ if macro_defined?("__GNUC__", "")
50
+ $CFLAGS += ' -Wall'
51
+ true
52
+ else
53
+ false
54
+ end
55
+ end
56
+
57
+ checking_for(checking_message("Win32 OS")) do
58
+ win32 = /cygwin|mingw|mswin32/ =~ RUBY_PLATFORM
59
+ if win32
60
+ $defs << "-DRB_GRN_PLATFORM_WIN32"
61
+ import_library_name = "libruby-#{module_name}.a"
62
+ $DLDFLAGS << " -Wl,--out-implib=#{import_library_name}"
63
+ $cleanfiles << import_library_name
64
+ local_groonga_install_dir = base_dir + "vendor" + "local"
65
+ $CFLAGS += " -I#{local_groonga_install_dir}/include"
66
+ ["libgroonga.lib", "libgroonga.dll.a"].each do |libgroonga_base|
67
+ libgroonga = "#{local_groonga_install_dir}/lib/#{libgroonga_base}"
68
+ if File.exist?(libgroonga)
69
+ $libs += " #{libgroonga}"
70
+ break
71
+ end
72
+ end
73
+ end
74
+ win32
75
+ end
76
+
77
+ have_header("ruby/st.h") unless have_macro("HAVE_RUBY_ST_H", "ruby.h")
78
+ have_func("rb_errinfo", "ruby.h")
79
+ have_type("enum ruby_value_type", "ruby.h")
80
+
81
+ checking_for(checking_message("debug flag")) do
82
+ debug = with_config("debug")
83
+ if debug
84
+ debug_flag = "-DRB_GRN_DEBUG"
85
+ $defs << debug_flag unless $defs.include?(debug_flag)
86
+ end
87
+ debug
88
+ end
89
+
90
+ $INSTALLFILES ||= []
91
+ $INSTALLFILES << ["../../lib/**/*.rb", "$(RUBYLIBDIR)", "../../lib"]
92
+
93
+ create_makefile(module_name)