Rails Stats Plugin or Show Me Those Pretty Graphs

Posted by shane
on Monday, July 17

I present to all five of you, my very first Rails plugin. Rails Stats is a basic graphical version of the Rake ‘stats’ task. It generates a graph showing your lines of code versus lines of test code, and two other graphs that may be useful to some of you visually driven folks. It could also be used by people outside of development, such as managers, to track the progress of your project.

In order for this plugin to work, you must have Gruff Graphs installed. After you have Gruff Graphs running successfully, install the plugin with:
script/plugin install http://shanesbrain.net/svn/rails/plugins/rails_stats
If your project is under Subversion version control, I highly recommend doing:
script/plugin install -x http://shanesbrain.net/svn/rails/plugins/rails_stats
to automatically use svn:externals which enables easy plugin updates with the ‘svn update’ command. Since I’m an iterative development type of guy (lazy and haven’t included any tests), this is a good idea.

To run it, simply point your brower to yourapp/rails_stats. For example, http://shanesbrain.net/rails_stats shows Rails Stats running on the current Typo trunk.

!graph 1 !graph 1 !graph 1

I don’t plan on expanding on this plugin too much, although I do want to add a graph showing green/red lines for test status and possibly integration with Subversion to show the last few commits.

I also finally got a chance to get my Subversion repository online, so you can browse the code at http://shanesbrain.net/svn/rails/plugins. There isn’t much documentation or tests since this plugin was so simple, but let me know if there is anything I missed. Feedback is welcome!

Comments

Leave a response

  1. Jeremy SeitzJuly 19, 2006 @ 07:55 PM
    This is a very cool plugin! I wonder if it might be possible to have a way where you can see changes over time... like a line chart showing test coverage over time, or perhaps the total lines of code over the life of a project? I guess you would need to track historical data somehow. I was not really aware of how powerful the hooks in svn are. Thanks for making this ;)
  2. shaneJuly 19, 2006 @ 09:27 PM
    Jeremy, thanks for the comment. It is possible to store historial data in either the database or a YAML file. You can extend the rake task 'test' to store test data and 'stats' to store code stats. To make it even more hands-off, you can have a Subversion post-commit hook run the tasks and persist the data everytime someone commits. I may add this functionality in the future. But if anyone wants to volunteer to do it now, let me know.
  3. topfunkyJuly 20, 2006 @ 12:28 PM
    Very nice! It would be better to have it all in one bar graph. But I also like the idea of storing data over time. I've been making significant changes to Gruff that will clean up some of these graphs and make them look a little bit better. Look for a release in the next few weeks.
  4. whitmneeSeptember 21, 2006 @ 02:01 PM
    i do not like this graph it makes no sent of a webb site for it i think this dumb
Comment