mbeditor 0.4.0 → 0.4.2
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/CHANGELOG.md +13 -0
- data/app/assets/javascripts/mbeditor/application.js +1 -0
- data/app/assets/javascripts/mbeditor/components/EditorPanel.js +161 -0
- data/app/assets/javascripts/mbeditor/components/MbeditorApp.js +210 -47
- data/app/assets/javascripts/mbeditor/components/QuickOpenDialog.js +4 -2
- data/app/assets/javascripts/mbeditor/editor_plugins.js +21 -0
- data/app/assets/javascripts/mbeditor/file_service.js +6 -0
- data/app/assets/javascripts/mbeditor/search_service.js +7 -3
- data/app/assets/javascripts/mbeditor/websocket_service.js +126 -0
- data/app/assets/stylesheets/mbeditor/editor.css +148 -9
- data/app/channels/mbeditor/editor_channel.rb +79 -0
- data/app/controllers/mbeditor/editors_controller.rb +42 -12
- data/app/views/layouts/mbeditor/application.html.erb +4 -0
- data/lib/mbeditor/cable_log_filter.rb +28 -0
- data/lib/mbeditor/engine.rb +10 -0
- data/lib/mbeditor/rack/silence_ping_request.rb +4 -1
- data/lib/mbeditor/version.rb +1 -1
- metadata +5 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mbeditor
|
|
4
|
+
# Wraps the ActionCable logger and suppresses all log lines that mention
|
|
5
|
+
# Mbeditor channels so the development console stays readable.
|
|
6
|
+
# Non-Mbeditor ActionCable messages pass through unchanged.
|
|
7
|
+
class CableLogFilter < SimpleDelegator
|
|
8
|
+
SUPPRESS_PATTERN = /Mbeditor::|mbeditor_editor/
|
|
9
|
+
|
|
10
|
+
%w[debug info warn error fatal unknown].each do |level|
|
|
11
|
+
define_method(level) do |message = nil, &block|
|
|
12
|
+
msg = message.nil? && block ? block.call : message.to_s
|
|
13
|
+
return if msg.match?(SUPPRESS_PATTERN)
|
|
14
|
+
|
|
15
|
+
super(message, &block)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Tagged-logging compat — the block body still passes through the filter.
|
|
20
|
+
def tagged(*tags, &block)
|
|
21
|
+
if __getobj__.respond_to?(:tagged)
|
|
22
|
+
__getobj__.tagged(*tags) { block.call }
|
|
23
|
+
else
|
|
24
|
+
block.call
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
data/lib/mbeditor/engine.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "mbeditor/rack/silence_ping_request"
|
|
4
4
|
require "mbeditor/rack/handle_pending_migrations"
|
|
5
|
+
require "mbeditor/cable_log_filter"
|
|
5
6
|
|
|
6
7
|
module Mbeditor
|
|
7
8
|
class Engine < ::Rails::Engine
|
|
@@ -24,6 +25,15 @@ module Mbeditor
|
|
|
24
25
|
end
|
|
25
26
|
|
|
26
27
|
config.after_initialize do
|
|
28
|
+
# Silence ActionCable framework logs for Mbeditor channels (subscription
|
|
29
|
+
# confirmations, streaming notices, action invocations, disconnect messages).
|
|
30
|
+
# We wrap the existing ActionCable logger in a filter proxy rather than
|
|
31
|
+
# replacing it, so the host app's non-Mbeditor channel logs are unaffected.
|
|
32
|
+
if defined?(ActionCable)
|
|
33
|
+
original_logger = ActionCable.server.config.logger || Rails.logger
|
|
34
|
+
ActionCable.server.config.logger = Mbeditor::CableLogFilter.new(original_logger)
|
|
35
|
+
end
|
|
36
|
+
|
|
27
37
|
Mbeditor::RubyDefinitionService.cache_path =
|
|
28
38
|
Rails.root.join("tmp", "mbeditor_ruby_defs.json").to_s
|
|
29
39
|
|
|
@@ -17,7 +17,7 @@ module Mbeditor
|
|
|
17
17
|
path = normalized_request_path(env)
|
|
18
18
|
if root_request?(env, path)
|
|
19
19
|
@app.call(env)
|
|
20
|
-
elsif mbeditor_request?(path) || editor_asset_request?(env, path)
|
|
20
|
+
elsif mbeditor_request?(path) || cable_request?(path) || editor_asset_request?(env, path)
|
|
21
21
|
Rails.logger.silence { @app.call(env) }
|
|
22
22
|
else
|
|
23
23
|
@app.call(env)
|
|
@@ -30,6 +30,9 @@ module Mbeditor
|
|
|
30
30
|
path.start_with?("/mbeditor/")
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
def cable_request?(path)
|
|
34
|
+
path == "/cable" || path.start_with?("/cable/")
|
|
35
|
+
end
|
|
33
36
|
# Silence asset pipeline requests that belong to the editor:
|
|
34
37
|
# - /assets/mbeditor/... is always an editor asset (CSS/JS bundle)
|
|
35
38
|
# - other /assets/... requests are silenced only when the browser is
|
data/lib/mbeditor/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mbeditor
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Oliver Noonan
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-04-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -78,9 +78,11 @@ files:
|
|
|
78
78
|
- app/assets/javascripts/mbeditor/git_service.js
|
|
79
79
|
- app/assets/javascripts/mbeditor/search_service.js
|
|
80
80
|
- app/assets/javascripts/mbeditor/tab_manager.js
|
|
81
|
+
- app/assets/javascripts/mbeditor/websocket_service.js
|
|
81
82
|
- app/assets/stylesheets/mbeditor/application.css
|
|
82
83
|
- app/assets/stylesheets/mbeditor/editor.css
|
|
83
84
|
- app/assets/stylesheets/mbeditor/themes.css
|
|
85
|
+
- app/channels/mbeditor/editor_channel.rb
|
|
84
86
|
- app/controllers/mbeditor/application_controller.rb
|
|
85
87
|
- app/controllers/mbeditor/editors_controller.rb
|
|
86
88
|
- app/controllers/mbeditor/git_controller.rb
|
|
@@ -98,6 +100,7 @@ files:
|
|
|
98
100
|
- config/initializers/assets.rb
|
|
99
101
|
- config/routes.rb
|
|
100
102
|
- lib/mbeditor.rb
|
|
103
|
+
- lib/mbeditor/cable_log_filter.rb
|
|
101
104
|
- lib/mbeditor/configuration.rb
|
|
102
105
|
- lib/mbeditor/engine.rb
|
|
103
106
|
- lib/mbeditor/rack/handle_pending_migrations.rb
|