yoomee-searchlogic 2.4.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/.gitignore +6 -0
  2. data/LICENSE +20 -0
  3. data/README.rdoc +308 -0
  4. data/Rakefile +35 -0
  5. data/VERSION.yml +5 -0
  6. data/init.rb +1 -0
  7. data/lib/searchlogic.rb +56 -0
  8. data/lib/searchlogic/active_record/association_proxy.rb +19 -0
  9. data/lib/searchlogic/active_record/consistency.rb +49 -0
  10. data/lib/searchlogic/active_record/named_scope_tools.rb +101 -0
  11. data/lib/searchlogic/core_ext/object.rb +43 -0
  12. data/lib/searchlogic/core_ext/proc.rb +17 -0
  13. data/lib/searchlogic/named_scopes/alias_scope.rb +67 -0
  14. data/lib/searchlogic/named_scopes/association_conditions.rb +132 -0
  15. data/lib/searchlogic/named_scopes/association_ordering.rb +44 -0
  16. data/lib/searchlogic/named_scopes/conditions.rb +232 -0
  17. data/lib/searchlogic/named_scopes/or_conditions.rb +141 -0
  18. data/lib/searchlogic/named_scopes/ordering.rb +48 -0
  19. data/lib/searchlogic/rails_helpers.rb +79 -0
  20. data/lib/searchlogic/search.rb +26 -0
  21. data/lib/searchlogic/search/base.rb +26 -0
  22. data/lib/searchlogic/search/conditions.rb +58 -0
  23. data/lib/searchlogic/search/date_parts.rb +23 -0
  24. data/lib/searchlogic/search/implementation.rb +14 -0
  25. data/lib/searchlogic/search/method_missing.rb +123 -0
  26. data/lib/searchlogic/search/ordering.rb +10 -0
  27. data/lib/searchlogic/search/scopes.rb +19 -0
  28. data/lib/searchlogic/search/to_yaml.rb +38 -0
  29. data/lib/searchlogic/search/unknown_condition_error.rb +15 -0
  30. data/rails/init.rb +1 -0
  31. data/searchlogic.gemspec +98 -0
  32. data/spec/searchlogic/active_record/association_proxy_spec.rb +23 -0
  33. data/spec/searchlogic/active_record/consistency_spec.rb +28 -0
  34. data/spec/searchlogic/core_ext/object_spec.rb +9 -0
  35. data/spec/searchlogic/core_ext/proc_spec.rb +8 -0
  36. data/spec/searchlogic/named_scopes/alias_scope_spec.rb +23 -0
  37. data/spec/searchlogic/named_scopes/association_conditions_spec.rb +203 -0
  38. data/spec/searchlogic/named_scopes/association_ordering_spec.rb +27 -0
  39. data/spec/searchlogic/named_scopes/conditions_spec.rb +319 -0
  40. data/spec/searchlogic/named_scopes/or_conditions_spec.rb +66 -0
  41. data/spec/searchlogic/named_scopes/ordering_spec.rb +34 -0
  42. data/spec/searchlogic/search_spec.rb +497 -0
  43. data/spec/spec_helper.rb +132 -0
  44. metadata +136 -0
@@ -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,136 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yoomee-searchlogic
3
+ version: !ruby/object:Gem::Version
4
+ hash: 41
5
+ prerelease: false
6
+ segments:
7
+ - 2
8
+ - 4
9
+ - 27
10
+ version: 2.4.27
11
+ platform: ruby
12
+ authors:
13
+ - Yoomee Developers, Ben Johnson of Binary Logic
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-09-22 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: activerecord
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 15
30
+ segments:
31
+ - 2
32
+ - 0
33
+ - 0
34
+ version: 2.0.0
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: Searchlogic makes using ActiveRecord named scopes easier and less repetitive.
38
+ email: developers@yoomee.com, bjohnson@binarylogic.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - LICENSE
45
+ - README.rdoc
46
+ files:
47
+ - .gitignore
48
+ - LICENSE
49
+ - README.rdoc
50
+ - Rakefile
51
+ - VERSION.yml
52
+ - init.rb
53
+ - lib/searchlogic.rb
54
+ - lib/searchlogic/active_record/association_proxy.rb
55
+ - lib/searchlogic/active_record/consistency.rb
56
+ - lib/searchlogic/active_record/named_scope_tools.rb
57
+ - lib/searchlogic/core_ext/object.rb
58
+ - lib/searchlogic/core_ext/proc.rb
59
+ - lib/searchlogic/named_scopes/alias_scope.rb
60
+ - lib/searchlogic/named_scopes/association_conditions.rb
61
+ - lib/searchlogic/named_scopes/association_ordering.rb
62
+ - lib/searchlogic/named_scopes/conditions.rb
63
+ - lib/searchlogic/named_scopes/or_conditions.rb
64
+ - lib/searchlogic/named_scopes/ordering.rb
65
+ - lib/searchlogic/rails_helpers.rb
66
+ - lib/searchlogic/search.rb
67
+ - lib/searchlogic/search/base.rb
68
+ - lib/searchlogic/search/conditions.rb
69
+ - lib/searchlogic/search/date_parts.rb
70
+ - lib/searchlogic/search/implementation.rb
71
+ - lib/searchlogic/search/method_missing.rb
72
+ - lib/searchlogic/search/ordering.rb
73
+ - lib/searchlogic/search/scopes.rb
74
+ - lib/searchlogic/search/to_yaml.rb
75
+ - lib/searchlogic/search/unknown_condition_error.rb
76
+ - rails/init.rb
77
+ - searchlogic.gemspec
78
+ - spec/searchlogic/active_record/association_proxy_spec.rb
79
+ - spec/searchlogic/active_record/consistency_spec.rb
80
+ - spec/searchlogic/core_ext/object_spec.rb
81
+ - spec/searchlogic/core_ext/proc_spec.rb
82
+ - spec/searchlogic/named_scopes/alias_scope_spec.rb
83
+ - spec/searchlogic/named_scopes/association_conditions_spec.rb
84
+ - spec/searchlogic/named_scopes/association_ordering_spec.rb
85
+ - spec/searchlogic/named_scopes/conditions_spec.rb
86
+ - spec/searchlogic/named_scopes/or_conditions_spec.rb
87
+ - spec/searchlogic/named_scopes/ordering_spec.rb
88
+ - spec/searchlogic/search_spec.rb
89
+ - spec/spec_helper.rb
90
+ has_rdoc: true
91
+ homepage: http://github.com/binarylogic/searchlogic
92
+ licenses: []
93
+
94
+ post_install_message:
95
+ rdoc_options:
96
+ - --charset=UTF-8
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ hash: 3
105
+ segments:
106
+ - 0
107
+ version: "0"
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ none: false
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ hash: 3
114
+ segments:
115
+ - 0
116
+ version: "0"
117
+ requirements: []
118
+
119
+ rubyforge_project: searchlogic
120
+ rubygems_version: 1.3.7
121
+ signing_key:
122
+ specification_version: 3
123
+ summary: Searchlogic makes using ActiveRecord named scopes easier and less repetitive.
124
+ test_files:
125
+ - spec/searchlogic/active_record/association_proxy_spec.rb
126
+ - spec/searchlogic/active_record/consistency_spec.rb
127
+ - spec/searchlogic/core_ext/object_spec.rb
128
+ - spec/searchlogic/core_ext/proc_spec.rb
129
+ - spec/searchlogic/named_scopes/alias_scope_spec.rb
130
+ - spec/searchlogic/named_scopes/association_conditions_spec.rb
131
+ - spec/searchlogic/named_scopes/association_ordering_spec.rb
132
+ - spec/searchlogic/named_scopes/conditions_spec.rb
133
+ - spec/searchlogic/named_scopes/or_conditions_spec.rb
134
+ - spec/searchlogic/named_scopes/ordering_spec.rb
135
+ - spec/searchlogic/search_spec.rb
136
+ - spec/spec_helper.rb