rails_spotlight 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/rails_spotlight/channels/handlers/live_console_handler.rb +1 -1
- data/lib/rails_spotlight/channels/handlers.rb +1 -3
- data/lib/rails_spotlight/channels/silence_action_cable_broadcaster_logging.rb +0 -1
- data/lib/rails_spotlight/channels.rb +1 -1
- data/lib/rails_spotlight/configuration.rb +1 -1
- data/lib/rails_spotlight/event.rb +2 -1
- data/lib/rails_spotlight/log_interceptor.rb +4 -4
- data/lib/rails_spotlight/railtie.rb +1 -1
- data/lib/rails_spotlight/utils.rb +1 -2
- data/lib/rails_spotlight/version.rb +1 -1
- data/lib/tasks/init.rake +6 -8
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe2bf391180544902b468c6ed68f371272495fa84ccf644d190c1ec0e4f5a868
|
4
|
+
data.tar.gz: 5d83732d8e23910855b239f91252b080734465242a562bea4062e7b6556df53c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a332f557220d87fcd3c01feb4479d926e9a4f837da8bbf269ef9e410fb6b0879879ae43bae2b57ad279f194fa025f61e299617b9633096fb79b0d4036951e71
|
7
|
+
data.tar.gz: 18439c9382b8ee6f7dbd67a5a31238dfcfcda883bfe1bf5274aeb7e87ea8a2be9ed0c9ec0237545386c7ed340c579f3d2f6f2eedf28aa3a369e12c7d60b4e575
|
data/README.md
CHANGED
@@ -11,6 +11,14 @@ Chrome extension [Rails Spotlight](https://chrome.google.com/webstore/detail/rai
|
|
11
11
|
|
12
12
|
Add this line to your application's Gemfile:
|
13
13
|
|
14
|
+
use bash
|
15
|
+
|
16
|
+
```bash
|
17
|
+
bundle add rails_spotlight --group development
|
18
|
+
```
|
19
|
+
|
20
|
+
or add it manually:
|
21
|
+
|
14
22
|
```ruby
|
15
23
|
group :development do
|
16
24
|
gem 'rails_spotlight'
|
@@ -44,7 +44,7 @@ module RailsSpotlight
|
|
44
44
|
executor.execute(command)
|
45
45
|
if executor.execution_successful?
|
46
46
|
{
|
47
|
-
payload: { result: executor.result_as_json(inspect_types: inspect_types) }
|
47
|
+
payload: { result: executor.result_as_json(inspect_types: inspect_types) }
|
48
48
|
}
|
49
49
|
else
|
50
50
|
{
|
@@ -19,9 +19,7 @@ module RailsSpotlight
|
|
19
19
|
def self.handle(data)
|
20
20
|
case data['type']
|
21
21
|
when LiveConsoleHandler::TYPE then LiveConsoleHandler.new(data).call
|
22
|
-
|
23
|
-
else
|
24
|
-
nil
|
22
|
+
when LogsHandler::TYPE then LogsHandler.new(data).call
|
25
23
|
end
|
26
24
|
end
|
27
25
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module RailsSpotlight
|
4
4
|
module Channels
|
5
|
-
SPOTLIGHT_CHANNEL = 'RailsSpotlight::Channels::SpotlightChannel'.freeze
|
5
|
+
SPOTLIGHT_CHANNEL = 'RailsSpotlight::Channels::SpotlightChannel'.freeze # rubocop:disable Style/RedundantFreeze
|
6
6
|
autoload(:SpotlightChannel, 'rails_spotlight/channels/spotlight_channel') if defined?(ActionCable)
|
7
7
|
end
|
8
8
|
end
|
@@ -4,7 +4,7 @@ require 'yaml'
|
|
4
4
|
require 'erb'
|
5
5
|
|
6
6
|
module RailsSpotlight
|
7
|
-
class Configuration
|
7
|
+
class Configuration # rubocop:disable Metrics/ClassLength
|
8
8
|
DEFAULT_NOT_ENCODABLE_EVENT_VALUES = {
|
9
9
|
'ActiveRecord' => ['ActiveRecord::ConnectionAdapters::AbstractAdapter'],
|
10
10
|
'ActionDispatch' => ['ActionDispatch::Request', 'ActionDispatch::Response']
|
@@ -57,8 +57,9 @@ module RailsSpotlight
|
|
57
57
|
def not_encodable?(value)
|
58
58
|
::RailsSpotlight.config.not_encodable_event_values.any? do |module_name, class_names|
|
59
59
|
next unless defined?(module_name.constantize)
|
60
|
+
|
60
61
|
class_names.any? { |class_name| value.is_a?(class_name.constantize) }
|
61
|
-
rescue => e
|
62
|
+
rescue => e # rubocop:disable Lint/RescueException, Lint/RedundantCopDisableDirective, Style/RescueStandardError
|
62
63
|
puts "Error in not_encodable? method: #{e.message}"
|
63
64
|
end
|
64
65
|
end
|
@@ -7,7 +7,7 @@ module RailsSpotlight
|
|
7
7
|
SEVERITY = %w[debug info warn error fatal unknown].freeze
|
8
8
|
SEVERITY_MAP = { 0 => 'debug', 1 => 'info', 2 => 'warn', 3 => 'error', 4 => 'fatal', 5 => 'unknown' }.freeze
|
9
9
|
|
10
|
-
def add(severity, message = nil, progname = nil)
|
10
|
+
def add(severity, message = nil, progname = nil) # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
|
11
11
|
severity ||= 5
|
12
12
|
return true if @logdev.nil? || severity < level
|
13
13
|
|
@@ -37,7 +37,7 @@ module RailsSpotlight
|
|
37
37
|
message.include?(::RailsSpotlight::Channels::SPOTLIGHT_CHANNEL)
|
38
38
|
end
|
39
39
|
|
40
|
-
def _push_event(level, message, progname = nil)
|
40
|
+
def _push_event(level, message, progname = nil) # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity, Metrics/AbcSize
|
41
41
|
callsite = Utils.dev_callsite(caller.drop(1))
|
42
42
|
name = progname.is_a?(String) || progname.is_a?(Symbol) ? progname : nil
|
43
43
|
AppRequest.current.events << Event.new('rsl.notification.log', 0, 0, 0, callsite.merge(message: message, level: level, progname: name)) if AppRequest.current && callsite
|
@@ -45,8 +45,8 @@ module RailsSpotlight
|
|
45
45
|
return unless ::RailsSpotlight.config.live_console_enabled?
|
46
46
|
return if message.blank?
|
47
47
|
|
48
|
-
id = AppRequest.current ? AppRequest.current.id : nil
|
49
|
-
payload = (callsite || {}).merge(msg: message, src: ENV['RS_SRC'] || ::RailsSpotlight.config.default_rs_src, l: level, dt: Time.now.to_f, id: id,
|
48
|
+
id = AppRequest.current ? AppRequest.current.id : nil # rubocop:disable Style/SafeNavigation
|
49
|
+
payload = (callsite || {}).merge(msg: message, src: ENV['RS_SRC'] || ::RailsSpotlight.config.default_rs_src, l: level, dt: Time.now.to_f, id: id, pg: name)
|
50
50
|
::RailsSpotlight::Channels::SpotlightChannel.broadcast(type: 'logs', payload: payload)
|
51
51
|
rescue StandardError => e
|
52
52
|
RailsSpotlight.config.logger.fatal("#{e.message}\n #{e.backtrace.join("\n ")}")
|
@@ -32,7 +32,7 @@ module RailsSpotlight
|
|
32
32
|
|
33
33
|
require 'rails_spotlight/channels/spotlight_channel' if ::RailsSpotlight.config.request_completed_broadcast_enabled?
|
34
34
|
|
35
|
-
app.routes.draw { mount ActionCable.server => '/cable' } if ::RailsSpotlight.config.auto_mount_action_cable?
|
35
|
+
app.routes.draw { mount ActionCable.server => ::RailsSpotlight.config.action_cable_mount_path || '/cable' } if ::RailsSpotlight.config.auto_mount_action_cable?
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
data/lib/tasks/init.rake
CHANGED
@@ -45,10 +45,10 @@ namespace :rails_spotlight do # rubocop:disable Metrics/BlockLength
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
desc
|
49
|
-
task inject_js_partial: :environment do
|
48
|
+
desc 'Generate rails_spotlight JavaScript ERB partial for application layout to allow injecting JS code from the extension'
|
49
|
+
task inject_js_partial: :environment do # rubocop:disable Metrics/BlockLength
|
50
50
|
# Define the partial name and path
|
51
|
-
partial_name =
|
51
|
+
partial_name = '_rails_spotlight_extension_js.html.erb'
|
52
52
|
partial_path = "app/views/layouts/#{partial_name}"
|
53
53
|
|
54
54
|
# Define the JavaScript code
|
@@ -99,12 +99,10 @@ namespace :rails_spotlight do # rubocop:disable Metrics/BlockLength
|
|
99
99
|
end
|
100
100
|
|
101
101
|
case layout_format
|
102
|
-
when 'slim'
|
103
|
-
puts "- if Rails.env.development?\n = render 'layouts/#{partial_name.split('.').first}'"
|
104
|
-
when 'haml'
|
105
|
-
puts "- if Rails.env.development?\n = render 'layouts/#{partial_name.split('.').first}'"
|
102
|
+
when 'slim', 'haml'
|
103
|
+
puts "- if Rails.env.development?\n = render 'layouts/#{partial_name.split('.').first}'" # rubocop:disable Style/StringLiteralsInInterpolation
|
106
104
|
else
|
107
|
-
puts "<% if Rails.env.development? %>\n <%= render 'layouts/#{partial_name.split('.').first}' %>\n<% end %>"
|
105
|
+
puts "<% if Rails.env.development? %>\n <%= render 'layouts/#{partial_name.split('.').first}' %>\n<% end %>" # rubocop:disable Style/StringLiteralsInInterpolation
|
108
106
|
end
|
109
107
|
end
|
110
108
|
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.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pawel Niemczyk
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack-contrib
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
version: 3.0.0
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '7.
|
42
|
+
version: '7.3'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,7 +49,7 @@ dependencies:
|
|
49
49
|
version: 3.0.0
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '7.
|
52
|
+
version: '7.3'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: action-cable-testing
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|