searchlogic-donotuse 2.3.9
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.
- checksums.yaml +15 -0
- data/CHANGELOG.rdoc +418 -0
- data/LICENSE +20 -0
- data/README.rdoc +299 -0
- data/Rakefile +19 -0
- data/VERSION.yml +5 -0
- data/init.rb +1 -0
- data/lib/searchlogic.rb +40 -0
- data/lib/searchlogic/active_record/consistency.rb +32 -0
- data/lib/searchlogic/active_record/named_scopes.rb +60 -0
- data/lib/searchlogic/core_ext/object.rb +41 -0
- data/lib/searchlogic/core_ext/proc.rb +11 -0
- data/lib/searchlogic/named_scopes/alias_scope.rb +67 -0
- data/lib/searchlogic/named_scopes/association_conditions.rb +102 -0
- data/lib/searchlogic/named_scopes/association_ordering.rb +43 -0
- data/lib/searchlogic/named_scopes/conditions.rb +229 -0
- data/lib/searchlogic/named_scopes/or_conditions.rb +137 -0
- data/lib/searchlogic/named_scopes/ordering.rb +48 -0
- data/lib/searchlogic/rails_helpers.rb +76 -0
- data/lib/searchlogic/search.rb +179 -0
- data/rails/init.rb +1 -0
- data/searchlogic.gemspec +85 -0
- data/spec/core_ext/object_spec.rb +7 -0
- data/spec/core_ext/proc_spec.rb +9 -0
- data/spec/named_scopes/alias_scope_spec.rb +19 -0
- data/spec/named_scopes/association_conditions_spec.rb +141 -0
- data/spec/named_scopes/association_ordering_spec.rb +27 -0
- data/spec/named_scopes/conditions_spec.rb +319 -0
- data/spec/named_scopes/or_conditions_spec.rb +59 -0
- data/spec/named_scopes/ordering_spec.rb +34 -0
- data/spec/search_spec.rb +369 -0
- data/spec/spec_helper.rb +104 -0
- metadata +89 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
require 'spec'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'ruby-debug'
|
4
|
+
require 'activerecord'
|
5
|
+
|
6
|
+
ENV['TZ'] = 'UTC'
|
7
|
+
Time.zone = 'Eastern Time (US & Canada)'
|
8
|
+
|
9
|
+
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
|
10
|
+
ActiveRecord::Base.configurations = true
|
11
|
+
|
12
|
+
ActiveRecord::Schema.verbose = false
|
13
|
+
ActiveRecord::Schema.define(:version => 1) do
|
14
|
+
create_table :companies do |t|
|
15
|
+
t.datetime :created_at
|
16
|
+
t.datetime :updated_at
|
17
|
+
t.string :name
|
18
|
+
t.string :description
|
19
|
+
t.integer :users_count, :default => 0
|
20
|
+
end
|
21
|
+
|
22
|
+
create_table :users do |t|
|
23
|
+
t.datetime :created_at
|
24
|
+
t.datetime :updated_at
|
25
|
+
t.integer :company_id
|
26
|
+
t.string :username
|
27
|
+
t.string :name
|
28
|
+
t.integer :age
|
29
|
+
t.boolean :male
|
30
|
+
end
|
31
|
+
|
32
|
+
create_table :carts do |t|
|
33
|
+
t.datetime :created_at
|
34
|
+
t.datetime :updated_at
|
35
|
+
t.integer :user_id
|
36
|
+
end
|
37
|
+
|
38
|
+
create_table :orders do |t|
|
39
|
+
t.datetime :created_at
|
40
|
+
t.datetime :updated_at
|
41
|
+
t.integer :user_id
|
42
|
+
t.date :shipped_on
|
43
|
+
t.float :taxes
|
44
|
+
t.float :total
|
45
|
+
end
|
46
|
+
|
47
|
+
create_table :fees do |t|
|
48
|
+
t.datetime :created_at
|
49
|
+
t.datetime :updated_at
|
50
|
+
t.string :owner_type
|
51
|
+
t.integer :owner_id
|
52
|
+
t.float :cost
|
53
|
+
end
|
54
|
+
|
55
|
+
create_table :line_items do |t|
|
56
|
+
t.datetime :created_at
|
57
|
+
t.datetime :updated_at
|
58
|
+
t.integer :order_id
|
59
|
+
t.float :price
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
64
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
65
|
+
require 'searchlogic'
|
66
|
+
|
67
|
+
Spec::Runner.configure do |config|
|
68
|
+
config.before(:each) do
|
69
|
+
class Company < ActiveRecord::Base
|
70
|
+
has_many :users, :dependent => :destroy
|
71
|
+
end
|
72
|
+
|
73
|
+
class User < ActiveRecord::Base
|
74
|
+
belongs_to :company, :counter_cache => true
|
75
|
+
has_many :orders, :dependent => :destroy
|
76
|
+
has_many :orders_big, :class_name => 'Order', :conditions => 'total > 100'
|
77
|
+
end
|
78
|
+
|
79
|
+
class Order < ActiveRecord::Base
|
80
|
+
belongs_to :user
|
81
|
+
has_many :line_items, :dependent => :destroy
|
82
|
+
end
|
83
|
+
|
84
|
+
class Fee < ActiveRecord::Base
|
85
|
+
belongs_to :owner, :polymorphic => true
|
86
|
+
end
|
87
|
+
|
88
|
+
class LineItem < ActiveRecord::Base
|
89
|
+
belongs_to :order
|
90
|
+
end
|
91
|
+
|
92
|
+
Company.destroy_all
|
93
|
+
User.destroy_all
|
94
|
+
Order.destroy_all
|
95
|
+
LineItem.destroy_all
|
96
|
+
end
|
97
|
+
|
98
|
+
config.after(:each) do
|
99
|
+
Object.send(:remove_const, :Company)
|
100
|
+
Object.send(:remove_const, :User)
|
101
|
+
Object.send(:remove_const, :Order)
|
102
|
+
Object.send(:remove_const, :LineItem)
|
103
|
+
end
|
104
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: searchlogic-donotuse
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.3.9
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Johnson of Binary Logic
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activerecord
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.3.9
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.3.9
|
27
|
+
description: Searchlogic makes using ActiveRecord named scopes easier and less repetitive.
|
28
|
+
email: bjohnson@binarylogic.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files:
|
32
|
+
- LICENSE
|
33
|
+
- README.rdoc
|
34
|
+
files:
|
35
|
+
- CHANGELOG.rdoc
|
36
|
+
- LICENSE
|
37
|
+
- README.rdoc
|
38
|
+
- Rakefile
|
39
|
+
- VERSION.yml
|
40
|
+
- init.rb
|
41
|
+
- lib/searchlogic.rb
|
42
|
+
- lib/searchlogic/active_record/consistency.rb
|
43
|
+
- lib/searchlogic/active_record/named_scopes.rb
|
44
|
+
- lib/searchlogic/core_ext/object.rb
|
45
|
+
- lib/searchlogic/core_ext/proc.rb
|
46
|
+
- lib/searchlogic/named_scopes/alias_scope.rb
|
47
|
+
- lib/searchlogic/named_scopes/association_conditions.rb
|
48
|
+
- lib/searchlogic/named_scopes/association_ordering.rb
|
49
|
+
- lib/searchlogic/named_scopes/conditions.rb
|
50
|
+
- lib/searchlogic/named_scopes/or_conditions.rb
|
51
|
+
- lib/searchlogic/named_scopes/ordering.rb
|
52
|
+
- lib/searchlogic/rails_helpers.rb
|
53
|
+
- lib/searchlogic/search.rb
|
54
|
+
- rails/init.rb
|
55
|
+
- searchlogic.gemspec
|
56
|
+
- spec/core_ext/object_spec.rb
|
57
|
+
- spec/core_ext/proc_spec.rb
|
58
|
+
- spec/named_scopes/alias_scope_spec.rb
|
59
|
+
- spec/named_scopes/association_conditions_spec.rb
|
60
|
+
- spec/named_scopes/association_ordering_spec.rb
|
61
|
+
- spec/named_scopes/conditions_spec.rb
|
62
|
+
- spec/named_scopes/or_conditions_spec.rb
|
63
|
+
- spec/named_scopes/ordering_spec.rb
|
64
|
+
- spec/search_spec.rb
|
65
|
+
- spec/spec_helper.rb
|
66
|
+
homepage: http://github.com/binarylogic/searchlogic
|
67
|
+
licenses: []
|
68
|
+
metadata: {}
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project: searchlogic-donotuse
|
85
|
+
rubygems_version: 2.2.2
|
86
|
+
signing_key:
|
87
|
+
specification_version: 4
|
88
|
+
summary: Searchlogic makes using ActiveRecord named scopes easier and less repetitive.
|
89
|
+
test_files: []
|