Buildhawk

Historical information about your build, on a webpage! Currently only graphs time taken, as stored in git notes.

See how it looks: rhnh.net/2010/09/18/build-time-graph-with-buildhawk

Status

Pretty raw: hackish script, no error checking, no test suite. I am adding to it as I use on one of my projects. Only checked on ruby 1.9.2. Depends on an unreleased experimental branch of TufteGraph (github.com/xaviershay/tufte-graph/tree/line).

Usage

gem install buildhawk

buildhawk --title "My App Name" # In your project directory, output HTML to stdout
buildhawk | browser             # Using http://gist.github.com/318247

You need to store the build time in git notes. This should be a single float: the build time in seconds. The following rake task should work for a standard ruby project with rvm. See rhnh.net/2010/09/06/storing-build-time-in-git-notes-with-zsh for more explanation. Note that ‘time` does not appear to output consistent enough spacing to be used reliably with cut, you may need to tweak the `cut -f 11 -d` command to pull out the right field.

namespace :build do
  desc "Run specs and store the time taken in a git note on HEAD"
  task :time do
    # ruby/rake are not aliased by rvm in the new zsh environment, so
    # have to explicitly call it using the rvm command stored in .rvmrc:
    #   rvm 1.9.2@myapp rake
    #
    # "2> >( )" construct redirects STDERR (where @time@ prints to) to the
    # bracketed commands. ZSH allows us to redirect it twice, once to git,
    # once to cat (back to STDOUT).
    formatter = "tail -n 1 | cut -f 11 -d ' ' - "
    exec((%{zsh -c "(time `cat .rvmrc` rake) } + 
          %{2> >(#{formatter} | git notes --ref=buildtime add -F - -f ) } +
          %{2> >(#{formatter} | cat)"}))
  end
end