module Mdbe

Constants

VERSION

Public Class Methods

application_port() click to toggle source
# File lib/mdbe/debug_server.rb, line 19
def self.application_port
  @application_port ||= Rails::Server.new.options[:Port]
end
debug_port() click to toggle source
# File lib/mdbe/debug_server.rb, line 14
def self.debug_port
  ensure_debug_server_running!
  @debug_server.options[:Port]
end
debug_storage() click to toggle source
# File lib/mdbe.rb, line 23
def debug_storage
  @debug_storage ||= {}
end
ensure_debug_server_running!() click to toggle source
# File lib/mdbe/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() click to toggle source
# File lib/mdbe.rb, line 19
def eval_object
  @eval_object ||= Object.new
end
full_gem_path() click to toggle source

initializer “mdbe” do |app|

app.config.threadsafe!

app.config.after_initialize do
  MaglevDatabaseExplorer.ensure_debug_server_running!
  MaglevDatabaseExplorer.install_rails_debugger
end

end

# File lib/mdbe.rb, line 14
def full_gem_path
  gem = Gem.loaded_specs["mdbe"]
  gem.full_gem_path
end
halt(inner_exception = nil) click to toggle source
# File lib/mdbe/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() click to toggle source
# File lib/mdbe/halt.rb, line 38
def halted_threads
  @halted_threads ||= []
end
install_rails_debugger() click to toggle source
# File lib/mdbe/halt.rb, line 3
def install_rails_debugger
  require "mdbe/action_controller_debug_patch"
end
store_debug_object(obj) click to toggle source
# File lib/mdbe.rb, line 27
def store_debug_object(obj)
  debug_storage[obj.object_id] = obj
end

Private Instance Methods

debug_storage() click to toggle source
# File lib/mdbe.rb, line 23
def debug_storage
  @debug_storage ||= {}
end
eval_object() click to toggle source
# File lib/mdbe.rb, line 19
def eval_object
  @eval_object ||= Object.new
end
full_gem_path() click to toggle source

initializer “mdbe” do |app|

app.config.threadsafe!

app.config.after_initialize do
  MaglevDatabaseExplorer.ensure_debug_server_running!
  MaglevDatabaseExplorer.install_rails_debugger
end

end

# File lib/mdbe.rb, line 14
def full_gem_path
  gem = Gem.loaded_specs["mdbe"]
  gem.full_gem_path
end
store_debug_object(obj) click to toggle source
# File lib/mdbe.rb, line 27
def store_debug_object(obj)
  debug_storage[obj.object_id] = obj
end