<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hi I&#039;m Max</title>
	<atom:link href="http://maxschulze.com/feed" rel="self" type="application/rss+xml" />
	<link>http://maxschulze.com</link>
	<description></description>
	<lastBuildDate>Sun, 17 Jul 2011 20:32:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Hudson Code Coverage Reports for Ruby 1.9.2</title>
		<link>http://maxschulze.com/ruby-on-rails/testing/hudson-code-coverage-reports-for-ruby-1-9-2</link>
		<comments>http://maxschulze.com/ruby-on-rails/testing/hudson-code-coverage-reports-for-ruby-1-9-2#comments</comments>
		<pubDate>Sun, 17 Jul 2011 19:44:53 +0000</pubDate>
		<dc:creator>maxschulze</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[coverage]]></category>
		<category><![CDATA[cover_me]]></category>
		<category><![CDATA[hudson]]></category>
		<category><![CDATA[metrics_fu]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby-1.9.2]]></category>

		<guid isPermaLink="false">http://maxschulze.com/?p=15</guid>
		<description><![CDATA[Want to increase the value of your Hudson Reports with some test/code coverage data? For Ruby 1.8.7 there is a great plugin which uses metrics_fu to display reports within Hudson from Joseph Wilk. But in my case I wanted to use the latest Ruby-1.9.2 stable (in my case p136). The code analysis tools that metrics_fu [...]]]></description>
			<content:encoded><![CDATA[<p>Want to increase the value of your Hudson Reports with some test/code coverage data? For Ruby 1.8.7 there is a great plugin which uses <a href="http://metric-fu.rubyforge.org/">metrics_fu</a> to display reports within Hudson from <a href="http://blog.josephwilk.net/ruby/ruby-metric-fu-hudson-plugin.html">Joseph Wilk</a>. But in my case I wanted to use the latest Ruby-1.9.2 stable (in my case p136). The code analysis tools that metrics_fu uses are currently not compatible with 1.9.2, so I decided to use <a href="http://www.metabates.com/2010/08/13/coverme-code-coverage-for-ruby-1-9/">cover_me</a> instead.</p>

<p>But how do you get the cover_me reports into Hudson? It&#8217;s actually very easy. Cover me comes with a Emma XML reporting formatter, that can generate XML coverage reports that you then can read with the Emma Hudson Plugin.</p>

<p>So here are the step-by-step instructions on how to configure Ruby 1.9.2-p136, cover_me 1.0.0.rc6, Hudson 2.0.1, Hudson Emma Plugin 1.25 and Rails 3.0.9</p>

<ol>
<li>Add the following to your Gemfile</li>
</ol>

<script src="http://gist.github.com/1088025.js"></script>

<ol>
<li>Run <code>bundle install</code> to install cover_me and it&#8217;s dependencies</li>
<li>Now run the cover_me installer <code>rails g cover_me:install</code></li>
<li>Edit the cover_me rake tasks file to have it output the coverage reports in the Emma XML format.</li>
</ol>

<script src="http://gist.github.com/1088027.js"></script>

<ol>
<li>Commit your changes and login to your Hudson server.</li>
<li>Configure your project and enable Emma Reports for your project.</li>
</ol>

<p><a href="http://www.maxschulze.com/wp-content/uploads/2011/07/Screen-shot-2011-07-17-at-22.25.50.png"><img src="http://www.maxschulze.com/wp-content/uploads/2011/07/Screen-shot-2011-07-17-at-22.25.50-1024x442.png" alt="Emma Report configuration in Hudson project configuration" title="Emma Report configuration in Hudson project configuration" width="560" height="241" class="aligncenter size-large wp-image-32" /></a></p>

<ol>
<li>That&#8217;s it!</li>
</ol>

<p>For your interest here is my bash-script for running rspec and cucumber with Hudson and generate the Emma Reports:</p>

<script src="http://gist.github.com/1088028.js"></script>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Hudson+Code+Coverage+Reports+for+Ruby+1.9.2+http%3A%2F%2Fis.gd%2FOS6mwS" title="Post to Twitter"><img class="nothumb" src="http://www.maxschulze.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Hudson+Code+Coverage+Reports+for+Ruby+1.9.2+http%3A%2F%2Fis.gd%2FOS6mwS" title="Post to Twitter">Tweet This Post</a></p></div><div id="google_plus_one"><g:plusone></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://maxschulze.com/ruby-on-rails/testing/hudson-code-coverage-reports-for-ruby-1-9-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails STI &#8211; Single Table Inheritance</title>
		<link>http://maxschulze.com/ruby-on-rails/rails-sti-single-table-inheritance</link>
		<comments>http://maxschulze.com/ruby-on-rails/rails-sti-single-table-inheritance#comments</comments>
		<pubDate>Tue, 26 Oct 2010 02:28:05 +0000</pubDate>
		<dc:creator>maxschulze</dc:creator>
				<category><![CDATA[ActiveRecord]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[active_record]]></category>
		<category><![CDATA[inheritance]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rails3]]></category>
		<category><![CDATA[sti]]></category>

		<guid isPermaLink="false">http://maxschulze.com/?p=5</guid>
		<description><![CDATA[Yesterday, I  came accross an interesting problem. I wanted to create a super-class called Message and let several other Models inherit from that. My main intention was to map different APIs to my own data-structure. I came up with the following: After I came up with this structure, I ran into the problem &#8220;How do [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, I  came accross an interesting problem. I wanted to create a super-class called Message and let several other Models inherit from that. My main intention was to map different APIs to my own data-structure. I came up with the following:</p>

<script src="http://gist.github.com/644010.js"></script>

<p>After I came up with this structure, I ran into the problem &#8220;How do I actually implement this?&#8221;. First <a href="http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html">I found out</a> that Rails ActiveRecord actually supports Single Table Inheritance through a &#8220;type&#8221; column. That means if I have a model named &#8220;Car&#8221; and a model named &#8220;Porsche&#8221; which inherits from Car, then upon saving a Porsche object it will create a Car object with the type attribute set to &#8220;porsche&#8221;. Sounds like what I wanted.</p>

<p>Unfortunately, Rails ActiveRecord STI implementation did not seem to work with Ruby modules. That&#8217;s when i stumbled across <a href="http://one.valeski.org/2010/02/multi-level-single-table-inheritance.html">this post</a>. He suggest using the Ruby sub-classing syntax, so my structure would look like this:</p>

<script src="http://gist.github.com/646210.js"></script>

<p>Looks good to me and works perfectly. Thanks goes to <a href="http://one.valeski.org/">Jud Boulder</a> for his post. And <a href="http://www.linkedin.com/in/andreasnomikos">Andreas Nomikos</a> for pointing me in the right direction.</p>

<p>By the way here are some useful links, that I stumbled across during my research on the topic:</p>

<ul>
    <li><a href="http://rookieonrails.blogspot.com/2008/01/single-table-inheritance-in-rails.html">Rookie on Rails: Single Table Inheritance in Rails</a></li>
    <li><a href="http://sociable.co.nz/post/1286186984/patch-rails3-sti">Sociable &#8211; Patch Rails3 route helpers to use STI base class.</a></li>
    <li><a href="http://therailworld.com/posts/18-Single-Table-Inheritance-with-Rails">Single Table Inheritance with Rails &#8211; theRailWorld.com by Phil McClure, Belfast</a></li>
    <li><a href="http://rhnh.net/2010/08/15/class-table-inheritance-and-eager-loading">Class Table Inheritance and Eager Loading &#8211; Xavier Shay&#8217;s Blog</a></li>
    <li><a href="http://coderrr.wordpress.com/2008/04/22/building-the-right-class-with-sti-in-rails/">Building the right class with STI in Rails « coderrr</a></li>
    <li><a href="http://railsforum.com/viewtopic.php?id=41068">STI and Polymorphism (Page 1) &#8211; Models and Database &#8211; Rails Forum &#8211; Ruby on Rails Help and Discussion Forum</a></li>
    <li><a href="http://github.com/aslakhellesoy/aruba">aslakhellesoy&#8217;s aruba at master &#8211; GitHub</a></li>
    <li><a href="http://stackoverflow.com/questions/3499215/class-table-inheritance-in-rails-3">Class Table Inheritance in Rails 3 &#8211; Stack Overflow</a></li>
</ul>
<div class="tweetthis" style="text-align:left;"><p> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Rails+STI+%E2%80%93+Single+Table+Inheritance+http%3A%2F%2Fis.gd%2Fa0gaeA" title="Post to Twitter"><img class="nothumb" src="http://www.maxschulze.com/wp-content/plugins/tweet-this/icons/en/twitter/tt-twitter.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/intent/tweet?text=Rails+STI+%E2%80%93+Single+Table+Inheritance+http%3A%2F%2Fis.gd%2Fa0gaeA" title="Post to Twitter">Tweet This Post</a></p></div><div id="google_plus_one"><g:plusone></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://maxschulze.com/ruby-on-rails/rails-sti-single-table-inheritance/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

