The steps I followed for setting it up in our Jenkins server are:
- Install the gem. I installed it under our ruby 1.9.2 in RVM.
- Create a .metrics file under your projects directory with the settings. This is not mandatory, but I had to use this because some configurations do not seem to be working with ruby 1.9.2. I’ve mentioned those below along with the contents of the .metrics file
- Create a job in Jenkins server, mention the repository details and for build step give the shell command as rvm 1.9.2 -S metrical
- Configure the HTML Publisher plugin for showing the nice Graphs generated by metric_fu as part of the build report. The default report location is tmp/metric_fu/output under the project directory. You can change the same in .metrics file.
As I mentioned above, tools such as flay and flog, which comes as part of metric_fu, have issues working with ruby 1.9.2. And the same case with stats graph and syntax highlighting. The same case with rcov also. So I had to create a .metrics file with the following contents and put in the project dir:
1 2 3 4 5 6 7 8
For test coverage I’ve used Simplecov which is easy to setup. It will generate the coverage report whenever you run the tests. This also generated html report which can be integrated easily into Jenkins. As mentioned here in the issue list, it does not generate the report when you are running with spork.