We are just a few simple steps away from completing the setup of our development environment and verifying its functionality. Then we'll create an online collaborative cookbook for holding and sharing everyone's favorite recipes. We want our cookbook to:
Browse to the InstantRails directory and double click on InstantRails.exe.
The dialog box shown in Figure 3 will appear.
Figure 3. Completing the configuration
When Instant Rails has completed the configuration, the main application window will appear showing that the configuration files for Apache and mySQL have been updated and both servers have been started.
Figure 4. Instant Rails main application window
Step 2. Let Windows know...
Next, we need to modify the Windows Hosts File so that Windows knows where to find our application. To do this,
click on the 'I' button in the Instant Rails main application window (next to the 'Apache' button) and follow the menus as shown in Figure 5.
When you're finished, save the file if you've made changes and exit Notepad.
Figure 6. Modifying the Windows Hosts file
Step 3. Edit and Copy the batch file that let's us use Ruby
Open the C:\InstantRails\use_ruby.cmd file with your text editor. Add "C:\InstantRails\ruby\lib;" to the PATH as shown in Figure 7 below. Save the file.
Important note: Remember that the name of the Instant Rails root directory on your system will probably not actually be "C:\InstantRails". Instead, it will be "C:\InstantRails-1.0" or "C:\InstantRails-7.6" or something else, depending on the name of the release you're working with. Make sure that what you add to the PATH per the instruction above is named appropriately for your situation. Let us know if this causes too much confusion for you.
"Save As" to put a copy in
C:\WINNT\system32 directory so it's there, and therefore in the PATH,
the next time you open a Command Prompt window.
Another Important note: Saving the file to the second location isn't absolutely required, but doing so will save you keystrokes every time you restart your development environment. One alternative is to just manually change directories from where ever you start (controlled by the "Start in" property for your Command Prompt window) to the "rails_apps" directory from whence most all of your Instant Rails work will begin. If you DO decide to use this time-saving device, make you save the file to the appropriate location, which is whatever the "Start in" property for your Command Prompt window is set to. For XP users, for example, the system32 directory is normally located under "C:\Windows\", not "C:\WINNT\" so they should "Save As" to the "C:\Windows\system32" directory. If you've installed Instant Rails on a system at work, your admin may have your Command Prompt window set up to "Start in" some network drive. Use whatever location makes sense based on your settings and your ability to control them. Let us know if this causes you too much confusion.
Figure 7. Edit the use_ruby.cmd file
Step 4. Use Ruby
Open a Command Prompt window and enter >use_ruby The result is shown in Figure 8 below.
Figure 8. We're going to use WEBrick so we need to start Ruby
Step 5. Stop the Apache web server
Bring up the InstantRails main application window (if you minimized it, it's the 'I' icon in the system tray on the bottom right of your screen). Once you have it open, stop the Apache web server using the menus as show in Figure 9 below.
Figure 9 Stop the Apache server
Step 6. Tell Instant Rails which app we're going to run and start the WEBrick server
We have to tell Instant Rails which app we're going to run.
Bring up the main application window and navigate the menus as shown in Figure 10 below.
Figure 10 Last step to configuring your application
You'll be presented with the window shown in Figure 11 below.
Select the cookbook application, then click the "Start with WEBrick" button.
Figure 11 Tell Rails which app you're going to run and start the WEBrick server
When you click the "Start with WEBrick" button, Instant Rails will launch a new Command Prompt window and start the WEBrick server. You can move on to the next step once you see the line containing "WEBrick::HTTPServer#start" as shown in Figure 12 below.
Figure 12. WEBrick is now ready to serve your browser needs
Step 7. Verify the configuration
Open your browser and point it to "http://localhost:3000/recipe/list".
should be rewarded with the result shown in Figure 13 below.
Figure 13. Success at last !!!
Step 8. Stop WEBrick
WEBrick can only serve one 'web site' at a time. To get ready to begin development on another app, we need to stop the server at this point.
This should stop the
server. It may close the window. If not, or if
rather, just close the window until you need to restart WEBrick to see
results of your development efforts that follow.
Bring the Command Prompt window in which you started WEBrick into focus and enter Ctrl-C.