In an effort to try and get more people up and running with YARV/Ruby 2.0, here's a quick and dirty guide for building your own copy to play with. This guide will create a safe yarv-based ruby interpreter that won't blow away or override your normal ruby interpreter.
If you already have an installation of ruby with rubygems installed, please temporarily alter your environment variables and remove the RUBYOPT value. This environment variable allows users to set up scripts that should be loaded by default when a ruby interpreter is launched. When building yarv, it will confuse the newly built interpreter, because the file won't exist in it's libraries/load path yet. For Windows users - to remove the variable go to Control Panel - System, click the advanced tab, click the Environment variables button. In the System Variables section, search for RUBYOPT and delete the entry. Please do not forget to add the entry back in when finished playing with YARV - the value should be 'rubygems'.
-
Install cygwin
http://www.cygwin.com
For Windows users only, obviously. Run the setup.exe provided to install via the Internet.
Make sure you install these non-default cygwin packages:
- If you don't have it yet, download a Subversion command line client. You can open a command line (Windows users, that means cygwin) and try out:
which svn
If it can't find the file, you need to get a client.
- Open a command line. For windows users, this means a cygwin command line.
svn co http://www.atdot.net/svn/yarv/trunk yarv
../yarv/configure --prefix=/usr/local/yarv --program-suffix=-yarv
-
- You will see errors! That's because YARV isn't finished yet. We're trying to help them test on real live ruby code.
- You will see errors!
You should now have a ruby/yarv executable in /usr/local/yarv/bin/ruby-yarv(.exe). To test out scripts, just provide the full path to the yarv interpreter when invoking to use YARV.
/usr/local/yarv/bin/ruby-yarv my_favorite_script.rb
Please play around with it, test it out on your own code and help file bug reports with the YARV/Ruby 2.0 team.
Read: Build your own Ruby 2.0 (with VM)