Star Monkey Post

We’re Favoring the Email List and Twitter

It’s just a bit too much maintenance to update the email list and this blog-based site for every meeting, so I’m going to stop posting upcoming meeting notes here. I’ll send reminders and notes for the meetings only to the email list and to Twitter, and leave this page as more of a...

Read More

Getting started with the codebase [updated]

Posted by John | Posted in Gemology | Posted on 18-05-2010

3

For those new to Ruby, here are some steps to help you get started with the codebase of the Gorge Technology Alliance Ruby web application:

Install Ruby.

  • If you’re on Mac, you probably already have it if you’ve installed XCode, which you probably already have if you’re a developer. That version (1.8.7) is perfect.
  • If you’re on Linux, use apt, yum, or whatever your package manager is.
  • If you’re on Windows, there’s a RubyInstaller that you can download that takes care of the details for you.

Full details are on the Ruby Download Page.

Beef-up Ruby with Gems and Rails

Grab RubyGems, Ruby’s packaging system. After you do that, you’ll be able to install Ruby on Rails. With Gems, the easiest way to install Rails is:

$ sudo gem install rails rspec rspec-rails rcov ci_reporter thoughtbot-shoulda faker

(Note: if you’re on Windows, you won’t use “sudo”)

That’ll give you Rails and all of the Rails pre-reqs.

Get Git, and get familiar with Github

The GTA code is hosted on Github. You can always see the CRGTA repository using the website.

If you’re not familiar with Git, our source control revision system of choice, you’ll need to be. Head to the Git download page and grab it.

Fork the code

You’ll probably want to have an account on Github. This is our workflow for making changes to the codebase, so if you want to have your changes included, you’ll need an account on Github. Using your account, you’ll fork the code so that you can work on your own version. When you have changes that you want added to the main repository, you’ll send a pull request.

Update your system with code pre-reqs

Now that you have Ruby, Git, and your Github account, go and fork the code and clone the repository to your local system using the command

$ git clone git@github.com:USERNAME/crgta.git

replacing USERNAME with your Github username. This will create the directory called “crgta” where you run this command. You’ll use the Gem system to install some prereqs using the following commands:

$ cd crgta$ sudo rake gems:install

This command uses rake, Ruby’s make system, to install gems that the codebase requires.

Create and migrate your database

At this point, you have a local version of the codebase. Every Rails app is tied to a database, so you’ll need a database. You have to create a file called database.yml in the config directory. If you browse to the config directory of your new codebase, you’ll see the file example_database.yml, which you can change to database.yml. This is a configuration file for the SQlite database, which is good enough for our purposes. Once you have this file, use the following commands in the crgta directory:

$ rake db:create$ rake db:migrate$ rake db:seed

This will create the database and add some initial data. After you’ve done this, you can issue the command:

$ ./script/server

which will start the application on http://localhost:3000.

Pull upstream changes

After you fork the code and start working, you’ll occasionally want to pull the changes from the main CRGTA repository. That will keep your codebase up to date so that you stay with us. Head to the forking help page for details.

Get to work

Now you’re set. Go play with the database, add functionality, and check out the Wiki page, which will be the home of the features list and details on codebase needs.

Let’s start a religious war!

Posted by John | Posted in Gemology | Posted on 13-01-2010

0

They say that the most fundamentalist people are the recent converts. Well, I’ve been programming for 10+ years in Python, and have been programming in Ruby for about 2 weeks, so I say I’m more fundamentalist than any of you people! Let’s make Ruby the official programming language of Star Monkeys!!