tanker 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +6 -4
- data/README.rdoc +2 -2
- data/Rakefile +2 -3
- data/VERSION +1 -1
- data/lib/tanker.rb +2 -2
- data/lib/tanker/paginated_array.rb +3 -2
- data/spec/tanker_spec.rb +11 -3
- data/tanker.gemspec +8 -9
- metadata +11 -11
data/Gemfile
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
gem 'jeweler'
|
4
3
|
gem 'json', '>= 1.5.1'
|
5
|
-
gem 'will_paginate', '>= 2.3.15'
|
6
|
-
gem 'kaminari'
|
7
4
|
|
8
5
|
group :test do
|
9
6
|
gem 'rspec', '>= 2.5.0'
|
10
|
-
gem 'ruby-debug19'
|
11
7
|
gem 'activerecord', '>= 3.0.7'
|
12
8
|
gem 'sqlite3'
|
13
9
|
end
|
14
10
|
|
11
|
+
group :development do
|
12
|
+
gem 'jeweler'
|
13
|
+
gem 'will_paginate', '>= 2.3.15'
|
14
|
+
gem 'kaminari'
|
15
|
+
end
|
16
|
+
|
15
17
|
|
data/README.rdoc
CHANGED
@@ -139,12 +139,12 @@ Disable pagination of search results
|
|
139
139
|
|
140
140
|
== Fetching attributes and snippets
|
141
141
|
|
142
|
-
As of version 1.1 Tanker supports fetching attributes and snippets directly from the Index. If you use either of
|
142
|
+
As of version 1.1 Tanker supports fetching attributes and snippets directly from the Index. If you use either of these search options
|
143
143
|
your Model instances will be instanced from the attributes coming from the index not by making another trip to the database.
|
144
144
|
|
145
145
|
This can represent a major speed increase for your queries but it also means that you will only have available the attributes
|
146
146
|
you indexed in your model. There are edge cases that are not tested so please help us have this feature be super stable and
|
147
|
-
have everyone
|
147
|
+
have everyone benefit from the speed this entails.
|
148
148
|
|
149
149
|
Example:
|
150
150
|
|
data/Rakefile
CHANGED
@@ -9,9 +9,8 @@ begin
|
|
9
9
|
gem.description = %Q{IndexTank is a great search indexing service, this gem tries to make any orm keep in sync with indextank with ease}
|
10
10
|
gem.email = "kidpollo@gmail.com"
|
11
11
|
gem.homepage = "http://github.com/kidpollo/tanker"
|
12
|
-
gem.authors = ["
|
13
|
-
|
14
|
-
#gem.add_dependency 'will_paginate', '>= 2.3.15'
|
12
|
+
gem.authors = ["Francisco Viramontes", "Jack Danger Canty"]
|
13
|
+
gem.files.exclude 'spec/integration_spec.rb'
|
15
14
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
15
|
end
|
17
16
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.2
|
data/lib/tanker.rb
CHANGED
@@ -232,7 +232,7 @@ module Tanker
|
|
232
232
|
|
233
233
|
self.tanker_config.index_name = name
|
234
234
|
|
235
|
-
config = ModelConfig.new(name, block)
|
235
|
+
config = ModelConfig.new(name, {}, block)
|
236
236
|
config.indexes.each do |key, value|
|
237
237
|
self.tanker_config.indexes << [key, value]
|
238
238
|
end
|
@@ -286,7 +286,7 @@ module Tanker
|
|
286
286
|
attr_accessor :index_name
|
287
287
|
attr_accessor :options
|
288
288
|
|
289
|
-
def initialize(index_name, options
|
289
|
+
def initialize(index_name, options, block)
|
290
290
|
@index_name = index_name
|
291
291
|
@options = options
|
292
292
|
@indexes = []
|
@@ -9,8 +9,9 @@ module Tanker
|
|
9
9
|
|
10
10
|
attr_reader :limit_value, :offset_value, :total_count
|
11
11
|
|
12
|
-
def initialize(original_array, limit_val
|
13
|
-
@limit_value
|
12
|
+
def initialize(original_array, limit_val, offset_val, total_count)
|
13
|
+
@limit_value = limit_val || default_per_page
|
14
|
+
@offset_value, @total_count = offset_val, total_count
|
14
15
|
super(original_array)
|
15
16
|
end
|
16
17
|
|
data/spec/tanker_spec.rb
CHANGED
@@ -105,7 +105,8 @@ describe Tanker do
|
|
105
105
|
end
|
106
106
|
|
107
107
|
dummy_instance = @dummy_class.new
|
108
|
-
Hash[*dummy_instance.tanker_config.indexes.flatten].keys.should ==
|
108
|
+
Hash[*dummy_instance.tanker_config.indexes.flatten].keys.include?(:something).should == true
|
109
|
+
Hash[*dummy_instance.tanker_config.indexes.flatten].keys.include?(:something_else).should == true
|
109
110
|
end
|
110
111
|
|
111
112
|
it 'should overwrite previously indexed fields if re-indexed' do
|
@@ -176,7 +177,8 @@ describe Tanker do
|
|
176
177
|
|
177
178
|
dummy_instance = dummy_class.new
|
178
179
|
dummy_instance.tanker_config.index_name.should == 'another index'
|
179
|
-
Hash[*dummy_instance.tanker_config.indexes.flatten].keys.should ==
|
180
|
+
Hash[*dummy_instance.tanker_config.indexes.flatten].keys.include?(:name).should == true
|
181
|
+
Hash[*dummy_instance.tanker_config.indexes.flatten].keys.include?(:email).should == true
|
180
182
|
|
181
183
|
Tanker.instance_variable_set(:@included_in, Tanker.included_in - [dummy_class])
|
182
184
|
end
|
@@ -487,7 +489,7 @@ describe Tanker do
|
|
487
489
|
end
|
488
490
|
end
|
489
491
|
|
490
|
-
describe "Kaminari support" do
|
492
|
+
describe "with Kaminari support" do
|
491
493
|
|
492
494
|
before :all do
|
493
495
|
Tanker.configuration = {:url => 'http://api.indextank.com', :pagination_backend => :kaminari}
|
@@ -497,6 +499,12 @@ describe Tanker do
|
|
497
499
|
Tanker.configuration = {}
|
498
500
|
end
|
499
501
|
|
502
|
+
# Need to do this for tests to pass on 1.8.7. If not tanker.rb is
|
503
|
+
# reloaded Tanker::KaminariPaginatedArray const gets removed (!?)
|
504
|
+
before :each do
|
505
|
+
load 'tanker.rb'
|
506
|
+
end
|
507
|
+
|
500
508
|
it 'should raise error message if Kaminari gem is not required' do
|
501
509
|
Person.tanker_index.should_receive(:search).and_return(
|
502
510
|
{
|
data/tanker.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{tanker}
|
8
|
-
s.version = "1.1.
|
8
|
+
s.version = "1.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [%q{
|
12
|
-
s.date = %q{2011-06-
|
11
|
+
s.authors = [%q{Francisco Viramontes}, %q{Jack Danger Canty}]
|
12
|
+
s.date = %q{2011-06-13}
|
13
13
|
s.description = %q{IndexTank is a great search indexing service, this gem tries to make any orm keep in sync with indextank with ease}
|
14
14
|
s.email = %q{kidpollo@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -31,7 +31,6 @@ Gem::Specification.new do |s|
|
|
31
31
|
"lib/tanker/railtie.rb",
|
32
32
|
"lib/tanker/tasks/tanker.rake",
|
33
33
|
"lib/tanker/utilities.rb",
|
34
|
-
"spec/integration_spec.rb",
|
35
34
|
"spec/integration_spec_conf.rb.example",
|
36
35
|
"spec/spec_helper.rb",
|
37
36
|
"spec/tanker_spec.rb",
|
@@ -53,19 +52,19 @@ Gem::Specification.new do |s|
|
|
53
52
|
s.specification_version = 3
|
54
53
|
|
55
54
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
56
|
-
s.add_runtime_dependency(%q<jeweler>, [">= 0"])
|
57
55
|
s.add_runtime_dependency(%q<json>, [">= 1.5.1"])
|
58
|
-
s.
|
59
|
-
s.
|
56
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
57
|
+
s.add_development_dependency(%q<will_paginate>, [">= 2.3.15"])
|
58
|
+
s.add_development_dependency(%q<kaminari>, [">= 0"])
|
60
59
|
else
|
61
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
62
60
|
s.add_dependency(%q<json>, [">= 1.5.1"])
|
61
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
63
62
|
s.add_dependency(%q<will_paginate>, [">= 2.3.15"])
|
64
63
|
s.add_dependency(%q<kaminari>, [">= 0"])
|
65
64
|
end
|
66
65
|
else
|
67
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
68
66
|
s.add_dependency(%q<json>, [">= 1.5.1"])
|
67
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
69
68
|
s.add_dependency(%q<will_paginate>, [">= 2.3.15"])
|
70
69
|
s.add_dependency(%q<kaminari>, [">= 0"])
|
71
70
|
end
|
metadata
CHANGED
@@ -2,37 +2,37 @@
|
|
2
2
|
name: tanker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.1.
|
5
|
+
version: 1.1.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
-
|
8
|
+
- Francisco Viramontes
|
9
9
|
- Jack Danger Canty
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-06-
|
14
|
+
date: 2011-06-13 00:00:00 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
|
-
name:
|
17
|
+
name: json
|
18
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 1.5.1
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: *id001
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: jeweler
|
29
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
35
|
-
type: :
|
34
|
+
version: "0"
|
35
|
+
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: *id002
|
38
38
|
- !ruby/object:Gem::Dependency
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: 2.3.15
|
46
|
-
type: :
|
46
|
+
type: :development
|
47
47
|
prerelease: false
|
48
48
|
version_requirements: *id003
|
49
49
|
- !ruby/object:Gem::Dependency
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: "0"
|
57
|
-
type: :
|
57
|
+
type: :development
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: *id004
|
60
60
|
description: IndexTank is a great search indexing service, this gem tries to make any orm keep in sync with indextank with ease
|
@@ -81,12 +81,12 @@ files:
|
|
81
81
|
- lib/tanker/railtie.rb
|
82
82
|
- lib/tanker/tasks/tanker.rake
|
83
83
|
- lib/tanker/utilities.rb
|
84
|
-
- spec/integration_spec.rb
|
85
84
|
- spec/integration_spec_conf.rb.example
|
86
85
|
- spec/spec_helper.rb
|
87
86
|
- spec/tanker_spec.rb
|
88
87
|
- spec/utilities_spec.rb
|
89
88
|
- tanker.gemspec
|
89
|
+
- spec/integration_spec.rb
|
90
90
|
homepage: http://github.com/kidpollo/tanker
|
91
91
|
licenses: []
|
92
92
|
|