command_deck 0.1.0
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 +7 -0
- data/.rubocop.yml +8 -0
- data/CHANGELOG.md +17 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/LICENSE.txt +21 -0
- data/README.md +141 -0
- data/Rakefile +12 -0
- data/TAGS +521 -0
- data/app/controllers/command_deck/actions_controller.rb +18 -0
- data/app/controllers/command_deck/assets_controller.rb +48 -0
- data/app/controllers/command_deck/base_controller.rb +17 -0
- data/app/controllers/command_deck/panels_controller.rb +108 -0
- data/config/routes.rb +9 -0
- data/lib/command_deck/assets/css/main.css +393 -0
- data/lib/command_deck/assets/js/core/api.js +20 -0
- data/lib/command_deck/assets/js/core/dom.js +33 -0
- data/lib/command_deck/assets/js/core/store.js +13 -0
- data/lib/command_deck/assets/js/main.js +39 -0
- data/lib/command_deck/assets/js/ui/overlay.js +305 -0
- data/lib/command_deck/assets/js/ui/panel_selector.js +32 -0
- data/lib/command_deck/assets/js/ui/position_manager.js +26 -0
- data/lib/command_deck/assets/js/ui/settings_dropdown.js +64 -0
- data/lib/command_deck/assets/js/ui/theme_manager.js +34 -0
- data/lib/command_deck/engine.rb +28 -0
- data/lib/command_deck/executor.rb +70 -0
- data/lib/command_deck/injector.rb +28 -0
- data/lib/command_deck/middleware.rb +57 -0
- data/lib/command_deck/railtie.rb +13 -0
- data/lib/command_deck/registry.rb +103 -0
- data/lib/command_deck/version.rb +5 -0
- data/lib/command_deck.rb +14 -0
- data/public/img/demo.png +0 -0
- data/sig/command_deck.rbs +4 -0
- metadata +110 -0
data/TAGS
ADDED
@@ -0,0 +1,521 @@
|
|
1
|
+
|
2
|
+
lib/command_deck.rb,262
|
3
|
+
module CommandDeckCommandDeck5,0
|
4
|
+
class Error < StandardError; endError13,0
|
5
|
+
class Error < StandardError; endCommandDeck::Error13,0
|
6
|
+
def self.configurationconfiguration15,0
|
7
|
+
def self.configureconfigure19,0
|
8
|
+
def self.load_panels!load_panels!23,0
|
9
|
+
|
10
|
+
lib/command_deck/version.rb,112
|
11
|
+
module CommandDeckCommandDeck3,0
|
12
|
+
VERSION = "0.1.0"VERSION4,0
|
13
|
+
VERSION = "0.1.0"CommandDeck::VERSION4,0
|
14
|
+
|
15
|
+
lib/command_deck/registry.rb,1936
|
16
|
+
module CommandDeckCommandDeck1,0
|
17
|
+
class RegistryRegistry2,0
|
18
|
+
class RegistryCommandDeck::Registry2,0
|
19
|
+
Action = Struct.new(:title, :key, :params, :block, keyword_init: true)Action3,0
|
20
|
+
Action = Struct.new(:title, :key, :params, :block, keyword_init: true)CommandDeck::Registry::Action3,0
|
21
|
+
Tab = Struct.new(:title, :actions, keyword_init: true)Tab4,0
|
22
|
+
Tab = Struct.new(:title, :actions, keyword_init: true)CommandDeck::Registry::Tab4,0
|
23
|
+
Panel = Struct.new(:title, :tabs, keyword_init: true)Panel5,0
|
24
|
+
Panel = Struct.new(:title, :tabs, keyword_init: true)CommandDeck::Registry::Panel5,0
|
25
|
+
def panels = (@panels ||= [])panels8,0
|
26
|
+
def panel(title, &blk) = PanelBuilder.new(title).tap { _1.instance_eval(&blk) }.build.then { panels << _1 }panel9,0
|
27
|
+
def find_action(key)find_action11,0
|
28
|
+
class PanelBuilderPanelBuilder17,0
|
29
|
+
class PanelBuilderCommandDeck::Registry::PanelBuilder17,0
|
30
|
+
def initialize(title) = (@title = titleinitialize18,0
|
31
|
+
def tab(title, &blk) = (@tabs << TabBuilder.new(title).tap { _1.instance_eval(&blk) }.build)tab21,0
|
32
|
+
def build = Panel.new(title: @title, tabs: @tabs)build22,0
|
33
|
+
class TabBuilderTabBuilder25,0
|
34
|
+
class TabBuilderCommandDeck::Registry::TabBuilder25,0
|
35
|
+
def initialize(title) = (@title = titleinitialize26,0
|
36
|
+
def action(title, key:, &blk)action29,0
|
37
|
+
def build = Tab.new(title: @title, actions: @actions)build33,0
|
38
|
+
class ActionBuilderActionBuilder36,0
|
39
|
+
class ActionBuilderCommandDeck::Registry::ActionBuilder36,0
|
40
|
+
def initialize(title, key)initialize37,0
|
41
|
+
def param(name, type, **opts) = (@params << { name: name, type: type, **opts })param44,0
|
42
|
+
def perform(&b) = (@block = b)perform45,0
|
43
|
+
def build = Action.new(title: @title, key: @key, params: @params, block: @block)build46,0
|
44
|
+
def self.panel(title, &blk) = Registry.panel(title, &blk)panel50,0
|
45
|
+
|
46
|
+
lib/command_deck/executor.rb,207
|
47
|
+
module CommandDeckCommandDeck1,0
|
48
|
+
class ExecutorExecutor2,0
|
49
|
+
class ExecutorCommandDeck::Executor2,0
|
50
|
+
def self.call(key:, params:, controller:)call3,0
|
51
|
+
def self.coerce(schema, raw)coerce9,0
|
52
|
+
|
53
|
+
lib/command_deck/configuration.rb,329
|
54
|
+
module CommandDeckCommandDeck1,0
|
55
|
+
class ConfigurationConfiguration2,0
|
56
|
+
class ConfigurationCommandDeck::Configuration2,0
|
57
|
+
attr_accessor :authorizeauthorize3,0
|
58
|
+
attr_accessor :authorizeauthorize=3,0
|
59
|
+
def initializeinitialize5,0
|
60
|
+
def self.configurationconfiguration10,0
|
61
|
+
def self.configureconfigure14,0
|
62
|
+
|
63
|
+
lib/command_deck/engine.rb,136
|
64
|
+
module CommandDeckCommandDeck1,0
|
65
|
+
class Engine < ::Rails::EngineEngine2,0
|
66
|
+
class Engine < ::Rails::EngineCommandDeck::Engine2,0
|
67
|
+
|
68
|
+
lib/command_deck/railtie.rb,142
|
69
|
+
module CommandDeckCommandDeck5,0
|
70
|
+
class Railtie < ::Rails::RailtieRailtie6,0
|
71
|
+
class Railtie < ::Rails::RailtieCommandDeck::Railtie6,0
|
72
|
+
|
73
|
+
test/test_command_deck.rb,208
|
74
|
+
class TestCommandDeck < Minitest::TestTestCommandDeck5,0
|
75
|
+
def test_that_it_has_a_version_numbertest_that_it_has_a_version_number6,0
|
76
|
+
def test_it_does_something_usefultest_it_does_something_useful10,0
|
77
|
+
|
78
|
+
app/controllers/command_deck/base_controller.rb,314
|
79
|
+
module CommandDeckCommandDeck1,0
|
80
|
+
class BaseController < ActionController::BaseBaseController2,0
|
81
|
+
class BaseController < ActionController::BaseCommandDeck::BaseController2,0
|
82
|
+
def authorize_command_deckauthorize_command_deck10,0
|
83
|
+
def current_user_for_command_deckcurrent_user_for_command_deck17,0
|
84
|
+
|
85
|
+
app/controllers/command_deck/home_controller.rb,190
|
86
|
+
module CommandDeckCommandDeck1,0
|
87
|
+
class HomeController < BaseControllerHomeController2,0
|
88
|
+
class HomeController < BaseControllerCommandDeck::HomeController2,0
|
89
|
+
def indexindex3,0
|
90
|
+
|
91
|
+
app/controllers/command_deck/actions_controller.rb,204
|
92
|
+
module CommandDeckCommandDeck1,0
|
93
|
+
class ActionsController < BaseControllerActionsController2,0
|
94
|
+
class ActionsController < BaseControllerCommandDeck::ActionsController2,0
|
95
|
+
def createcreate3,0
|
96
|
+
|
97
|
+
app/controllers/command_deck/crud_controller.rb,246
|
98
|
+
module CommandDeckCommandDeck1,0
|
99
|
+
class CrudController < BaseControllerCrudController2,0
|
100
|
+
class CrudController < BaseControllerCommandDeck::CrudController2,0
|
101
|
+
def indexindex3,0
|
102
|
+
def handle_error(message, status)handle_error24,0
|
103
|
+
|
104
|
+
app/helpers/command_deck/application_helper.rb,202
|
105
|
+
module CommandDeckCommandDeck3,0
|
106
|
+
module ApplicationHelperApplicationHelper4,0
|
107
|
+
module ApplicationHelperCommandDeck::ApplicationHelper4,0
|
108
|
+
def command_deck_launchercommand_deck_launcher7,0
|
109
|
+
|
110
|
+
web-console/lib/web_console.rb,101
|
111
|
+
module WebConsoleWebConsole6,0
|
112
|
+
def self.loggerlogger28,0
|
113
|
+
def self.deprecatordeprecator32,0
|
114
|
+
|
115
|
+
web-console/lib/web_console/context.rb,390
|
116
|
+
module WebConsoleWebConsole3,0
|
117
|
+
class ContextContext5,0
|
118
|
+
class ContextWebConsole::Context5,0
|
119
|
+
def initialize(binding)initialize6,0
|
120
|
+
def extract(input = nil)extract15,0
|
121
|
+
GLOBAL_OBJECTS = [GLOBAL_OBJECTS21,0
|
122
|
+
GLOBAL_OBJECTS = [WebConsole::Context::GLOBAL_OBJECTS21,0
|
123
|
+
def globalglobal30,0
|
124
|
+
def local(input)local34,0
|
125
|
+
def eval(cmd)eval41,0
|
126
|
+
|
127
|
+
web-console/lib/web_console/errors.rb,269
|
128
|
+
module WebConsoleWebConsole3,0
|
129
|
+
Error = Class.new(StandardError)Error5,0
|
130
|
+
Error = Class.new(StandardError)WebConsole::Error5,0
|
131
|
+
DoubleRenderError = Class.new(Error)DoubleRenderError8,0
|
132
|
+
DoubleRenderError = Class.new(Error)WebConsole::DoubleRenderError8,0
|
133
|
+
|
134
|
+
web-console/lib/web_console/evaluator.rb,311
|
135
|
+
module WebConsoleWebConsole3,0
|
136
|
+
class EvaluatorEvaluator9,0
|
137
|
+
class EvaluatorWebConsole::Evaluator9,0
|
138
|
+
cattr_reader :cleaner, default: begincleaner11,0
|
139
|
+
def initialize(binding = TOPLEVEL_BINDING)initialize17,0
|
140
|
+
def eval(input)eval21,0
|
141
|
+
def format_exception(exc)format_exception34,0
|
142
|
+
|
143
|
+
web-console/lib/web_console/exception_mapper.rb,526
|
144
|
+
module WebConsoleWebConsole3,0
|
145
|
+
class ExceptionMapperExceptionMapper4,0
|
146
|
+
class ExceptionMapperWebConsole::ExceptionMapper4,0
|
147
|
+
attr_reader :excexc5,0
|
148
|
+
def self.follow(exc)follow7,0
|
149
|
+
def self.find_binding(mappers, exception_object_id)find_binding17,0
|
150
|
+
def initialize(exception)initialize23,0
|
151
|
+
def firstfirst29,0
|
152
|
+
def [](index)[]33,0
|
153
|
+
def guess_binding_for_index(index)guess_binding_for_index39,0
|
154
|
+
def guess_the_first_application_bindingguess_the_first_application_binding49,0
|
155
|
+
|
156
|
+
web-console/lib/web_console/extensions.rb,148
|
157
|
+
module KernelKernel3,0
|
158
|
+
def console(binding = Bindex.current_bindings.second)console13,0
|
159
|
+
class BindingBinding25,0
|
160
|
+
def consoleconsole31,0
|
161
|
+
|
162
|
+
web-console/lib/web_console/injector.rb,190
|
163
|
+
module WebConsoleWebConsole3,0
|
164
|
+
class InjectorInjector5,0
|
165
|
+
class InjectorWebConsole::Injector5,0
|
166
|
+
def initialize(body, headers)initialize6,0
|
167
|
+
def inject(content)inject15,0
|
168
|
+
|
169
|
+
web-console/lib/web_console/interceptor.rb,162
|
170
|
+
module WebConsoleWebConsole1,0
|
171
|
+
module InterceptorInterceptor2,0
|
172
|
+
module InterceptorWebConsole::Interceptor2,0
|
173
|
+
def self.call(request, error)call3,0
|
174
|
+
|
175
|
+
web-console/lib/web_console/middleware.rb,1628
|
176
|
+
module WebConsoleWebConsole5,0
|
177
|
+
class MiddlewareMiddleware6,0
|
178
|
+
class MiddlewareWebConsole::Middleware6,0
|
179
|
+
TEMPLATES_PATH = File.expand_path("../templates", __FILE__)TEMPLATES_PATH7,0
|
180
|
+
TEMPLATES_PATH = File.expand_path("../templates", __FILE__)WebConsole::Middleware::TEMPLATES_PATH7,0
|
181
|
+
cattr_accessor :mount_point, default: "/__web_console"mount_point9,0
|
182
|
+
cattr_accessor :mount_point, default: "/__web_console"mount_point=9,0
|
183
|
+
cattr_accessor :whiny_requests, default: truewhiny_requests10,0
|
184
|
+
cattr_accessor :whiny_requests, default: truewhiny_requests=10,0
|
185
|
+
def initialize(app)initialize12,0
|
186
|
+
def call(env)call16,0
|
187
|
+
def acceptable_content_type?(headers)acceptable_content_type?54,0
|
188
|
+
def json_response(opts = {})json_response58,0
|
189
|
+
def json_response_with_session(id, request, opts = {})json_response_with_session66,0
|
190
|
+
def create_regular_or_whiny_request(env)create_regular_or_whiny_request72,0
|
191
|
+
def repl_sessions_rerepl_sessions_re77,0
|
192
|
+
def update_reupdate_re81,0
|
193
|
+
def binding_change_rebinding_change_re85,0
|
194
|
+
def id_for_repl_session_update(request)id_for_repl_session_update89,0
|
195
|
+
def id_for_repl_session_stack_frame_change(request)id_for_repl_session_stack_frame_change95,0
|
196
|
+
def update_repl_session(id, request)update_repl_session101,0
|
197
|
+
def change_stack_trace(id, request)change_stack_trace111,0
|
198
|
+
def respond_with_unavailable_session(id)respond_with_unavailable_session119,0
|
199
|
+
def respond_with_unacceptable_requestrespond_with_unacceptable_request125,0
|
200
|
+
def call_app(env)call_app131,0
|
201
|
+
|
202
|
+
web-console/lib/web_console/permissions.rb,670
|
203
|
+
module WebConsoleWebConsole5,0
|
204
|
+
class PermissionsPermissions6,0
|
205
|
+
class PermissionsWebConsole::Permissions6,0
|
206
|
+
ALWAYS_PERMITTED_NETWORKS = %w( 127.0.0.0/8 ::1 ::ffff:127.0.0.0/104 )ALWAYS_PERMITTED_NETWORKS8,0
|
207
|
+
ALWAYS_PERMITTED_NETWORKS = %w( 127.0.0.0/8 ::1 ::ffff:127.0.0.0/104 )WebConsole::Permissions::ALWAYS_PERMITTED_NETWORKS8,0
|
208
|
+
def initialize(networks = nil)initialize10,0
|
209
|
+
def include?(network)include?14,0
|
210
|
+
def to_sto_s20,0
|
211
|
+
def normalize_networks(networks)normalize_networks26,0
|
212
|
+
def coerce_network_to_ipaddr(network)coerce_network_to_ipaddr30,0
|
213
|
+
def human_readable_ipaddr(ipaddr)human_readable_ipaddr38,0
|
214
|
+
|
215
|
+
web-console/lib/web_console/railtie.rb,200
|
216
|
+
module WebConsoleWebConsole5,0
|
217
|
+
class Railtie < ::Rails::RailtieRailtie6,0
|
218
|
+
class Railtie < ::Rails::RailtieWebConsole::Railtie6,0
|
219
|
+
def web_console_permissionsweb_console_permissions63,0
|
220
|
+
|
221
|
+
web-console/lib/web_console/request.rb,659
|
222
|
+
module WebConsoleWebConsole3,0
|
223
|
+
class Request < ActionDispatch::RequestRequest4,0
|
224
|
+
class Request < ActionDispatch::RequestWebConsole::Request4,0
|
225
|
+
cattr_accessor :permissions, default: Permissions.newpermissions5,0
|
226
|
+
cattr_accessor :permissions, default: Permissions.newpermissions=5,0
|
227
|
+
def permitted?permitted?7,0
|
228
|
+
def strict_remote_ipstrict_remote_ip11,0
|
229
|
+
class GetSecureIp < ActionDispatch::RemoteIp::GetIpGetSecureIp19,0
|
230
|
+
class GetSecureIp < ActionDispatch::RemoteIp::GetIpWebConsole::Request::GetSecureIp19,0
|
231
|
+
def initialize(req, proxies)initialize20,0
|
232
|
+
def filter_proxies(ips)filter_proxies31,0
|
233
|
+
|
234
|
+
web-console/lib/web_console/session.rb,514
|
235
|
+
module WebConsoleWebConsole3,0
|
236
|
+
class SessionSession13,0
|
237
|
+
class SessionWebConsole::Session13,0
|
238
|
+
cattr_reader :inmemory_storage, default: {}inmemory_storage14,0
|
239
|
+
def find(id)find21,0
|
240
|
+
def from(storage)from32,0
|
241
|
+
attr_reader :idid42,0
|
242
|
+
def initialize(exception_mappers)initialize44,0
|
243
|
+
def eval(input)eval56,0
|
244
|
+
def switch_binding_to(index, exception_object_id)switch_binding_to63,0
|
245
|
+
def context(objpath)context70,0
|
246
|
+
def store_into_memorystore_into_memory76,0
|
247
|
+
|
248
|
+
web-console/lib/web_console/source_location.rb,417
|
249
|
+
module WebConsoleWebConsole3,0
|
250
|
+
class SourceLocationSourceLocation4,0
|
251
|
+
class SourceLocationWebConsole::SourceLocation4,0
|
252
|
+
def initialize(binding)initialize5,0
|
253
|
+
def path() @binding.source_location.first endpath10,0
|
254
|
+
def lineno() @binding.source_location.last endlineno11,0
|
255
|
+
def path() @binding.eval("__FILE__") endpath13,0
|
256
|
+
def lineno() @binding.eval("__LINE__") endlineno14,0
|
257
|
+
|
258
|
+
web-console/lib/web_console/template.rb,416
|
259
|
+
module WebConsoleWebConsole3,0
|
260
|
+
class TemplateTemplate8,0
|
261
|
+
class TemplateWebConsole::Template8,0
|
262
|
+
cattr_accessor :template_paths, default: [ File.expand_path("../templates", __FILE__) ]template_paths10,0
|
263
|
+
cattr_accessor :template_paths, default: [ File.expand_path("../templates", __FILE__) ]template_paths=10,0
|
264
|
+
def initialize(env, session)initialize12,0
|
265
|
+
def render(template)render19,0
|
266
|
+
|
267
|
+
web-console/lib/web_console/testing/erb_precompiler.rb,348
|
268
|
+
module WebConsoleWebConsole6,0
|
269
|
+
module TestingTesting7,0
|
270
|
+
module TestingWebConsole::Testing7,0
|
271
|
+
class ERBPrecompilerERBPrecompiler9,0
|
272
|
+
class ERBPrecompilerWebConsole::Testing::ERBPrecompiler9,0
|
273
|
+
def initialize(path)initialize10,0
|
274
|
+
def buildbuild17,0
|
275
|
+
def method_missing(name, *args, &block)method_missing21,0
|
276
|
+
|
277
|
+
web-console/lib/web_console/testing/fake_middleware.rb,622
|
278
|
+
module WebConsoleWebConsole8,0
|
279
|
+
module TestingTesting9,0
|
280
|
+
module TestingWebConsole::Testing9,0
|
281
|
+
class FakeMiddlewareFakeMiddleware10,0
|
282
|
+
class FakeMiddlewareWebConsole::Testing::FakeMiddleware10,0
|
283
|
+
DEFAULT_HEADERS = { Rack::CONTENT_TYPE => "application/javascript" }DEFAULT_HEADERS13,0
|
284
|
+
DEFAULT_HEADERS = { Rack::CONTENT_TYPE => "application/javascript" }WebConsole::Testing::FakeMiddleware::DEFAULT_HEADERS13,0
|
285
|
+
def initialize(opts)initialize15,0
|
286
|
+
def call(env)call21,0
|
287
|
+
def viewview28,0
|
288
|
+
def req_path(env)req_path35,0
|
289
|
+
def render(template)render39,0
|
290
|
+
|
291
|
+
web-console/lib/web_console/testing/helper.rb,219
|
292
|
+
module WebConsoleWebConsole3,0
|
293
|
+
module TestingTesting4,0
|
294
|
+
module TestingWebConsole::Testing4,0
|
295
|
+
module HelperHelper5,0
|
296
|
+
module HelperWebConsole::Testing::Helper5,0
|
297
|
+
def self.gem_rootgem_root6,0
|
298
|
+
|
299
|
+
web-console/lib/web_console/version.rb,109
|
300
|
+
module WebConsoleWebConsole3,0
|
301
|
+
VERSION = "4.2.1"VERSION4,0
|
302
|
+
VERSION = "4.2.1"WebConsole::VERSION4,0
|
303
|
+
|
304
|
+
web-console/lib/web_console/view.rb,438
|
305
|
+
module WebConsoleWebConsole3,0
|
306
|
+
class View < ActionView::BaseView4,0
|
307
|
+
class View < ActionView::BaseWebConsole::View4,0
|
308
|
+
def only_on_error_page(*args)only_on_error_page9,0
|
309
|
+
def only_on_regular_page(*args)only_on_regular_page14,0
|
310
|
+
def render_javascript(template)render_javascript23,0
|
311
|
+
def render_inlined_string(template)render_inlined_string33,0
|
312
|
+
def render(*)render41,0
|
313
|
+
def t(key, options = {})t54,0
|
314
|
+
|
315
|
+
web-console/lib/web_console/whiny_request.rb,303
|
316
|
+
module WebConsoleWebConsole3,0
|
317
|
+
class WhinyRequest < SimpleDelegatorWhinyRequest8,0
|
318
|
+
class WhinyRequest < SimpleDelegatorWebConsole::WhinyRequest8,0
|
319
|
+
def permitted?permitted?9,0
|
320
|
+
def whine_unless(condition)whine_unless18,0
|
321
|
+
def loggerlogger25,0
|
322
|
+
def requestrequest29,0
|
323
|
+
|
324
|
+
web-console/test/dummy/app/controllers/application_controller.rb,79
|
325
|
+
class ApplicationController < ActionController::BaseApplicationController3,0
|
326
|
+
|
327
|
+
web-console/test/dummy/app/controllers/controller_helper_test_controller.rb,118
|
328
|
+
class ControllerHelperTestController < ApplicationControllerControllerHelperTestController3,0
|
329
|
+
def indexindex4,0
|
330
|
+
|
331
|
+
web-console/test/dummy/app/controllers/exception_test_controller.rb,157
|
332
|
+
class ExceptionTestController < ApplicationControllerExceptionTestController3,0
|
333
|
+
def indexindex4,0
|
334
|
+
def xhrxhr9,0
|
335
|
+
def test_methodtest_method13,0
|
336
|
+
|
337
|
+
web-console/test/dummy/app/controllers/helper_error_controller.rb,100
|
338
|
+
class HelperErrorController < ApplicationControllerHelperErrorController3,0
|
339
|
+
def indexindex4,0
|
340
|
+
|
341
|
+
web-console/test/dummy/app/controllers/helper_test_controller.rb,98
|
342
|
+
class HelperTestController < ApplicationControllerHelperTestController3,0
|
343
|
+
def indexindex4,0
|
344
|
+
|
345
|
+
web-console/test/dummy/app/controllers/model_test_controller.rb,242
|
346
|
+
class ModelTestController < ApplicationControllerModelTestController3,0
|
347
|
+
def indexindex4,0
|
348
|
+
class LocalModelLocalModel8,0
|
349
|
+
class LocalModelModelTestController::LocalModel8,0
|
350
|
+
def initializeinitialize9,0
|
351
|
+
def workwork13,0
|
352
|
+
|
353
|
+
web-console/test/dummy/app/controllers/tests_controller.rb,293
|
354
|
+
class TestsController < ApplicationControllerTestsController3,0
|
355
|
+
def render_console_ontop_of_textrender_console_ontop_of_text4,0
|
356
|
+
def renders_console_only_oncerenders_console_only_once9,0
|
357
|
+
def doesnt_render_console_on_non_html_requestsdoesnt_render_console_on_non_html_requests14,0
|
358
|
+
|
359
|
+
web-console/test/dummy/app/helpers/application_helper.rb,47
|
360
|
+
module ApplicationHelperApplicationHelper3,0
|
361
|
+
|
362
|
+
web-console/test/dummy/config/application.rb,147
|
363
|
+
module DummyDummy11,0
|
364
|
+
class Application < Rails::ApplicationApplication12,0
|
365
|
+
class Application < Rails::ApplicationDummy::Application12,0
|
366
|
+
|
367
|
+
web-console/test/support/scenarios/bad_custom_error_scenario.rb,343
|
368
|
+
module WebConsoleWebConsole3,0
|
369
|
+
class BadCustomErrorScenarioBadCustomErrorScenario4,0
|
370
|
+
class BadCustomErrorScenarioWebConsole::BadCustomErrorScenario4,0
|
371
|
+
class Error < StandardErrorError5,0
|
372
|
+
class Error < StandardErrorWebConsole::BadCustomErrorScenario::Error5,0
|
373
|
+
def initialize(*)initialize6,0
|
374
|
+
def callcall12,0
|
375
|
+
|
376
|
+
web-console/test/support/scenarios/basic_nested_scenario.rb,216
|
377
|
+
module WebConsoleWebConsole3,0
|
378
|
+
class BasicNestedScenarioBasicNestedScenario4,0
|
379
|
+
class BasicNestedScenarioWebConsole::BasicNestedScenario4,0
|
380
|
+
def callcall5,0
|
381
|
+
def raise_an_errorraise_an_error13,0
|
382
|
+
|
383
|
+
web-console/test/support/scenarios/custom_error_scenario.rb,298
|
384
|
+
module WebConsoleWebConsole3,0
|
385
|
+
class CustomErrorScenarioCustomErrorScenario4,0
|
386
|
+
class CustomErrorScenarioWebConsole::CustomErrorScenario4,0
|
387
|
+
Error = Class.new(StandardError)Error5,0
|
388
|
+
Error = Class.new(StandardError)WebConsole::CustomErrorScenario::Error5,0
|
389
|
+
def callcall7,0
|
390
|
+
|
391
|
+
web-console/test/support/scenarios/eval_nested_scenario.rb,228
|
392
|
+
module WebConsoleWebConsole3,0
|
393
|
+
class EvalNestedScenarioEvalNestedScenario4,0
|
394
|
+
class EvalNestedScenarioWebConsole::EvalNestedScenario4,0
|
395
|
+
def callcall5,0
|
396
|
+
def raise_an_error_in_evalraise_an_error_in_eval13,0
|
397
|
+
|
398
|
+
web-console/test/support/scenarios/flat_scenario.rb,143
|
399
|
+
module WebConsoleWebConsole3,0
|
400
|
+
class FlatScenarioFlatScenario4,0
|
401
|
+
class FlatScenarioWebConsole::FlatScenario4,0
|
402
|
+
def callcall5,0
|
403
|
+
|
404
|
+
web-console/test/support/scenarios/reraised_scenario.rb,273
|
405
|
+
module WebConsoleWebConsole3,0
|
406
|
+
class ReraisedScenarioReraisedScenario4,0
|
407
|
+
class ReraisedScenarioWebConsole::ReraisedScenario4,0
|
408
|
+
def callcall5,0
|
409
|
+
def raise_an_error_in_evalraise_an_error_in_eval13,0
|
410
|
+
def method_that_raisesmethod_that_raises19,0
|
411
|
+
|
412
|
+
web-console/test/test_helper.rb,339
|
413
|
+
module SilenceRailsDomTestingSilenceRailsDomTesting26,0
|
414
|
+
def assert_select(*)assert_select27,0
|
415
|
+
module PlatformSpecificTestMacroPlatformSpecificTestMacro40,0
|
416
|
+
def test(name, options = {})test41,0
|
417
|
+
def capture(stream)capture61,0
|
418
|
+
alias silence capturesilence78,0
|
419
|
+
module ExternalExternal87,0
|
420
|
+
def self.exceptionexception88,0
|
421
|
+
|
422
|
+
web-console/test/web_console/context_test.rb,211
|
423
|
+
module WebConsoleWebConsole5,0
|
424
|
+
class ContextTest < ActiveSupport::TestCaseContextTest6,0
|
425
|
+
class ContextTest < ActiveSupport::TestCaseWebConsole::ContextTest6,0
|
426
|
+
def context(b, o = "")context31,0
|
427
|
+
|
428
|
+
web-console/test/web_console/evaluator_test.rb,577
|
429
|
+
module WebConsoleWebConsole5,0
|
430
|
+
class EvaluatorTest < ActiveSupport::TestCaseEvaluatorTest6,0
|
431
|
+
class EvaluatorTest < ActiveSupport::TestCaseWebConsole::EvaluatorTest6,0
|
432
|
+
class TestError < StandardErrorTestError7,0
|
433
|
+
class TestError < StandardErrorWebConsole::EvaluatorTest::TestError7,0
|
434
|
+
def backtracebacktrace8,0
|
435
|
+
class BadlyDefinedError < StandardErrorBadlyDefinedError16,0
|
436
|
+
class BadlyDefinedError < StandardErrorWebConsole::EvaluatorTest::BadlyDefinedError16,0
|
437
|
+
def backtracebacktrace17,0
|
438
|
+
def current_tracecurrent_trace71,0
|
439
|
+
|
440
|
+
web-console/test/web_console/exception_mapper_test.rb,201
|
441
|
+
module WebConsoleWebConsole5,0
|
442
|
+
class ExceptionMapperTest < ActiveSupport::TestCaseExceptionMapperTest6,0
|
443
|
+
class ExceptionMapperTest < ActiveSupport::TestCaseWebConsole::ExceptionMapperTest6,0
|
444
|
+
|
445
|
+
web-console/test/web_console/helper_test.rb,902
|
446
|
+
module WebConsoleWebConsole5,0
|
447
|
+
class HelperTest < ActionDispatch::IntegrationTestHelperTest6,0
|
448
|
+
class HelperTest < ActionDispatch::IntegrationTestWebConsole::HelperTest6,0
|
449
|
+
class BaseApplicationBaseApplication7,0
|
450
|
+
class BaseApplicationWebConsole::HelperTest::BaseApplication7,0
|
451
|
+
def call(env)call8,0
|
452
|
+
def requestrequest14,0
|
453
|
+
def statusstatus18,0
|
454
|
+
def headersheaders22,0
|
455
|
+
def bodybody26,0
|
456
|
+
class SingleConsoleApplication < BaseApplicationSingleConsoleApplication40,0
|
457
|
+
class SingleConsoleApplication < BaseApplicationWebConsole::HelperTest::SingleConsoleApplication40,0
|
458
|
+
def call(env)call41,0
|
459
|
+
class MultipleConsolesApplication < BaseApplicationMultipleConsolesApplication50,0
|
460
|
+
class MultipleConsolesApplication < BaseApplicationWebConsole::HelperTest::MultipleConsolesApplication50,0
|
461
|
+
def call(env)call51,0
|
462
|
+
|
463
|
+
web-console/test/web_console/injector_test.rb,173
|
464
|
+
module WebConsoleWebConsole5,0
|
465
|
+
class InjectorTest < ActiveSupport::TestCaseInjectorTest6,0
|
466
|
+
class InjectorTest < ActiveSupport::TestCaseWebConsole::InjectorTest6,0
|
467
|
+
|
468
|
+
web-console/test/web_console/integration_test.rb,185
|
469
|
+
module WebConsoleWebConsole5,0
|
470
|
+
class IntegrationTest < ActiveSupport::TestCaseIntegrationTest6,0
|
471
|
+
class IntegrationTest < ActiveSupport::TestCaseWebConsole::IntegrationTest6,0
|
472
|
+
|
473
|
+
web-console/test/web_console/interceptor_test.rb,262
|
474
|
+
module WebConsoleWebConsole5,0
|
475
|
+
class InterceptorTest < ActionDispatch::IntegrationTestInterceptorTest6,0
|
476
|
+
class InterceptorTest < ActionDispatch::IntegrationTestWebConsole::InterceptorTest6,0
|
477
|
+
def generate_template_errorgenerate_template_error16,0
|
478
|
+
|
479
|
+
web-console/test/web_console/middleware_test.rb,518
|
480
|
+
module WebConsoleWebConsole5,0
|
481
|
+
class MiddlewareTest < ActionDispatch::IntegrationTestMiddlewareTest6,0
|
482
|
+
class MiddlewareTest < ActionDispatch::IntegrationTestWebConsole::MiddlewareTest6,0
|
483
|
+
class ApplicationApplication7,0
|
484
|
+
class ApplicationWebConsole::MiddlewareTest::Application7,0
|
485
|
+
def initialize(options = {})initialize8,0
|
486
|
+
def call(env)call13,0
|
487
|
+
def bodybody17,0
|
488
|
+
def statusstatus32,0
|
489
|
+
def headersheaders36,0
|
490
|
+
def raise_exceptionraise_exception258,0
|
491
|
+
|
492
|
+
web-console/test/web_console/permissions_test.rb,221
|
493
|
+
module WebConsoleWebConsole5,0
|
494
|
+
class PermissionsTest < ActiveSupport::TestCasePermissionsTest6,0
|
495
|
+
class PermissionsTest < ActiveSupport::TestCaseWebConsole::PermissionsTest6,0
|
496
|
+
def permit(*args)permit50,0
|
497
|
+
|
498
|
+
web-console/test/web_console/request_test.rb,277
|
499
|
+
module WebConsoleWebConsole5,0
|
500
|
+
class RequestTest < ActiveSupport::TestCaseRequestTest6,0
|
501
|
+
class RequestTest < ActiveSupport::TestCaseWebConsole::RequestTest6,0
|
502
|
+
def request(*args)request55,0
|
503
|
+
def mock_env(*args)mock_env59,0
|
504
|
+
def xhr(*args)xhr63,0
|
505
|
+
|
506
|
+
web-console/test/web_console/session_test.rb,501
|
507
|
+
module WebConsoleWebConsole5,0
|
508
|
+
class SessionTest < ActiveSupport::TestCaseSessionTest6,0
|
509
|
+
class SessionTest < ActiveSupport::TestCaseWebConsole::SessionTest6,0
|
510
|
+
class ValueAwareError < StandardErrorValueAwareError7,0
|
511
|
+
class ValueAwareError < StandardErrorWebConsole::SessionTest::ValueAwareError7,0
|
512
|
+
def self.raise(value)raise8,0
|
513
|
+
def self.raise_nested_error(value)raise_nested_error14,0
|
514
|
+
attr_reader :valuevalue21,0
|
515
|
+
def initialize(value)initialize23,0
|
516
|
+
|
517
|
+
web-console/test/web_console/whiny_request_test.rb,227
|
518
|
+
module WebConsoleWebConsole5,0
|
519
|
+
class WhinyRequestTest < ActiveSupport::TestCaseWhinyRequestTest6,0
|
520
|
+
class WhinyRequestTest < ActiveSupport::TestCaseWebConsole::WhinyRequestTest6,0
|
521
|
+
def request(*args)request24,0
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CommandDeck
|
4
|
+
# Controller for executing actions
|
5
|
+
class ActionsController < BaseController
|
6
|
+
def create
|
7
|
+
key = params[:key].to_s
|
8
|
+
begin
|
9
|
+
result = Executor.call(key: key, params: params[:params])
|
10
|
+
render json: { ok: true, result: result }
|
11
|
+
rescue ArgumentError => e
|
12
|
+
render json: { ok: false, error: e.message }, status: :not_found
|
13
|
+
rescue StandardError => e
|
14
|
+
render json: { ok: false, error: e.message, backtrace: e.backtrace.take(8) }, status: :internal_server_error
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CommandDeck
|
4
|
+
# Controller for serving assets
|
5
|
+
class AssetsController < BaseController
|
6
|
+
def js
|
7
|
+
rel = params[:path].presence || "main"
|
8
|
+
ext = params[:format].presence || "js"
|
9
|
+
rel = "#{rel}.#{ext}" unless rel.end_with?(".#{ext}")
|
10
|
+
path = safe_asset_path("js", rel)
|
11
|
+
return head :not_found unless path && File.file?(path)
|
12
|
+
|
13
|
+
send_data File.binread(path), type: js_mime_for(path), disposition: "inline"
|
14
|
+
end
|
15
|
+
|
16
|
+
def css
|
17
|
+
rel = params[:path].presence || "main"
|
18
|
+
ext = params[:format].presence || "css"
|
19
|
+
rel = "#{rel}.#{ext}" unless rel.end_with?(".#{ext}")
|
20
|
+
path = safe_asset_path("css", rel)
|
21
|
+
return head :not_found unless path && File.file?(path)
|
22
|
+
|
23
|
+
send_data File.binread(path), type: "text/css; charset=utf-8", disposition: "inline"
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def base_assets_root
|
29
|
+
@base_assets_root ||= File.expand_path(File.join(__dir__, "../../../lib/command_deck/assets"))
|
30
|
+
end
|
31
|
+
|
32
|
+
def safe_asset_path(kind, rel)
|
33
|
+
# Prevent traversal and restrict to known roots (js/ or css/)
|
34
|
+
rel = rel.to_s.sub(%r{^/+}, "")
|
35
|
+
rel = rel.gsub("..", "")
|
36
|
+
root = File.join(base_assets_root, kind)
|
37
|
+
full = File.expand_path(File.join(root, rel))
|
38
|
+
return nil unless full.start_with?(root)
|
39
|
+
|
40
|
+
full
|
41
|
+
end
|
42
|
+
|
43
|
+
def js_mime_for(*)
|
44
|
+
# All ESM served as application/javascript
|
45
|
+
"application/javascript; charset=utf-8"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CommandDeck
|
4
|
+
class BaseController < ActionController::Base
|
5
|
+
# POC: dev-only
|
6
|
+
before_action :ensure_development!
|
7
|
+
|
8
|
+
# Simpler for the POC; we can wire CSRF later if needed.
|
9
|
+
skip_forgery_protection
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def ensure_development!
|
14
|
+
head :not_found unless Rails.env.development?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|