Ready. Set. Oh yeah! Consular to start your project environment

I have a number of cool tools that run in a watching pattern while I work my nodejs apps.  I use guard to watch package.js, Gemfile and some others.  node-dev watches the app as a whole and restarts my node app.  vows is watching the world to run my tests. 

It’s really nice to forget about all that cruft and just build the app while those things work automagically.  Unfortunately the magic doesn’t start until I say go.  And go.  And go.  And go.

There has to be a better way than starting half a dozen terminals or terminal tabs and  remembering to run guard, node-dev, vows, etc.  Turns out there is @rubyist and @pragma_tech had the cheese: terminitor.

Yeah – read it again: terminitor.  The govna isn’t much help.  It’s a different dude.  Even turns out people were so confused they changed the name to consular.

I’m not entirely sure how consular does it’s magic, but I did piece together the Ubuntu puzzle.  Here’s the deal:

1. Make sure to export TERM_EDITOR & EDITOR (vim for me) in your ~/.bashrc.  If you use a different shell, YMMV.

sudo apt-get install xdotool

This appears to be a keyboard & mouse abstraction layer.  This is required by a consular ‘core’.  Coming soon.

gem install consular

gem install consular-gnome-terminal

Initialize and configure consular with:

consular init

This should open ~/.consularch in your editor if you have TERM_EDITOR  configured.  Add

require ‘consular/gnome-terminal’

Head to a project directory in your terminal and

consular edit

This will create and open a Termfile in your editor of choice.  This file has some sample configurations using Now you can get rolling by running:

consular start

This will run the default, but you can learn the DSL and start everything from guard to your vim environment.  Get into your working mode faster.

libnotify support for expresso

Warning: Linux, Terminal, vim and Continuous Testing ahead.  Not a fan?  Did you know Continuous testing is coming to Visual Studio vNext?  Yeah – it’s that good an idea!  Go get NCrunch for VS 2010 or the preview of VS 2011.

I recently switched from vows to expresso for my nodejs unit testing.  I prefer the BDD format of vows, but I was having trouble getting them to work nicely with soda and selenium.  Vows has watch support for continuous testing which I love, but it didn’t have libnotify support.  I need this, because I run my watchers like Guard, node-dev, and such on another workspace.

image

Without the notifications from libnotify I would have to switch back and for to see the terminal output of the watcher process.  Kills my flow. 

Expresso doesn’t have watch support so I added it to my Guardfile:

image

That should run expresso for all of my fast tests whenever anything changes.  Cool!  Unfortunately, guard doesn’t expand wildcards like the terminal and expresso relies on this to test folders recursively.  I’ve pushed a –d –directory option to my fork if you want it.  I’ll submit a pull request later, but don’t hold your breath.

Cool my fast tests are running when I change things in my app.  Now it’s time for a results notification.  Unfortunately, expresso only has Growl support, but not libnotify… foiled again!  No fear, christiaan has a pull request pending just for this reason.  But how do I get it? 

Grrr!

Not really.  First I fork expresso

image

Then I add christiaans fork to my remotes

git remote add christiaan git://github.com/christiaan/expresso.git

Then I pull in his commits

git fetch christiaan 

Push the result up to my repo for nice people like you.

git push origin master

OK it’s in there, but how do I USE it?  Well npm (node package manager) has support for a smooth dev experience like this.

I can jump into my expresso fork repo and use npm link:

cd ~/projects/expresso

npm link

npm link will create a symlink in my global package source which I can then use anywhere.  I could also npm link them into any local projects, but this works for me at the moment.  I might depend on them locally later, but we’ll see.

Now when I change things in my project, guard notices and tells expresso to do it’s thing and I get a notification as to how things went.  Pretty nice.

image