jiminy 0.1.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +20 -0
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +0 -0
  6. data/Gemfile +12 -0
  7. data/Gemfile.lock +245 -0
  8. data/LICENSE +21 -0
  9. data/README.md +173 -0
  10. data/Rakefile +12 -0
  11. data/bin/console +15 -0
  12. data/bin/setup +8 -0
  13. data/example.png +0 -0
  14. data/exe/jiminy +9 -0
  15. data/jiminy.gemspec +42 -0
  16. data/lib/jiminy/cli.rb +137 -0
  17. data/lib/jiminy/configuration.rb +97 -0
  18. data/lib/jiminy/github_apiable.rb +17 -0
  19. data/lib/jiminy/recording/n_plus_one.rb +50 -0
  20. data/lib/jiminy/recording/prosopite_ext/send_notifications_with_tmp_file.rb +44 -0
  21. data/lib/jiminy/recording/prosopite_ext/tmp_file_recorder.rb +40 -0
  22. data/lib/jiminy/recording/rspec.rb +22 -0
  23. data/lib/jiminy/recording/test_controller_concern.rb +26 -0
  24. data/lib/jiminy/recording.rb +14 -0
  25. data/lib/jiminy/reporting/ci_providers/circle_ci/api_request.rb +45 -0
  26. data/lib/jiminy/reporting/ci_providers/circle_ci/artifact.rb +17 -0
  27. data/lib/jiminy/reporting/ci_providers/circle_ci/base.rb +46 -0
  28. data/lib/jiminy/reporting/ci_providers/circle_ci/job.rb +17 -0
  29. data/lib/jiminy/reporting/ci_providers/circle_ci/pipeline.rb +49 -0
  30. data/lib/jiminy/reporting/ci_providers/circle_ci/vcs.rb +13 -0
  31. data/lib/jiminy/reporting/ci_providers/circle_ci/workflow.rb +41 -0
  32. data/lib/jiminy/reporting/ci_providers/circle_ci.rb +54 -0
  33. data/lib/jiminy/reporting/ci_providers/github.rb +29 -0
  34. data/lib/jiminy/reporting/ci_providers/local/artifact.rb +25 -0
  35. data/lib/jiminy/reporting/ci_providers/local.rb +30 -0
  36. data/lib/jiminy/reporting/ci_providers/provider_configuration.rb +28 -0
  37. data/lib/jiminy/reporting/ci_providers.rb +12 -0
  38. data/lib/jiminy/reporting/n_plus_one.rb +39 -0
  39. data/lib/jiminy/reporting/reporters/base_reporter.rb +26 -0
  40. data/lib/jiminy/reporting/reporters/dry_run_reporter.rb +13 -0
  41. data/lib/jiminy/reporting/reporters/github_reporter.rb +28 -0
  42. data/lib/jiminy/reporting/reporters.rb +11 -0
  43. data/lib/jiminy/reporting/yaml_file_comment_presenter.rb +71 -0
  44. data/lib/jiminy/reporting.rb +32 -0
  45. data/lib/jiminy/rspec.rb +3 -0
  46. data/lib/jiminy/setup.rb +10 -0
  47. data/lib/jiminy/templates/reporting/comment_header.md.erb +5 -0
  48. data/lib/jiminy/templates/reporting/n_plus_one.md.erb +12 -0
  49. data/lib/jiminy/version.rb +5 -0
  50. data/lib/jiminy.rb +13 -0
  51. metadata +254 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ed071d31bf26f4a0beaed34426656d9afbf1a99122b57d27aabcf58a03439910
4
+ data.tar.gz: 59c64b03f115328b28da4eb4fda6e573891c770845e97a584cc3d4e400816e37
5
+ SHA512:
6
+ metadata.gz: 7ec6ebd488281ebf37f80885fd7e824f9cccbcd076447afc91551d9a96791db4e801ae413305b565f920d090b3c79afda48f8cdceae8fd9d9f7cee3ce0c76f05
7
+ data.tar.gz: e02a8751271ccd992976f7a98b5fd636d7e3d369d4f1cf9e3eecead0fcc0a29fc56126e9181b526bfc1205c933436506de04d4c409593a13a72b8c2b92c2b1a6
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,20 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+ NewCops: enable
4
+
5
+ Style/Documentation:
6
+ Enabled: false
7
+
8
+ Style/StringLiterals:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Style/StringLiteralsInInterpolation:
13
+ Enabled: true
14
+ EnforcedStyle: double_quotes
15
+
16
+ Layout/LineLength:
17
+ Max: 120
18
+
19
+ Naming/MemoizedInstanceVariableName:
20
+ Enabled: false
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.1.1
data/CHANGELOG.md ADDED
File without changes
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in jiminy.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.21"
data/Gemfile.lock ADDED
@@ -0,0 +1,245 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jiminy (0.1.0.pre1)
5
+ octokit (>= 4, < 5)
6
+ prosopite (>= 1, < 2)
7
+ rails (>= 5, < 7.2)
8
+ thor (>= 1.2, < 2)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ actioncable (7.0.2.2)
14
+ actionpack (= 7.0.2.2)
15
+ activesupport (= 7.0.2.2)
16
+ nio4r (~> 2.0)
17
+ websocket-driver (>= 0.6.1)
18
+ actionmailbox (7.0.2.2)
19
+ actionpack (= 7.0.2.2)
20
+ activejob (= 7.0.2.2)
21
+ activerecord (= 7.0.2.2)
22
+ activestorage (= 7.0.2.2)
23
+ activesupport (= 7.0.2.2)
24
+ mail (>= 2.7.1)
25
+ net-imap
26
+ net-pop
27
+ net-smtp
28
+ actionmailer (7.0.2.2)
29
+ actionpack (= 7.0.2.2)
30
+ actionview (= 7.0.2.2)
31
+ activejob (= 7.0.2.2)
32
+ activesupport (= 7.0.2.2)
33
+ mail (~> 2.5, >= 2.5.4)
34
+ net-imap
35
+ net-pop
36
+ net-smtp
37
+ rails-dom-testing (~> 2.0)
38
+ actionpack (7.0.2.2)
39
+ actionview (= 7.0.2.2)
40
+ activesupport (= 7.0.2.2)
41
+ rack (~> 2.0, >= 2.2.0)
42
+ rack-test (>= 0.6.3)
43
+ rails-dom-testing (~> 2.0)
44
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
45
+ actiontext (7.0.2.2)
46
+ actionpack (= 7.0.2.2)
47
+ activerecord (= 7.0.2.2)
48
+ activestorage (= 7.0.2.2)
49
+ activesupport (= 7.0.2.2)
50
+ globalid (>= 0.6.0)
51
+ nokogiri (>= 1.8.5)
52
+ actionview (7.0.2.2)
53
+ activesupport (= 7.0.2.2)
54
+ builder (~> 3.1)
55
+ erubi (~> 1.4)
56
+ rails-dom-testing (~> 2.0)
57
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
58
+ activejob (7.0.2.2)
59
+ activesupport (= 7.0.2.2)
60
+ globalid (>= 0.3.6)
61
+ activemodel (7.0.2.2)
62
+ activesupport (= 7.0.2.2)
63
+ activerecord (7.0.2.2)
64
+ activemodel (= 7.0.2.2)
65
+ activesupport (= 7.0.2.2)
66
+ activestorage (7.0.2.2)
67
+ actionpack (= 7.0.2.2)
68
+ activejob (= 7.0.2.2)
69
+ activerecord (= 7.0.2.2)
70
+ activesupport (= 7.0.2.2)
71
+ marcel (~> 1.0)
72
+ mini_mime (>= 1.1.0)
73
+ activesupport (7.0.2.2)
74
+ concurrent-ruby (~> 1.0, >= 1.0.2)
75
+ i18n (>= 1.6, < 2)
76
+ minitest (>= 5.1)
77
+ tzinfo (~> 2.0)
78
+ addressable (2.8.0)
79
+ public_suffix (>= 2.0.2, < 5.0)
80
+ ast (2.4.2)
81
+ builder (3.2.4)
82
+ byebug (11.1.3)
83
+ concurrent-ruby (1.1.9)
84
+ crass (1.0.6)
85
+ diff-lcs (1.5.0)
86
+ digest (3.1.0)
87
+ erubi (1.10.0)
88
+ faraday (1.9.3)
89
+ faraday-em_http (~> 1.0)
90
+ faraday-em_synchrony (~> 1.0)
91
+ faraday-excon (~> 1.1)
92
+ faraday-httpclient (~> 1.0)
93
+ faraday-multipart (~> 1.0)
94
+ faraday-net_http (~> 1.0)
95
+ faraday-net_http_persistent (~> 1.0)
96
+ faraday-patron (~> 1.0)
97
+ faraday-rack (~> 1.0)
98
+ faraday-retry (~> 1.0)
99
+ ruby2_keywords (>= 0.0.4)
100
+ faraday-em_http (1.0.0)
101
+ faraday-em_synchrony (1.0.0)
102
+ faraday-excon (1.1.0)
103
+ faraday-httpclient (1.0.1)
104
+ faraday-multipart (1.0.3)
105
+ multipart-post (>= 1.2, < 3)
106
+ faraday-net_http (1.0.1)
107
+ faraday-net_http_persistent (1.2.0)
108
+ faraday-patron (1.0.0)
109
+ faraday-rack (1.0.0)
110
+ faraday-retry (1.0.3)
111
+ globalid (1.0.0)
112
+ activesupport (>= 5.0)
113
+ i18n (1.10.0)
114
+ concurrent-ruby (~> 1.0)
115
+ io-wait (0.2.1)
116
+ loofah (2.14.0)
117
+ crass (~> 1.0.2)
118
+ nokogiri (>= 1.5.9)
119
+ mail (2.7.1)
120
+ mini_mime (>= 0.1.1)
121
+ marcel (1.0.2)
122
+ method_source (1.0.0)
123
+ mini_mime (1.1.2)
124
+ minitest (5.15.0)
125
+ multipart-post (2.1.1)
126
+ net-imap (0.2.3)
127
+ digest
128
+ net-protocol
129
+ strscan
130
+ net-pop (0.1.1)
131
+ digest
132
+ net-protocol
133
+ timeout
134
+ net-protocol (0.1.2)
135
+ io-wait
136
+ timeout
137
+ net-smtp (0.3.1)
138
+ digest
139
+ net-protocol
140
+ timeout
141
+ nio4r (2.5.8)
142
+ nokogiri (1.13.3-x86_64-darwin)
143
+ racc (~> 1.4)
144
+ octokit (4.22.0)
145
+ faraday (>= 0.9)
146
+ sawyer (~> 0.8.0, >= 0.5.3)
147
+ parallel (1.21.0)
148
+ parser (3.1.0.0)
149
+ ast (~> 2.4.1)
150
+ prosopite (1.0.7)
151
+ public_suffix (4.0.6)
152
+ racc (1.6.0)
153
+ rack (2.2.3)
154
+ rack-test (1.1.0)
155
+ rack (>= 1.0, < 3)
156
+ rails (7.0.2.2)
157
+ actioncable (= 7.0.2.2)
158
+ actionmailbox (= 7.0.2.2)
159
+ actionmailer (= 7.0.2.2)
160
+ actionpack (= 7.0.2.2)
161
+ actiontext (= 7.0.2.2)
162
+ actionview (= 7.0.2.2)
163
+ activejob (= 7.0.2.2)
164
+ activemodel (= 7.0.2.2)
165
+ activerecord (= 7.0.2.2)
166
+ activestorage (= 7.0.2.2)
167
+ activesupport (= 7.0.2.2)
168
+ bundler (>= 1.15.0)
169
+ railties (= 7.0.2.2)
170
+ rails-dom-testing (2.0.3)
171
+ activesupport (>= 4.2.0)
172
+ nokogiri (>= 1.6)
173
+ rails-html-sanitizer (1.4.2)
174
+ loofah (~> 2.3)
175
+ railties (7.0.2.2)
176
+ actionpack (= 7.0.2.2)
177
+ activesupport (= 7.0.2.2)
178
+ method_source
179
+ rake (>= 12.2)
180
+ thor (~> 1.0)
181
+ zeitwerk (~> 2.5)
182
+ rainbow (3.1.1)
183
+ rake (13.0.6)
184
+ regexp_parser (2.2.1)
185
+ rexml (3.2.5)
186
+ rspec (3.10.0)
187
+ rspec-core (~> 3.10.0)
188
+ rspec-expectations (~> 3.10.0)
189
+ rspec-mocks (~> 3.10.0)
190
+ rspec-core (3.10.2)
191
+ rspec-support (~> 3.10.0)
192
+ rspec-expectations (3.10.2)
193
+ diff-lcs (>= 1.2.0, < 2.0)
194
+ rspec-support (~> 3.10.0)
195
+ rspec-mocks (3.10.3)
196
+ diff-lcs (>= 1.2.0, < 2.0)
197
+ rspec-support (~> 3.10.0)
198
+ rspec-support (3.10.3)
199
+ rubocop (1.25.1)
200
+ parallel (~> 1.10)
201
+ parser (>= 3.1.0.0)
202
+ rainbow (>= 2.2.2, < 4.0)
203
+ regexp_parser (>= 1.8, < 3.0)
204
+ rexml
205
+ rubocop-ast (>= 1.15.1, < 2.0)
206
+ ruby-progressbar (~> 1.7)
207
+ unicode-display_width (>= 1.4.0, < 3.0)
208
+ rubocop-ast (1.15.2)
209
+ parser (>= 3.0.1.1)
210
+ rubocop-rake (0.6.0)
211
+ rubocop (~> 1.0)
212
+ rubocop-rspec (2.8.0)
213
+ rubocop (~> 1.19)
214
+ ruby-progressbar (1.11.0)
215
+ ruby2_keywords (0.0.5)
216
+ sawyer (0.8.2)
217
+ addressable (>= 2.3.5)
218
+ faraday (> 0.8, < 2.0)
219
+ strscan (3.0.1)
220
+ thor (1.2.1)
221
+ timeout (0.2.0)
222
+ tzinfo (2.0.4)
223
+ concurrent-ruby (~> 1.0)
224
+ unicode-display_width (2.1.0)
225
+ websocket-driver (0.7.5)
226
+ websocket-extensions (>= 0.1.0)
227
+ websocket-extensions (0.1.5)
228
+ zeitwerk (2.5.4)
229
+
230
+ PLATFORMS
231
+ x86_64-darwin-20
232
+ x86_64-darwin-21
233
+ x86_64-linux
234
+
235
+ DEPENDENCIES
236
+ byebug
237
+ jiminy!
238
+ rake (~> 13.0)
239
+ rspec (~> 3.0)
240
+ rubocop (~> 1.21)
241
+ rubocop-rake (>= 0.6.0, < 1)
242
+ rubocop-rspec (>= 2, < 3)
243
+
244
+ BUNDLED WITH
245
+ 2.3.7
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Gavin Morrice
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,173 @@
1
+ # Jiminy
2
+
3
+ ## Your external conscience when creating pull requests
4
+
5
+ Jiminy wraps around your test suite and detects n+1 queries in your code.
6
+
7
+ Once your test suite has run, these can be reported in GitHub PR comments.
8
+
9
+ ## How it works
10
+
11
+ Under the hood, Jiminy uses [Prosopite](https://github.com/charkost/prosopite) to detect N+1 queries.
12
+
13
+ When running RSpec tests, Jiminy extends Prosopite to log the n+1 instances it detects to a temp file (by default, `tmp/jiminy/results.yml`).
14
+
15
+ Via a command-line interface, Jiminy will then report these n+1 queries by commenting in the related PR on GitHub.
16
+
17
+ ## How it looks
18
+
19
+ ![How a Jiminy comment looks in a PR](./example.png)
20
+
21
+ ## Assumptions
22
+
23
+ Jiminy is still pre-release. The current version assumes the following:
24
+
25
+ - Your application is built in Ruby on Rails
26
+ - You are using RSpec as your test suite
27
+ - You are running your tests on CircleCI
28
+ - Your code repository is on GitHub
29
+
30
+ ## Limitations
31
+
32
+ Since Jiminy works (via Prosopite) by monitoring DB queries made by the application in test mode, it's possible that your code might introduce a new n+1 that isn't detected. This is more likely if your test setup doesn't create multiple records. For example:
33
+
34
+ ``` ruby
35
+ # in your controller ...
36
+ def index
37
+ @users = User.all
38
+ @users.each do |user|
39
+ user.profile.name
40
+ end
41
+ end
42
+
43
+ # in your test ...
44
+ before do
45
+ @user = User.create(profile: Profile.new(name: "Profile name"))
46
+ end
47
+
48
+ it "loads the index" do
49
+ get :index
50
+ expect(response).to be_ok
51
+ end
52
+ ```
53
+
54
+ This controller code will likely result in n+1 records being loaded from the DB, but since only one record is created in the test setup this probably won't be detected.
55
+
56
+ You can improve results by adding additional records in some of your test setups to better emulate a real-life scenario.
57
+
58
+ ## Installation
59
+
60
+ ### Installing the gem
61
+
62
+ Add the following to your test and development groups:
63
+
64
+ ``` ruby
65
+ group :development, :test do
66
+ gem "jiminy"
67
+ end
68
+ ```
69
+
70
+ ### Extending your test suite
71
+
72
+ Add the following in `spec/support.rb`:
73
+
74
+ ``` ruby
75
+ require "jiminy/rspec"
76
+
77
+ RSpec.configure do |config|
78
+ config.before(:suite) { Jiminy.reset_results_file! }
79
+ config.around do |example|
80
+ Jiminy.wrap_rspec_example(example)
81
+ end
82
+ end
83
+ ```
84
+
85
+ ### Running the CLI
86
+
87
+ ``` bash
88
+ bundle exec jiminy report --commit b4742289dDDD364fd983fd57787dda74134acbaf --dry-run --pr-number=2 --poll-interval=5 --timeout=20
89
+ ```
90
+
91
+ ### CirleCI Config
92
+
93
+ Make sure your CircleCI configuration saves the artifacts created when running your test suite:
94
+
95
+ ```yaml
96
+ # ...
97
+ - store_artifacts:
98
+ path: ./tmp/jiminy
99
+ # ...
100
+ ```
101
+
102
+ ### GitHub Actions
103
+
104
+ Call the Jiminy CLI from a GitHub action:
105
+
106
+ ```yaml
107
+ - name: Report N+1 issues
108
+ env:
109
+ CIRCLE_CI_API_TOKEN: ${{ secrets.CIRCLE_CI_API_TOKEN }}
110
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111
+ PR_NUMBER: ${{ github.event.number }}
112
+
113
+ run: |
114
+ bundle exec jiminy report --commit ${{ github.event.pull_request.head.sha }} --pr-number=$PR_NUMBER --poll-interval=15 --timeout=300
115
+ ```
116
+
117
+ ## Configuration
118
+
119
+ Add an initializer to your Rails initializers directory:
120
+
121
+ ``` ruby
122
+ # config/initializers/jiminy.rb
123
+ Jiminy.configure do |config|
124
+ config.ci_workflow_name = "build_and_test"
125
+
126
+ config.project_username = "bodacious"
127
+
128
+ # NOTE: This is case sensitive on CircleCI
129
+ config.project_reponame = "jiminy"
130
+
131
+ config.circle_ci_api_token = ENV["CIRCLE_CI_API_TOKEN"]
132
+
133
+ config.github_token = ENV["GITHUB_TOKEN"]
134
+
135
+ # config.ignore_file_path = File.join("./.jiminy_ignores.yml")
136
+
137
+ # config.temp_file_location = File.join("./tmp/jiminy/results.yml")
138
+ end
139
+ ```
140
+
141
+ _NOTE: This file must be named `config/initializers/jiminy.rb` or **the gem will not detect the configuration**._
142
+
143
+ ## Ignoring instances
144
+
145
+ If you're adding Jiminy to an existing app, you might want to silence some of the existing warnings and focus on preventing new n+1s being introduced.
146
+
147
+ You can do this by creating a file in your application's directory called `.jiminy_ignores.yml` and listing the files you wish to ignore:
148
+
149
+ ```yaml
150
+ ---
151
+ - app/controllers/application_controller.rb
152
+ - app/models/user.rb
153
+ # - etc.
154
+ ```
155
+
156
+ ## How to run the test suite
157
+
158
+ Jiminy testing is still fairly sparse. To run the existing tests use:
159
+
160
+
161
+ ``` bash
162
+ $ rspec spec
163
+ ```
164
+
165
+ or
166
+
167
+ ``` bash
168
+ $ rake
169
+ ```
170
+
171
+ ## Contributing
172
+
173
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bodacious/jiminy.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "jiminy"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/example.png ADDED
Binary file
data/exe/jiminy ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "jiminy/setup"
6
+ require "jiminy/cli"
7
+ require "jiminy/reporting"
8
+
9
+ Jiminy::CLI.start
data/jiminy.gemspec ADDED
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/jiminy/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "jiminy"
7
+ spec.version = Jiminy::VERSION
8
+ spec.authors = ["Bodacious"]
9
+ spec.email = ["gavin@gavinmorrice.com"]
10
+ spec.license = "MIT"
11
+ spec.summary = "Detects N+1 queries in test suite and comments on Github PRs"
12
+ spec.description = <<~STRING
13
+ Wraps around your CI integration to detect and warn about n+1 queries before they're merged
14
+ STRING
15
+ spec.homepage = "https://github.com/bodacious/jiminy"
16
+ spec.required_ruby_version = ">= 2.6.0"
17
+
18
+ spec.metadata["homepage_uri"] = spec.homepage
19
+ spec.metadata["source_code_uri"] = spec.homepage
20
+ spec.metadata["changelog_uri"] = File.join(spec.homepage, "blob/main/CHANGELOG.md")
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
+ `git ls-files -z`.split("\x0").reject do |f|
26
+ (f == __FILE__) || f.match(%r{\A(?:(?:spec)/|\.(?:git|circleci))})
27
+ end
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_runtime_dependency "octokit", ">= 4", "< 5"
34
+ spec.add_runtime_dependency "prosopite", ">= 1", "< 2"
35
+ spec.add_runtime_dependency "rails", ">= 5", "< 7.2"
36
+ spec.add_runtime_dependency "thor", ">= 1.2", "< 2"
37
+ spec.add_development_dependency "byebug"
38
+ spec.add_development_dependency "rubocop", ">= 1", "< 2"
39
+ spec.add_development_dependency "rubocop-rake", ">= 0.6.0", "< 1"
40
+ spec.add_development_dependency "rubocop-rspec", ">= 2", "< 3"
41
+ spec.metadata["rubygems_mfa_required"] = "true"
42
+ end