Skip to content

Commit 73c4185

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 57f4243 + 0f58b1e commit 73c4185

File tree

14 files changed

+512
-50
lines changed

14 files changed

+512
-50
lines changed

.travis.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ os:
55
- osx
66

77
rvm:
8+
- 1.8.7
89
- 1.9.3
910
- 2.0.0
1011
- 2.1.10
1112
- 2.2.8
12-
- 2.3.5
13-
- 2.4.2
14-
- 2.5.0
13+
- 2.3.8
14+
- 2.4.6
15+
- 2.5.5
16+
- 2.6.3
1517
- ruby-head
1618

1719
matrix:
@@ -25,10 +27,13 @@ matrix:
2527
- os: osx
2628
rvm: 2.0.0
2729

30+
- os: osx
31+
rvm: 1.8.7
32+
2833
# include:
2934
# - os: osx
3035
# rvm: 1.9.3
3136
# before_script: rvm install ruby-1.9.3 # not binary
3237
# - os: osx
3338
# rvm: 2.0.0
34-
# before_script: rvm install ruby-2.0.0 # not binary
39+
# before_script: rvm install ruby-2.0.0 # not binary

Gemfile

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,21 @@ source "http://rubygems.org"
33
# @param [Array<String>] versions compatible ruby versions
44
# @return [Array<String>] an array with mri platforms of given versions
55
def mries(*versions)
6-
versions.flat_map do |v|
7-
%w(ruby mingw x64_mingw)
8-
.map { |platform| "#{platform}_#{v}".to_sym unless platform == "x64_mingw" && v < "2.0" }
9-
.delete_if &:nil?
10-
end
6+
versions.map do |v|
7+
%w(ruby mingw x64_mingw).map do |platform|
8+
"#{platform}_#{v}".to_sym unless platform == "x64_mingw" && v < "2.0"
9+
end.delete_if &:nil?
10+
end.flatten
11+
end
12+
13+
if RUBY_VERSION < '1.9' || defined?(JRUBY_VERSION)
14+
gem "ruby-debug-base", :platforms => [:jruby, *mries('18')]
15+
end
16+
17+
if RUBY_VERSION && RUBY_VERSION >= "1.9"
18+
gem "ruby-debug-base19x", ">= 0.11.32", :platforms => mries('19')
1119
end
1220

13-
gem "ruby-debug-base", :platforms => [:jruby, *mries('18')]
14-
gem "ruby-debug-base19x", ">= 0.11.32", :platforms => mries('19')
1521
if RUBY_VERSION && RUBY_VERSION >= "2.0"
1622
gem "debase", "~> 0.2", ">= 0.2.2", :platforms => mries('20', '21', '22', '23', '24', '25')
1723
end
@@ -23,6 +29,10 @@ group :development do
2329
end
2430

2531
group :test do
26-
gem "test-unit"
32+
if RUBY_VERSION < "1.9"
33+
gem "test-unit", "~> 2.1.2"
34+
else
35+
gem "test-unit"
36+
end
2737
end
2838

README.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,32 @@
1-
[gem]: https://rubygems.org/gems/ruby-debug-ide
2-
# ruby-debug-ide
3-
An interface which glues ruby-debug to IDEs like Eclipse (RDT), NetBeans and RubyMine.
4-
51
[![official JetBrains project](http://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
62
[![Gem Version](https://badge.fury.io/rb/ruby-debug-ide.svg)][gem]
73
[![Build Status](https://travis-ci.org/ruby-debug/ruby-debug-ide.svg?branch=master)](https://travis-ci.org/ruby-debug/ruby-debug-ide)
4+
5+
[gem]: https://rubygems.org/gems/ruby-debug-ide
6+
# ruby-debug-ide
7+
8+
The 'ruby-debug-ide' gem provides the protocol to establish communication between the debugger engine (such as [debase](https://rubygems.org/gems/debase) or [ruby-debug-base](https://rubygems.org/gems/ruby-debug-base)) and IDEs (for example, RubyMine, Visual Studio Code, or Eclipse). 'ruby-debug-ide' redirect commands from the IDE to the debugger engine. Then, it returns answers/events received from the debugger engine to the IDE. To learn more about a communication protocol, see the following document: [ruby-debug-ide protocol](protocol-spec.md).
9+
10+
## Install debugging gems
11+
Depending on the used Ruby version, you need to add/install the following debugging gems to the Gemfile:
12+
- Ruby 2.x - [ruby-debug-ide](https://rubygems.org/gems/ruby-debug-ide) and [debase](https://rubygems.org/gems/debase)
13+
- Ruby 1.9.x - [ruby-debug-ide](https://rubygems.org/gems/ruby-debug-ide) and [ruby-debug-base19x](https://rubygems.org/gems/ruby-debug-base19x)
14+
- jRuby or Ruby 1.8.x - [ruby-debug-ide](https://rubygems.org/gems/ruby-debug-ide) and [ruby-debug-base](https://rubygems.org/gems/ruby-debug-base)
15+
> For Windows, make sure that the Ruby [DevKit](https://github.com/oneclick/rubyinstaller/wiki/Development-Kit) is installed.
16+
17+
## Start debugging session
18+
To start the debugging session for a Rails application, run the following command:
19+
```shell
20+
rdebug-ide --host 0.0.0.0 --port 1234 --dispatcher-port 1234 -- bin/rails s
21+
```
22+
If you want to debug a Rails application run using Docker Compose, you need to start the Rails server from the Docker in the following way:
23+
```yaml
24+
command: bundle exec rdebug-ide --host 0.0.0.0 --port 1234 -- bin/rails s -p 3000 -b 0.0.0.0
25+
volumes:
26+
- .:/sample_rails_app
27+
ports:
28+
- "1234:1234"
29+
- "3000:3000"
30+
- "26162:26162"
31+
```
32+
Note that all ports above should be exposed in the Dockerfile.

bin/rdebug-ide

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ options = OpenStruct.new(
1717
'port' => 1234,
1818
'stop' => false,
1919
'tracing' => false,
20+
'skip_wait_for_start' => false,
2021
'int_handler' => true,
2122
'dispatcher_port' => -1,
2223
'evaluation_timeout' => 10,
@@ -28,8 +29,7 @@ options = OpenStruct.new(
2829
'value_as_nested_element' => false,
2930
'attach_mode' => false,
3031
'cli_debug' => false,
31-
'key_value_mode' => false,
32-
'server_mode' => false
32+
'key_value_mode' => false
3333
)
3434

3535
opts = OptionParser.new do |opts|
@@ -68,6 +68,7 @@ EOB
6868

6969
opts.on('--stop', 'stop when the script is loaded') {options.stop = true}
7070
opts.on("-x", "--trace", "turn on line tracing") {options.tracing = true}
71+
opts.on("--skip_wait_for_start", "skip wait for 'start' command") {options.skip_wait_for_start = true}
7172
opts.on("-l", "--load-mode", "load mode (experimental)") {options.load_mode = true}
7273
opts.on("-d", "--debug", "Debug self - prints information for debugging ruby-debug itself") do
7374
Debugger.cli_debug = true
@@ -85,9 +86,6 @@ EOB
8586
opts.on("--key-value", "Key/Value presentation of hash items") do
8687
options.key_value_mode = true
8788
end
88-
opts.on("--server-mode", "Tells that rdebug-ide is working in server mode") do
89-
options.server_mode = true
90-
end
9189
opts.on("--ignore-port", "Generate another port") do
9290
options.ignore_port = true
9391
end
@@ -169,7 +167,7 @@ Debugger.inspect_time_limit = options.inspect_time_limit
169167
Debugger.catchpoint_deleted_event = options.catchpoint_deleted_event || options.rm_protocol_extensions
170168
Debugger.value_as_nested_element = options.value_as_nested_element || options.rm_protocol_extensions
171169
Debugger.key_value_mode = options.key_value_mode
172-
Debugger.server_mode = options.server_mode
170+
Debugger.skip_wait_for_start = options.skip_wait_for_start
173171

174172
if options.attach_mode
175173
Debugger.require_multiprocess

ext/mkrf_conf.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
install_dir = File.expand_path("../../../..", __FILE__)
12
jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
23
rbx = defined?(RUBY_ENGINE) && 'rbx' == RUBY_ENGINE
34

@@ -27,11 +28,11 @@ def already_installed(dep)
2728

2829
begin
2930
puts "Installing base gem"
30-
inst = Gem::DependencyInstaller.new :prerelease => dep.prerelease?
31+
inst = Gem::DependencyInstaller.new(:prerelease => dep.prerelease?, :install_dir => install_dir)
3132
inst.install dep
3233
rescue
3334
begin
34-
inst = Gem::DependencyInstaller.new(:prerelease => true)
35+
inst = Gem::DependencyInstaller.new(:prerelease => true, :install_dir => install_dir)
3536
inst.install dep
3637
rescue Exception => e
3738
puts e

lib/ruby-debug-ide.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def cleanup_backtrace(backtrace)
6868
attr_reader :interface
6969
# protocol extensions
7070
attr_accessor :catchpoint_deleted_event, :value_as_nested_element
71-
attr_accessor :server_mode
71+
attr_accessor :skip_wait_for_start
7272

7373

7474
#
@@ -100,8 +100,8 @@ def prepare_debugger(options)
100100

101101
# wait for 'start' command
102102
@mutex.synchronize do
103-
@proceed.wait(@mutex) unless server_mode
104-
end
103+
@proceed.wait(@mutex)
104+
end unless options.skip_wait_for_start
105105
end
106106

107107
def debug_program(options)

lib/ruby-debug-ide/commands/control.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ def help_command
2222

2323
def help(cmd)
2424
%{
25-
q[uit]\texit from debugger,
25+
q[uit]\texit from debugger,
2626
exit\talias to quit
2727
}
2828
end
2929
end
3030
end
31-
31+
3232
class RestartCommand < Command # :nodoc:
3333
self.control = true
3434

@@ -39,7 +39,7 @@ def regexp
3939
$
4040
/x
4141
end
42-
42+
4343
def execute
4444
if not defined? Debugger::RDEBUG_SCRIPT or not defined? Debugger::ARGV
4545
print "We are not in a context we can restart from.\n"
@@ -64,7 +64,7 @@ def help_command
6464

6565
def help(cmd)
6666
%{
67-
restart|R [args]
67+
restart|R [args]
6868
Restart the program. This is is a re-exec - all debugger state
6969
is lost. If command arguments are passed those are used.
7070
}
@@ -78,7 +78,7 @@ class StartCommand < Command # :nodoc:
7878
def regexp
7979
/^\s*(start)(\s+ \S+ .*)?$/x
8080
end
81-
81+
8282
def execute
8383
@printer.print_debug("Starting: running program script")
8484
Debugger.run_prog_script #Debugger.prog_script_running?
@@ -102,23 +102,23 @@ class InterruptCommand < Command # :nodoc:
102102
self.event = false
103103
self.control = true
104104
self.need_context = true
105-
105+
106106
def regexp
107107
/^\s*i(?:nterrupt)?\s*$/
108108
end
109-
109+
110110
def execute
111111
unless Debugger.interrupt_last
112112
context = Debugger.thread_context(Thread.main)
113113
context.interrupt
114114
end
115115
end
116-
116+
117117
class << self
118118
def help_command
119119
'interrupt'
120120
end
121-
121+
122122
def help(cmd)
123123
%{
124124
i[nterrupt]\tinterrupt the program
@@ -137,12 +137,12 @@ def regexp
137137

138138
def execute
139139
Debugger.require_multiprocess
140-
interface.command_queue << "finish" if Debugger.server_mode
140+
interface.command_queue << "finish" if Debugger.skip_wait_for_start
141141
Debugger.stop
142142
Debugger.interface.close
143143
Debugger::MultiProcess.undo_monkey
144144
Debugger.control_thread = nil
145-
Thread.current.exit unless Debugger.server_mode #@control_thread is a current thread
145+
Thread.current.exit unless Debugger.skip_wait_for_start #@control_thread is a current thread
146146
end
147147

148148
class << self

lib/ruby-debug-ide/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Debugger
2-
IDE_VERSION='0.7.0.beta6'
2+
IDE_VERSION='0.7.1.beta1'
33
end

lib/ruby-debug-ide/xml_printer.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,7 @@ def print_load_result(file, exception = nil)
459459
end
460460

461461
def print_element(name, additional_tags = nil)
462-
additional_tags_presentation = additional_tags.nil? ? ''
463-
: additional_tags.map {|tag, value| " #{tag}=\"#{value}\""}.reduce(:+)
462+
additional_tags_presentation = additional_tags.nil? ? '' : additional_tags.map {|tag, value| " #{tag}=\"#{value}\""}.reduce(:+)
464463

465464
print("<#{name}#{additional_tags_presentation}>")
466465
begin

0 commit comments

Comments
 (0)