While setting up my laptop to do development work on I came to the realization that I’ve always gotten my IDE running using a patchwork quilt of websites, each providing small but crucial tips on getting a Rails dev environment with GitHub integration working smoothly under Windows. Here’s my attempt to put all those tips in an ordered list for others to benefit from.inflatables for sale in canada
This guide assumes you’ve already created yourself a GitHub account, so if you haven’t gotten to that yet, head on over and spend the two minutes it takes to register and verify an account.
- The first thing we need is the Ruby binaries compiled to run on Windows operating systems. That means heading over to the RubyInstaller for Windows and downloading the latest Ruby package. I went with Ruby 1.9.2-p0:
- After the download was complete, run the executable to install Ruby. I made sure to click the checkbox that added the Ruby binaries to my path so Windows could access them as needed.
- That’s it for Ruby itself – now let’s get the Rails 3 framework downloaded and installed. This too is amazingly simple. Having installed Ruby to the default location of C:\Ruby192\ , I next opened a Command Prompt and navigated to C:\Ruby192\bin\ . There I executed the command:
gem install rails
- Some time later, that will complete. Next up is the installation of the SQLite3 gem, which allows us to make use of an extremely lightweight and free relational database with our Ruby applications. Install the SQLite gem by running the following command:
gem install sqlite3-ruby
- The previous command will have given you a warning which in part reads, “You can put the sqlite3.dll available in this package in your Ruby bin directory, for example C:\Ruby\bin”. To accomplish this, click over to the SQLite Download Page and download the DLL of the SQLite library: At the time of writing, that was sqlitedll-3_6_23_1.zip. Unzip the file and place the sqlite3.dll file contained within inside your Ruby binaries directory (again in our example at C:\Ruby192\bin\ ).
- Next we introduce our Ruby on Rails IDE of choice, Aptana Studio 3. While Studio 3 is technically still in beta, its feature set already boasts a built-in console, a smart file explorer and mandatory Git integration, which in mind cements it in place as the best Rails 3 development environment on the Windows family of OSes. Head over to the Download Aptana Studio 3.0.0 page, grab the standalone version, and install once that’s downloaded.
- Start up Aptana Studio 3. While the IDE comes with Git integration built in, to use GitHub we’ve got to install the add-on Eclipse EGit. Start this process by opening the Help menu and selecting Install New Software… Change the dropdown selector for Work with: to –All Available Sites– and type egit into the filter field to have Aptana search and retrieve add-ons listed by that name:
- Proceed through the various screens to install EGit. Once that’s done, choose to restart Aptana Studio 3 so it is given the chance to load the new add-on into memory.
- Time to create our first Rails project! Navigate to File > New > Ruby/Rails Project. Next, let’s give the new project an obvious name: My Test Project. Leave the rest of the properties as shown below (most importantly, leave Generate App set to Use the standard ‘rails’ generator) and click Finish:
- Since we’ve got a command line console ready and waiting for us, let’s make use of it. In order to upload and download files from GitHub securely we’ll have to create a public encryption key that GitHub knows about. Do this by generating a key using the ssh-keygen tool that came with our Ruby installation and specifying your own e-mail address, pressing Enter at each of the three following prompts to select the default behaviour:
- Navigate to the id_rsa.pub file generated and open the file in a text editor like Notepad. Copy the entire contents of the file to the clipboard and paste it into your GitHub account settings under SSH Public Keys > Add another public key > Key. Leave the Title blank and hit the Add key button.
- Now we need to create a new GitHub repository, naming it anything you want. On the next page, copy the SSH address for the repository and return to Aptana Studio 3.
- With that SSH address, it’s time to configure your test project to upload to GitHub. Start by viewing your project via Project Explorer. Next, right-click the entire project and select Team > Share Project…
- Select Git, not Aptana Git. (EGit is listed as Git, while Aptana Git is the default installation of the Git package that doesn’t work well with GitHub.)
- Select My Test Project from the list. If you can’t click the Finish button because it’s greyed out, first click the Create Repository button, and the Finish.
- Again viewing your project via Project Explorer, right-click the entire project and select Team > Push… Paste the SSH address into the URI field, which will automatically populate the rest of the fields. Click Next to continue.
- You’re now going to run into an error that reads “Auth fail”. This is expected – in the earlier step we generated a SSH key and placed it within a directory named \.ssh\ . However, EGit is looking for files within \ssh\ (which moments ago was also automatically created). A quick fix is implemented by copying the files id_rsa and id_rsa.pub to \ssh\ . Back in Aptana Studio, run File > Restart to restart the IDE.
- Return yet again to the project as viewed from the Project Explorer, and again right-click the entire project and select Team > Commit. Commit all of the files of the project (or just a few) so we’ve got something to push up to GitHub in the next step.
- Again we use the Project Explorer to right-click the entire project. Select Team > Push… Re-enter the SSH address and again click Next. The final dialog screen allows you to select which branch you want to push your commits under.
That’ll do it – the end of this series of steps leaves you with a Windows development environment for Rails 3 that can push and pull changes to GitHub.