rails_spotlight 0.4.2 → 0.5.1

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -4
  3. data/Dockerfile +1 -2
  4. data/Dockerfile-rails-6.0 +2 -2
  5. data/Dockerfile-rails-6.1 +2 -2
  6. data/Dockerfile-rails-7.1 +44 -0
  7. data/{Dockerfile-rails-7.0 → Dockerfile-rails-8.0} +3 -3
  8. data/{Dockerfile-rails-5.2 → Dockerfile-rails-8.0.2} +10 -5
  9. data/README.md +48 -16
  10. data/docker-compose.yml +14 -9
  11. data/docs/assets/images/sql_execution_toggle.gif +0 -0
  12. data/fake_spec_res/config/rails_spotlight.yml +49 -0
  13. data/fake_spec_res/rails_spotlight_spec.rb +23 -5
  14. data/lib/rails_spotlight/app_notifications.rb +2 -3
  15. data/lib/rails_spotlight/channels/handlers/{live_console_handler.rb → console_handler.rb} +3 -3
  16. data/lib/rails_spotlight/channels/handlers/logs_handler.rb +1 -1
  17. data/lib/rails_spotlight/channels/handlers.rb +3 -3
  18. data/lib/rails_spotlight/channels/spotlight_channel.rb +20 -1
  19. data/lib/rails_spotlight/configuration.rb +46 -60
  20. data/lib/rails_spotlight/event.rb +21 -5
  21. data/lib/rails_spotlight/log_interceptor.rb +36 -58
  22. data/lib/rails_spotlight/middlewares/concerns/skip_request_paths.rb +1 -1
  23. data/lib/rails_spotlight/middlewares/handlers/base_action_handler.rb +45 -55
  24. data/lib/rails_spotlight/middlewares/handlers/code_analysis_action_handler.rb +8 -13
  25. data/lib/rails_spotlight/middlewares/handlers/console_action_handler.rb +8 -12
  26. data/lib/rails_spotlight/middlewares/handlers/directory_index_action_handler.rb +16 -27
  27. data/lib/rails_spotlight/middlewares/handlers/file_action_handler.rb +21 -55
  28. data/lib/rails_spotlight/middlewares/handlers/meta_action_handler.rb +3 -8
  29. data/lib/rails_spotlight/middlewares/handlers/not_found_action_handler.rb +1 -1
  30. data/lib/rails_spotlight/middlewares/handlers/sql_action_handler.rb +18 -35
  31. data/lib/rails_spotlight/middlewares/handlers/verify_action_handler.rb +1 -3
  32. data/lib/rails_spotlight/middlewares/header_marker.rb +4 -4
  33. data/lib/rails_spotlight/middlewares/request_completed.rb +6 -9
  34. data/lib/rails_spotlight/rails_command_executor.rb +3 -5
  35. data/lib/rails_spotlight/railtie.rb +17 -11
  36. data/lib/rails_spotlight/render_view_reporter.rb +3 -3
  37. data/lib/rails_spotlight/storage.rb +4 -14
  38. data/lib/rails_spotlight/utils.rb +1 -1
  39. data/lib/rails_spotlight/version.rb +1 -1
  40. data/lib/tasks/init.rake +30 -8
  41. metadata +16 -16
@@ -5,26 +5,20 @@ module RailsSpotlight
5
5
  module Handlers
6
6
  class FileActionHandler < BaseActionHandler
7
7
  def execute
8
- raise NotFound, 'File not found' unless path_valid?
8
+ raise Forbidden.new('File manager is disabled', code: :disabled_file_manager_settings) unless enabled?
9
+ raise NotFound.new('File not found', code: :file_not_found) unless path_valid?
9
10
 
10
- if write_mode?
11
- try_to_update_file
12
- else
13
- File.read(file_path)
11
+ begin
12
+ write_mode? ? try_to_update_file : File.read(file_path)
13
+ rescue => e # rubocop:disable Style/RescueStandardError
14
+ raise UnprocessableEntity.new(e.message, code: write_mode? ? :file_update_error : :file_read_error)
14
15
  end
15
- rescue => e # rubocop:disable Style/RescueStandardError
16
- raise UnprocessableEntity, e.message
17
16
  end
18
17
 
19
18
  private
20
19
 
21
- def text_response_body
22
- File.read(file_path)
23
- end
24
-
25
- def new_content
26
- body_fetch('content')
27
- end
20
+ def text_response_body = File.read(file_path)
21
+ def new_content = body_fetch('content')
28
22
 
29
23
  def json_response_body
30
24
  {
@@ -33,11 +27,7 @@ module RailsSpotlight
33
27
  in_project: file_in_project?,
34
28
  relative_path: Pathname.new(file_path).relative_path_from(::RailsSpotlight.config.rails_root).to_s,
35
29
  root_path: ::RailsSpotlight.config.rails_root
36
- }.merge(write_mode? ? { new_content: new_content } : {})
37
- end
38
-
39
- def write_mode?
40
- request_mode == 'write'
30
+ }.merge(write_mode? ? { new_content: } : {})
41
31
  end
42
32
 
43
33
  def try_to_update_file
@@ -56,13 +46,9 @@ module RailsSpotlight
56
46
  'Editing files is blocked. Please check the Rails spotlight BLOCK_EDITING_FILES_OUTSIDE_OF_THE_PROJECT configuration.'
57
47
  end
58
48
 
59
- def request_mode
60
- @request_mode ||= body_fetch('mode', 'read')
61
- end
62
-
63
- def path_valid?
64
- File.exist?(file_path)
65
- end
49
+ def write_mode? = request_mode == 'write'
50
+ def request_mode = @request_mode ||= body_fetch('mode', 'read')
51
+ def path_valid? = File.exist?(file_path)
66
52
 
67
53
  def file_path
68
54
  @file_path ||= if path_file_in_project?
@@ -78,29 +64,13 @@ module RailsSpotlight
78
64
  end
79
65
  end
80
66
 
81
- def original_file_path
82
- @original_file_path ||= body_fetch('file')
83
- end
67
+ def original_file_path = @original_file_path ||= body_fetch('file')
84
68
 
85
- def path_file_in_project?
86
- @path_file_in_project ||= original_file_path.start_with?(::RailsSpotlight.config.rails_root)
87
- end
88
-
89
- def file_in_project?
90
- File.exist?(File.join(::RailsSpotlight.config.rails_root, original_file_path))
91
- end
92
-
93
- def file_in_project_app_dir?
94
- File.exist?(File.join(::RailsSpotlight.config.rails_root, 'app', original_file_path))
95
- end
96
-
97
- def file_in_project_views_dir?
98
- File.exist?(File.join(::RailsSpotlight.config.rails_root, 'app', 'views', original_file_path))
99
- end
100
-
101
- def file_outside_project?
102
- !file_in_project? && File.exist?(original_file_path)
103
- end
69
+ def path_file_in_project? = @path_file_in_project ||= original_file_path.start_with?(::RailsSpotlight.config.rails_root)
70
+ def file_in_project? = File.exist?(File.join(::RailsSpotlight.config.rails_root, original_file_path))
71
+ def file_in_project_app_dir? = File.exist?(File.join(::RailsSpotlight.config.rails_root, 'app', original_file_path))
72
+ def file_in_project_views_dir? = File.exist?(File.join(::RailsSpotlight.config.rails_root, 'app', 'views', original_file_path))
73
+ def file_outside_project? = !file_in_project? && File.exist?(original_file_path)
104
74
 
105
75
  def editing_outside_project_file_is_blocked?(file_path)
106
76
  return false unless file_outside_project?
@@ -109,13 +79,9 @@ module RailsSpotlight
109
79
  !file_path.start_with?(::RailsSpotlight.config.rails_root)
110
80
  end
111
81
 
112
- def block_editing_files?
113
- ::RailsSpotlight.config.block_editing_files
114
- end
115
-
116
- def block_editing_files_outside_of_the_project?
117
- ::RailsSpotlight.config.block_editing_files_outside_of_the_project
118
- end
82
+ def block_editing_files? = ::RailsSpotlight.config.block_editing_files
83
+ def block_editing_files_outside_of_the_project? = ::RailsSpotlight.config.block_editing_files_outside_of_the_project
84
+ def enabled? = ::RailsSpotlight.config.file_manager_enabled
119
85
  end
120
86
  end
121
87
  end
@@ -10,18 +10,13 @@ module RailsSpotlight
10
10
 
11
11
  def json_response_body
12
12
  {
13
- events: events,
13
+ events:,
14
14
  root_path: ::RailsSpotlight.config.rails_root
15
15
  }
16
16
  end
17
17
 
18
- def id
19
- @id ||= request.params['id']
20
- end
21
-
22
- def events
23
- @events ||= Storage.new(id).read || []
24
- end
18
+ def id = @id ||= request.params['id']
19
+ def events = @events ||= Storage.new(id).read || []
25
20
  end
26
21
  end
27
22
  end
@@ -5,7 +5,7 @@ module RailsSpotlight
5
5
  module Handlers
6
6
  class NotFoundActionHandler < BaseActionHandler
7
7
  def execute
8
- raise NotFound, 'Not found'
8
+ raise NotFound.new('Not found', code: :action_not_found)
9
9
  end
10
10
  end
11
11
  end
@@ -5,10 +5,11 @@ module RailsSpotlight
5
5
  module Handlers
6
6
  class SqlActionHandler < BaseActionHandler
7
7
  def execute
8
- return transaction unless ActiveSupport.const_defined?('ExecutionContext')
8
+ raise Forbidden.new('SQL is disabled', code: :disabled_sql_console_settings) unless enabled?
9
+ return transactional { transaction } unless ActiveSupport.const_defined?('ExecutionContext')
9
10
 
10
11
  ActiveSupport::ExecutionContext.set(rails_spotlight: request_id) do
11
- transaction
12
+ transactional { transaction }
12
13
  end
13
14
  end
14
15
 
@@ -18,7 +19,7 @@ module RailsSpotlight
18
19
  return block.call if force_execution?
19
20
 
20
21
  ActiveRecord::Base.transaction do
21
- begin
22
+ begin # rubocop:disable Style/RedundantBegin
22
23
  block.call
23
24
  ensure
24
25
  raise ActiveRecord::Rollback
@@ -36,9 +37,7 @@ module RailsSpotlight
36
37
  end
37
38
  end
38
39
 
39
- def run # rubocop:disable Metrics/AbcSize
40
- RailsSpotlight.config.logger && RailsSpotlight.config.logger.info("Executing query: #{query}") # rubocop:disable Style/SafeNavigation
41
-
40
+ def run
42
41
  return self.result = ActiveRecord::Base.connection.exec_query(query) if connection_options.blank? || !ActiveRecord::Base.respond_to?(:connects_to)
43
42
 
44
43
  connections = ActiveRecord::Base.connects_to(**connection_options)
@@ -53,50 +52,34 @@ module RailsSpotlight
53
52
 
54
53
  def json_response_body
55
54
  {
56
- query: query,
57
- result: result,
58
- logs: logs,
55
+ query:, result:, logs:,
59
56
  error: error.present? ? error.inspect : nil,
60
57
  query_mode: force_execution? ? 'force' : 'default'
61
58
  }
62
59
  end
63
60
 
64
61
  def logger(_, started, finished, unique_id, payload)
65
- logs << { time: started, end: finished, unique_id: unique_id }.merge(
62
+ logs << { time: started, end: finished, unique_id: }.merge(
66
63
  payload.as_json(except: %i[connection method name filename line transaction])
67
64
  )
68
65
  end
69
66
 
70
- def logs
71
- @logs ||= []
72
- end
73
-
74
- def query
75
- @query ||= body_fetch('query')
76
- end
77
-
78
- def raw_options
79
- @raw_options ||= body_fetch('options', {}) || {}
80
- end
81
-
82
- def mode
83
- @mode ||= body_fetch('mode', 'default')
84
- end
85
-
86
- def use
87
- @use ||= { 'shard' => 'default', 'role' => 'reading' }.merge(raw_options.fetch('use', {}))
88
- end
67
+ def logs = @logs ||= []
68
+ def query = @query ||= body_fetch('query')
69
+ def raw_options = @raw_options ||= body_fetch('options', {}) || {}
70
+ def mode = @mode ||= body_fetch('mode', 'default')
71
+ def use = @use ||= { 'shard' => 'default', 'role' => 'reading' }.merge(raw_options.fetch('use', {}))
89
72
 
73
+ # TODO: Check for each rails version
90
74
  def connection_options
91
75
  @connection_options ||= raw_options
92
- .symbolize_keys
93
- .slice(:database, :shards)
94
- .reject { |_, v| v.nil? || (!v.is_a?(TrueClass) && !v.is_a?(FalseClass) && v.empty?) } # TODO: Check for each rails version
76
+ .symbolize_keys
77
+ .slice(:database, :shards)
78
+ .reject { |_, v| v.nil? || (!v.is_a?(TrueClass) && !v.is_a?(FalseClass) && v.empty?) }
95
79
  end
96
80
 
97
- def force_execution?
98
- @force_execution ||= mode == 'force'
99
- end
81
+ def force_execution? = @force_execution ||= mode == 'force'
82
+ def enabled? = ::RailsSpotlight.config.sql_console_enabled?
100
83
  end
101
84
  end
102
85
  end
@@ -12,9 +12,7 @@ module RailsSpotlight
12
12
  "Rails Spotlight is working!\nRails version: #{Rails.version}\nRails environment: #{Rails.env}"
13
13
  end
14
14
 
15
- def skip_project_validation?
16
- true
17
- end
15
+ def skip_project_validation? = true
18
16
 
19
17
  def json_response_body
20
18
  {
@@ -15,8 +15,10 @@ module RailsSpotlight
15
15
 
16
16
  def call(env)
17
17
  request_path = env['PATH_INFO']
18
+ return app.call(env) if skip?(request_path)
19
+
18
20
  middleware = Rack::ResponseHeaders.new(app) do |headers|
19
- headers['X-Rails-Spotlight-Version'] = RailsSpotlight::VERSION unless skip?(request_path)
21
+ headers['X-Rails-Spotlight-Version'] = RailsSpotlight::VERSION
20
22
  end
21
23
  middleware.call(env)
22
24
  end
@@ -25,9 +27,7 @@ module RailsSpotlight
25
27
 
26
28
  attr_reader :app, :app_config
27
29
 
28
- def default_skip_paths
29
- %w[/__better_errors /__meta_request]
30
- end
30
+ def default_skip_paths = %w[/__better_errors /__meta_request /rails]
31
31
  end
32
32
  end
33
33
  end
@@ -14,15 +14,12 @@ module RailsSpotlight
14
14
  end
15
15
 
16
16
  def call(env)
17
+ return app.call(env) if skip?(env['PATH_INFO']) || (env['HTTP_CONNECTION'] == 'Upgrade' && env['HTTP_UPGRADE'] == 'websocket')
17
18
  return app.call(env) unless ::RailsSpotlight.config.request_completed_broadcast_enabled?
18
19
 
19
- if skip?(env['PATH_INFO']) || (env['HTTP_CONNECTION'] == 'Upgrade' && env['HTTP_UPGRADE'] == 'websocket')
20
- app.call(env)
21
- else
22
- status, headers, body = app.call(env)
23
- publish_event(status, headers, env)
24
- [status, headers, body]
25
- end
20
+ status, headers, body = app.call(env)
21
+ publish_event(status, headers, env)
22
+ [status, headers, body]
26
23
  rescue => e # rubocop:disable Style/RescueStandardError
27
24
  ::RailsSpotlight.config.logger.error "Error in RailsSpotlight::Middlewares::RequestCompletedHandler instrumentation: #{e.message}"
28
25
  app.call(env)
@@ -49,8 +46,8 @@ module RailsSpotlight
49
46
  payload: {
50
47
  id: rails_spotlight_request_id,
51
48
  http_method: env['REQUEST_METHOD'],
52
- host: host,
53
- url: url,
49
+ host:,
50
+ url:,
54
51
  format: request.format.symbol,
55
52
  controller: request.path_parameters[:controller],
56
53
  action: request.path_parameters[:action]
@@ -31,15 +31,13 @@ module RailsSpotlight
31
31
 
32
32
  attr_reader :result, :console, :error, :syntax_error
33
33
 
34
- def execution_successful?
35
- error.nil?
36
- end
34
+ def execution_successful? = error.nil?
37
35
 
38
36
  def result_as_json(inspect_types: false)
39
37
  if error
40
38
  {
41
39
  status: :error,
42
- syntax_error: syntax_error,
40
+ syntax_error:,
43
41
  error: error.respond_to?(:message) ? error.message : error.to_s,
44
42
  backtrace: error.respond_to?(:backtrace) ? error.backtrace : nil
45
43
  }
@@ -50,7 +48,7 @@ module RailsSpotlight
50
48
  raw: result,
51
49
  type: result.class.name,
52
50
  types: result_inspect_types(inspect_types, result),
53
- console: console
51
+ console:
54
52
  }
55
53
  end
56
54
  end
@@ -6,22 +6,29 @@ require_relative 'log_interceptor'
6
6
  module RailsSpotlight
7
7
  class Railtie < ::Rails::Railtie
8
8
  initializer 'rails_spotlight.inject_middlewares' do
9
- insert_base_middlewares unless Rails.env.production?
9
+ next unless ::RailsSpotlight.config.enabled?
10
+
11
+ insert_base_middlewares
10
12
  end
11
13
 
12
14
  initializer 'rails_spotlight.log_interceptor' do
13
- unless Rails.env.production?
14
- Rails.logger&.extend(LogInterceptor)
15
- defined?(Sidekiq::Logger) && Sidekiq.logger&.extend(LogInterceptor)
16
- end
15
+ next unless ::RailsSpotlight.config.enabled?
16
+ next unless ::RailsSpotlight.config.logs_enabled?
17
+
18
+ Rails.logger&.extend(LogInterceptor)
19
+ defined?(Sidekiq::Logger) && Sidekiq.logger&.extend(LogInterceptor)
17
20
  end
18
21
 
19
22
  initializer 'rails_spotlight.subscribe_to_notifications' do
20
- AppNotifications.subscribe unless Rails.env.production?
23
+ next unless ::RailsSpotlight.config.enabled?
24
+
25
+ AppNotifications.subscribe
21
26
  end
22
27
 
23
28
  initializer 'rails_spotlight.action_cable_setup' do
24
- insert_action_cable_helpers unless Rails.env.production?
29
+ next unless ::RailsSpotlight.config.enabled?
30
+
31
+ insert_action_cable_helpers
25
32
  end
26
33
 
27
34
  def insert_action_cable_helpers
@@ -32,7 +39,7 @@ module RailsSpotlight
32
39
 
33
40
  require 'rails_spotlight/channels/spotlight_channel' if ::RailsSpotlight.config.request_completed_broadcast_enabled?
34
41
 
35
- app.routes.draw { mount ActionCable.server => ::RailsSpotlight.config.action_cable_mount_path || '/cable' } if ::RailsSpotlight.config.auto_mount_action_cable?
42
+ app.routes.draw { mount ActionCable.server => ::RailsSpotlight.config.cable_mount_path || '/cable' } if ::RailsSpotlight.config.auto_mount_cable?
36
43
  end
37
44
  end
38
45
 
@@ -53,6 +60,7 @@ module RailsSpotlight
53
60
  app.middleware.use ::RailsSpotlight::Middlewares::MainRequestHandler
54
61
 
55
62
  return unless ::RailsSpotlight.config.request_completed_broadcast_enabled?
63
+ return unless ActionCable.server.config&.cable&.dig(:adapter).present?
56
64
 
57
65
  # app.middleware.insert_after ::RailsSpotlight::Middlewares::HeaderMarker, RailsSpotlight::Middlewares::RequestCompleted, app.config
58
66
  if defined? ActionDispatch::Executor
@@ -62,8 +70,6 @@ module RailsSpotlight
62
70
  end
63
71
  end
64
72
 
65
- def app
66
- Rails.application
67
- end
73
+ def app = Rails.application
68
74
  end
69
75
  end
@@ -5,10 +5,10 @@ module RailsSpotlight
5
5
  def self.report_rendered_view_locals(view, locals: nil, params: nil, show_devise: false, skip_vars: [], metadata: {})
6
6
  ActiveSupport::Notifications.instrument(
7
7
  'render_view.locals',
8
- params: params,
8
+ params:,
9
9
  locals: serialize_as_json(locals),
10
- instance_variables: dev_instance_variables(view, skip_vars: skip_vars, show_devise: show_devise),
11
- metadata: metadata
10
+ instance_variables: dev_instance_variables(view, skip_vars:, show_devise:),
11
+ metadata:
12
12
  )
13
13
  end
14
14
 
@@ -15,19 +15,14 @@ module RailsSpotlight
15
15
  maintain_file_pool(RailsSpotlight.config.storage_pool_size)
16
16
  end
17
17
 
18
- def read
19
- # avoid FileNotFound error
20
- File.exist?(json_file) ? File.read(json_file) : '[]'
21
- end
18
+ def read = File.exist?(json_file) ? File.read(json_file) : '[]'
22
19
 
23
20
  private
24
21
 
25
22
  def maintain_file_pool(size)
26
23
  files = Dir["#{dir_path}/*.json"]
27
24
  files = files.sort_by { |f| -file_ctime(f) }
28
- (files[size..] || []).each do |file|
29
- FileUtils.rm_f(file)
30
- end
25
+ (files[size..] || []).each { |file| FileUtils.rm_f(file) }
31
26
  end
32
27
 
33
28
  def file_ctime(file)
@@ -36,12 +31,7 @@ module RailsSpotlight
36
31
  0
37
32
  end
38
33
 
39
- def json_file
40
- File.join(dir_path, "#{key}.json")
41
- end
42
-
43
- def dir_path
44
- @dir_path ||= RailsSpotlight.config.storage_path
45
- end
34
+ def json_file = @json_file ||= File.join(dir_path, "#{key}.json")
35
+ def dir_path = @dir_path ||= RailsSpotlight.config.storage_path
46
36
  end
47
37
  end
@@ -13,7 +13,7 @@ module RailsSpotlight
13
13
  {
14
14
  filename: sub_source_path(filename),
15
15
  line: line.to_i,
16
- method: method
16
+ method:
17
17
  }
18
18
  rescue # rubocop:disable Style/RescueStandardError, Lint/SuppressedException
19
19
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsSpotlight
4
- VERSION = '0.4.2'
4
+ VERSION = '0.5.1'
5
5
  end
data/lib/tasks/init.rake CHANGED
@@ -10,32 +10,54 @@ namespace :rails_spotlight do # rubocop:disable Metrics/BlockLength
10
10
  config_path = Rails.root.join('config', 'rails_spotlight.yml')
11
11
 
12
12
  default_config = <<~YAML
13
+ ENABLED: true
13
14
  # Default configuration for RailsSpotlight
14
15
  PROJECT_NAME: <%=Rails.application.class.respond_to?(:module_parent_name) ? Rails.application.class.module_parent_name : Rails.application.class.parent_name%>
15
16
  SOURCE_PATH: <%=Rails.root%>
16
17
  STORAGE_PATH: <%=Rails.root.join('tmp', 'data', 'rails_spotlight')%>
17
18
  STORAGE_POOL_SIZE: 20
18
19
  LOGGER: <%=Logger.new(Rails.root.join('log', 'rails_spotlight.log'))%>
20
+
21
+ # Security configuration
22
+ DATA_ACCESS_TOKEN:
23
+ RAILS_SPOTLIGHT_PROJECT:
24
+
19
25
  # Prevent from processing and sending some data to the extension
20
26
  MIDDLEWARE_SKIPPED_PATHS: []
21
27
  NOT_ENCODABLE_EVENT_VALUES:
22
28
  SKIP_RENDERED_IVARS: []
29
+
30
+ # Features
31
+ LOGS_ENABLED: true
32
+ FILE_MANAGER_ENABLED: true
33
+ RUBOCOP_ENABLED: true
34
+ SQL_CONSOLE_ENABLED: true
35
+ IRB_CONSOLE_ENABLED: true
36
+
23
37
  # File manager configuration
24
38
  BLOCK_EDITING_FILES: false
25
39
  BLOCK_EDITING_FILES_OUTSIDE_OF_THE_PROJECT: true
26
40
  DIRECTORY_INDEX_IGNORE: ['/.git', '**/*.lock', '**/.DS_Store', '/app/assets/images/**', '/app/assets/fonts/**', '/app/assets/builds/**']
41
+
42
+ # Rubocop configuration
27
43
  RUBOCOP_CONFIG_PATH: '.rubocop.yml'
44
+
28
45
  # Workarounds of CSP restrictions for form JS execution from the extension
29
46
  FORM_JS_EXECUTION_TOKEN: <%= Digest::MD5.hexdigest(Rails.application.class.respond_to?(:module_parent_name) ? Rails.application.class.module_parent_name : Rails.application.class.parent_name)%>
30
- # Rest of the configuration is required for ActionCable. It will be disabled automatically in when ActionCable is not available.
31
- AUTO_MOUNT_ACTION_CABLE: false
32
- ACTION_CABLE_MOUNT_PATH: /cable
47
+
33
48
  # Required for all action cable features
34
- USE_ACTION_CABLE: false
49
+ USE_CABLE: false
50
+
51
+ # Rest of the configuration is required for ActionCable. It will be disabled automatically in when ActionCable is not available.
52
+ AUTO_MOUNT_CABLE: false
53
+ CABLE_MOUNT_PATH: /cable
54
+
35
55
  # Experimental feature.
36
- LIVE_LOGS_ENABLED: false
56
+ CABLE_LOGS_ENABLED: false
37
57
  DEFAULT_RS_SRC: default
38
- LIVE_CONSOLE_ENABLED: false
58
+
59
+ CABLE_CONSOLE_ENABLED: false
60
+
39
61
  REQUEST_COMPLETED_BROADCAST_ENABLED: false
40
62
  YAML
41
63
 
@@ -103,9 +125,9 @@ namespace :rails_spotlight do # rubocop:disable Metrics/BlockLength
103
125
 
104
126
  case layout_format
105
127
  when 'slim', 'haml'
106
- puts "- if Rails.env.development?\n = render 'layouts/#{partial_name.split('.').first}'" # rubocop:disable Style/StringLiteralsInInterpolation
128
+ puts "- if defined?(RailsSpotlight) && Rails.env.development?\n = render 'layouts/#{partial_name.split('.').first}'" # rubocop:disable Style/StringLiteralsInInterpolation
107
129
  else
108
- puts "<% if Rails.env.development? %>\n <%= render 'layouts/#{partial_name.split('.').first}' %>\n<% end %>" # rubocop:disable Style/StringLiteralsInInterpolation
130
+ puts "<% if defined?(RailsSpotlight) && Rails.env.development? %>\n <%= render 'layouts/#{partial_name.split('.').first}' %>\n<% end %>" # rubocop:disable Style/StringLiteralsInInterpolation
109
131
  end
110
132
  end
111
133
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_spotlight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pawel Niemczyk
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-11-02 00:00:00.000000000 Z
10
+ date: 2025-04-14 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rack-contrib
@@ -16,7 +15,7 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '1.1'
18
+ version: '2.0'
20
19
  - - "<"
21
20
  - !ruby/object:Gem::Version
22
21
  version: '3'
@@ -26,7 +25,7 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- version: '1.1'
28
+ version: '2.0'
30
29
  - - "<"
31
30
  - !ruby/object:Gem::Version
32
31
  version: '3'
@@ -36,20 +35,20 @@ dependencies:
36
35
  requirements:
37
36
  - - ">="
38
37
  - !ruby/object:Gem::Version
39
- version: 3.0.0
38
+ version: '6.0'
40
39
  - - "<"
41
40
  - !ruby/object:Gem::Version
42
- version: '8.1'
41
+ version: '9'
43
42
  type: :runtime
44
43
  prerelease: false
45
44
  version_requirements: !ruby/object:Gem::Requirement
46
45
  requirements:
47
46
  - - ">="
48
47
  - !ruby/object:Gem::Version
49
- version: 3.0.0
48
+ version: '6.0'
50
49
  - - "<"
51
50
  - !ruby/object:Gem::Version
52
- version: '8.1'
51
+ version: '9'
53
52
  - !ruby/object:Gem::Dependency
54
53
  name: action-cable-testing
55
54
  requirement: !ruby/object:Gem::Requirement
@@ -218,10 +217,11 @@ files:
218
217
  - CHANGELOG.md
219
218
  - CODE_OF_CONDUCT.md
220
219
  - Dockerfile
221
- - Dockerfile-rails-5.2
222
220
  - Dockerfile-rails-6.0
223
221
  - Dockerfile-rails-6.1
224
- - Dockerfile-rails-7.0
222
+ - Dockerfile-rails-7.1
223
+ - Dockerfile-rails-8.0
224
+ - Dockerfile-rails-8.0.2
225
225
  - Gemfile
226
226
  - Guardfile
227
227
  - LICENSE.txt
@@ -231,7 +231,9 @@ files:
231
231
  - docker-compose.dev.yml
232
232
  - docker-compose.yml
233
233
  - docker-variables.env
234
+ - docs/assets/images/sql_execution_toggle.gif
234
235
  - exe/rails_spotlight
236
+ - fake_spec_res/config/rails_spotlight.yml
235
237
  - fake_spec_res/dummy/index.html
236
238
  - fake_spec_res/dummy_controller.rb
237
239
  - fake_spec_res/rails_spotlight_spec.rb
@@ -241,7 +243,7 @@ files:
241
243
  - lib/rails_spotlight/app_request.rb
242
244
  - lib/rails_spotlight/channels.rb
243
245
  - lib/rails_spotlight/channels/handlers.rb
244
- - lib/rails_spotlight/channels/handlers/live_console_handler.rb
246
+ - lib/rails_spotlight/channels/handlers/console_handler.rb
245
247
  - lib/rails_spotlight/channels/handlers/logs_handler.rb
246
248
  - lib/rails_spotlight/channels/silence_action_cable_broadcaster_logging.rb
247
249
  - lib/rails_spotlight/channels/spotlight_channel.rb
@@ -279,7 +281,6 @@ metadata:
279
281
  source_code_uri: https://github.com/pniemczyk/rails_spotlight
280
282
  changelog_uri: https://github.com/pniemczyk/rails_spotlight/blob/master/CHANGELOG.md
281
283
  rubygems_mfa_required: 'true'
282
- post_install_message:
283
284
  rdoc_options: []
284
285
  require_paths:
285
286
  - lib
@@ -287,15 +288,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
287
288
  requirements:
288
289
  - - ">="
289
290
  - !ruby/object:Gem::Version
290
- version: 2.6.0
291
+ version: '3.1'
291
292
  required_rubygems_version: !ruby/object:Gem::Requirement
292
293
  requirements:
293
294
  - - ">="
294
295
  - !ruby/object:Gem::Version
295
296
  version: '0'
296
297
  requirements: []
297
- rubygems_version: 3.4.12
298
- signing_key:
298
+ rubygems_version: 3.6.3
299
299
  specification_version: 4
300
300
  summary: Lets have a look at your rails application in details
301
301
  test_files: []