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
21 changes: 21 additions & 0 deletions .github/workflows/dockerhub-description.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Update Docker Hub description

on:
push:
branches:
- master
paths:
- README.md
workflow_dispatch:

jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: peter-evans/dockerhub-description@1b9a80c056b620d92cedb9d9b5a223409c68ddfa # v5.0.0
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
repository: rubylang/all-ruby
228 changes: 118 additions & 110 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,123 +1,131 @@
# all-ruby
# rubylang/all-ruby

This software is a script to install historic Ruby versions since ruby-0.49.
Also, all-ruby script runs all ruby binaries with same arguments.
Historic Ruby versions since ruby-0.49, all built and packaged into a single image. The bundled `all-ruby` script runs every Ruby binary with the same arguments so you can compare behavior across versions.

## Platform
* Docker Hub: https://hub.docker.com/r/rubylang/all-ruby
* GitHub Container Registry: https://github.com/ruby/all-ruby/pkgs/container/all-ruby
* Source: https://github.com/ruby/all-ruby

This software is developed on Debian GNU/Linux 10 (buster) amd64.
## Quick start

However Ruby doesn't support 64 bit platform until ruby 1.8.0.
So, the older ruby needs 32 bit development tools which can be
installed as follows.
Pull the latest image and list the bundled Ruby versions:

% sudo dpkg --add-architecture i386
% sudo apt update
% sudo apt-get build-dep ruby2.5
% sudo apt install rake gcc-multilib \
zlib1g:i386 libncurses5:i386 libgdbm6:i386 libssl1.1:i386 \
libreadline7:i386 libffi6:i386
```
docker pull rubylang/all-ruby:latest
docker run --rm rubylang/all-ruby ./all-ruby -v
```

For Debian GNU/Linux 9 (stretch) :
The `latest` tag contains every supported Ruby version in one image.

% sudo apt-get build-dep ruby2.3
% sudo apt install rake gcc-multilib \
zlib1g:i386 libncurses5:i386 libgdbm3:i386 libssl1.0.2:i386 \
libreadline7:i386 libffi6:i386
## What is this?

This image bundles historic Ruby releases starting from ruby-0.49 and provides an `all-ruby` script that invokes each `ruby` binary in turn with the same arguments. It is useful for checking when a feature was introduced, when behavior changed, or how a snippet runs across the entire Ruby history.

## Usage

This software provides Rakefile and "rake all" downloads and builds
historic ruby versions.

% git clone https://github.com/akr/all-ruby.git
% cd all-ruby
% rake setup_build
% rake all # this takes long time

Note that `rake setup_build` is same as
`mkdir ../build-all-ruby; ln -s ../build-all-ruby build`.
build-all-ruby directory is required to avoid that
`ruby -v` emits `last_commit=` line.

all-ruby script runs all ruby binaries.

% ./all-ruby -e 'p RUBY_VERSION'
ruby-0.49 -e:1: syntax error
exit 1
ruby-0.50 -e:1: syntax error
exit 1
ruby-0.51 -e:1: undefined method `p' for "main"(Object)
exit 1
ruby-0.54 -e:1:in method `p': undefined method `p' for "main"(Object)
exit 1
ruby-0.55 -e:1: undefined method `p' for "main"(Object)
exit 1
...
ruby-0.65 -e:1: undefined method `p' for "main"(Object)
exit 1
ruby-0.69 -e:1: Uninitialized constant RUBY_VERSION
exit 1
...
ruby-1.3.4-990531 /tmp/rbHMsENn:1: uninitialized constant RUBY_VERSION (NameError)
exit 1
ruby-1.3.4-990611 "1.3.4"
...
ruby-2.7.0-preview1 "2.7.0"
% ALL_RUBY_SINCE=ruby-1.6 all-ruby -e 'p 0.class'
ruby-1.6.0 Fixnum
...
ruby-2.3.8 Fixnum
ruby-2.4.0-preview1 Integer
...
ruby-2.7.0-preview1 Integer

## Documentation

rake without arguments shows the help message for the Rakefile.

% rake
"rake all" will install 384 ruby
"rake list" shows versions
"rake sync" updates versions

all-ruby without arguments shows help message for all-ruby script.

% ./all-ruby
usage: all-ruby RUBY-ARGS
environment variables:
ALL_RUBY_SINCE=ruby-1.4 run only versions since specified one
ALL_RUBY_BINS='ruby-2.4.4 ruby-2.5.1' run only versions specfied
ALL_RUBY_ADDBINS=./ruby run specified commands additionaly
ALL_RUBY_SHOW_DUP=yes don't suppress duplicated output

## Docker

Dockerfile is provided to generate a docker image containing
ruby binaries built by the Rakefile.

Pre-built docker image can be used as follows:

% docker pull rubylang/all-ruby
% docker run --rm rubylang/all-ruby ./all-ruby -v
% docker run --rm -e 'ALL_RUBY_SINCE=ruby-2.0' \
-e 'ALL_RUBY_ADDBINS=/usr/bin/ruby' \
rubylang/all-ruby ./all-ruby -e 'p 0.class'

If you want to build a docker image yourself,
you can use following command.
This uses your CPUs parallel.

% docker build ./ -t my-all-ruby

If you want to use only n CPUs, build argument j=n can be used.
(--cpuset-cpus option of "docker build" is also usable.)

% docker build ./ --build-arg j=1 -t my-all-ruby

## Links

- https://github.com/akr/all-ruby
Run the same script across every bundled Ruby:

```
% docker run --rm rubylang/all-ruby ./all-ruby -e 'p RUBY_VERSION'
ruby-0.49 -e:1: syntax error
exit 1
ruby-0.50 -e:1: syntax error
exit 1
ruby-0.51 -e:1: undefined method `p' for "main"(Object)
exit 1
...
ruby-1.3.4-990611 "1.3.4"
...
ruby-2.7.0-preview1 "2.7.0"
```

Limit the range with `ALL_RUBY_SINCE`, or add your own Ruby into the comparison with `ALL_RUBY_ADDBINS`:

```
% docker run --rm -e 'ALL_RUBY_SINCE=ruby-2.0' \
rubylang/all-ruby ./all-ruby -e 'p 0.class'
ruby-2.0.0-p0 Fixnum
...
ruby-2.3.8 Fixnum
ruby-2.4.0-preview1 Integer
...
```

`./all-ruby` without arguments prints the supported environment variables:

```
% ./all-ruby
usage: all-ruby RUBY-ARGS
environment variables:
ALL_RUBY_SINCE=ruby-1.4 run only versions since specified one
ALL_RUBY_BINS='ruby-2.4.4 ruby-2.5.1' run only versions specfied
ALL_RUBY_ADDBINS=./ruby run specified commands additionaly
ALL_RUBY_SHOW_DUP=yes don't suppress duplicated output
```

## Images

- **`rubylang/all-ruby:latest`** — every supported Ruby version in a single image. Also mirrored to `ghcr.io/ruby/all-ruby:latest`.

## Contributing

The Dockerfile and build scripts live in the [ruby/all-ruby](https://github.com/ruby/all-ruby) repository.

### Building Ruby binaries locally

The Rakefile downloads and builds the historic Ruby versions:

```
% git clone https://github.com/ruby/all-ruby.git
% cd all-ruby
% rake setup_build
% rake all # this takes long time
```

`rake setup_build` is equivalent to `mkdir ../build-all-ruby; ln -s ../build-all-ruby build`. The `build-all-ruby` directory is required to prevent `ruby -v` from emitting a `last_commit=` line.

`rake` without arguments prints the available tasks:

```
% rake
"rake all" will install 384 ruby
"rake list" shows versions
"rake sync" updates versions
```

### Platform requirements

The build is developed on Debian GNU/Linux 10 (buster) amd64. Ruby did not support 64-bit platforms until ruby 1.8.0, so older Rubies require 32-bit development tools:

```
% sudo dpkg --add-architecture i386
% sudo apt update
% sudo apt-get build-dep ruby2.5
% sudo apt install rake gcc-multilib \
zlib1g:i386 libncurses5:i386 libgdbm6:i386 libssl1.1:i386 \
libreadline7:i386 libffi6:i386
```

For Debian GNU/Linux 9 (stretch):

```
% sudo apt-get build-dep ruby2.3
% sudo apt install rake gcc-multilib \
zlib1g:i386 libncurses5:i386 libgdbm3:i386 libssl1.0.2:i386 \
libreadline7:i386 libffi6:i386
```

### Building the Docker image locally

```
% docker build ./ -t my-all-ruby
```

The build uses all available CPUs in parallel. Restrict it with the `j` build argument (or `--cpuset-cpus`):

```
% docker build ./ --build-arg j=1 -t my-all-ruby
```

## Author

Expand Down
Loading