searchlight 3.1.0 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +0 -1
- data/gemfiles/Gemfile.rails-3.2.x +0 -1
- data/gemfiles/Gemfile.rails-4.0.x +0 -1
- data/lib/searchlight/search.rb +8 -1
- data/lib/searchlight/version.rb +1 -1
- data/searchlight.gemspec +0 -4
- data/spec/searchlight/search_spec.rb +2 -2
- data/spec/spec_helper.rb +0 -7
- metadata +2 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2417c0b1b3d3b3a7de838a2c5129c3182c421083
|
4
|
+
data.tar.gz: fdb71cd159542903b8a21065962564fec9d9f14d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8da4a68ca0e200a61dcd3fcaaba0eb44b2e549b203511a1408d3cab0aa71e502797ecb7f5cb644e2dfd955cbdc6ce838101066328cd9a3dbe0bdf9df6202692
|
7
|
+
data.tar.gz: a8c3067c059af9749675bdbae399b06073e9e94eaa5e58af233856f554bcc9c1634dd4400e206f46340fc4fc1054026311cc1f60bfd3678b4b1274744beafc3f
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
Searchlight does its best to use [semantic versioning](http://semver.org).
|
4
4
|
|
5
|
+
## v3.1.1
|
6
|
+
|
7
|
+
### Bugfix
|
8
|
+
|
9
|
+
- Bugfix for Sequel users. Don't use `.call` unless target is a proc; avoids mistakenly using `Sequel::Dataset#call`. See [bug report](https://github.com/nathanl/searchlight/issues/25). Thanks to [Jorge Marques](https://github.com/jorge-marques) for pointing out this problem. Bug was introduced in v3.1.0.
|
10
|
+
|
5
11
|
## v3.1.0
|
6
12
|
|
7
13
|
Allow callable search targets, thanks to [Adam Nowak](https://github.com/lubieniebieski).
|
data/README.md
CHANGED
@@ -7,7 +7,6 @@ Searchlight can work with **any** ORM or object that can build a query using **c
|
|
7
7
|
[![Gem Version](https://badge.fury.io/rb/searchlight.png)](https://rubygems.org/gems/searchlight)
|
8
8
|
[![Code Climate](https://codeclimate.com/github/nathanl/searchlight.png)](https://codeclimate.com/github/nathanl/searchlight)
|
9
9
|
[![Build Status](https://api.travis-ci.org/nathanl/searchlight.png?branch=master)](https://travis-ci.org/nathanl/searchlight)
|
10
|
-
[![Coverage Status](https://coveralls.io/repos/nathanl/searchlight/badge.png?branch=master)](https://coveralls.io/r/nathanl/searchlight?branch=master)
|
11
10
|
[![Dependency Status](https://gemnasium.com/nathanl/searchlight.png)](https://gemnasium.com/nathanl/searchlight)
|
12
11
|
|
13
12
|
## Getting Started
|
data/lib/searchlight/search.rb
CHANGED
@@ -15,7 +15,8 @@ module Searchlight
|
|
15
15
|
def search
|
16
16
|
@search ||= begin
|
17
17
|
target = self.class.search_target
|
18
|
-
if
|
18
|
+
if callable?(target)
|
19
|
+
# for delayed scope evaluation
|
19
20
|
target.call
|
20
21
|
else
|
21
22
|
target
|
@@ -84,6 +85,12 @@ module Searchlight
|
|
84
85
|
false
|
85
86
|
end
|
86
87
|
|
88
|
+
def callable?(target)
|
89
|
+
# The obvious implementation would be 'respond_to?(:call)`, but
|
90
|
+
# then we may use Sequel::Dataset#call by accident.
|
91
|
+
target.is_a?(Proc)
|
92
|
+
end
|
93
|
+
|
87
94
|
MissingSearchTarget = Class.new(Searchlight::Error)
|
88
95
|
|
89
96
|
class UndefinedOption < Searchlight::Error
|
data/lib/searchlight/version.rb
CHANGED
data/searchlight.gemspec
CHANGED
@@ -25,12 +25,8 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
26
26
|
spec.add_development_dependency "rake"
|
27
27
|
spec.add_development_dependency "capybara", "~> 2.0"
|
28
|
-
spec.add_development_dependency "simplecov", "~> 0.7"
|
29
28
|
|
30
29
|
# To test integration with actionview and activerecord
|
31
30
|
spec.add_development_dependency "actionview", "~> 4.1"
|
32
31
|
spec.add_development_dependency "activemodel", "~> 4.1"
|
33
|
-
|
34
|
-
# For coverage testing on Travis
|
35
|
-
spec.add_development_dependency "coveralls", "~> 0.7"
|
36
32
|
end
|
@@ -186,7 +186,7 @@ describe Searchlight::Search do
|
|
186
186
|
|
187
187
|
describe "search_on" do
|
188
188
|
|
189
|
-
context "when an explicit
|
189
|
+
context "when an explicit search target was provided and it's not a proc" do
|
190
190
|
|
191
191
|
let(:example_search_target) { "Bobby Fischer" }
|
192
192
|
|
@@ -210,7 +210,7 @@ describe Searchlight::Search do
|
|
210
210
|
|
211
211
|
end
|
212
212
|
|
213
|
-
context "when an explicit
|
213
|
+
context "when an explicit search target was provided and it is a proc" do
|
214
214
|
|
215
215
|
it "calls it in the process of producing search results" do
|
216
216
|
search = ProcSearch.new(first_name: "Jimmy")
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: searchlight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Long
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: named
|
@@ -81,20 +81,6 @@ dependencies:
|
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '2.0'
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: simplecov
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - "~>"
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '0.7'
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - "~>"
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '0.7'
|
98
84
|
- !ruby/object:Gem::Dependency
|
99
85
|
name: actionview
|
100
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,20 +109,6 @@ dependencies:
|
|
123
109
|
- - "~>"
|
124
110
|
- !ruby/object:Gem::Version
|
125
111
|
version: '4.1'
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: coveralls
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
requirements:
|
130
|
-
- - "~>"
|
131
|
-
- !ruby/object:Gem::Version
|
132
|
-
version: '0.7'
|
133
|
-
type: :development
|
134
|
-
prerelease: false
|
135
|
-
version_requirements: !ruby/object:Gem::Requirement
|
136
|
-
requirements:
|
137
|
-
- - "~>"
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
version: '0.7'
|
140
112
|
description: Searchlight is a low-magic way to build database searches using an ORM.
|
141
113
|
It's compatible with ActiveRecord, Sequel, Mongoid, and any other ORM that can build
|
142
114
|
queries by chaining method calls.
|