GithubHelp home page GithubHelp logo

rake-compiler-dev-box's Introduction

rake-compiler-dev-box

A virtual machine for using rake-compiler.

rake-compiler is totally awesome, and you should be using it if you maintain a Ruby gem with C or Java extensions to build native binaries for your users.

However, getting your local environment set up to build for all the assorted platforms can be a pain. Thankfully, we have the amazing tool Vagrant for "lightweight, reproducible, and portable development environments."

rake-compiler + Vagrant = easy native gems for all.

Dependencies

How to Build the Virtual Machine

Easy-peasy:

$ git clone https://github.com/tjschuck/rake-compiler-dev-box.git
$ cd rake-compiler-dev-box
$ vagrant up

That's it! Go grab a cup of coffee, though -- it can take a couple of minutes to build the first time.

Building Your Native Gems

Once you have your gem ready to package, clone or move your repo into the same directory as the rake-compiler-dev-box:

$ pwd
/Users/tjschuck/Code/rake-compiler-dev-box
$ git clone [email protected]:codahale/bcrypt-ruby.git
Cloning into 'bcrypt-ruby'...
[...], done.

Now fire up your virtual machine (if you haven't already):

$ vagrant up

And SSH in:

$ vagrant ssh

You'll now be inside the virtual machine. The directory on your host machine with your gem in it and the scripts to build it will be mounted at /vagrant:

vagrant@precise32:~$ cd /vagrant
vagrant@precise32:/vagrant$ ls
bcrypt-ruby  bin  bootstrap.sh  LICENSE.txt  README.md  sample_gem  Vagrantfile

To build all gem binaries (native, Java, and Windows versions), run:

vagrant@precise32:/vagrant$ package_all YOUR_GEM'S_DIR_NAME

And wait for everything to build. Replace YOUR_GEM'S_DIR_NAME with the correct value -- above, it would be bcrypt-ruby. There's a sample_gem dir in there as well if you'd like to experiment.

All of your gem binaries will be put into pkg:

vagrant@precise32:/vagrant$ ls bcrypt-ruby/pkg/
bcrypt-ruby-3.1.0            bcrypt-ruby-3.1.0-x86-linux.gem
bcrypt-ruby-3.1.0.gem        bcrypt-ruby-3.1.0-x86-mingw32
bcrypt-ruby-3.1.0-java       bcrypt-ruby-3.1.0-x86-mingw32.gem
bcrypt-ruby-3.1.0-java.gem   bcrypt-ruby-3.1.0-x86-mswin32-60
bcrypt-ruby-3.1.0-x86-linux  bcrypt-ruby-3.1.0-x86-mswin32-60.gem

Happy compiling!

VM Management

Log out of the virtual machine (exit or ^D).

To shut down the virtual machine:

$ vagrant halt

To start it up again:

$ vagrant up

To completely remove the VM, clearing it from disk and destroying all contents:

$ vagrant destroy

To reinstantiate it for future compiling, it can be recreated with:

$ vagrant up

See the Vagrant docs for more info.

❤️ ❤️ ❤️

rake-compiler-dev-box's People

Contributors

tjschuck avatar luislavena avatar larskanis avatar rubys avatar

Watchers

James Cloos avatar Roman Lishtaba avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.