Skip to content

Ahead-of-time (AOT) Compiler designed for Ruby, that just works.

License

Notifications You must be signed in to change notification settings

sadiqmmm/ruby-compiler

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruby Compiler

Ahead-of-time (AOT) Compiler designed for Ruby, that just works.

GitHub version

Features

  • Works on Linux, Mac and Windows
  • Creates a binary distribution of your application
  • Supports natively any form of require and load, including dynamic ones (e.g. load(my_path + 'x.rb')
  • Features zero-config auto-update capabilities to make your compiled project to stay updated
  • Native C extensions are fully supported
  • Rails applications are fully supported
  • Open Source, MIT Licensed

Development Status

Master CI RAM Test Black-box Test
Windows Status Status Status
macOS / Linux Status Status Status

Get Started

It takes less than 5 minutes to compile any project with Ruby Compiler.

You won't need to modify a single line of code in your application, no matter how you developed it as long as it works in plain Ruby!

Arch. Latest Stable
Windows x86-64 https://sourceforge.net/projects/ruby-compiler/files/v0.1.0/rubyc.exe/download
macOS x86-64 https://sourceforge.net/projects/ruby-compiler/files/v0.1.0/rubyc-darwin-x64/download
Linux x86-64 https://sourceforge.net/projects/ruby-compiler/files/v0.1.0/rubyc-linux-x64/download

Install on Windows

First install the prerequisites:

Then download the executable rubyc.exe, optionally put it under C:\Windows (or any other directory that is part of PATH). Execute rubyc from the command line.

Install on macOS

First install the prerequisites:

  • SquashFS Tools 4.3: brew install squashfs
  • Xcode
    • You also need to install the Command Line Tools via Xcode. You can find this under the menu Xcode -> Preferences -> Downloads
    • This step will install gcc and the related toolchain containing make
  • Ruby

Then,

curl -L https://sourceforge.net/projects/ruby-compiler/files/v0.1.0/rubyc-darwin-x64/download > rubyc
chmod +x rubyc
./rubyc

Install on Linux

First install the prerequisites:

Then,

curl -L https://sourceforge.net/projects/ruby-compiler/files/v0.1.0/rubyc-linux-x64/download > rubyc
chmod +x rubyc
./rubyc

Usage

If ENTRANCE was not provided, then a single Ruby interpreter executable will be produced.

rubyc [OPTION]... [ENTRANCE]
  -r, --root=DIR                   The path to the root of the application
  -o, --output=FILE                The path of the output file
  -d, --tmpdir=DIR                 The directory for temporary files
  -c, --clean                      Cleans temporary files before compiling
      --make-args=ARGS             Extra arguments to be passed to make
      --nmake-args=ARGS            Extra arguments to be passed to nmake
      --debug                      Enable debug mode
  -v, --version                    Prints the version of rubyc and exit
      --ruby-version               Prints the version of the Ruby runtime and exit
      --ruby-api-version           Prints the version of the Ruby API and exit
  -h, --help                       Prints this help and exit
      --examples                   Prints usage examples

Examples

Producing a single Ruby interpreter executable

rubyc
./a.out (or a.exe on Windows)

Bootstrapping Ruby Compiler itself

git clone --depth 1 https://github.com/pmq20/ruby-compiler
cd ruby-compiler
rubyc bin/rubyc
./a.out (or a.exe on Windows)

Compiling a CLI tool

git clone --depth 1 https://github.com/pmq20/node-compiler
cd node-compiler
rubyc bin/nodec
./a.out (or a.exe on Windows)

Compiling a Rails application

rails new yours
cd yours
rubyc bin/rails
./a.out server (or a.exe server on Windows)

See Also

  • Libsquash: portable, user-land SquashFS that can be easily linked and embedded within your application.
  • Libautoupdate: cross-platform C library to enable your application to auto-update itself in place.

About

Ahead-of-time (AOT) Compiler designed for Ruby, that just works.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 56.0%
  • Ruby 33.6%
  • Roff 6.0%
  • Assembly 1.0%
  • Yacc 0.9%
  • Shell 0.6%
  • Other 1.9%