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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 432e9a94536f38173152799da14d74ba3adb8e23
4
- data.tar.gz: 649e95855e50d9663f831b8e639e97d7c9bbb64c
3
+ metadata.gz: 2417c0b1b3d3b3a7de838a2c5129c3182c421083
4
+ data.tar.gz: fdb71cd159542903b8a21065962564fec9d9f14d
5
5
  SHA512:
6
- metadata.gz: 545f658dcc895609270b655f20d6dc14e3ffcdbb26567b4a2051d86372872c540e58b03264fd9e6a68f68a8b4860d5f5eb0ba68c9d60590dab71025523203798
7
- data.tar.gz: 926a6a17de716ce11200f0c3182238338d57aaaa4aab19662a50df4021344f16affe998504db9f8e5219e9911bdc06616f63a2f100635cffacb042f937d69d58
6
+ metadata.gz: f8da4a68ca0e200a61dcd3fcaaba0eb44b2e549b203511a1408d3cab0aa71e502797ecb7f5cb644e2dfd955cbdc6ce838101066328cd9a3dbe0bdf9df6202692
7
+ data.tar.gz: a8c3067c059af9749675bdbae399b06073e9e94eaa5e58af233856f554bcc9c1634dd4400e206f46340fc4fc1054026311cc1f60bfd3678b4b1274744beafc3f
@@ -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
@@ -4,4 +4,3 @@ gemspec :path => ".."
4
4
 
5
5
  gem "rails", "~> 3.2.13"
6
6
  gem 'mongoid', "~> 3.1.4"
7
- gem 'coveralls', require: false
@@ -5,4 +5,3 @@ gemspec :path => '..'
5
5
  gem "rails", "~> 4.0.0"
6
6
  gem "mongoid"
7
7
  gem 'bson_ext'
8
- gem 'coveralls', require: false
@@ -15,7 +15,8 @@ module Searchlight
15
15
  def search
16
16
  @search ||= begin
17
17
  target = self.class.search_target
18
- if target.respond_to?(:call)
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
@@ -1,3 +1,3 @@
1
1
  module Searchlight
2
- VERSION = "3.1.0"
2
+ VERSION = "3.1.1"
3
3
  end
@@ -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, non-callable search target was provided" do
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, callable search target was provided" do
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")
@@ -1,11 +1,4 @@
1
1
  require 'capybara/rspec'
2
- if ENV["TRAVIS"]
3
- require 'coveralls'
4
- Coveralls.wear!
5
- else
6
- require 'simplecov'
7
- SimpleCov.start { add_filter "/spec" }
8
- end
9
2
  require 'searchlight'
10
3
  $LOAD_PATH << '.'
11
4
  require 'support/mock_model'
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.0
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-09-16 00:00:00.000000000 Z
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.