I'm a Floridian web engineer who planted his roots in Paris. Some of my favorite past-times are analyzing and optimizing development processes, building solid APIs, mentoring junior devs, and long walks on the beach.

Dot-Rspec files 03-02-2011

I was recently working on a small library for assigning people a schedule and I decided to go with rspec 2 for testing. As I was working with it, I found that you can use a .rspec file to keep all of the settings in which seemed like a good idea to me. I'm used to having config files like that what with .bashrc, .rvmrc, etc. My file was laid out as such:

--format documentation

I could then run the command rspec spec/libs/* and it would run all of my tests in the desired format. I didn't want to have to specify the directory every time and so I decided to add the -I option in my .rspec file to include the directory. This, for some reason, would not work and while looking for a solution, I found the rspec 1 to 2 upgrade page with my answer.

Create a Rake Task

Under rake task it lists how you can set the options using a Rakefile, which in retrospec(...har), I should have been using anyways. I ended up using something like the following:

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new do |t|
    t.rspec_opts = ["--color", "--format documentation", "--fail-fast"]
    t.pattern = ['spec/libs/*.rb']

Now I can call my tests with rake spec.

Moral of the Story

Don't use .rspec for your rspec configurations. You'll probably end up needing a Rakefile at some point anyways so you might as well use that.

Tags: rspec ruby

Magic Ruby 2011 02-13-2011

The Talks

Nothing speaks to people like the word 'free'. It is a good reason to attend Barcamps. And while Magic Ruby is free, that is not the only reason I went (though it made it hard not to). I've been developing in Ruby for a little over a year and I'm still amazed at what a good community it has.

I enjoyed all of the talks, though the keynotes were definitely the highlights. Probably because they involved relatively little code detail, focusing on concepts and kept the momentum going. I think that one of the most difficult things to do is give a speech and have it involve a good deal of code but still not be too dry. Also, the talk length was around an hour each, which means that the speakers have to maintain the audience's attention that entire time. Not a small task.

Lightning Talks

For anyone who hasn't given a lightning talk it is somewhat of a shocking experience(har) if you have to prerecord them. For Magic Ruby, they had you record your slides prior to giving the talk using Jink , then during the talk the slides change without your prompting. So if you time things wrong, you can potentially end up with ten or twenty seconds to kill before you can move on to the next topic. I just used that time to complement my audience.

I ended up giving a lightning talk on a tool I've been using more and more over the past year, Pivotal Tracker.

Git Hooks + Pivotal Trackers

In my development environment I had been taking advantage of their API. It lets you do just about anything you can do from their site, only from the command-line. Seriously, if you're not using it, stop what you're doing and make an account. End of plug. Ok, so I had been using a script in my git hooks that pulls in the current stories that I'm working on and prepends them to my commit message so that it is easy to associate a commit with the ticket that you're working on. In my personal time, I've been working on a gem that uses this idea. I hope to have it finished in time for the Orlando Barcamp.

Make Backspace Reverse Chrome History 02-03-2011

Where's the love?

Can Nodejs be Used to Make a Website? 01-11-2011

Derp. Yes. So this week I got the chance to play around with nodejs. I was using expressjs, sequelizejs and some other libraries all via npm. It was all very familiar feeling coming from a rails background. npm works pretty much like ruby's gem package manager.


Expressjs has a boat load of features that you would come to expect from any web framework. It comes with a templating system. Currently, it supports haml, ejs, jade, and jQuery templates. Personally, I'm a pretty big fan of haml and because of which jade also seems pretty nice. It deals with routing by associating a path to http request verbs. This is pretty standard if you've ever used something like sinatra. Here is an example:

  app.get('/', function(req, res){
    you gotta do some stuff here

It also offers a pretty straight-forward way of configuring your application:

  app.configure('development', function(){
      // executed for 'development' only


Sequelizejs is a nice orm library. I have a few minor complaints about it. For one, the query data is manipulated via a callback. So for instance, the following is not kosher:

people = Person.findAll({where: "name = 'Francis' or name = 'Jeff'"});

instead you would do the following:

Person.findAll({where: "name = 'Francis' or name = 'Jeff'"},function(people){ people[0].some_cool_method(); });

I suppose this is fine if your'e happy doing things this way but I for one, do not appreciate being forced to work within the constraints of a callback.

In the end, there's definately enough features to go around for anyone who would actually want to make an entire application in javascript. For anyone who wouldn't want to make an entire app in javascript, at least playing around with nodejs is a way to hone your skills in working with it. I've found that working with nodejs has done at least that.

Coming soon: Should nodejs be used to make a website?

Tags: nodejs

Rails 3 Routing: Use match in a Block 12-19-2010

I was trying to set up an easy route that would let me use the following url: "posts/tags/:tagname". As I was playing around I realized that you can use match inside of a block. More importantly you can also give it a path name so that it can be easily referred to. Here is what I did:

  resources :posts do
    collection do
      get 'display'
      match ":name", :to => "posts#tags", :as => 'by_tag_name'

This is nice because in my code I can now call:

=linkto name, bytagnameposts_path(:name => name)

Tags: routes Rails