Wow – busy few days. I built three small distributions of Ruby on Rails 1.2.6 for use in my course. There is support for Windows and Mac OS/X 10.4.
The basic idea is to come up with a distribution that works from a USB drive for students working in a lab as well as a really simple distribution that does not mess with your system configuration and it can be put anywhere in a directory structure including on a shared file server.
Then I built printed documentation for each of them and a podcast for each version to walk my students through the installation process.
This whole thing is available at:
www.rubylearn.com
Have fun.
The tricky bit is in this setup script (I kind of nicked the idea from Instant Rails and then improved on it). This script sets up all the necessary environment variables to point the path and Ruby runtime to wherever the script is running from.
This leads to a bit clunky interface as you have to run this script every time you open a command window – but after teaching Rails for a while I have learned that students learn to love the command line interface and trying to hid the real world from them is a disservice. Students learning command-line for the first time are a little uncomfortable – but after a few days they are command line wizards.
The essence of the script is setting the parameters – here is the one that uses AFS space and sets all the paths to somewhere deep in AFS space so it is a 500 byte install if AFS is mounted already :) But the essence of the script can be adapted to any environment.
This also tells the environment variables that Ruby listens to:
HERE=/afs/umich.edu/user/c/s/csev/Public/html/teachrails/rte-mac/
if [ -r $HERE/ruby/bin/ruby ] ;
then
echo Setting up Ruby Environment using AFS
export DYLD_LIBRARY_PATH=$HERE/ruby/lib/
export GEM_HOME=$HERE/ruby/lib/ruby/gems/1.8
export PATH=$HERE/ruby/bin/:$HERE/ruby/bin/:/bin:/sbin:/usr/bin:/usr/sbin
export RUBYLIB=$HERE/ruby/lib/ruby/:$HERE/ruby/lib/ruby/1.8/:$HERE/ruby/lib/ruby/site_ruby/1.8:$HERE/ruby/lib//ruby/1.8/universal-darwin8.0/
export RUBYGEMS=$HERE/ruby/lib/ruby/site_ruby/1.8
ruby –version
rails –version
else
echo
echo ‘******* Error ******’
echo Unable to find AFS space with ruby-mac installation
echo $HERE
fi
Feel free to tell me how confused I am – some of this was guesswork – just keep adding paths to variables until it worked. Someone wiser than me can clearly improve on this.