kasket 1.0.3.beta2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/kasket.rb CHANGED
@@ -15,7 +15,7 @@ module Kasket
15
15
  MAJOR = 1
16
16
  MINOR = 0
17
17
  PATCH = 3
18
- STRING = "#{MAJOR}.#{MINOR}.#{PATCH}.beta2"
18
+ STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
19
19
  end
20
20
 
21
21
  module_function
@@ -12,7 +12,7 @@ module Kasket
12
12
  def initialize(model_class)
13
13
  @model_class = model_class
14
14
  @supported_query_pattern = /^select \* from (?:`|")#{@model_class.table_name}(?:`|") where \((.*)\)(|\s+limit 1)\s*$/i
15
- @table_and_column_pattern = /(?:(?:`|")?#{@model_class.table_name}(?:`|")?\.)?(?:`|")?(\w+)(?:`|")?/ # Matches: `users`.id, `users`.`id`, users.id, id
15
+ @table_and_column_pattern = /(?:(?:`|")?#{@model_class.table_name}(?:`|")?\.)?(?:`|")?(\D\w*)(?:`|")?/ # Matches: `users`.id, `users`.`id`, users.id, id
16
16
  @key_eq_value_pattern = /^[\(\s]*#{@table_and_column_pattern}\s+(=|IN)\s+#{VALUE}[\)\s]*$/ # Matches: KEY = VALUE, (KEY = VALUE), ()(KEY = VALUE))
17
17
  end
18
18
 
data/test/parser_test.rb CHANGED
@@ -8,6 +8,11 @@ class ParserTest < ActiveSupport::TestCase
8
8
  @parser = Kasket::QueryParser.new(Post)
9
9
  end
10
10
 
11
+ should "not support conditions with number as column (e.g. 0 = 1)" do
12
+ kasket_query = @parser.parse('SELECT * FROM `posts` WHERE (0 = 1)')
13
+ assert(!kasket_query)
14
+ end
15
+
11
16
  should 'not support IN queries in combination with other conditions' do
12
17
  parsed_query = @parser.parse('SELECT * FROM `posts` WHERE (`posts`.`id` IN (1,2,3) AND `posts`.`is_active` = 1)')
13
18
  assert(!parsed_query)
metadata CHANGED
@@ -1,138 +1,137 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: kasket
3
- version: !ruby/object:Gem::Version
4
- hash: -3005910022
5
- prerelease: 6
6
- segments:
7
- - 1
8
- - 0
9
- - 3
10
- - beta
11
- - 2
12
- version: 1.0.3.beta2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
5
+ prerelease:
13
6
  platform: ruby
14
- authors:
7
+ authors:
15
8
  - Mick Staugaard
16
9
  - Eric Chapweske
17
10
  autorequire:
18
11
  bindir: bin
19
12
  cert_chain: []
20
-
21
- date: 2012-03-13 00:00:00 Z
22
- dependencies:
23
- - !ruby/object:Gem::Dependency
13
+ date: 2012-06-15 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
24
16
  name: activerecord
25
- prerelease: false
26
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
27
18
  none: false
28
- requirements:
19
+ requirements:
29
20
  - - ~>
30
- - !ruby/object:Gem::Version
31
- hash: 11
32
- segments:
33
- - 2
34
- - 3
35
- - 4
21
+ - !ruby/object:Gem::Version
36
22
  version: 2.3.4
37
23
  type: :runtime
38
- version_requirements: *id001
39
- - !ruby/object:Gem::Dependency
40
- name: rake
41
24
  prerelease: false
42
- requirement: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: !ruby/object:Gem::Requirement
43
26
  none: false
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- hash: 3
48
- segments:
49
- - 0
50
- version: "0"
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: 2.3.4
31
+ - !ruby/object:Gem::Dependency
32
+ name: rake
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
51
39
  type: :development
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
- name: bundler
55
40
  prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
41
+ version_requirements: !ruby/object:Gem::Requirement
57
42
  none: false
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- hash: 3
62
- segments:
63
- - 0
64
- version: "0"
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
65
55
  type: :development
66
- version_requirements: *id003
67
- - !ruby/object:Gem::Dependency
68
- name: shoulda
69
56
  prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
57
+ version_requirements: !ruby/object:Gem::Requirement
71
58
  none: false
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- hash: 3
76
- segments:
77
- - 0
78
- version: "0"
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ - !ruby/object:Gem::Dependency
64
+ name: shoulda
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
79
71
  type: :development
80
- version_requirements: *id004
81
- - !ruby/object:Gem::Dependency
82
- name: mocha
83
72
  prerelease: false
84
- requirement: &id005 !ruby/object:Gem::Requirement
73
+ version_requirements: !ruby/object:Gem::Requirement
85
74
  none: false
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- hash: 3
90
- segments:
91
- - 0
92
- version: "0"
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ - !ruby/object:Gem::Dependency
80
+ name: mocha
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
93
87
  type: :development
94
- version_requirements: *id005
95
- - !ruby/object:Gem::Dependency
96
- name: temping
97
88
  prerelease: false
98
- requirement: &id006 !ruby/object:Gem::Requirement
89
+ version_requirements: !ruby/object:Gem::Requirement
99
90
  none: false
100
- requirements:
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: temping
97
+ requirement: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
101
100
  - - ~>
102
- - !ruby/object:Gem::Version
103
- hash: 27
104
- segments:
105
- - 1
106
- - 3
107
- - 0
101
+ - !ruby/object:Gem::Version
108
102
  version: 1.3.0
109
103
  type: :development
110
- version_requirements: *id006
111
- - !ruby/object:Gem::Dependency
112
- name: sqlite3
113
104
  prerelease: false
114
- requirement: &id007 !ruby/object:Gem::Requirement
105
+ version_requirements: !ruby/object:Gem::Requirement
115
106
  none: false
116
- requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
119
- hash: 3
120
- segments:
121
- - 0
122
- version: "0"
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 1.3.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: sqlite3
113
+ requirement: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ! '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
123
119
  type: :development
124
- version_requirements: *id007
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
125
127
  description: puts a cap on your queries
126
- email:
128
+ email:
127
129
  - mick@zendesk.com
128
130
  - eac@zendesk.com
129
131
  executables: []
130
-
131
132
  extensions: []
132
-
133
133
  extra_rdoc_files: []
134
-
135
- files:
134
+ files:
136
135
  - lib/kasket/active_record_patches.rb
137
136
  - lib/kasket/configuration_mixin.rb
138
137
  - lib/kasket/dirty_mixin.rb
@@ -159,40 +158,29 @@ files:
159
158
  - test/transaction_test.rb
160
159
  homepage: http://github.com/staugaard/kasket
161
160
  licenses: []
162
-
163
161
  post_install_message:
164
162
  rdoc_options: []
165
-
166
- require_paths:
163
+ require_paths:
167
164
  - lib
168
- required_ruby_version: !ruby/object:Gem::Requirement
165
+ required_ruby_version: !ruby/object:Gem::Requirement
169
166
  none: false
170
- requirements:
171
- - - ">="
172
- - !ruby/object:Gem::Version
173
- hash: 3
174
- segments:
175
- - 0
176
- version: "0"
177
- required_rubygems_version: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ! '>='
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
171
+ required_rubygems_version: !ruby/object:Gem::Requirement
178
172
  none: false
179
- requirements:
180
- - - ">"
181
- - !ruby/object:Gem::Version
182
- hash: 25
183
- segments:
184
- - 1
185
- - 3
186
- - 1
187
- version: 1.3.1
173
+ requirements:
174
+ - - ! '>='
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
188
177
  requirements: []
189
-
190
178
  rubyforge_project:
191
- rubygems_version: 1.8.17
179
+ rubygems_version: 1.8.24
192
180
  signing_key:
193
181
  specification_version: 3
194
182
  summary: A write back caching layer on active record
195
- test_files:
183
+ test_files:
196
184
  - test/cache_expiry_test.rb
197
185
  - test/cacheable_test.rb
198
186
  - test/configuration_mixin_test.rb