The InstantRails project ( http://instantrails.rubyforge.org/ ) is outdated and contains just too much IMHO ( Apache, PHP, who needs that when searching for Rails? ). Other options to get Rails running require an installer ( http://railsinstaller.org/ or http://rubyinstaller.org/ ), which is good, but in some environments ( limited access accounts ) installing is not an option. And in yet other environments, you'd, well I'd, rather have a command line option, instead of an in-your-face installer that requires end-users to press 'next', 'next', 'next'...
So that's why about two years ago I created Portable Rails 3. It's name was 'inspired' by the thoughtfully named Portable Git ( http://code.google.com/p/msysgit/downloads/list ) which could make an excelent companion.
Installing was as simple as extracting (or cloning) and running start-cmd.bat
, but things have changed in the meantime. Rails 3.2 expects a compiler present on the system, and for this the approach that worked for 3.0 no longer works.
Luckily things have changed, but it isn't as portable as what I named PortableRails3 two years ago. So for now I'll call it a recipe. A dumb recipe, as you've got to perform these steps still manually, but they're quite easy. As I don't think Github is meant for sharing binaries I won't publish the result on Github anymore.
Don't like to cook by yourself, scroll down to Recipe C... A is for DIY'rs and B for something in between... (B is actually the work in progress to automate the process of creating new versions of C)
Allright, you came here not to do it yourself... here it is prebundled, ~83MB zipped (on box.com, in just plain old zip so you can really extract it anywhere), it won't be the latest and the greatest all time... but that's the thing with instant food, it is never as fresh when you make it on your own.
- Download portable ruby (basically step 1 to 4 or recipe C) or create it running the prepare.sh-script (only tested this on MacOS-X, but it isn't really advanced stuff here); the latest is based on Ruby 2.1.6 (getting SQLite to work on 2.2 at the moment of writing was bit too much of a hassle))
- Extract it
- Run
start-cmd.bat
- Run
postinstall.sh
(which takes basically care of step 6 to 11 of recipe C)
(or the documentation of all steps that I've scripted)
- The latest ruby in .7z format (http://rubyforge.org/frs/download.php/76799/ruby-1.9.3-p392-i386-mingw32.7z)
- The DevKit as self-extracting .exe (actually a .7z as well) (http://cloud.github.com/downloads/oneclick/rubyinstaller/DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe)
(in case you're looking for the latest and greatest versions, have a look at the ruby installer download page)
(actually some details are left out of this recipe, check prepare.sh and postinstall.sh if you run into problems with this approach)
- Extract the latest ruby.
- Extract the latest DevKit
- Copy the contents of the DevKit folder onto the ruby folder. (by now you've already something that consumes 450MB(!) of your precious SSD/HDD-space)
- Copy https://github.com/murb/PortableRails3/raw/master/start-cmd.bat to the main dir.
- Run
start-cmd.bat
- Make sure docs won't get installed
echo gem: --no-ri --no-rdoc > ~/.gemrc
(unless you want them, you can skip this step, I prefer The Internet) - Open the
installer.rb
files found in the rubygem folder (/lib/ruby/2.1.6/rubygems/installer.rb
and maybe also in/lib/ruby/site_ruby/2.1.6/rubygems/installer.rb
) and make sure that the line afterdef shebang(a)
readsreturn '#!/usr/bin/env ruby'
(all rest in this method will now be skipped, and actually this line is enough) - And type the magical
gem install rails
followed by Enter (and btw. bless yourself with the fact that you're now in a more or less POSIX-compatible environment) - Fix yourself a nice cup of coffee
- Seeing the prompt again? Type
rails -v
and see how it responds with somthing likeRails 3.2.12
: congrats, you've got it installed, but it isn't portable (yet) - Make sure that the gem installed batch files work in a portable setting:
cp /bin/gem.bat /bin/bin.template && for file in /bin/*.bat; do cp /bin/bin.template $file; done
- Seeing the prompt again? Type
rails -v
and see how it still responds with somthing likeRails 3.2.12
: congrats, you've got it portable (test it by zipping it and unpacking it somewhere else)
In case you're bothered with a warning "DL is depricated", just uncomment the line warn "DL is deprecated, please use Fiddle"
in /lib/ruby/2.0.0/dl.rb (hat tip to mamat hensem)
When you're running it portable on your Windows machine you can simply create a new rails program using the infamous rails new {applicationname}
-command. In case you're not allowed to access the internet rerun the bundle
-command with the --local
option (bundle --local
) inside the {applicationname} directory.
No guarantee that they still work in more up to date environments, but for your information:
- 3.0 (ruby 1.9): https://github.com/murb/PortableRails/tree/3.0
- 3.2 (ruby 1.9): https://github.com/murb/PortableRails/tree/3.2
- 4.2 (ruby 2.1): https://github.com/murb/PortableRails/tree/4.2 (current)
Updating to the latest and greatest should be made easier for the maintainer (now me). That's what prepare.sh
(recipe A) is about to become, which I can run on my (MacOS-X) machine to prepare a simple .zip file that can be moved to a windows machine.
The software has been tested on Windows XP running on a MacBookPro via Virtual Box and a locked down Hewlett Packard machine within a bank (I guess that means pretty much locked down) and it worked. I hope it also works for you within your school, university or other company. If it doesn't try harder first, and then try contacting me.
- Coffeescript doesn't work properly currently. This is a known issue, and haven't had the time to figure this out correctly. Just remove the
//= require turbolinks
-line (or alternatively: simply removing the=
makes it a comment) from application.js and make sure no .coffee files are being included
All credits go to the http://rubyinstaller.org/downloads/ team. I hardly did anything. Give them a big thanks!