Module: MaglevDatabaseExplorer
- Defined in:
- lib/maglev-database-explorer.rb,
lib/maglev-database-explorer/halt.rb,
lib/maglev-database-explorer/engine.rb,
lib/maglev-database-explorer/version.rb,
lib/maglev-database-explorer/debug_server.rb,
lib/maglev-database-explorer/debug_storage.rb,
app/helpers/maglev_database_explorer/application_helper.rb,
app/controllers/maglev_database_explorer/code_controller.rb,
app/controllers/maglev_database_explorer/object_controller.rb,
app/controllers/maglev_database_explorer/application_controller.rb,
app/controllers/maglev_database_explorer/object_explorer_controller.rb
Overview
Workaround for Engines not working correctly on MagLev
Defined Under Namespace
Modules: ApplicationHelper
Classes: ApplicationController, CodeController, Engine, ObjectController, ObjectExplorerController
Constant Summary
collapse
- VERSION =
"0.0.5"
Class Method Summary
collapse
Class Method Details
.application_port ⇒ Object
19
20
21
|
# File 'lib/maglev-database-explorer/debug_server.rb', line 19
def self.application_port
@application_port ||= Rails::Server.new.options[:Port]
end
|
.debug_port ⇒ Object
14
15
16
17
|
# File 'lib/maglev-database-explorer/debug_server.rb', line 14
def self.debug_port
ensure_debug_server_running!
@debug_server.options[:Port]
end
|
.debug_storage ⇒ Object
2
3
4
|
# File 'lib/maglev-database-explorer/debug_storage.rb', line 2
def self.debug_storage
@debug_storage ||= {}
end
|
.ensure_debug_server_running! ⇒ Object
2
3
4
5
6
7
8
9
10
11
12
|
# File 'lib/maglev-database-explorer/debug_server.rb', line 2
def self.ensure_debug_server_running!
if not @debug_server
@debug_server = Rails::Server.new
@debug_server.options[:Port] += 1
@debug_server.options[:pid] = false
Thread.start do
@debug_server.start
end
end
end
|
.eval_object ⇒ Object
20
21
22
|
# File 'lib/maglev-database-explorer/engine.rb', line 20
def self.eval_object
@eval_object ||= Object.new
end
|
.full_gem_path ⇒ Object
15
16
17
18
|
# File 'lib/maglev-database-explorer/engine.rb', line 15
def self.full_gem_path
gem = Gem.loaded_specs["maglev-database-explorer"]
gem.full_gem_path
end
|
.halt(inner_exception = nil) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/maglev-database-explorer/halt.rb', line 7
def halt(inner_exception = nil)
halt_proc = Proc.new do
nil.pause
end
halt_proc.__call_and_rescue do |eval_result|
is_exception = eval_result[0]
if is_exception
if inner_exception == nil
Thread.current.__set_exception(eval_result[1])
else
Thread.current.__set_exception(inner_exception)
end
Thread.current[:is_rails_thread] = true
eval_result[1] = Thread.current
halted_threads.push(Thread.current)
Thread.current[:manual_stop] = true
Thread.stop
Thread.current[:manual_stop] = false
halted_threads.delete(Thread.current)
eval_result[1].__exception.__resume
else
puts "ERROR: expected a Halt. __call_and_rescue not working correctly."
Thread.current.__set_exception(nil)
end
end
end
|
.halted_threads ⇒ Object
38
39
40
|
# File 'lib/maglev-database-explorer/halt.rb', line 38
def halted_threads
@halted_threads ||= []
end
|
.install_rails_debugger ⇒ Object
3
4
5
|
# File 'lib/maglev-database-explorer/halt.rb', line 3
def install_rails_debugger
require "maglev-database-explorer/action_controller_debug_patch"
end
|
.store_debug_object(obj) ⇒ Object
6
7
8
|
# File 'lib/maglev-database-explorer/debug_storage.rb', line 6
def self.store_debug_object(obj)
debug_storage[obj.object_id] = obj
end
|