programming

Update: I’m ditching Sake for Thor. These tasks have been ported to thor and are available on github.

I’ve started using Git as my SCM of choice for Subversion projects over the last several months and have found that, while I don’t want to use Subversion anymore, there are some things it makes easier than git. For example, let’s say you’re working on something and you want to pull in the changes from other people on your team. With svn its simply:

$ svn up

With git things are different, since it only merges changesets and not locally changed files. This was a pain before git-stash came along, since I’d have to back out a change, update, and then reapply it. Even with git-stash things are a bit more painful. Here’s the equivalent to the above for a git-svn project:

$ git stash
$ git svn rebase
$ git stash apply

Oh, and that’s only if you’re on the master branch. If you’re on another one (and you should be), then heres what it looks like if you want to keep master up to date too:

$ git stash
$ git checkout master
$ git svn rebase
$ git checkout mybranch
$ git rebase master
$ git stash apply

Whew! Note that this mostly applies to git-svn projects. For regular git projects a git-pull will do nicely.

I got sick of this, and I noticed that the Rubinius project uses a Rakefile to handle a fair number of the git commands, including updating and pushing. Here’s a Sake script that gives you two tasks: git:update and git:push which automatically check whether the project is a git-svn project and do the right thing. Install it like so:

$ sake -i http://pastie.caboo.se/147964.txt

And now were back to a one-liner:

$ sake git:update

Update: I just added git:open and git:close which you should think of as opening and closing issues. They just create and delete branches and can be used like this:

$ sake git:open
* Name your branch: ofx
* Switching to master
Switched to branch "master"
Switched to a new branch "ofx"
$ sake git:close
* Switching to master
* Deleting branch ofx

And don’t worry, git:close is safe and won’t destroy your work if you haven’t merged it yet:

$ sake git:close
* Switching to master
* Deleting branch ofx
* Branch ofx isn't a strict subset of master, quitting

Update: I gave this its own repo on github, so go forth, and git.

apple macbook

I upgraded to Leopard over the weekend after borrowing a friends copy, since I just couldn’t wait for mine to arrive (thanks Coda!), and its been overall a Good Thing. Leopard has brought us new versions of just about every app in OS X. The most notable ones, for me, are Mail, iCal, Terminal, Spaces, and Stacks.

Mail.app

Mail got an iTunes-like sidebar and a little Mail Activity status area (yes, there are other things like Notes and Todos, but I haven’t bothered to use them yet). The update coincided with GMail’s addition of IMAP, a long-awaited feature especially for us iPhone users. My previous solution of forwarding all my accounts to a fastmail.fm account is pretty much defunct. Setting up GMail’s IMAP on two accounts with a combined message count of 17,904 was not a fun experience. Now that Ive set it up and tweaked a few things it seems to be humming along quite nicely, Inbox Zero style. Heres what I recommend you do if you’re going to set up IMAP with Gmail:

  1. Log into gmail.com
  2. Archive everything (except stuff you haven’t dealt with yet)
  3. Delete all your labels (maybe, see below for an explanation)
  4. Enable IMAP under Settings
  5. Add the GMail account to Mail.app (Ill call it Personal)
  6. On the sidebar in Mail select Personal → [Gmail] → Sent Mail, then choose the Mailbox → Use This Mailbox For → Sent
  7. Do the same for Trash, Junk, and Drafts
  8. Install Mail Act-On (might require some Terminal tweaking)
  9. Create an archive rule called Act-On: y | Archive and say that if its in Personal to move the message to Personal → [Gmail] → All Mail
  10. Repeat #9 for each other account you have

Now you’ll have the ability to get to that holy grail of email, Inbox Zero, with more ease than before. Under this setup you’ll have an inbox, but it’ll be empty most of the time. The email you’ve dealt with will be archived and will be visible in Mail under Personal → [Gmail] → All Mail and under All Mail on gmail.com. Oh, and about step #3.. when Gmail first came out and told us search, don’t sort and gave us labels I thought I understood what to do, but what I ended up doing was pretty much sorting email into labels, going totally against how Gmail is set up. What I discovered is that labels should only be for emails that you still have an active interest in, otherwise you’re just sorting and filing. In GTD-speak thats only use labels for emails that still have an action associated with them. By the way, this applies locally to Mail.app as well. Get rid of your folders. You only need Smart Mailboxes and search. Try it, you’ll like it.

iCal

The only thing that looks the same (almost) in this version of iCal is the events view. Everything else has been tweaked. The mini-calendar is more legible and larger. The list of calendars has, like Mail, been iTunes-ified. The biggest change is the dropping of the edit drawer in favor of a popup. My only complaint with it is that I don’t understand why they went with a drop shadow under the text boxes inside rather than a fuzzy blue border like in Safari.

Terminal

So Terminal has real preferences now, and tabs. The former is nice, but I’ve already set things up so I doubt it’ll have much effect. The latter has been mitigated by the fact that I use screen. Oh well, they’re welcome additions anyway. Thanks Apple!

Spaces

This is probably the best new feature in Leopard as far as Im concerned. Don’t get me wrong, I’m excited about Time Machine, but mostly because it’ll encourage other people to back up more, making the Mac ecosystem a better place to be. Most of the other things in Leopard are not really big-ticket items, but are nevertheless cool to have. I’m still noticing little things, like the fact that ⌘⇧4 (grab selection) now has coordinates and dimension numbers nice touch!

Anyway, Spaces is exactly what Virtue Desktops and Desktop Manager should have been. The animation is exactly right (windows slide off the screen in the direction of motion, the pager comes onto the screen with the arrow inside the old space pointing to the new one), windows that live on all spaces are supported and predictably stay put when switching spaces. Dragging apps around when viewing all spaces is dead simple, and Exposé even works in that view. All-in-all, Im very impressed with their implementation of virtual desktops.

Stacks

Ive only got the default stacks in my dock right now (Downloads and Documents), but I’m digging this feature already enough to make me leave the Dock visible and put it on the left side. So now the Dock does have a use for me: My Active Stuff. I removed all apps from it, so only running ones show up. I can easily click on the stacks in the dock, pull out the thing I want to mess with, and either open it or drag it to an application (usually opening folders in TextMate).

Ruby

Despite the best laid plans of mice and men, Ruby is still broken under Leopard. Not as broken as Tiger, mind you, but broken is broken. So Im sticking with my Tiger setup of using MacPorts for everything. Oh well.

3rd-Party Apps

  • Spanning Sync went bonkers and now wants to delete all my iCal events.
  • 1Password refused to work at first, but has been updated for Leopard and now works just as before
  • Pyro and Safari 3 are feuding, and as a result you cant upload files in Pyro

So all in all Im quite pleased with the upgrade, and I recommend you check out the Ars Technica review for more. It has already changed the way I work for the better, though how much of that is coincident Im not sure yet.