rails_spotlight 0.1.5 → 0.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87f0223a0d6c7cac9d284d7d19a7befa0280c52f3731b01cef1207b83628875d
4
- data.tar.gz: 0e5adc3f69234b898dce003bb9c2f82be164bab0afbd5a7b5c826d30cb013b49
3
+ metadata.gz: 797f782446bb2946abfc23b500dd6bed6032df02be0795e0d44083ca78344d19
4
+ data.tar.gz: a95afda90830aaa9520b1f88012091a3481ca6ac71fd031fda5f4e8dddd8b126
5
5
  SHA512:
6
- metadata.gz: fa5134d60d3c1ca1d7b34c30adccd3316f3aab59f445e35d3e547cc6c735ea05056769a4dc5a5d5344b56ffdbdb01969cf0d94286346c5735b450222fc76a68d
7
- data.tar.gz: cc448d4957b17c63e7ad7081df7e988c64548e3a619dc834a7956c32def2132b3c02e8af7e0e1aa603e7b4c0068c942f61118054158a5d872c815205ddb409d0
6
+ metadata.gz: a5a44dc240578e5a9a639a666d6adcb5bee447e46d26af4d6f2fd3e8e1c1c39bb9129f1df13ca209a525a16413584e2a06405c1392e652c882d671389533524a
7
+ data.tar.gz: 047e4a531ef327f471a494d0865be7b2d2327572bfda8c5575638b62ebf768ab66d34c497177c3cf9b04586df6f95cace25ac234525acba17cea8d56c7a2ef0f
data/README.md CHANGED
@@ -17,6 +17,14 @@ group :development do
17
17
  end
18
18
  ```
19
19
 
20
+ ## Configuration
21
+
22
+ environment variables
23
+
24
+ ```
25
+ RAILS_SPOTLIGHT_PROJECT=MyProjectName
26
+ ```
27
+
20
28
  ## Testing
21
29
 
22
30
  To run tests for all versions of Rails and Ruby, run:
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative '../../support/project'
4
+
3
5
  module RailsSpotlight
4
6
  module Middlewares
5
7
  module Handlers
@@ -19,7 +21,10 @@ module RailsSpotlight
19
21
  end
20
22
 
21
23
  def json_response_body
22
- { source: text_response_body }
24
+ {
25
+ source: text_response_body,
26
+ project: ::RailsSpotlight::Support::Project.instance.name
27
+ }
23
28
  end
24
29
 
25
30
  def write_mode?
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative '../../support/project'
4
+
3
5
  module RailsSpotlight
4
6
  module Middlewares
5
7
  module Handlers
@@ -36,7 +38,13 @@ module RailsSpotlight
36
38
  attr_accessor :error
37
39
 
38
40
  def json_response_body
39
- { result: result, logs: logs, error: error.inspect, query_mode: force_execution? ? 'force' : 'default' }
41
+ {
42
+ result: result,
43
+ logs: logs,
44
+ error: error.inspect,
45
+ query_mode: force_execution? ? 'force' : 'default',
46
+ project: ::RailsSpotlight::Support::Project.instance.name
47
+ }
40
48
  end
41
49
 
42
50
  def logger(_, started, finished, unique_id, payload)
@@ -0,0 +1,19 @@
1
+ module RailsSpotlight
2
+ module Support
3
+ class Project
4
+ include Singleton
5
+
6
+ def name
7
+ @name ||= ENV['RAILS_SPOTLIGHT_PROJECT'] || if app_class.respond_to?(:module_parent_name)
8
+ app_class.module_parent_name
9
+ else
10
+ app_class.parent_name
11
+ end
12
+ end
13
+
14
+ def app_class
15
+ @app_class ||= Rails.application.class
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsSpotlight
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_spotlight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pawel Niemczyk
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-17 00:00:00.000000000 Z
11
+ date: 2023-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack-contrib
@@ -187,6 +187,7 @@ files:
187
187
  - lib/rails_spotlight/middlewares/handlers/verify_action_handler.rb
188
188
  - lib/rails_spotlight/middlewares/request_handler.rb
189
189
  - lib/rails_spotlight/railtie.rb
190
+ - lib/rails_spotlight/support/project.rb
190
191
  - lib/rails_spotlight/version.rb
191
192
  - sig/rails_spotlight.rbs
192
193
  homepage: https://github.com/pniemczyk/rails_spotlight