Friday, November 16, 2007

Onto Rails and rSpec

Like I mentioned yesterday, I started trying out rSpec. When in Rails, it's a little different. You need to include more stuff. I couldn't get my spec to run properly. Apparently, you have to import a bunch of stuff:

require File.dirname(__FILE__) + '/../../config/boot'
require "#{RAILS_ROOT}/config/environment"
require File.dirname(__FILE__) + '/../../app/models/project_management'

The first two lines I got from the codehappy blog post. The third just imports the model I'm testing out.

I may be doing it completely wrong so I'd appreciate any feed back.

Thursday, November 15, 2007

Command line Subversion, Rails

Like I mentioned on my earlier post, I'm a slow learner when I read manuals. I like watching much more. Check out episode 36 on Railscasts. It gives a nice quick overview on how it's done on the Mac. It's the same on Linux.

Learning Behaviour Driven Development

I've been doing a bunch of Google searches on Behaviour Driven Development (BDD) but all I've found were long articles and wordy introductions. I suppose some people learn that way but I'm way to lazy.

Thank goodness for screencasts. To dive into it, check out the website smartic.us' screencasts on rSpec.

Obviously, I don't know much. All I know is that rSpec is a gem used for testing. He dives straight into making a class and testing it. Or rather, testing it, then making the class. You'll see. :)

Saturday, November 10, 2007

Ubuntu and gVim

I've always been a Windows or DOS user ever since childhood. In the past several years I have tried to migrate to Linux.
Here comes in Ruby on Rails... on gVim... on... Ubuntu. It's nice and fast. you feel like you put your computer on steroids. Enough talk. Let me share with you the simple steps I took to install it.
  1. Install Ruby on Rails so that gVim may be able to access whatever files are in the RoR install.
  2. Go to http://www.cs.cornell.edu/w8/~djm/ubuntu/gutsy/#gvim and follow the installation instructions for gVim.
  3. Go back to my earlier post on Vim and you may follow that and paste the custom files in the gVim ~/.vim/ (which is equivalent to the Window's ~/vimfiles/ folder).
Happy geek out!

Thursday, October 25, 2007

Running Multiple servers

Now this really isn't a hack for rails or a fix. Its a nice little thing built into rails that I just started using. Its running multiple rails programs on a localhost for testing.
Basically, the jist is you can run several RoR servers on the same computer as long as the ports are different.

To achieve this when you run a RoR server with the command :
ruby script/server
you can add a port option by adding -p and specifying the port number:
ruby script/server -p 3001

the default port is 3000, and you can't run multiple servers on a localhost without specifiying a port.

you can also use :Rserver -p 3001 if you are running it on Vim

Wednesday, October 24, 2007

Tackling VIM

Two posts ago I was talking about the RoR talk that Guy gave. Since then, I've learned how to use VIM. There is a bit of a learning curve but you'll see you'll start to work a lot faster about 2 days of continuous use (sleep is ok).

I've found T Pope's article to be very useful. Read that and all the links in the article and the preceding articles.

Stumbling into REST

I stumbled into REST accidentally about 1 month ago. Since then, I've learned to try (at least) to make the URLs more beautiful and this simplifying the sites that I create. Here are some resources I've found to be quite useful:

1) DHH's 2006 keynote
2) Episodes 35 and 67 of Railscasts

If anyone can add to this list, please drop a comment!