Adding Ruby on Rails Support

On Windows

Download and install Ruby + Ruby on Rails

  • Download the Ruby + Ruby on Rails package for Windows. The package contains Ruby and all its standard extensions, Gem, and the Ruby on Rails (RoR) framework. It was packaged by Aprelium.
  • Install the package contents in a directory of your choice (the default location is C:\Ruby).

Creating/deploying a Ruby on Rails (RoR) application

  • To create a sample Rails application, open a command line window by selecting Start in Windows, then choose Run..., then type cmd and press the Return key. In the displayed command line window, execute the following sequence of commands (press Return after entering each line):

    C:
    mkdir \railstest
    cd \railstest
    rails cookbook

    The above commands create a subdirectory called cookbook inside C:\railstest. The subdirectory contains the skeleton of a sample Rails application that could be improved later.
  • If you have a ready-to-use RoR application, copy it in a directory of your choice on your hard drive. In the rest of the instructions, substitute all occurences of C:\railstest\cookbook with the actual path of the directory where you have put the RoR application.

Declaring the application in Abyss Web Server

  • Stop Abyss Web Server (exit the application) and restart it: this will ensure that Abyss Web Server will get the new environment variables just installed by the Ruby + Ruby on Rails package.
  • Run Abyss Web Server and open its console.
  • Select the host that will serve the RoR application:
  • Press the Configure button associated with the host you have selected (in the Hosts table).
  • Select General.
  • Enter C:\railstest\cookbook\public in the Documents Path field. If you have used other names or created the RoR application in another directory, locate the public subdirectory in your Rails application and make it your Documents Path.
  • Press OK.
  • Select Scripting Parameters and press Add in the Interpreters table.
  • Set Interface to FastCGI (Local - Pipes).
  • Enter C:\ruby\bin\rubyw.exe in the Interpreter Path field (or locate rubyw.exe or ruby.exe executables in your Ruby + Ruby on Rails installation directory).
  • Enter in the Arguments field:

    "C:\\railstest\\cookbook\\public\\dispatch.fcgi"

    You may have to update the path if you have put your RoR application in a directory other than C:\railstest\cookbook. But in all the cases, backslashes must be doubled and the file path enclosed between double-quotes.
  • Press Add in the Extensions table, enter fcgi in the Extension field, press OK, then press OK a second time.
  • Select URL Rewriting, press Add in the URL Rewriting Rules table.
  • Enter in the Virtual Path Regular Expression field:

    ^(.*)$

  • Press Add in the Conditions table.
  • Set Variable to REQUEST_FILENAME, set Operator to Is not a file, and press OK.
  • Press Add one more time in the Conditions table.
  • Set Variable to REQUEST_FILENAME, set Operator to Is not a directory, and press OK.
  • Set If this rule matches to Perform an internal redirection.
  • Set Redirect to to:

    /dispatch.fcgi?$1

  • Press OK.

Apply the modifications

  • Press Restart to restart the server.

Test the application

At that stage, Abyss Web Server should be ready to serve your RoR application. To test it, browse http://127.0.0.1 and click on About your application's environment or browse http://127.0.0.1/rails/info/properties directly.

Learn to program using Ruby on Rails

Now it's probably time to read one of the several Ruby on Rails tutorials available on the Internet to understand how it works and to build your first application.
For example, the tutorial in Rolling with Ruby on Rails by Curt Hibbs is Windows centric and explains how to setup Ruby, MySQL, Rails and how to create a simple application. In our case, skip the Ruby and Rails setup as it's already done and begin reading from A Rails Application's Directory Structure in the second page to learn how to start with Rails programming.

On Mac OS X/macOS

Download and install Locomotive (All-in-one Ruby on Rails package)

  • Download Locomotive. The package contains Ruby and all its standard extensions, Gem, and the Ruby on Rails (RoR) framework.
  • Open the downloaded DMG package file.
  • Drag the Locomotive2 folder from the package and drop it on the Applications folder.

Creating/deploying a Ruby on Rails (RoR) application

  • Open the Locomotive2 folder you've just copied inside Applications.
  • Double-click on the Locomotive application bundle located inside the Locomotive2 folder to launch it.
  • In the Applications menu of Locomotive, select Create New....
  • For this example, the name of the application will be cookbook and we'll assume it will be put in the /Sites directory. Fill the Create New... dialog accordingly and click Create
  • Locomotive will generate the skelton of a Ruby on Rails application called inside /Sites/cookbook.
  • The new application will also be displayed in Locomtive's main window. That window could be used to control Ruby on Rails applications created with Locomotive. There is also a Run button which can start a simple server written in Ruby to test the application locally.

Declaring the application in Abyss Web Server

  • Run Abyss Web Server and open its console.
  • Select the host that will serve the RoR application:
  • Press the Configure button associated with the host you have selected (in the Hosts table).
  • Select General.
  • Enter /Sites/cookbook/public in the Documents Path field. If you have used other names or created the RoR application in another directory, locate the public subdirectory in your Rails application and make it your Documents Path.
  • Press OK.
  • Select Scripting Parameters and press Add in the Scripting Parameters table.
  • Set Interface to FastCGI (Local - Pipes).
  • If you are using an Intel-based Macintosh: in the Interpreter Path field, enter:

    /Applications/Locomotive2/Bundles/standardRailsSept2006.locobundle/i386/bin/ruby

    or locate the ruby executable inside the i386 subfolder located deep inside your Locomotive2 folder.
  • If you are using a PowerPC-based Macintosh: in the Interpreter Path field, enter:

    /Applications/Locomotive2/Bundles/standardRailsSept2006.locobundle/powerpc/bin/ruby

    or locate the ruby executable inside the powerpc subfolder located deep inside your Locomotive2 folder.
  • Enter in the Arguments field:

    "/Sites/cookbook/public/dispatch.fcgi"

    You may have to update the path if you have put your RoR application in a directory other than /Sites/cookbook.
  • Press Add in the Extensions table, enter fcgi in the Extension field, press OK, then press OK a second time.
  • Select URL Rewriting, press Add in the URL Rewriting Rules table.
  • Enter in the Virtual Path Regular Expression field:

    ^(.*)$

  • Press Add in the Conditions table.
  • Set Variable to REQUEST_FILENAME, set Operator to Is not a file, and press OK.
  • Press Add one more time in the Conditions table.
  • Set Variable to REQUEST_FILENAME, set Operator to Is not a directory, and press OK.
  • Set If this rule matches to Perform an internal redirection.
  • Set Redirect to to:

    /dispatch.fcgi?$1

  • Press OK.

Apply the modifications

  • Press Restart to restart the server.

Test the application

At that stage, Abyss Web Server should be ready to serve your RoR application. To test it, browse http://127.0.0.1 and click on About your application's environment or browse http://127.0.0.1/rails/info/properties directly.

Using Locomotive to open a preset development terminal

When developing a RoR applications, the use of the rails command line is required. Locomotive makes your life easy: all you have to do in that case is to right-click on a given RoR application in Locomotive's main window and to select Open Terminal. This will open a preset Mac OS X/macOS Terminal window which recognizes the rails command and which is already set to work on the RoR application of your choice.

Learn to program using Ruby on Rails

Now it's probably time to read one of the several Ruby on Rails tutorials available on the Internet to understand how it works and to build your first application.
Locomotive's help feature (open Help menu and select Locomotive Help) contains also a quick RoR tutorial which you can follow to learn the basics of using that framework.

Keep in touch with us

Sign up for our low volume newsletter to get product announcements, articles and power tips.

or