Project, simplified project workflows



2010/08/21 // Leeds // // Feed



Programmers hate repeating themselves. Whether it’s in the code that we write or the daily tasks that we perform. One thing that’s been annoying me for a while is how everytime I want to open a project I do the same, mundane things:

  • Open Textmate
  • Open GitX (or another Git browser)
  • Open the Basecamp project for that app (if there is one)
  • Boot the Rails server and open localhost:3000

I imagine for quite a lot of people this sounds familiar. To draft out a quick idea, and as a hat tip to _why, here’s my attempt to make these tasks a bit easier.

With project you can quickly automate a set of tasks into a streamlined workflow. Leveraging YAML to describe commands, it’s easy to build up a set of executable snippets to run against any given project.

First of all let’s define a project:

:clientproject:
  :path: /path/to/project
  :app: localhost:3000
  :basecamp_url: me.grouphub.com/project/log
  :workflow: default

A project is just a collection of YAML keys and values. The only required one is workflow, which tells project which workflow to apply to that project. Now that’s done, let’s define a workflow for that project:

:default:
  - mate %path
  - cd %path && gitx
  - open 'http://%basecamp_url'
  - open 'http://%app'
  - cd %path && rails server

This workflow just outlines the things I mentioned above when first opening a project. The special variables used in the commands (such as %path and %app) are looked up on the project when the workflow runs. This makes reusing workflows across different projects really easy.

Now its just a case of issuing the project command to run the workflow for a given project:

project clientproject

As project doesn’t support daemonising commands yet, the last command rails server will remain running in the foreground waiting for you to issue the shutdown signal when you’re done.

Check out out the readme for a more detailed write up.

At the moment Project is pretty basic, but I’m finding it speeds up simple tasks on a day-to-day basis. There are still a couple of bugs to iron out, but I hope you find it useful too!

Other (possibly related) posts

Comments