Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ruby:2.6.6-slim

# Install build tooks.
RUN apt update && apt install -y build-essential

# Working folder.
RUN mkdir /app
WORKDIR /app

# Setup bundler.
RUN gem update --system 3.1.4 && \
gem install bundler -v 2.1.4

# Entrypoint script will install gems.
COPY docker-entrypoint.sh docker-entrypoint.sh
RUN chmod +x docker-entrypoint.sh
ENTRYPOINT ["sh", "/app/docker-entrypoint.sh"]
46 changes: 22 additions & 24 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
source "http://rubygems.org"

# @param [Array<String>] versions compatible ruby versions
# @return [Array<String>] an array with mri platforms of given versions
def mries(*versions)
versions.map do |v|
%w(ruby mingw x64_mingw).map do |platform|
"#{platform}_#{v}".to_sym unless platform == "x64_mingw" && v < "2.0"
end.delete_if &:nil?
end.flatten
end

if RUBY_VERSION < '1.9' || defined?(JRUBY_VERSION)
gem "ruby-debug-base", :platforms => [:jruby, *mries('18')]
end

if RUBY_VERSION && RUBY_VERSION >= "1.9"
gem "ruby-debug-base19x", ">= 0.11.32", :platforms => mries('19')
end

if RUBY_VERSION && RUBY_VERSION >= "2.0"
gem "debase", "~> 0.2", ">= 0.2.2", :platforms => mries('20', '21', '22', '23', '24', '25')
# Need to limit Debase to 0.2.2 for Ruby 2.0 so the tests
# pass but it appears that Debase 2.4 will work when Debase
# is using in a project. The error in the tests is:
#
# Error: test_catchpoint_basics(RDCatchpointTest): RuntimeError: expected "suspended" start_element, but got "end_document: []"
#
if RUBY_VERSION
if RUBY_VERSION < "1.9"
gem "ruby-debug-base"
elsif RUBY_VERSION < "2.0"
gem "ruby-debug-base19x", ">= 0.11.32"
elsif RUBY_VERSION < "2.1"
gem "debase", "<= 0.2.2"
else
gem "debase", ">= 0.2.2"
end
end

gemspec

group :development do
gem "bundler"
end
group :development, :test do
# Bundler 1.9.0 has an error on Ruby 1.9.3:
#
# https://github.com/rubygems/bundler/issues/3492
#
gem "bundler", "> 1.9"

group :test do
if RUBY_VERSION < "1.9"
gem "test-unit", "~> 2.1.2"
else
Expand Down
38 changes: 36 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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).

## Install debugging gems
## Install the debugging gems
Depending on the used Ruby version, you need to add/install the following debugging gems to the Gemfile:
- Ruby 2.x - [ruby-debug-ide](https://rubygems.org/gems/ruby-debug-ide) and [debase](https://rubygems.org/gems/debase)
- 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)
Expand All @@ -28,4 +28,38 @@ ports:
- "3000:3000"
- "26162:26162"
```
Note that all ports above should be exposed in the Dockerfile.
Note that all ports above should be exposed in the Dockerfile.

## Developing Ruby Debug IDE

To develop the Ruby Debug IDE you can either setup Ruby on your host machine or use the Docker container provided. Currently there is just the one container but more can be added for different Ruby versions if needed. The Ruby Debug IDE should run using all versions of Ruby.

### Host

Install Ruby. We recommend using [RVM](https://rvm.io/) or [Rbenv](https://github.com/rbenv/rbenv).

### Docker

In the root folder run:

```bash
docker-compose build
```

Then run the container:

```bash
docker-compose run app bash
```

Note: The gems are not installed until the container is run and the [docker-entrypoint.sh](docker-entrypoint.sh) is called.

### Tests

Once you have your development environment setup make sure the tests all pass:

```bash
rake
```

You should now be good to go. Having trouble getting your development environment setup then open an [issue](https://github.com/corgibytes/ruby-debug-ide/issues).
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3.7'
services:
app:
build: .
volumes:
- .:/app
- bundler-data:/usr/local/bundle
ports:
- "1234:1234" # RubyMine

volumes:
bundler-data:
8 changes: 8 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set -e

bundle check || bundle install
bundle clean --force

exec "$@"