sequel-rails 0.9.10 → 0.9.11

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: eba946c66e7d9fa0575c3ca8be8d9b2814aea6f5
4
- data.tar.gz: d2babb6feab008ba8a5351cdc8a8be90bad8b2d2
3
+ metadata.gz: 44b6703d7b0e5a73f9539c3a89e7d4cad0dcfff3
4
+ data.tar.gz: eb21ad4107e1eacf55d4f21175e815be2ef308b2
5
5
  SHA512:
6
- metadata.gz: 51725615f608c37dca7faafb45abd22861438d3b26d428c37577062703c9d9a6712a0585c7af3f0967419d823ff70d3b53c38ccf269f3d76af1dbd3b99754a24
7
- data.tar.gz: 0df87880f42c040b73b312f397b65e82411109db500043ed6ae32def27c59c397851284cc7ed0628d4d3cb3129dccd0e6bfa226d7160c2b1efa00647f8abdc8e
6
+ metadata.gz: b0d73d406b6477ecbe4dc74d3870fd0b70cafaa4b27e1cd1deb14126d4b46c9606aa2225e11f536f0e27f12de3c916bdbcd09f0405f1611c75469b217675afee
7
+ data.tar.gz: 1a5b250db4634b304caf5e9d9169801e51415e21c3819d8400dacb11126e8985bc2adb52716c360c13d126c870957db4df59b4d648ff3d907c0d07c531ec155e
data/History.md CHANGED
@@ -1,3 +1,8 @@
1
+ 0.9.11 (2015-03-13)
2
+ ===================
3
+
4
+ * Track query count in `SequelRails::Railties::LogSubscriber.count`
5
+
1
6
  0.9.10 (2015-02-26)
2
7
  ===================
3
8
 
@@ -14,6 +14,7 @@ module SequelRails
14
14
  # because of queries in middleware or in cases we are streaming
15
15
  # and it won't be cleaned up by the method below.
16
16
  ::SequelRails::Railties::LogSubscriber.reset_runtime
17
+ ::SequelRails::Railties::LogSubscriber.reset_count
17
18
  super
18
19
  end
19
20
 
@@ -29,6 +30,7 @@ module SequelRails
29
30
  def append_info_to_payload(payload)
30
31
  super
31
32
  payload[:db_runtime] = (db_runtime || 0) + ::SequelRails::Railties::LogSubscriber.reset_runtime
33
+ payload[:db_query_count] = ::SequelRails::Railties::LogSubscriber.count
32
34
  end
33
35
 
34
36
  module ClassMethods
@@ -9,13 +9,27 @@ module SequelRails
9
9
  Thread.current['sequel_sql_runtime'] ||= 0
10
10
  end
11
11
 
12
+ def self.count=(value)
13
+ Thread.current['sequel_sql_count'] = value
14
+ end
15
+
16
+ def self.count
17
+ Thread.current['sequel_sql_count'] ||= 0
18
+ end
19
+
12
20
  def self.reset_runtime
13
- rt, self.runtime = runtime, 0
14
- rt
21
+ previous, self.runtime = runtime, 0
22
+ previous
23
+ end
24
+
25
+ def self.reset_count
26
+ previous, self.count = count, 0
27
+ previous
15
28
  end
16
29
 
17
30
  def sql(event)
18
31
  self.class.runtime += event.duration
32
+ self.class.count += 1
19
33
  return unless logger.debug?
20
34
 
21
35
  payload = event.payload
@@ -1,3 +1,3 @@
1
1
  module SequelRails
2
- VERSION = '0.9.10'
2
+ VERSION = '0.9.11'
3
3
  end
@@ -10,19 +10,24 @@ describe SequelRails::Railties::LogSubscriber do
10
10
  before do
11
11
  setup
12
12
  described_class.attach_to :sequel
13
+ described_class.reset_count
13
14
  end
14
15
  after { teardown }
15
16
 
16
- it 'logs queries' do
17
+ it 'logs queries, runtime and count' do
18
+ expect(described_class.count).to eq 0
17
19
  User.all
18
20
  wait
19
21
  expect(@logger.logged(:debug).last).to match(/SELECT \* FROM ("|`)users("|`)/)
22
+ expect(described_class.count).to be > 0
20
23
  end
21
24
 
22
- it 'does not log query when logger level is not debug' do
25
+ it 'does not log query when logger level is not debug, but track runtime and count' do
26
+ expect(described_class.count).to eq 0
23
27
  @logger.level = :info
24
28
  User.all
25
29
  wait
26
30
  expect(@logger.logged(:debug).size).to eq 0
31
+ expect(described_class.count).to be > 0
27
32
  end
28
33
  end
metadata CHANGED
@@ -1,176 +1,190 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.10
4
+ version: 0.9.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brasten Sager (brasten)
8
8
  - Jonathan TRON
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-26 00:00:00.000000000 Z
12
+ date: 2015-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
+ name: activemodel
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
- - - '>='
18
+ - - ">="
18
19
  - !ruby/object:Gem::Version
19
20
  version: '0'
20
- name: activemodel
21
- prerelease: false
22
21
  type: :runtime
22
+ prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
+ name: railties
29
30
  requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
- - - '>='
32
+ - - ">="
32
33
  - !ruby/object:Gem::Version
33
34
  version: 3.2.0
34
- name: railties
35
- prerelease: false
36
35
  type: :runtime
36
+ prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: 3.2.0
42
42
  - !ruby/object:Gem::Dependency
43
+ name: actionpack
43
44
  requirement: !ruby/object:Gem::Requirement
44
45
  requirements:
45
- - - '>='
46
+ - - ">="
46
47
  - !ruby/object:Gem::Version
47
48
  version: 3.2.0
48
- name: actionpack
49
- prerelease: false
50
49
  type: :runtime
50
+ prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: 3.2.0
56
56
  - !ruby/object:Gem::Dependency
57
+ name: sequel
57
58
  requirement: !ruby/object:Gem::Requirement
58
59
  requirements:
59
- - - '>='
60
+ - - ">="
60
61
  - !ruby/object:Gem::Version
61
62
  version: '3.28'
62
- - - <
63
+ - - "<"
63
64
  - !ruby/object:Gem::Version
64
65
  version: '5.0'
65
- name: sequel
66
- prerelease: false
67
66
  type: :runtime
67
+ prerelease: false
68
68
  version_requirements: !ruby/object:Gem::Requirement
69
69
  requirements:
70
- - - '>='
70
+ - - ">="
71
71
  - !ruby/object:Gem::Version
72
72
  version: '3.28'
73
- - - <
73
+ - - "<"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '5.0'
76
76
  - !ruby/object:Gem::Dependency
77
+ name: combustion
77
78
  requirement: !ruby/object:Gem::Requirement
78
79
  requirements:
79
- - - '>='
80
+ - - ">="
80
81
  - !ruby/object:Gem::Version
81
82
  version: '0'
82
- name: combustion
83
- prerelease: false
84
83
  type: :development
84
+ prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  - !ruby/object:Gem::Dependency
91
+ name: generator_spec
91
92
  requirement: !ruby/object:Gem::Requirement
92
93
  requirements:
93
- - - '>='
94
+ - - ">="
94
95
  - !ruby/object:Gem::Version
95
96
  version: '0'
96
- name: generator_spec
97
- prerelease: false
98
97
  type: :development
98
+ prerelease: false
99
99
  version_requirements: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  - !ruby/object:Gem::Dependency
105
+ name: rake
105
106
  requirement: !ruby/object:Gem::Requirement
106
107
  requirements:
107
- - - '>='
108
+ - - ">="
108
109
  - !ruby/object:Gem::Version
109
110
  version: 0.8.7
110
- name: rake
111
- prerelease: false
112
111
  type: :development
112
+ prerelease: false
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: 0.8.7
118
118
  - !ruby/object:Gem::Dependency
119
+ name: rspec
119
120
  requirement: !ruby/object:Gem::Requirement
120
121
  requirements:
121
- - - ~>
122
+ - - "~>"
122
123
  - !ruby/object:Gem::Version
123
124
  version: '3.1'
124
- name: rspec
125
- prerelease: false
126
125
  type: :development
126
+ prerelease: false
127
127
  version_requirements: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: '3.1'
132
132
  - !ruby/object:Gem::Dependency
133
+ name: rspec-rails
133
134
  requirement: !ruby/object:Gem::Requirement
134
135
  requirements:
135
- - - ~>
136
+ - - "~>"
136
137
  - !ruby/object:Gem::Version
137
138
  version: '3.1'
138
- name: rspec-rails
139
- prerelease: false
140
139
  type: :development
140
+ prerelease: false
141
141
  version_requirements: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: '3.1'
146
146
  - !ruby/object:Gem::Dependency
147
+ name: rubocop
147
148
  requirement: !ruby/object:Gem::Requirement
148
149
  requirements:
149
- - - ~>
150
+ - - "~>"
150
151
  - !ruby/object:Gem::Version
151
152
  version: 0.28.0
152
- name: rubocop
153
- prerelease: false
154
153
  type: :development
154
+ prerelease: false
155
155
  version_requirements: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ~>
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
159
  version: 0.28.0
160
160
  - !ruby/object:Gem::Dependency
161
+ name: ammeter
161
162
  requirement: !ruby/object:Gem::Requirement
162
163
  requirements:
163
164
  - - '='
164
165
  - !ruby/object:Gem::Version
165
166
  version: 1.1.2
166
- name: ammeter
167
- prerelease: false
168
167
  type: :development
168
+ prerelease: false
169
169
  version_requirements: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - '='
172
172
  - !ruby/object:Gem::Version
173
173
  version: 1.1.2
174
+ - !ruby/object:Gem::Dependency
175
+ name: test-unit
176
+ requirement: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ type: :development
182
+ prerelease: false
183
+ version_requirements: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
174
188
  description: Integrate Sequel with Rails (3.x and 4.x)
175
189
  email:
176
190
  - brasten@gmail.com
@@ -181,10 +195,10 @@ extra_rdoc_files:
181
195
  - LICENSE
182
196
  - README.md
183
197
  files:
184
- - .gitignore
185
- - .rspec
186
- - .rubocop.yml
187
- - .travis.yml
198
+ - ".gitignore"
199
+ - ".rspec"
200
+ - ".rubocop.yml"
201
+ - ".travis.yml"
188
202
  - Gemfile
189
203
  - History.md
190
204
  - LICENSE
@@ -260,25 +274,25 @@ homepage: http://talentbox.github.io/sequel-rails/
260
274
  licenses:
261
275
  - MIT
262
276
  metadata: {}
263
- post_install_message:
277
+ post_install_message:
264
278
  rdoc_options:
265
- - --charset=UTF-8
279
+ - "--charset=UTF-8"
266
280
  require_paths:
267
281
  - lib
268
282
  required_ruby_version: !ruby/object:Gem::Requirement
269
283
  requirements:
270
- - - '>='
284
+ - - ">="
271
285
  - !ruby/object:Gem::Version
272
286
  version: '0'
273
287
  required_rubygems_version: !ruby/object:Gem::Requirement
274
288
  requirements:
275
- - - '>='
289
+ - - ">="
276
290
  - !ruby/object:Gem::Version
277
291
  version: '0'
278
292
  requirements: []
279
- rubyforge_project:
280
- rubygems_version: 2.1.9
281
- signing_key:
293
+ rubyforge_project:
294
+ rubygems_version: 2.4.5
295
+ signing_key:
282
296
  specification_version: 4
283
297
  summary: Use Sequel with Rails (3.x and 4.x)
284
298
  test_files: