searchlogic-heroku 2.4.19
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/LICENSE +20 -0
- data/README.rdoc +308 -0
- data/Rakefile +35 -0
- data/VERSION.yml +5 -0
- data/init.rb +1 -0
- data/lib/searchlogic.rb +56 -0
- data/lib/searchlogic/active_record/association_proxy.rb +19 -0
- data/lib/searchlogic/active_record/consistency.rb +49 -0
- data/lib/searchlogic/active_record/named_scope_tools.rb +101 -0
- data/lib/searchlogic/core_ext/object.rb +43 -0
- data/lib/searchlogic/core_ext/proc.rb +17 -0
- data/lib/searchlogic/named_scopes/alias_scope.rb +67 -0
- data/lib/searchlogic/named_scopes/association_conditions.rb +131 -0
- data/lib/searchlogic/named_scopes/association_ordering.rb +44 -0
- data/lib/searchlogic/named_scopes/conditions.rb +226 -0
- data/lib/searchlogic/named_scopes/or_conditions.rb +141 -0
- data/lib/searchlogic/named_scopes/ordering.rb +48 -0
- data/lib/searchlogic/rails_helpers.rb +79 -0
- data/lib/searchlogic/search.rb +251 -0
- data/rails/init.rb +1 -0
- data/searchlogic.gemspec +89 -0
- data/spec/searchlogic/active_record/association_proxy_spec.rb +23 -0
- data/spec/searchlogic/active_record/consistency_spec.rb +28 -0
- data/spec/searchlogic/core_ext/object_spec.rb +9 -0
- data/spec/searchlogic/core_ext/proc_spec.rb +8 -0
- data/spec/searchlogic/named_scopes/alias_scope_spec.rb +23 -0
- data/spec/searchlogic/named_scopes/association_conditions_spec.rb +198 -0
- data/spec/searchlogic/named_scopes/association_ordering_spec.rb +27 -0
- data/spec/searchlogic/named_scopes/conditions_spec.rb +319 -0
- data/spec/searchlogic/named_scopes/or_conditions_spec.rb +66 -0
- data/spec/searchlogic/named_scopes/ordering_spec.rb +34 -0
- data/spec/searchlogic/search_spec.rb +459 -0
- data/spec/spec_helper.rb +132 -0
- metadata +128 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
require 'spec'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'ruby-debug'
|
4
|
+
require 'active_record'
|
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 :audits do |t|
|
15
|
+
t.string :auditable_type
|
16
|
+
t.integer :auditable_id
|
17
|
+
end
|
18
|
+
|
19
|
+
create_table :companies do |t|
|
20
|
+
t.datetime :created_at
|
21
|
+
t.datetime :updated_at
|
22
|
+
t.string :name
|
23
|
+
t.string :description
|
24
|
+
t.integer :users_count, :default => 0
|
25
|
+
end
|
26
|
+
|
27
|
+
create_table :user_groups do |t|
|
28
|
+
t.string :name
|
29
|
+
end
|
30
|
+
|
31
|
+
create_table :user_groups_users, :id => false do |t|
|
32
|
+
t.integer :user_group_id, :null => false
|
33
|
+
t.integer :user_id, :null => false
|
34
|
+
end
|
35
|
+
|
36
|
+
create_table :users do |t|
|
37
|
+
t.datetime :created_at
|
38
|
+
t.datetime :updated_at
|
39
|
+
t.integer :company_id
|
40
|
+
t.string :username
|
41
|
+
t.string :name
|
42
|
+
t.integer :age
|
43
|
+
t.boolean :male
|
44
|
+
t.string :some_type_id
|
45
|
+
t.datetime :whatever_at
|
46
|
+
end
|
47
|
+
|
48
|
+
create_table :carts do |t|
|
49
|
+
t.datetime :created_at
|
50
|
+
t.datetime :updated_at
|
51
|
+
t.integer :user_id
|
52
|
+
end
|
53
|
+
|
54
|
+
create_table :orders do |t|
|
55
|
+
t.datetime :created_at
|
56
|
+
t.datetime :updated_at
|
57
|
+
t.integer :user_id
|
58
|
+
t.date :shipped_on
|
59
|
+
t.float :taxes
|
60
|
+
t.float :total
|
61
|
+
end
|
62
|
+
|
63
|
+
create_table :fees do |t|
|
64
|
+
t.datetime :created_at
|
65
|
+
t.datetime :updated_at
|
66
|
+
t.string :owner_type
|
67
|
+
t.integer :owner_id
|
68
|
+
t.float :cost
|
69
|
+
end
|
70
|
+
|
71
|
+
create_table :line_items do |t|
|
72
|
+
t.datetime :created_at
|
73
|
+
t.datetime :updated_at
|
74
|
+
t.integer :order_id
|
75
|
+
t.float :price
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
80
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
81
|
+
require 'searchlogic'
|
82
|
+
|
83
|
+
Spec::Runner.configure do |config|
|
84
|
+
config.before(:each) do
|
85
|
+
class Audit < ActiveRecord::Base
|
86
|
+
belongs_to :auditable, :polymorphic => true
|
87
|
+
end
|
88
|
+
|
89
|
+
class Company < ActiveRecord::Base
|
90
|
+
has_many :orders, :through => :users
|
91
|
+
has_many :users, :dependent => :destroy
|
92
|
+
end
|
93
|
+
|
94
|
+
class UserGroup < ActiveRecord::Base
|
95
|
+
has_and_belongs_to_many :users
|
96
|
+
end
|
97
|
+
|
98
|
+
class User < ActiveRecord::Base
|
99
|
+
belongs_to :company, :counter_cache => true
|
100
|
+
has_many :orders, :dependent => :destroy
|
101
|
+
has_many :orders_big, :class_name => 'Order', :conditions => 'total > 100'
|
102
|
+
has_and_belongs_to_many :user_groups
|
103
|
+
|
104
|
+
self.skip_time_zone_conversion_for_attributes = [:whatever_at]
|
105
|
+
end
|
106
|
+
|
107
|
+
class Order < ActiveRecord::Base
|
108
|
+
belongs_to :user
|
109
|
+
has_many :line_items, :dependent => :destroy
|
110
|
+
end
|
111
|
+
|
112
|
+
class Fee < ActiveRecord::Base
|
113
|
+
belongs_to :owner, :polymorphic => true
|
114
|
+
end
|
115
|
+
|
116
|
+
class LineItem < ActiveRecord::Base
|
117
|
+
belongs_to :order
|
118
|
+
end
|
119
|
+
|
120
|
+
Company.destroy_all
|
121
|
+
User.destroy_all
|
122
|
+
Order.destroy_all
|
123
|
+
LineItem.destroy_all
|
124
|
+
end
|
125
|
+
|
126
|
+
config.after(:each) do
|
127
|
+
Object.send(:remove_const, :Company)
|
128
|
+
Object.send(:remove_const, :User)
|
129
|
+
Object.send(:remove_const, :Order)
|
130
|
+
Object.send(:remove_const, :LineItem)
|
131
|
+
end
|
132
|
+
end
|
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: searchlogic-heroku
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 57
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 2
|
8
|
+
- 4
|
9
|
+
- 19
|
10
|
+
version: 2.4.19
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Ben Johnson of Binary Logic
|
14
|
+
- William
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2010-07-26 00:00:00 +08:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: activerecord
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 15
|
31
|
+
segments:
|
32
|
+
- 2
|
33
|
+
- 0
|
34
|
+
- 0
|
35
|
+
version: 2.0.0
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id001
|
38
|
+
description: Searchlogic makes using ActiveRecord named scopes easier and less repetitive.
|
39
|
+
email: bjohnson@binarylogic.com
|
40
|
+
executables: []
|
41
|
+
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files:
|
45
|
+
- LICENSE
|
46
|
+
- README.rdoc
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- LICENSE
|
50
|
+
- README.rdoc
|
51
|
+
- Rakefile
|
52
|
+
- VERSION.yml
|
53
|
+
- init.rb
|
54
|
+
- lib/searchlogic.rb
|
55
|
+
- lib/searchlogic/active_record/association_proxy.rb
|
56
|
+
- lib/searchlogic/active_record/consistency.rb
|
57
|
+
- lib/searchlogic/active_record/named_scope_tools.rb
|
58
|
+
- lib/searchlogic/core_ext/object.rb
|
59
|
+
- lib/searchlogic/core_ext/proc.rb
|
60
|
+
- lib/searchlogic/named_scopes/alias_scope.rb
|
61
|
+
- lib/searchlogic/named_scopes/association_conditions.rb
|
62
|
+
- lib/searchlogic/named_scopes/association_ordering.rb
|
63
|
+
- lib/searchlogic/named_scopes/conditions.rb
|
64
|
+
- lib/searchlogic/named_scopes/or_conditions.rb
|
65
|
+
- lib/searchlogic/named_scopes/ordering.rb
|
66
|
+
- lib/searchlogic/rails_helpers.rb
|
67
|
+
- lib/searchlogic/search.rb
|
68
|
+
- rails/init.rb
|
69
|
+
- searchlogic.gemspec
|
70
|
+
- spec/searchlogic/active_record/association_proxy_spec.rb
|
71
|
+
- spec/searchlogic/active_record/consistency_spec.rb
|
72
|
+
- spec/searchlogic/core_ext/object_spec.rb
|
73
|
+
- spec/searchlogic/core_ext/proc_spec.rb
|
74
|
+
- spec/searchlogic/named_scopes/alias_scope_spec.rb
|
75
|
+
- spec/searchlogic/named_scopes/association_conditions_spec.rb
|
76
|
+
- spec/searchlogic/named_scopes/association_ordering_spec.rb
|
77
|
+
- spec/searchlogic/named_scopes/conditions_spec.rb
|
78
|
+
- spec/searchlogic/named_scopes/or_conditions_spec.rb
|
79
|
+
- spec/searchlogic/named_scopes/ordering_spec.rb
|
80
|
+
- spec/searchlogic/search_spec.rb
|
81
|
+
- spec/spec_helper.rb
|
82
|
+
has_rdoc: true
|
83
|
+
homepage: http://github.com/binarylogic/searchlogic
|
84
|
+
licenses: []
|
85
|
+
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options:
|
88
|
+
- --charset=UTF-8
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
hash: 3
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
version: "0"
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
hash: 3
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
version: "0"
|
109
|
+
requirements: []
|
110
|
+
|
111
|
+
rubyforge_project: searchlogic
|
112
|
+
rubygems_version: 1.3.7
|
113
|
+
signing_key:
|
114
|
+
specification_version: 3
|
115
|
+
summary: Searchlogic makes using ActiveRecord named scopes easier and less repetitive.
|
116
|
+
test_files:
|
117
|
+
- spec/searchlogic/active_record/association_proxy_spec.rb
|
118
|
+
- spec/searchlogic/active_record/consistency_spec.rb
|
119
|
+
- spec/searchlogic/core_ext/object_spec.rb
|
120
|
+
- spec/searchlogic/core_ext/proc_spec.rb
|
121
|
+
- spec/searchlogic/named_scopes/alias_scope_spec.rb
|
122
|
+
- spec/searchlogic/named_scopes/association_conditions_spec.rb
|
123
|
+
- spec/searchlogic/named_scopes/association_ordering_spec.rb
|
124
|
+
- spec/searchlogic/named_scopes/conditions_spec.rb
|
125
|
+
- spec/searchlogic/named_scopes/or_conditions_spec.rb
|
126
|
+
- spec/searchlogic/named_scopes/ordering_spec.rb
|
127
|
+
- spec/searchlogic/search_spec.rb
|
128
|
+
- spec/spec_helper.rb
|