activegroonga 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/NEWS.ja.rdoc CHANGED
@@ -1,5 +1,11 @@
1
1
  = お知らせ
2
2
 
3
+ == 1.0.4: 2011-04-01
4
+
5
+ === 改良
6
+
7
+ * Kaminari対応。(Viewのみ)
8
+
3
9
  == 1.0.3: 2010-12-25
4
10
 
5
11
  === 改良
data/NEWS.rdoc CHANGED
@@ -1,5 +1,11 @@
1
1
  = NEWS
2
2
 
3
+ == 1.0.4: 2011-04-01
4
+
5
+ === Improvements
6
+
7
+ * Supported Kaminari. (View interface only)
8
+
3
9
  == 1.0.3: 2010-12-25
4
10
 
5
11
  === Improvements
data/README.ja.rdoc CHANGED
@@ -12,10 +12,10 @@ groongaは全文検索機能とカラムストアの機能を提供していま
12
12
  ActiveRecordとRDBの組み合わせの代わりに、ActiveGroongaと
13
13
  groongaの組み合わせを使うことができます。
14
14
 
15
- Ruby/groongaをベースとしています。Ruby/groongaとgroongaに関
16
- する情報は以下を参照して下さい。
15
+ rroongaをベースとしています。rroongaとgroongaに関する情報は以
16
+ 下を参照して下さい。
17
17
 
18
- * Ruby/groonga: http://groonga.rubyforge.org/
18
+ * rroonga: http://groonga.rubyforge.org/
19
19
  * groonga: http://groonga.org/
20
20
 
21
21
  == 作者
@@ -39,7 +39,7 @@ LGPL 2.1です。詳しくはlicense/LGPLを見てください。
39
39
 
40
40
  == ドキュメント
41
41
 
42
- http://groonga.rubyforge.org/active_groonga/
42
+ http://groonga.rubyforge.org/activegroonga/
43
43
 
44
44
  == メーリングリスト
45
45
 
data/README.rdoc CHANGED
@@ -12,10 +12,10 @@ groonga provides both of full text search and column store
12
12
  features. ActiveGroonga + groonga can be used as an
13
13
  alternative of ActiveRecord + RDB.
14
14
 
15
- ActiveGroonga is based on Ruby/groonga. See the following
16
- URLs about Ruby/groonga and groonga.
15
+ ActiveGroonga is based on rroonga. See the following URLs
16
+ about rroonga and groonga.
17
17
 
18
- * Ruby/groonga: http://groonga.rubyforge.org/
18
+ * rroonga: http://groonga.rubyforge.org/
19
19
  * groonga: http://groonga.org/
20
20
 
21
21
  == Author
@@ -41,7 +41,7 @@ contributed patches.)
41
41
 
42
42
  Japanese only. Sorry.
43
43
 
44
- http://groonga.rubyforge.org/active_groonga/
44
+ http://groonga.rubyforge.org/activegroonga/
45
45
 
46
46
  == Mailing list
47
47
 
data/Rakefile CHANGED
@@ -121,7 +121,7 @@ Hoe.spec('activegroonga') do |_project|
121
121
  description = cleanup_white_space(entries[entries.index("Description") + 1])
122
122
  project.summary, project.description, = description.split(/\n\n+/, 3)
123
123
 
124
- project.remote_rdoc_dir = "active_groonga"
124
+ project.remote_rdoc_dir = "activegroonga"
125
125
  end
126
126
 
127
127
  project.spec.dependencies.delete_if {|dependency| dependency.name == "hoe"}
@@ -182,6 +182,24 @@ task :prepare_docs_for_publishing do
182
182
  end
183
183
  end
184
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}"
200
+ end
201
+ end
202
+
185
203
  desc "Tag the current revision."
186
204
  task :tag do
187
205
  sh("git tag -a #{version} -m 'release #{version}!!!'")
@@ -33,6 +33,8 @@ module ActiveGroonga
33
33
  cattr_accessor :configurations
34
34
 
35
35
  @@context = nil
36
+ cattr_writer :context, :instance_writer => false
37
+
36
38
  @@encoding = "utf8"
37
39
  cattr_reader :encoding, :instance_reader => false
38
40
 
@@ -110,7 +112,7 @@ module ActiveGroonga
110
112
  end
111
113
 
112
114
  def context
113
- Groonga::Context.default
115
+ @@context ||= Groonga::Context.default
114
116
  end
115
117
 
116
118
  def encoding=(new_encoding)
@@ -24,7 +24,7 @@ module ActiveGroonga
24
24
  end
25
25
 
26
26
  def persisted?
27
- not (new_record? or destroyed?)
27
+ !new_record? and !destroyed?
28
28
  end
29
29
 
30
30
  def save(options={})
@@ -31,6 +31,7 @@ module ActiveGroonga
31
31
  end
32
32
 
33
33
  def paginate(sort_keys, options={})
34
+ options[:page] = normalize_page_value(options[:page])
34
35
  records = @records.paginate(sort_keys, options)
35
36
  set = self.class.new(records, @klass,
36
37
  :expression => @expression)
@@ -81,12 +82,28 @@ module ActiveGroonga
81
82
  end
82
83
  end
83
84
 
85
+ def normalize_page_value(page)
86
+ if page.blank?
87
+ 1
88
+ else
89
+ begin
90
+ Integer(page)
91
+ rescue ArgumentError
92
+ 1
93
+ end
94
+ end
95
+ end
96
+
84
97
  module PaginationProxy
85
98
  Groonga::Pagination.instance_methods.each do |method_name|
86
99
  define_method(method_name) do
87
100
  @records.send(method_name)
88
101
  end
89
102
  end
103
+
104
+ # For kaminari.
105
+ alias_method :num_pages, :n_pages
106
+ alias_method :limit_value, :page_size
90
107
  end
91
108
  end
92
109
  end
@@ -17,7 +17,7 @@ module ActiveGroonga
17
17
  module VERSION
18
18
  MAJOR = 1
19
19
  MINOR = 0
20
- TINY = 3
20
+ TINY = 4
21
21
 
22
22
  STRING = [MAJOR, MINOR, TINY].join(".")
23
23
  end
@@ -17,13 +17,6 @@ require 'pathname'
17
17
 
18
18
  require 'active_model'
19
19
 
20
- base_dir = Pathname(__FILE__).dirname
21
- rroonga_dir = (base_dir + "../../groonga").expand_path
22
- if rroonga_dir.exist?
23
- $LOAD_PATH.unshift(rroonga_dir + "ext" + "groonga")
24
- $LOAD_PATH.unshift(rroonga_dir + "lib")
25
- end
26
-
27
20
  require 'groonga'
28
21
 
29
22
  module ActiveGroonga
@@ -48,4 +41,5 @@ module ActiveGroonga
48
41
  end
49
42
  end
50
43
 
44
+ base_dir = Pathname(__FILE__).dirname
51
45
  I18n.load_path << (base_dir + 'active_groonga/locale/en.yml').to_s
@@ -27,6 +27,7 @@ module ActiveGroongaTestUtils
27
27
  end
28
28
 
29
29
  def setup_sand_box
30
+ ActiveGroonga::Base.context = nil
30
31
  Groonga::Context.default = nil
31
32
  @context = Groonga::Context.default
32
33
 
data/test/test-schema.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2009-2010 Kouhei Sutou <kou@clear-code.com>
1
+ # Copyright (C) 2009-2011 Kouhei Sutou <kou@clear-code.com>
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -118,6 +118,7 @@ ActiveGroonga::Schema.define(:version => 0) do |schema|
118
118
  create_table("terms",
119
119
  :type => :patricia_trie,
120
120
  :key_type => "ShortText",
121
+ :default_tokenizer => "TokenBigram",
121
122
  :force => true) do |table|
122
123
  end
123
124
 
@@ -131,6 +132,7 @@ ActiveGroonga::Schema.define(:version => 0) do |schema|
131
132
  end
132
133
 
133
134
  change_table("terms") do |table|
135
+ table.index("bookmarks", "comment", :name => "bookmarks_comment")
134
136
  table.index("bookmarks", "content", :name => "bookmarks_content")
135
137
  end
136
138
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activegroonga
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
5
- prerelease: false
4
+ hash: 31
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 3
10
- version: 1.0.3
9
+ - 4
10
+ version: 1.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kouhei Sutou
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-25 00:00:00 +09:00
18
+ date: 2011-03-31 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -255,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
255
  requirements: []
256
256
 
257
257
  rubyforge_project: groonga
258
- rubygems_version: 1.3.7
258
+ rubygems_version: 1.6.2
259
259
  signing_key:
260
260
  specification_version: 3
261
261
  summary: A library to use groonga with ActiveRecord like API.