activegroonga 1.0.4 → 1.0.5
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.
- data/README.textile +55 -0
- data/Rakefile +45 -165
- data/{license/LGPL → doc/text/lgpl.txt} +0 -0
- data/doc/text/news.textile +60 -0
- data/doc/text/tutorial.textile +3 -0
- data/lib/active_groonga/base.rb +50 -2
- data/lib/active_groonga/railtie.rb +6 -5
- data/lib/active_groonga/railties/groonga.rake +8 -4
- data/lib/active_groonga/result_set.rb +133 -8
- data/lib/active_groonga/version.rb +1 -1
- data/test/active-groonga-test-utils.rb +6 -0
- data/test/run-test.rb +11 -24
- data/test/test-base.rb +10 -4
- data/test/test-result-set.rb +121 -9
- metadata +90 -138
- data/AUTHORS +0 -1
- data/NEWS.ja.rdoc +0 -46
- data/NEWS.rdoc +0 -46
- data/README.ja.rdoc +0 -52
- data/README.rdoc +0 -52
- data/test-unit-notify/Rakefile +0 -47
- data/test-unit-notify/lib/test/unit/notify.rb +0 -104
- data/test-unit/COPYING +0 -56
- data/test-unit/GPL +0 -340
- data/test-unit/PSFL +0 -271
- data/test-unit/Rakefile +0 -53
- data/test-unit/TODO +0 -5
- data/test-unit/bin/testrb +0 -5
- data/test-unit/html/bar.svg +0 -153
- data/test-unit/html/developer.svg +0 -469
- data/test-unit/html/favicon.ico +0 -0
- data/test-unit/html/favicon.svg +0 -82
- data/test-unit/html/heading-mark.svg +0 -393
- data/test-unit/html/index.html +0 -247
- data/test-unit/html/index.html.ja +0 -270
- data/test-unit/html/install.svg +0 -636
- data/test-unit/html/logo.svg +0 -483
- data/test-unit/html/test-unit.css +0 -339
- data/test-unit/html/tutorial.svg +0 -559
- data/test-unit/lib/test/unit.rb +0 -328
- data/test-unit/lib/test/unit/assertionfailederror.rb +0 -25
- data/test-unit/lib/test/unit/assertions.rb +0 -1334
- data/test-unit/lib/test/unit/attribute.rb +0 -125
- data/test-unit/lib/test/unit/autorunner.rb +0 -363
- data/test-unit/lib/test/unit/collector.rb +0 -36
- data/test-unit/lib/test/unit/collector/descendant.rb +0 -23
- data/test-unit/lib/test/unit/collector/dir.rb +0 -108
- data/test-unit/lib/test/unit/collector/load.rb +0 -144
- data/test-unit/lib/test/unit/collector/objectspace.rb +0 -34
- data/test-unit/lib/test/unit/color-scheme.rb +0 -106
- data/test-unit/lib/test/unit/color.rb +0 -96
- data/test-unit/lib/test/unit/diff.rb +0 -740
- data/test-unit/lib/test/unit/error.rb +0 -130
- data/test-unit/lib/test/unit/exceptionhandler.rb +0 -39
- data/test-unit/lib/test/unit/failure.rb +0 -136
- data/test-unit/lib/test/unit/fixture.rb +0 -176
- data/test-unit/lib/test/unit/notification.rb +0 -129
- data/test-unit/lib/test/unit/omission.rb +0 -191
- data/test-unit/lib/test/unit/pending.rb +0 -150
- data/test-unit/lib/test/unit/priority.rb +0 -180
- data/test-unit/lib/test/unit/runner/console.rb +0 -52
- data/test-unit/lib/test/unit/runner/emacs.rb +0 -8
- data/test-unit/lib/test/unit/runner/tap.rb +0 -8
- data/test-unit/lib/test/unit/testcase.rb +0 -483
- data/test-unit/lib/test/unit/testresult.rb +0 -121
- data/test-unit/lib/test/unit/testsuite.rb +0 -110
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +0 -14
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +0 -430
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +0 -63
- data/test-unit/lib/test/unit/ui/tap/testrunner.rb +0 -82
- data/test-unit/lib/test/unit/ui/testrunner.rb +0 -53
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +0 -77
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +0 -41
- data/test-unit/lib/test/unit/util/backtracefilter.rb +0 -42
- data/test-unit/lib/test/unit/util/method-owner-finder.rb +0 -28
- data/test-unit/lib/test/unit/util/observable.rb +0 -90
- data/test-unit/lib/test/unit/util/output.rb +0 -31
- data/test-unit/lib/test/unit/util/procwrapper.rb +0 -48
- data/test-unit/lib/test/unit/version.rb +0 -7
- data/test-unit/sample/adder.rb +0 -13
- data/test-unit/sample/subtracter.rb +0 -12
- data/test-unit/sample/test_adder.rb +0 -20
- data/test-unit/sample/test_subtracter.rb +0 -20
- data/test-unit/sample/test_user.rb +0 -23
- data/test-unit/test/collector/test-descendant.rb +0 -133
- data/test-unit/test/collector/test-load.rb +0 -442
- data/test-unit/test/collector/test_dir.rb +0 -406
- data/test-unit/test/collector/test_objectspace.rb +0 -100
- data/test-unit/test/run-test.rb +0 -15
- data/test-unit/test/test-attribute.rb +0 -86
- data/test-unit/test/test-color-scheme.rb +0 -69
- data/test-unit/test/test-color.rb +0 -47
- data/test-unit/test/test-diff.rb +0 -518
- data/test-unit/test/test-emacs-runner.rb +0 -60
- data/test-unit/test/test-fixture.rb +0 -287
- data/test-unit/test/test-notification.rb +0 -33
- data/test-unit/test/test-omission.rb +0 -81
- data/test-unit/test/test-pending.rb +0 -70
- data/test-unit/test/test-priority.rb +0 -119
- data/test-unit/test/test-testcase.rb +0 -544
- data/test-unit/test/test_assertions.rb +0 -1197
- data/test-unit/test/test_error.rb +0 -26
- data/test-unit/test/test_failure.rb +0 -33
- data/test-unit/test/test_testresult.rb +0 -113
- data/test-unit/test/test_testsuite.rb +0 -129
- data/test-unit/test/testunit-test-util.rb +0 -14
- data/test-unit/test/ui/test_tap.rb +0 -33
- data/test-unit/test/ui/test_testrunmediator.rb +0 -20
- data/test-unit/test/util/test-method-owner-finder.rb +0 -38
- data/test-unit/test/util/test-output.rb +0 -11
- data/test-unit/test/util/test_backtracefilter.rb +0 -41
- data/test-unit/test/util/test_observable.rb +0 -102
- data/test-unit/test/util/test_procwrapper.rb +0 -36
data/README.textile
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
h1. README
|
|
2
|
+
|
|
3
|
+
h2. Name
|
|
4
|
+
|
|
5
|
+
ActiveGroonga
|
|
6
|
+
|
|
7
|
+
h2. Description
|
|
8
|
+
|
|
9
|
+
A library to use groonga with ActiveRecord like API.
|
|
10
|
+
|
|
11
|
+
groonga provides both of full text search and column store
|
|
12
|
+
features. ActiveGroonga + groonga can be used as an
|
|
13
|
+
alternative of ActiveRecord + RDB.
|
|
14
|
+
|
|
15
|
+
ActiveGroonga is based on rroonga. See the following URLs
|
|
16
|
+
about rroonga and groonga.
|
|
17
|
+
|
|
18
|
+
* "rroonga":http://groonga.rubyforge.org/
|
|
19
|
+
* "groonga":http://groonga.org/
|
|
20
|
+
|
|
21
|
+
h2. Authors
|
|
22
|
+
|
|
23
|
+
* Kouhei Sutou <kou@clear-code.com>
|
|
24
|
+
|
|
25
|
+
h2. License
|
|
26
|
+
|
|
27
|
+
LGPL 2.1. See license/LGPL for details.
|
|
28
|
+
|
|
29
|
+
(Kouhei Sutou has a right to change license inclidng
|
|
30
|
+
contributed patches.)
|
|
31
|
+
|
|
32
|
+
h2. Dependencies
|
|
33
|
+
|
|
34
|
+
* rroonga
|
|
35
|
+
|
|
36
|
+
h2. Install
|
|
37
|
+
|
|
38
|
+
<pre>
|
|
39
|
+
!!!command_line
|
|
40
|
+
% sudo gem install activegroonga
|
|
41
|
+
</pre>
|
|
42
|
+
|
|
43
|
+
h2. Documents
|
|
44
|
+
|
|
45
|
+
* "Reference manual in English":http://groonga.rubyforge.org/rroonga/en/
|
|
46
|
+
* "Reference manual in Japanese":http://groonga.rubyforge.org/rroonga/ja/
|
|
47
|
+
|
|
48
|
+
h2. Mailing list
|
|
49
|
+
|
|
50
|
+
* English: "groonga-users-en":http://rubyforge.org/mailman/listinfo/groonga-users-en
|
|
51
|
+
* Japanese: "groonga-dev":http://lists.sourceforge.jp/mailman/listinfo/groonga-dev
|
|
52
|
+
|
|
53
|
+
h2. Thanks
|
|
54
|
+
|
|
55
|
+
* ...
|
data/Rakefile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# -*- coding: utf-8; mode: ruby -*-
|
|
2
2
|
#
|
|
3
|
-
# Copyright (C) 2009 Kouhei Sutou <kou@clear-code.com>
|
|
3
|
+
# Copyright (C) 2009-2011 Kouhei Sutou <kou@clear-code.com>
|
|
4
4
|
#
|
|
5
5
|
# This library is free software; you can redistribute it and/or
|
|
6
6
|
# modify it under the terms of the GNU Lesser General Public
|
|
@@ -17,199 +17,79 @@
|
|
|
17
17
|
|
|
18
18
|
require 'English'
|
|
19
19
|
|
|
20
|
-
require 'find'
|
|
21
|
-
require 'fileutils'
|
|
22
20
|
require 'pathname'
|
|
23
|
-
require 'erb'
|
|
24
21
|
require 'rubygems'
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
require 'hoe'
|
|
29
|
-
|
|
30
|
-
ENV["NODOT"] = "yes"
|
|
22
|
+
require 'rubygems/package_task'
|
|
23
|
+
require "jeweler"
|
|
24
|
+
require "packnga"
|
|
31
25
|
|
|
32
|
-
base_dir =
|
|
33
|
-
truncate_base_dir = Proc.new do |x|
|
|
34
|
-
x.gsub(/^#{Regexp.escape(base_dir + File::SEPARATOR)}/, '')
|
|
35
|
-
end
|
|
26
|
+
base_dir = Pathname.new(__FILE__).dirname.expand_path
|
|
36
27
|
|
|
37
|
-
@rroonga_base_dir =
|
|
38
|
-
rroonga_ext_dir =
|
|
39
|
-
rroonga_lib_dir =
|
|
40
|
-
$LOAD_PATH.unshift(rroonga_ext_dir)
|
|
41
|
-
$LOAD_PATH.unshift(rroonga_lib_dir)
|
|
28
|
+
@rroonga_base_dir = base_dir.parent.expand_path + 'rroonga'
|
|
29
|
+
rroonga_ext_dir = @rroonga_base_dir + 'ext' + "groonga"
|
|
30
|
+
rroonga_lib_dir = @rroonga_base_dir + 'lib'
|
|
31
|
+
$LOAD_PATH.unshift(rroonga_ext_dir.to_s)
|
|
32
|
+
$LOAD_PATH.unshift(rroonga_lib_dir.to_s)
|
|
42
33
|
ENV["RUBYLIB"] = "#{rroonga_lib_dir}:#{rroonga_ext_dir}:#{ENV['RUBYLIB']}"
|
|
43
34
|
|
|
44
|
-
active_groonga_lib_dir =
|
|
45
|
-
$LOAD_PATH.unshift(active_groonga_lib_dir)
|
|
35
|
+
active_groonga_lib_dir = base_dir + "lib"
|
|
36
|
+
$LOAD_PATH.unshift(active_groonga_lib_dir.to_s)
|
|
46
37
|
|
|
47
38
|
def guess_version
|
|
48
39
|
require 'active_groonga/version'
|
|
49
40
|
ActiveGroonga::VERSION::STRING
|
|
50
41
|
end
|
|
51
42
|
|
|
52
|
-
manifest = File.join(base_dir, "Manifest.txt")
|
|
53
|
-
manifest_contents = []
|
|
54
|
-
base_dir_included_components = %w(AUTHORS
|
|
55
|
-
NEWS.rdoc NEWS.ja.rdoc
|
|
56
|
-
README.rdoc README.ja.rdoc
|
|
57
|
-
Rakefile extconf.rb)
|
|
58
|
-
excluded_components = %w(.cvsignore .gdb_history CVS depend Makefile pkg
|
|
59
|
-
.git .svn doc vendor .test-result)
|
|
60
|
-
excluded_suffixes = %w(.png .ps .pdf .o .so .a .txt .~)
|
|
61
|
-
Find.find(base_dir) do |target|
|
|
62
|
-
target = truncate_base_dir[target]
|
|
63
|
-
components = target.split(File::SEPARATOR)
|
|
64
|
-
if components.size == 1 and !File.directory?(target)
|
|
65
|
-
next unless base_dir_included_components.include?(components[0])
|
|
66
|
-
end
|
|
67
|
-
Find.prune if (excluded_components - components) != excluded_components
|
|
68
|
-
next if excluded_suffixes.include?(File.extname(target))
|
|
69
|
-
manifest_contents << target if File.file?(target)
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
File.open(manifest, "w") do |f|
|
|
73
|
-
f.puts manifest_contents.sort.join("\n")
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
# For Hoe's no user friendly default behavior. :<
|
|
77
|
-
File.open("README.txt", "w") {|file| file << "= Dummy README\n== XXX\n"}
|
|
78
|
-
FileUtils.cp("NEWS.rdoc", "History.txt")
|
|
79
|
-
at_exit do
|
|
80
|
-
FileUtils.rm_f("README.txt")
|
|
81
|
-
FileUtils.rm_f("History.txt")
|
|
82
|
-
FileUtils.rm_f(manifest)
|
|
83
|
-
end
|
|
84
|
-
|
|
85
43
|
def cleanup_white_space(entry)
|
|
86
44
|
entry.gsub(/(\A\n+|\n+\z)/, '') + "\n"
|
|
87
45
|
end
|
|
88
46
|
|
|
89
47
|
ENV["VERSION"] ||= guess_version
|
|
90
48
|
version = ENV["VERSION"].dup
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
else
|
|
102
|
-
nil
|
|
103
|
-
end
|
|
104
|
-
end.compact
|
|
105
|
-
project.email = ['groonga-users-en@rubyforge.org',
|
|
106
|
-
'groonga-dev@lists.sourceforge.jp']
|
|
107
|
-
project.url = 'http://groonga.rubyforge.org/'
|
|
108
|
-
project.testlib = :testunit2
|
|
109
|
-
project.test_globs = ["test/run-test.rb"]
|
|
110
|
-
project.spec_extras = {
|
|
111
|
-
:extra_rdoc_files => Dir.glob("*.rdoc"),
|
|
112
|
-
}
|
|
113
|
-
project.readme_file = "README.ja.rdoc"
|
|
114
|
-
project.extra_deps = [["rroonga", ">= 1.0.4"],
|
|
115
|
-
["activemodel", ">= 3.0.1"]]
|
|
116
|
-
|
|
117
|
-
news_of_current_release = File.read("NEWS.rdoc").split(/^==\s.*$/)[1]
|
|
118
|
-
project.changes = cleanup_white_space(news_of_current_release)
|
|
119
|
-
|
|
120
|
-
entries = File.read("README.rdoc").split(/^==\s(.*)$/)
|
|
49
|
+
spec = nil
|
|
50
|
+
Jeweler::Tasks.new do |_spec|
|
|
51
|
+
spec = _spec
|
|
52
|
+
spec.name = "activegroonga"
|
|
53
|
+
spec.version = version
|
|
54
|
+
spec.rubyforge_project = "groonga"
|
|
55
|
+
spec.homepage = "http://groonga.rubyforge.org/"
|
|
56
|
+
spec.authors = ["Kouhei Sutou"]
|
|
57
|
+
spec.email = ["kou@clear-code.com"]
|
|
58
|
+
entries = File.read("README.textile").split(/^h2\.\s(.*)$/)
|
|
121
59
|
description = cleanup_white_space(entries[entries.index("Description") + 1])
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
options = rdoc_task.options
|
|
131
|
-
t_option_index = options.index("-t") || options.index("--title")
|
|
132
|
-
rdoc_task.options[t_option_index, 2] = nil
|
|
133
|
-
rdoc_task.title = "ActiveGroonga - #{version}"
|
|
134
|
-
rdoc_task.rdoc_files = Dir.glob("lib/**/*.rb")
|
|
135
|
-
rdoc_task.rdoc_files += Dir.glob("*.rdoc")
|
|
60
|
+
spec.summary, spec.description, = description.split(/\n\n+/, 3)
|
|
61
|
+
spec.license = "LGPLv2"
|
|
62
|
+
spec.files = FileList["{lib,test}/**/*.rb",
|
|
63
|
+
"lib/**/railties/**/*.rake",
|
|
64
|
+
"lib/**/locale/**/*.yml",
|
|
65
|
+
"Rakefile",
|
|
66
|
+
"README.textile",
|
|
67
|
+
"doc/text/**/*"]
|
|
136
68
|
end
|
|
137
69
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
include ERB::Util
|
|
142
|
-
|
|
143
|
-
def apply_template(file, head, header, footer)
|
|
144
|
-
content = File.read(file)
|
|
145
|
-
content = content.sub(/lang="en"/, 'lang="ja"')
|
|
146
|
-
|
|
147
|
-
title = nil
|
|
148
|
-
content = content.sub(/<title>(.+?)<\/title>/) do
|
|
149
|
-
title = $1
|
|
150
|
-
head.result(binding)
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
content = content.sub(/<body(?:.*?)>/) do |body_start|
|
|
154
|
-
"#{body_start}\n#{header.result(binding)}\n"
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
content = content.sub(/<\/body/) do |body_end|
|
|
158
|
-
"\n#{footer.result(binding)}\n#{body_end}"
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
File.open(file, "w") do |file|
|
|
162
|
-
file.print(content)
|
|
163
|
-
end
|
|
70
|
+
Rake::Task["release"].prerequisites.clear
|
|
71
|
+
Jeweler::RubygemsDotOrgTasks.new do
|
|
164
72
|
end
|
|
165
73
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
template = File.read(file)
|
|
169
|
-
erb = ERB.new(template, nil, "-")
|
|
170
|
-
erb.filename = file
|
|
171
|
-
erb
|
|
74
|
+
Gem::PackageTask.new(spec) do |pkg|
|
|
75
|
+
pkg.need_tar_gz = true
|
|
172
76
|
end
|
|
173
77
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
Find.find("doc") do |file|
|
|
179
|
-
if /\.html\z/ =~ file and /_(?:c|rb)\.html\z/ !~ file
|
|
180
|
-
apply_template(file, head, header, footer)
|
|
181
|
-
end
|
|
78
|
+
Packnga::DocumentTask.new(spec) do |task|
|
|
79
|
+
task.yard do |yard_task|
|
|
80
|
+
yard_task.options += ["--exclude", "/templates/"]
|
|
81
|
+
yard_task.options += ["--markup", "textile"]
|
|
182
82
|
end
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
namespace :backward_compatibility do
|
|
186
|
-
desc "Publish HTML for backward compatibility."
|
|
187
|
-
task :publish_html do
|
|
188
|
-
config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
|
|
189
|
-
host = "#{config["username"]}@rubyforge.org"
|
|
190
|
-
|
|
191
|
-
rsync_args = "-av --exclude .svn --delete"
|
|
192
|
-
remote_dir = "/var/www/gforge-projects/#{project.rubyforge_name}/"
|
|
193
|
-
mkdir_p "active_groonga"
|
|
194
|
-
File.open("active_groonga/.htaccess", "w") do |htaccess|
|
|
195
|
-
htaccess.puts(<<-EOH)
|
|
196
|
-
Redirect permanent / http://groonga.rubyforge.org/activegroonga/
|
|
197
|
-
EOH
|
|
198
|
-
end
|
|
199
|
-
sh "rsync #{rsync_args} active_groonga/ #{host}:#{remote_dir}"
|
|
83
|
+
task.reference do |reference_task|
|
|
84
|
+
# reference_task.mode = "xhtml"
|
|
200
85
|
end
|
|
201
86
|
end
|
|
202
87
|
|
|
203
|
-
|
|
204
|
-
task :tag do
|
|
205
|
-
sh("git tag -a #{version} -m 'release #{version}!!!'")
|
|
88
|
+
Packnga::ReleaseTask.new(spec) do |task|
|
|
206
89
|
end
|
|
207
90
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
spec = project.spec
|
|
211
|
-
spec_name = File.join(base_dir, project.spec.spec_name)
|
|
212
|
-
File.open(spec_name, "w") do |spec_file|
|
|
213
|
-
spec_file.puts(spec.to_ruby)
|
|
214
|
-
end
|
|
91
|
+
task :test do
|
|
92
|
+
ruby("test/run-test.rb")
|
|
215
93
|
end
|
|
94
|
+
|
|
95
|
+
task :default => :test
|
|
File without changes
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
h1. NEWS
|
|
2
|
+
|
|
3
|
+
h2. 1.0.5: 2011-05-01
|
|
4
|
+
|
|
5
|
+
h3. Improvements
|
|
6
|
+
|
|
7
|
+
* Supported Rails 3.1.0.
|
|
8
|
+
* groonga:seed showes seed candidate files on not found.
|
|
9
|
+
* Used YARD.
|
|
10
|
+
* Added {ActiveGroonga::Base.sort_keys}.
|
|
11
|
+
* Added {ActiveGroonga::Base.limit}.
|
|
12
|
+
|
|
13
|
+
h3. Fixes
|
|
14
|
+
|
|
15
|
+
* Fixed groonga:seed dependency.
|
|
16
|
+
|
|
17
|
+
h2. 1.0.4: 2011-04-01
|
|
18
|
+
|
|
19
|
+
h3. Improvements
|
|
20
|
+
|
|
21
|
+
* Supported Kaminari. (View interface only)
|
|
22
|
+
|
|
23
|
+
h2. 1.0.3: 2010-12-25
|
|
24
|
+
|
|
25
|
+
h3. Improvements
|
|
26
|
+
|
|
27
|
+
* Supported score.
|
|
28
|
+
|
|
29
|
+
h2. 1.0.1: 2010-11-29
|
|
30
|
+
|
|
31
|
+
h3. Improvements
|
|
32
|
+
|
|
33
|
+
* generator: Supported table type customize.
|
|
34
|
+
* Added ActiveGroonga::Base.exists?.
|
|
35
|
+
* Added ActiveGroonga::Base.all.
|
|
36
|
+
|
|
37
|
+
h3. Changes
|
|
38
|
+
|
|
39
|
+
* Changed to use record key instead of record ID for record
|
|
40
|
+
identifier for hash table and patricia trie.
|
|
41
|
+
|
|
42
|
+
h2. 1.0.0: 2010-11-29
|
|
43
|
+
|
|
44
|
+
* Support Rails 3.
|
|
45
|
+
|
|
46
|
+
h2. 0.0.7: 2009-10-02
|
|
47
|
+
|
|
48
|
+
* Support Ruby/groonga 0.0.7.
|
|
49
|
+
|
|
50
|
+
h2. 0.0.6: 2009-07-31
|
|
51
|
+
|
|
52
|
+
* Support Ruby/groonga 0.0.6.
|
|
53
|
+
|
|
54
|
+
h2. 0.0.2: 2009-06-05
|
|
55
|
+
|
|
56
|
+
* Support Ruby/groonga 0.0.2.
|
|
57
|
+
|
|
58
|
+
h2. 0.0.1: 2009-04-30
|
|
59
|
+
|
|
60
|
+
* Initial release!
|
data/lib/active_groonga/base.rb
CHANGED
|
@@ -38,6 +38,45 @@ module ActiveGroonga
|
|
|
38
38
|
@@encoding = "utf8"
|
|
39
39
|
cattr_reader :encoding, :instance_reader => false
|
|
40
40
|
|
|
41
|
+
# The default sort keys for {ResultSet#sort} and
|
|
42
|
+
# {ResultSet#paginate}.
|
|
43
|
+
#
|
|
44
|
+
# @scope class
|
|
45
|
+
# @attribute [rw] sort_keys
|
|
46
|
+
# @return [Array<Array<String, Symbol>>] An array of
|
|
47
|
+
# sort key. Each sort key is an array of sort key
|
|
48
|
+
# column name and order.
|
|
49
|
+
# @example
|
|
50
|
+
# # Sorts by "name" column value in ascending order by default.
|
|
51
|
+
# User.sort_keys = [["name", :ascending]]
|
|
52
|
+
#
|
|
53
|
+
# # Sorts by "name" column value in ascending order and
|
|
54
|
+
# # sorts by "age" column value in descending order for
|
|
55
|
+
# # the same name records by default.
|
|
56
|
+
# User.sort_keys = [["name", :ascending], ["age", :descending]]
|
|
57
|
+
#
|
|
58
|
+
# # Sorts by id value in ascending order by default.
|
|
59
|
+
# User.sort_keys = nil
|
|
60
|
+
#
|
|
61
|
+
# @since 1.0.5
|
|
62
|
+
class_attribute :sort_keys
|
|
63
|
+
|
|
64
|
+
# The default limit for {ResultSet#sort} and
|
|
65
|
+
# {ResultSet#paginate}.
|
|
66
|
+
#
|
|
67
|
+
# @scope class
|
|
68
|
+
# @attribute [rw] limit
|
|
69
|
+
# @return [Integer] The default limit value.
|
|
70
|
+
# @example
|
|
71
|
+
# # Limits sorted records by default.
|
|
72
|
+
# User.limit = 20
|
|
73
|
+
#
|
|
74
|
+
# # Doesn't limit sorted records by default.
|
|
75
|
+
# User.limit = nil
|
|
76
|
+
#
|
|
77
|
+
# @since 1.0.5
|
|
78
|
+
class_attribute :limit
|
|
79
|
+
|
|
41
80
|
class << self
|
|
42
81
|
def configure(configuration)
|
|
43
82
|
case configuration
|
|
@@ -100,11 +139,11 @@ module ActiveGroonga
|
|
|
100
139
|
records = table.select do |record|
|
|
101
140
|
yield(record)
|
|
102
141
|
end
|
|
103
|
-
|
|
142
|
+
create_result_set(records, :expression => records.expression)
|
|
104
143
|
end
|
|
105
144
|
|
|
106
145
|
def all(options={})
|
|
107
|
-
|
|
146
|
+
create_result_set(table)
|
|
108
147
|
end
|
|
109
148
|
|
|
110
149
|
def count
|
|
@@ -207,6 +246,15 @@ module ActiveGroonga
|
|
|
207
246
|
def instance_method_already_implemented?(method_name)
|
|
208
247
|
super(method_name)
|
|
209
248
|
end
|
|
249
|
+
|
|
250
|
+
private
|
|
251
|
+
def create_result_set(records, options={})
|
|
252
|
+
default_options = {
|
|
253
|
+
:default_sort_keys => sort_keys,
|
|
254
|
+
:default_limit => limit,
|
|
255
|
+
}
|
|
256
|
+
ResultSet.new(records, self, default_options.merge(options))
|
|
257
|
+
end
|
|
210
258
|
end
|
|
211
259
|
|
|
212
260
|
def initialize(record_or_attributes=nil)
|