18
19
20
21
22
23
24
25
26
27
28
29
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# File 'lib/spork/test_framework/rdebug_ide_test_unit.rb', line 18
def setup_rdebug(argv)
if argv.grep(/rdebug-ide/).size > 0
while argv.shift !~ /rdebug-ide/; end
options = OpenStruct.new(
'frame_bind' => false,
'host' => nil,
'load_mode' => false,
'port' => 1234,
'stop' => false,
'tracing' => false
)
opts = OptionParser.new do |opts|
opts.banner = " Using ruby-debug-base \#{Debugger::VERSION}\n Usage: rdebug-ide is supposed to be called from RDT, NetBeans or RubyMine. The\n command line interface to ruby-debug is rdebug.\n EOB\n opts.separator \"\"\n opts.separator \"Options:\"\n opts.on(\"-h\", \"--host HOST\", \"Host name used for remote debugging\") {|host| options.host = host}\n opts.on(\"-p\", \"--port PORT\", Integer, \"Port used for remote debugging\") {|port| options.port = port}\n opts.on('--stop', 'stop when the script is loaded') {options.stop = true}\n opts.on(\"-x\", \"--trace\", \"turn on line tracing\") {options.tracing = true}\n opts.on(\"-l\", \"--load-mode\", \"load mode (experimental)\") {options.load_mode = true}\n opts.on(\"-d\", \"--debug\", \"Debug self - prints information for debugging ruby-debug itself\") do\n Debugger.cli_debug = true\n end\n opts.on(\"--xml-debug\", \"Debug self - sends information <message>s for debugging ruby-debug itself\") do\n Debugger.xml_debug = true\n end\n opts.on(\"-I\", \"--include PATH\", String, \"Add PATH to $LOAD_PATH\") do |path|\n $LOAD_PATH.unshift(path)\n end\n\n opts.on(\"--keep-frame-binding\", \"Keep frame bindings\") {options.frame_bind = true}\n opts.separator \"\"\n opts.separator \"Common options:\"\n opts.on_tail(\"-v\", \"--version\", \"Show version\") do\n puts \"Using ruby-debug-base \#{Debugger::VERSION}\"\n exit\n end\n end\n\n begin\n opts.parse! argv\n rescue StandardError => e\n puts opts\n puts\n puts e.message\n exit(1)\n end\n\n if argv.empty?\n puts opts\n puts\n puts \"Must specify a script to run\"\n exit(1)\n end\n\n # install interruption handler\n trap('INT') { Debugger.interrupt_last }\n\n # set options\n Debugger.keep_frame_binding = options.frame_bind\n Debugger.tracing = options.tracing\n\n Debugger.start_server(options.host, options.port)\n Debugger.start do\n yield\n end\n\n else\n\n yield\n\n end\n\nend\n"
|