acts_as_indexed 0.6.5 → 0.6.6

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/.gitignore CHANGED
@@ -3,3 +3,4 @@ test/test.log
3
3
  coverage
4
4
  index
5
5
  pkg
6
+ .bundle
data/CHANGELOG CHANGED
@@ -1,5 +1,10 @@
1
+ ===0.6.6 [31st August 2010]
2
+ - Now Heroku compatible out of the box, index is created in tmp when root dir is non-writable. [parndt - Philip Arndt - Great suggestion]
3
+ - Fixed a require path issue on 1.9.2.
4
+ - Fixed an issue with index_file location on Rails 3.0.0 final.
5
+
1
6
  ===0.6.5 [19th August 2010]
2
- - Reintroduced support for older version of Ruby which do not implement Array#exclude? [bug report by Andy Egger]
7
+ - Reintroduced support for older version of Ruby which do not implement Array#exclude? [bug report by Andy Eggers]
3
8
  - Using Bundler to manage development dependencies.
4
9
 
5
10
  ===0.6.4 [16th August 2010]
data/README.rdoc CHANGED
@@ -30,7 +30,8 @@ acts_as_indexed is now available as a Gem as several people have requested it.
30
30
 
31
31
  gem install acts_as_indexed
32
32
 
33
- Make sure to specify the Gem in your environment.rb file (Rails 2.x.x), or the Gemfile (Rails 3.x.x).
33
+ Make sure to specify the Gem in your environment.rb file (Rails 2.x.x), or the
34
+ Gemfile (Rails 3.x.x).
34
35
 
35
36
  ==== No Git?
36
37
 
@@ -65,14 +66,17 @@ the current model.
65
66
  ...
66
67
  end
67
68
 
68
- Any of the configuration options in the Further Configuration section can be added as to the acts_as_indexed method call. These will override any defaults or global configuration.
69
+ Any of the configuration options in the Further Configuration section can be
70
+ added as to the acts_as_indexed method call. These will override any defaults
71
+ or global configuration.
69
72
 
70
- You can specify proc that needs to evaluate to true before the item gets indexed.
71
- This is useful if you only want items with a certain state to be included.
72
- The Proc is passed the current object's instance so you are able to test against that.
73
+ You can specify proc that needs to evaluate to true before the item gets
74
+ indexed. This is useful if you only want items with a certain state to be
75
+ included. The Proc is passed the current object's instance so you are able to
76
+ test against that.
73
77
 
74
- For example, if you have a visible column that is false if the post is hidden, or true
75
- if it is visible, you can filter the index by doing:
78
+ For example, if you have a visible column that is false if the post is hidden,
79
+ or true if it is visible, you can filter the index by doing:
76
80
 
77
81
  class Post < ActiveRecord::Base
78
82
  acts_as_indexed :fields => [:title, :body], :if => Proc.new { |post| post.visible? }
@@ -114,7 +118,7 @@ A config block can be provided in your environment files or initializers.
114
118
  Example showing defaults:
115
119
 
116
120
  ActsAsIndexed.configure do |config|
117
- config.index_file = [RAILS_ROOT,'index']
121
+ config.index_file = [RAILS_ROOT,'index']
118
122
  config.index_file_depth = 3
119
123
  config.min_word_size = 3
120
124
  end
@@ -122,6 +126,10 @@ Example showing defaults:
122
126
  A full rundown of the available configuration options can be found in
123
127
  <tt>lib/acts_as_indexed/configuration.rb</tt>
124
128
 
129
+ === Heroku Support
130
+
131
+ Acts As Indexed now supports Heroku out-of-the-box. When a non-writeable root
132
+ directory is detected, the index will be created in the tmp directory.
125
133
 
126
134
  == RDoc Documentation
127
135
 
data/Rakefile CHANGED
@@ -7,6 +7,7 @@ task :default => :test
7
7
 
8
8
  desc 'Test the acts_as_indexed plugin.'
9
9
  Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'test'
10
11
  t.libs << 'lib'
11
12
  t.pattern = 'test/**/*_test.rb'
12
13
  t.verbose = true
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.5
1
+ 0.6.6
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{acts_as_indexed}
8
- s.version = "0.6.5"
8
+ s.version = "0.6.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Douglas F Shearer"]
12
- s.date = %q{2010-08-19}
12
+ s.date = %q{2010-08-31}
13
13
  s.description = %q{Acts As Indexed is a plugin which provides a pain-free way to add fulltext search to your Ruby on Rails app}
14
14
  s.email = %q{dougal.s@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -27,12 +27,21 @@ module ActsAsIndexed
27
27
  attr_accessor :if_proc
28
28
 
29
29
  def initialize
30
- @index_file = Rails.root.join('index') if Rails.root
30
+ @index_file = nil
31
31
  @index_file_depth = 3
32
32
  @min_word_size = 3
33
33
  @if_proc = if_proc
34
34
  end
35
35
 
36
+ # Since we cannot expect Rails to be available on load, it is best to put
37
+ # off setting the index_file attribute until as late as possible.
38
+ def index_file
39
+ if @index_file.nil?
40
+ @index_file = default_index_file
41
+ end
42
+ @index_file
43
+ end
44
+
36
45
  def index_file=(file_path)
37
46
  # Under the old syntax this was an array of path parts.
38
47
  # If this is still using the array then rewrite to a Pathname.
@@ -57,5 +66,15 @@ module ActsAsIndexed
57
66
  @if_proc ||= Proc.new{true}
58
67
  end
59
68
 
69
+ private
70
+
71
+ def default_index_file
72
+ if Rails.root.writable?
73
+ Rails.root.join('index')
74
+ else
75
+ Rails.root.join('tmp', 'index')
76
+ end
77
+ end
78
+
60
79
  end
61
80
  end
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/abstract_unit'
1
+ require 'abstract_unit'
2
2
 
3
3
  class ActsAsIndexedTest < ActiveSupport::TestCase
4
4
  fixtures :posts
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/abstract_unit'
1
+ require 'abstract_unit'
2
2
  include ActsAsIndexed
3
3
 
4
4
  class ConfigurationTest < ActiveSupport::TestCase
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/abstract_unit'
1
+ require 'abstract_unit'
2
2
  include ActsAsIndexed
3
3
 
4
4
  class SearchAtomTest < ActiveSupport::TestCase
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/abstract_unit'
1
+ require 'abstract_unit'
2
2
  include ActsAsIndexed
3
3
 
4
4
  class SearchIndexTest < ActiveSupport::TestCase
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_indexed
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 5
10
- version: 0.6.5
9
+ - 6
10
+ version: 0.6.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Douglas F Shearer
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-19 00:00:00 +01:00
18
+ date: 2010-08-31 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21