query_count 1.0.0 → 1.1.0
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 +4 -4
- data/.github/workflows/ci.yml +114 -0
- data/.rubocop.yml +6 -2
- data/CHANGELOG.md +7 -0
- data/Gemfile +1 -1
- data/README.md +20 -4
- data/gemfiles/4.2.gemfile +3 -0
- data/gemfiles/5.0.gemfile +2 -1
- data/gemfiles/5.1.gemfile +2 -1
- data/gemfiles/5.2.gemfile +2 -1
- data/gemfiles/6.0.gemfile +2 -1
- data/gemfiles/6.1.gemfile +2 -0
- data/gemfiles/7.0.gemfile +2 -0
- data/gemfiles/edge.gemfile +4 -0
- data/lib/query_count/version.rb +1 -1
- data/query_count.gemspec +4 -3
- metadata +20 -15
- data/.travis.yml +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66024a7857129277ac1750e76cbfc12c00dd5583fa18456c27e24c8165b88705
|
4
|
+
data.tar.gz: 8241feb72c765ecbc6f142779152c10fd6d71f8b489169c46a5b85c733a55249
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9209026496704cf1abce72bc6bc9dc26c020a38d54ed0d344facf009bb58915b2bdefbfcd3b2db4bec2cddad9b6263a77fba5b753513f85c5e7b9024a04f572
|
7
|
+
data.tar.gz: bb7aa63426c6640384a5dc0492ae36c7087fbe0f69e5fdedf277c784965deb7e4b4dbb26620354b0703969f4fd6bd5b20826d9e6c7910cac77bbe7054bf70de0
|
@@ -0,0 +1,114 @@
|
|
1
|
+
name: CI
|
2
|
+
on: [push, pull_request]
|
3
|
+
jobs:
|
4
|
+
tests:
|
5
|
+
runs-on: ubuntu-latest
|
6
|
+
strategy:
|
7
|
+
fail-fast: false
|
8
|
+
matrix:
|
9
|
+
include:
|
10
|
+
# rails 4.2, ruby 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
|
11
|
+
- rails: '4.2'
|
12
|
+
ruby: '2.0'
|
13
|
+
- rails: '4.2'
|
14
|
+
ruby: '2.1'
|
15
|
+
- rails: '4.2'
|
16
|
+
ruby: '2.2'
|
17
|
+
- rails: '4.2'
|
18
|
+
ruby: '2.3'
|
19
|
+
- rails: '4.2'
|
20
|
+
ruby: '2.4'
|
21
|
+
- rails: '4.2'
|
22
|
+
ruby: '2.5'
|
23
|
+
- rails: '4.2'
|
24
|
+
ruby: '2.6'
|
25
|
+
# rails 5.0, ruby 2.2, 2.3, 2.4, 2.5, 2.6, 2.7
|
26
|
+
- rails: '5.0'
|
27
|
+
ruby: '2.2'
|
28
|
+
- rails: '5.0'
|
29
|
+
ruby: '2.3'
|
30
|
+
- rails: '5.0'
|
31
|
+
ruby: '2.4'
|
32
|
+
- rails: '5.0'
|
33
|
+
ruby: '2.5'
|
34
|
+
- rails: '5.0'
|
35
|
+
ruby: '2.6'
|
36
|
+
- rails: '5.0'
|
37
|
+
ruby: '2.7'
|
38
|
+
# rails 5.1, ruby 2.2, 2.3, 2.4, 2.5, 2.6, 2.7
|
39
|
+
- rails: '5.1'
|
40
|
+
ruby: '2.2'
|
41
|
+
- rails: '5.1'
|
42
|
+
ruby: '2.3'
|
43
|
+
- rails: '5.1'
|
44
|
+
ruby: '2.4'
|
45
|
+
- rails: '5.1'
|
46
|
+
ruby: '2.5'
|
47
|
+
- rails: '5.1'
|
48
|
+
ruby: '2.6'
|
49
|
+
- rails: '5.1'
|
50
|
+
ruby: '2.7'
|
51
|
+
# rails 5.2, ruby 2.2, 2.3, 2.4, 2.5, 2.6, 2.7
|
52
|
+
- rails: '5.2'
|
53
|
+
ruby: '2.2'
|
54
|
+
- rails: '5.2'
|
55
|
+
ruby: '2.3'
|
56
|
+
- rails: '5.2'
|
57
|
+
ruby: '2.4'
|
58
|
+
- rails: '5.2'
|
59
|
+
ruby: '2.5'
|
60
|
+
- rails: '5.2'
|
61
|
+
ruby: '2.6'
|
62
|
+
- rails: '5.2'
|
63
|
+
ruby: '2.7'
|
64
|
+
# rails 6.0, ruby 2.5, 2.6, 2.7, 3.0, 3.1
|
65
|
+
- rails: '6.0'
|
66
|
+
ruby: '2.5'
|
67
|
+
- rails: '6.0'
|
68
|
+
ruby: '2.6'
|
69
|
+
- rails: '6.0'
|
70
|
+
ruby: '2.7'
|
71
|
+
- rails: '6.0'
|
72
|
+
ruby: '3.0'
|
73
|
+
- rails: '6.0'
|
74
|
+
ruby: '3.1'
|
75
|
+
# rails 6.1, ruby 2.5, 2.6, 2.7, 3.0, 3.1
|
76
|
+
- rails: '6.1'
|
77
|
+
ruby: '2.5'
|
78
|
+
- rails: '6.1'
|
79
|
+
ruby: '2.6'
|
80
|
+
- rails: '6.1'
|
81
|
+
ruby: '2.7'
|
82
|
+
- rails: '6.1'
|
83
|
+
ruby: '3.0'
|
84
|
+
- rails: '6.1'
|
85
|
+
ruby: '3.1'
|
86
|
+
# rails 7.0; ruby 2.7, 3.0, 3.1
|
87
|
+
- rails: '7.0'
|
88
|
+
ruby: '2.7'
|
89
|
+
- rails: '7.0'
|
90
|
+
ruby: '3.0'
|
91
|
+
- rails: '7.0'
|
92
|
+
ruby: '3.1'
|
93
|
+
# rails edge; ruby 2.7, 3.0, 3.1
|
94
|
+
- rails: 'edge'
|
95
|
+
ruby: '2.7'
|
96
|
+
- rails: 'edge'
|
97
|
+
ruby: '3.0'
|
98
|
+
- rails: 'edge'
|
99
|
+
ruby: '3.1'
|
100
|
+
name: Rails ${{ matrix.rails }} on Ruby ${{ matrix.ruby }}
|
101
|
+
steps:
|
102
|
+
- name: Checkout
|
103
|
+
uses: actions/checkout@v2
|
104
|
+
- name: Set up Ruby
|
105
|
+
env:
|
106
|
+
RAILS_VERSION: ${{ matrix.rails }}
|
107
|
+
uses: ruby/setup-ruby@v1
|
108
|
+
with:
|
109
|
+
ruby-version: ${{ matrix.ruby }}
|
110
|
+
bundler-cache: true
|
111
|
+
- name: Run tests
|
112
|
+
env:
|
113
|
+
RAILS_VERSION: ${{ matrix.rails }}
|
114
|
+
run: bundle exec rake
|
data/.rubocop.yml
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
AllCops:
|
2
2
|
NewCops: enable
|
3
|
-
|
3
|
+
SuggestExtensions: false
|
4
|
+
TargetRubyVersion: 3.1
|
5
|
+
|
6
|
+
Gemspec/RequiredRubyVersion:
|
7
|
+
Enabled: false
|
4
8
|
|
5
9
|
Layout/IndentationConsistency:
|
6
10
|
EnforcedStyle: indented_internal_methods
|
@@ -9,7 +13,7 @@ Layout/LineLength:
|
|
9
13
|
Max: 100
|
10
14
|
|
11
15
|
Metrics/BlockLength:
|
12
|
-
|
16
|
+
IgnoredMethods: [RSpec.describe, context]
|
13
17
|
|
14
18
|
Style/Documentation:
|
15
19
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Query Count
|
2
2
|
|
3
|
-
|
3
|
+
[](https://badge.fury.io/rb/query_count)
|
4
|
+
[](https://github.com/rubysamurai/query_count/actions?query=workflow%3ACI)
|
5
|
+
|
6
|
+
A zero-configuration gem to count the number of SQL queries performed by the ActiveRecord.
|
7
|
+
Supports **Rails 4.2+** and **Ruby 2.0+** (the complete testing matrix is [here](.github/workflows/ci.yml)).
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
@@ -10,17 +14,29 @@ Add this line to your application's Gemfile:
|
|
10
14
|
gem 'query_count'
|
11
15
|
```
|
12
16
|
|
13
|
-
Run
|
17
|
+
Run `bundle install`.
|
14
18
|
|
15
19
|
## Usage
|
16
20
|
|
17
|
-
The gem will automatically include the number of SQL queries
|
21
|
+
The gem will automatically include the number of SQL queries to the default Rails log.
|
18
22
|
|
19
23
|
```
|
20
24
|
ActiveRecord: 34.0ms | SQL Queries: 8 (1 cached)
|
21
25
|
```
|
22
26
|
|
23
|
-
This log example shows that the total number of queries was 8 and 1
|
27
|
+
This log example shows that the total number of queries was 8, and 1 was cached, which means the request hit the database 7 times.
|
28
|
+
|
29
|
+
`QueryCount::Counter` provides public methods `counter`, `counter_cache`, `reset_counter`, `reset_counter_cache`.
|
30
|
+
|
31
|
+
RSpec 3 example:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
it 'performs exactly 5 queries' do
|
35
|
+
QueryCount::Counter.reset_counter
|
36
|
+
5.times { User.last }
|
37
|
+
expect(QueryCount::Counter.counter).to eq 5
|
38
|
+
end
|
39
|
+
```
|
24
40
|
|
25
41
|
## License
|
26
42
|
|
data/gemfiles/5.0.gemfile
CHANGED
data/gemfiles/5.1.gemfile
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
gem '
|
1
|
+
gem 'activerecord', '~> 5.1.0'
|
2
|
+
gem 'railties', '~> 5.1.0'
|
data/gemfiles/5.2.gemfile
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
gem '
|
1
|
+
gem 'activerecord', '~> 5.2.0'
|
2
|
+
gem 'railties', '~> 5.2.0'
|
data/gemfiles/6.0.gemfile
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
gem '
|
1
|
+
gem 'activerecord', '~> 6.0.0'
|
2
|
+
gem 'railties', '~> 6.0.0'
|
data/lib/query_count/version.rb
CHANGED
data/query_count.gemspec
CHANGED
@@ -10,12 +10,13 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.description = spec.summary
|
11
11
|
spec.homepage = 'https://github.com/rubysamurai/query_count'
|
12
12
|
spec.license = 'MIT'
|
13
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.0.0')
|
14
14
|
|
15
15
|
spec.metadata['homepage_uri'] = spec.homepage
|
16
16
|
spec.metadata['source_code_uri'] = spec.homepage
|
17
17
|
spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/issues"
|
18
18
|
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/master/CHANGELOG.md"
|
19
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
19
20
|
|
20
21
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
21
22
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
@@ -24,9 +25,9 @@ Gem::Specification.new do |spec|
|
|
24
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
26
|
spec.require_paths = ['lib']
|
26
27
|
|
27
|
-
spec.add_runtime_dependency '
|
28
|
+
spec.add_runtime_dependency 'activerecord', '>= 4.2'
|
29
|
+
spec.add_runtime_dependency 'railties', '>= 4.2'
|
28
30
|
|
29
|
-
spec.add_development_dependency 'rake', '>= 13.0'
|
30
31
|
spec.add_development_dependency 'rspec', '>= 3.9'
|
31
32
|
spec.add_development_dependency 'sqlite3', '>= 1.3'
|
32
33
|
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: query_count
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitriy Tarasov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: railties
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
-
type: :
|
33
|
+
version: '4.2'
|
34
|
+
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '4.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,10 +73,10 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
+
- ".github/workflows/ci.yml"
|
76
77
|
- ".gitignore"
|
77
78
|
- ".rspec"
|
78
79
|
- ".rubocop.yml"
|
79
|
-
- ".travis.yml"
|
80
80
|
- CHANGELOG.md
|
81
81
|
- Gemfile
|
82
82
|
- LICENSE.txt
|
@@ -84,10 +84,14 @@ files:
|
|
84
84
|
- Rakefile
|
85
85
|
- bin/console
|
86
86
|
- bin/setup
|
87
|
+
- gemfiles/4.2.gemfile
|
87
88
|
- gemfiles/5.0.gemfile
|
88
89
|
- gemfiles/5.1.gemfile
|
89
90
|
- gemfiles/5.2.gemfile
|
90
91
|
- gemfiles/6.0.gemfile
|
92
|
+
- gemfiles/6.1.gemfile
|
93
|
+
- gemfiles/7.0.gemfile
|
94
|
+
- gemfiles/edge.gemfile
|
91
95
|
- lib/query_count.rb
|
92
96
|
- lib/query_count/controller_runtime.rb
|
93
97
|
- lib/query_count/counter.rb
|
@@ -102,7 +106,8 @@ metadata:
|
|
102
106
|
source_code_uri: https://github.com/rubysamurai/query_count
|
103
107
|
bug_tracker_uri: https://github.com/rubysamurai/query_count/issues
|
104
108
|
changelog_uri: https://github.com/rubysamurai/query_count/blob/master/CHANGELOG.md
|
105
|
-
|
109
|
+
rubygems_mfa_required: 'true'
|
110
|
+
post_install_message:
|
106
111
|
rdoc_options: []
|
107
112
|
require_paths:
|
108
113
|
- lib
|
@@ -110,15 +115,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
115
|
requirements:
|
111
116
|
- - ">="
|
112
117
|
- !ruby/object:Gem::Version
|
113
|
-
version: 2.
|
118
|
+
version: 2.0.0
|
114
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
120
|
requirements:
|
116
121
|
- - ">="
|
117
122
|
- !ruby/object:Gem::Version
|
118
123
|
version: '0'
|
119
124
|
requirements: []
|
120
|
-
rubygems_version: 3.
|
121
|
-
signing_key:
|
125
|
+
rubygems_version: 3.2.32
|
126
|
+
signing_key:
|
122
127
|
specification_version: 4
|
123
128
|
summary: SQL queries counter for Rails apps
|
124
129
|
test_files: []
|