Module: MindControl
- Defined in:
- lib/mind_control.rb,
lib/mind_control/cui.rb,
lib/mind_control/repl.rb,
lib/mind_control/client.rb,
lib/mind_control/server.rb,
lib/mind_control/version.rb,
lib/mind_control/loggable.rb,
lib/mind_control/pry_commands.rb
Defined Under Namespace
Modules: Client, Loggable Classes: CUI, REPL, Server
Constant Summary collapse
- DEFAULT_SOCKETS_DIR =
Default directory for UNIX socket files.
"/tmp/ruby_mind_control"- VERSION =
"0.1.2"- PryCommands =
::Pry::CommandSet.new
Class Attribute Summary collapse
-
.logger ⇒ Object
Returns the value of attribute logger.
Class Method Summary collapse
-
.start(options = {}) ⇒ Object
Start MindControl server.
-
.stop ⇒ Object
Stop MindControl server.
Class Attribute Details
.logger ⇒ Object
Returns the value of attribute logger.
12 13 14 |
# File 'lib/mind_control.rb', line 12 def logger @logger end |
Class Method Details
.start(options = {}) ⇒ Object
Start MindControl server.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/mind_control.rb', line 30 def self.start( = {} ) raise "MindControl already started!" if @server && @server.running? # Name that will be displayed in process list of mind-control client. # The default is process name of the host program (eg. "ruby"). process_name = [ :name ] || $PROGRAM_NAME # Make name filesystem safe process_name.gsub! /[^[[:alnum:]]\-_]/, "_" # Some shared temp directory for sockets. socket_dir = [ :sockets_dir ] || DEFAULT_SOCKETS_DIR # Construct unique socket path for current process socket_name = "#{process_name}.#{Process.pid}.sock" socket_path = File.join( socket_dir, socket_name ) # Construct REPL (NB: same settings for all connections!) repl = MindControl::REPL.new( [ :target ] || TOPLEVEL_BINDING, [ :pry ] || {} ) # Start server @server = MindControl::Server.new( socket_path, repl ) @server.start return nil end |
.stop ⇒ Object
Stop MindControl server.
60 61 62 63 64 65 |
# File 'lib/mind_control.rb', line 60 def self.stop return unless @server @server.stop @server = nil end |