Draconis Software Blog

Sake - Rake for Your Whole System

Ruby's version of make, Rake, is an indispensable tool that all Rubyists should learn and use regularly. It's the perfect way to run all of those project-specific tasks like clearing the cache or removing stale session data.

Once you start using Rake, you'll probably find that you duplicate many of your tasks in all of your projects. It's not too much to copy often-used .rake files, but there is a better way. Sake (short for System-wide Rake) solves this. Once you install a Rake task into Sake's repository, it becomes available system-wide via the sake command.

Say you have a file named dbversion.rake, which finds the migration version of your database, as follows:

RUBY:
  1. namespace :db do
  2.   desc "Returns the current schema version"
  3.   task :version => :environment do
  4.     puts "Current version: " +
  5.       ActiveRecord::Migrator.current_version.to_s
  6.   end
  7. end

To install this system-wide, first install Sake by running gem install sake. Rubygems will download and install everything for you. Now you can install the Rake task into Sake by typing sake -i dbversion.rake. You can now run the db:version task inside any Rails app by typing sake db:version. Pretty neat, eh?

Sake has a few more tricks up its sleeve. You can view the rake tasks that are currently installed into Sake by running sake -T. It can also install tasks hosted on a remote web server by replacing the filename that appears after sake -i with the url. Check out the original blog post to read more.

Some other sites with info on Rake that I found interesting:

Freelancers/small business: Track your invoices

invotrakApologies for the shameless plug, but I'm excited to mention our new site which launched late last week: invotrak.com. We do a lot of consulting work for various clients, often with many projects running simultaneously, and it got harder and harder to keep track of the invoices we sent to our clients. So, out of this need, invotrak was created. It's free and easy to use, so if you're in a similar position to us (freelancers, small businesses, etc), check it out and let us know what you think.

Also, apologies for the lack of posts lately - we've been real busy getting invotrak launched and work with our clients. Hopefully we'll get some more posts up this week.

Footnotes: Improving Rails / TextMate Synergy

As a Rails developer on OS X, I spent a lot of time bouncing back and forth between my web browser and the incredible editor TextMate. Often times, I will complete my latest modification to the source and I'll load it up in Firefox only to find an ambiguous page with the title "Action Controller: Exception Caught". Usually, a quick look through the stack trace reveals the line that is causing the problems. Then, it is back to TextMate to open the offending file, find the mistake and reload the web browser.

This can get tedious rather quickly. I have found that the Footnotes plugin for Rails does wonders and increases my productivity dramatically. It turns all of the lines in the stack trace into clickable [

CODE:
  1. ]dHhtdDovLw==[

] links. TextMate registers itself with the OS X so that it receives all clicks of this type - a quick click on the stack trace will open the relevant file and place the cursor at the correct line. In addition, Footnotes adds some extremely useful debug information (and more TextMate links!) to the bottom of every view when the application is launched in the debug environment.

Footnotes is incredibly easy to install directly from within TextMate. To do it, just follow these instructions:

  1. TextMate Context Menu - Install PluginOpen up your application as a TextMate project by issuing "[
    CODE:
    1. ]bWF0ZSAuIg==[

    ] from Terminal.app in the application's root. Then, open any file (I chose [

    CODE:
    1. ]YXBwbGljYXRpb24ucmI=[

    ] in the [

    CODE:
    1. ]YXBwL2NvbnRyb2xsZXJz[

    ] directory).

  2. Make sure that the editor has focus and then press Ctrl-| to bring up the Rails bundle's context menu. Select item #2 (Install plugin) from this menu.
  3. In the Plugin Search dialog that appears, type "Footnotes" and then press Go. This should bring up the Textmate Footnotes plugin as the only result. To install it, click the down arrow button on the right. If all is well, the Footnotes plugin should now be installed.
  4. Start up [
    CODE:
    1. ]c2NyaXB0L3NlcnZlcg==[

    ] and see the pretty links!

How to upgrade to BugZilla 3.0

BugZillaBugZilla 3.0 stable was recently released, and upgrading an existing BugZilla installation is easy. Yesterday, I spent some time upgrading our 2.22.1 installation to the new 3.0 and have, so far, been impressed with the updates. Here's a quick overview of the upgrade process (it might seem a bit unintuitive at first).
(Read the article)

Introduction to Antispam Practices

There's a good overview of antispam practices at Howto Forge today, detailing the various methods either currently in use (black/gray/white lists, applications, etc), and proposed (DKIM, etc).

In a world where spam is bound to hold such an important position,
methods of preventing it should also be given an increasing importance.
Some of the easiest and most widely used prevention methods are host
control solutions, Antispam applications and user education.

I'm particularly excited about Domain Keys Identified Mail (DKIM), which I wrote about recently. Such a method would be very useful in tracking down spammers and controlling the flood of junk they put out, though, as this article points out, it's not without it's limitations. "The main disadvantage of DKIM is that email messages can be significantly modified in certain situations (e.g. when being forwarded by list severs), causing the signature to be invalidated and the message to be rejected. A solution to this issue would be combining DomainKeys with SPF, because SPF is immune to modifications of the email data."

Check the article out - it's a good overview of what's currently going on, and perhaps may inspire you to try a different approach to your current antispam efforts.

New MacBook Pros

15inch MacBook ProThere's a great, in-depth review (via Engadget) of the new MacBook Pro 15inch, which was released just a few days ago. The reviewer notes "I'm new to Mac computers, new to OS X, but I am one happy switcher", which echoes a sentiment I had not too long ago.

One of the big new features is the introduction of the LED back-lit screen:

LED back-lighting is touted to provide a more evenly lit screen with sharper images and colors without sacrificing battery life. All these I find to be true, the screen is without a doubt the best i've ever seen on a laptop, and better than a lot of desktop monitors I use. With the brightness up to full, even in the most well lit rooms, solid whites are almost blinding, which allows you to turn down the brightness and use less battery.

I was originally a Mac guy, switched to Linux as my desktop du jour, and then switched back with the MacBook, and I'm very glad I did.

Cool Mac App: stattoo

For you Mac users out there, there's a cool app I recently stumbled across called stattoo, by Panic Software. It's a simple little app that adds mini apps to your desktop to show interesting information (i.e. weather, latest email, upcoming appointments, etc). It's a little faster than using the Dashboard, looks wonderful, and unobtrusive enough not to interfere with other things you're doing.

Give it a try. It costs a couple bucks if you like it, and so far I've been very impressed.