A Docker image to get started hacking Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
Dockerfile
README.md
bootstrap.sh
setup.sh
start.sh
test.rb

README.md

Ruby Hacker Box

Purpose

The Ruby Hacker Box is meant to make it easy for new Ruby hackers to get started hacking Ruby very quickly.

It was started at @ko1's Ruby Hack Challenge and is based on the documentation that was written for those events.

Requirements

  • Docker
  • git
  • For the time being, documentation and scripts exists only for Unix shells.

Setup

You have two options to install: running the boostrap script or manually following the install instructions.

Bootstrap

You can get started by just pasting the following line in your command line:

curl -s https://raw.githubusercontent.com/davidstosik/mri-dev-docker/master/bootstrap.sh | sh /dev/stdin

Manual

  1. Clone this repository.
git clone https://github.com/davidstosik/mri-dev-docker.git
  1. Clone the Ruby source repository inside this repository.
git clone https://github.com/ruby/ruby.git mri-dev-docker/ruby

You can also copy your own ruby source folder in mri-dev-docker if you already have it.

  1. Run the setup script
cd mri-dev-docker
./setup.sh

Getting started

You can open a Bash prompt in the Docker container you just built by using the start script:

./start.sh

(This is just a shortcut to run the docker run command with the proper options.)

The files are structured as described in @ko1's Build MRI and install built binaries.

They are organised as follows:

/
├── ruby/
└── workdir/
    ├── build/
    ├── install/
    └── ruby -> /ruby
  • /ruby/ contains the Ruby source code, as a Docker volume mounted from the host's ruby directory that was checked out from GitHub during setup
  • /workdir/ is your working directory, containing:
    • the build/ directory (*.o and other artifacts)
    • the install/ directory (in which you can find the compiled bin/ruby)
    • a symbolic link to /ruby, for convenience

Once in the Docker's shell, you can start hacking Ruby, then use make to build from the source, and for example, run tests:

make btest
make test-all
make test-spec

You can also run /ruby/test.rb using miniruby with make run.

About volumes

Note that ruby/ is not mounted directly inside /workdir to allow Docker to manage both directories as separate volumes, respectively mounted to your host ruby directory, and to a Docker volume that will backup build changes between sessions.

Thanks to that, it is possible to hack at Ruby's source code from the host, using your favorite tool suite. Build steps only will have to happen inside the Docker container's shell.