<?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>Kabisa Blog &#187; Ruby</title>
	<atom:link href="http://blog.kabisa.nl/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.kabisa.nl</link>
	<description>The Ruby on Rails Experts</description>
	<lastBuildDate>Thu, 17 Jun 2010 11:13:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Running cucumber features with sunspot_rails</title>
		<link>http://blog.kabisa.nl/2010/02/03/running-cucumber-features-with-sunspot_rails/</link>
		<comments>http://blog.kabisa.nl/2010/02/03/running-cucumber-features-with-sunspot_rails/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 07:57:15 +0000</pubDate>
		<dc:creator>Patrick Baselier</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.kabisa.nl/?p=75</guid>
		<description><![CDATA[We wanted to integrate the sunspot_rails gem into our cucumber features. I found a ticket where mat adviced to call Sunspot::Rails::Server.start / stop in one of the available cucumber hooks.
Code found in features/support/env.rb is run when Cucumber begins and exits so this seemed the right place to start Solr:

Sunspot::Rails::Server.new.start
&#160;
at_exit do
  Sunspot::Rails::Server.new.stop
end

Also, make sure you&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>We wanted to integrate the <a href="http://github.com/outoftime/sunspot" target="_blank">sunspot_rails gem</a> into our cucumber features. I found a <a href="http://outoftime.lighthouseapp.com/projects/20339/tickets/59-cucumber-testing-and-solr_rails" target="_blank">ticket</a> where <a href="http://outoftime.lighthouseapp.com/users/24899" target="_blank">mat</a> adviced to call <strong>Sunspot::Rails::Server.start / stop</strong> in one of the available cucumber hooks.</p>
<p>Code found in <strong>features/support/env.rb</strong> is run when Cucumber begins and exits so this seemed the right place to start Solr:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#6666ff; font-weight:bold;">Sunspot::Rails::Server</span>.<span style="color:#9900CC;">new</span>.<span style="color:#9900CC;">start</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">at_exit</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  <span style="color:#6666ff; font-weight:bold;">Sunspot::Rails::Server</span>.<span style="color:#9900CC;">new</span>.<span style="color:#9900CC;">stop</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Also, make sure you&#8217;ve added a cucumber environment to the <strong>config/sunspot.yml</strong> file; we copied the test-environment for that:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">test: <span style="color:#006600; font-weight:bold;">&amp;</span>amp;TEST
  solr:
    hostname: localhost
    port: <span style="color:#006666;">8981</span>
    log_level: WARNING
&nbsp;
cucumber:
  <span style="color:#006600; font-weight:bold;">&amp;</span>lt;<span style="color:#006600; font-weight:bold;">&amp;</span>lt;: <span style="color:#006600; font-weight:bold;">*</span>TEST</pre></div></div>

<p>Running cucumber will let all scenarios fail unfortunately and we got a &#8216;<strong>Connection refused &#8211; connect(2) (RSolr::RequestError)</strong>&#8216; in our console.</p>
<p>The reason for this is simple (after I stepped into the sunspot_rails gem to be honest): the <strong>Sunspot::Rails::Server.new.start</strong> method will eventually launch a Java Servlet Container (Jetty) with the Solr WAR and uses the port defined in your <strong>sunspot.yml</strong>.<br />
Now, starting up a server could take some time, so if cucumber&#8217;s features are run before the Solr server is up and running, the &#8216;Connection refused&#8217; sounds trivial then.<br />
First I added a sleep after starting up the server:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#6666ff; font-weight:bold;">Sunspot::Rails::Server</span>.<span style="color:#9900CC;">new</span>.<span style="color:#9900CC;">start</span>
<span style="color:#CC0066; font-weight:bold;">sleep</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">5</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>and this will work for most cases, but I thought it would be better to let cucumber wait just long enough until the server is up and running. When the server is up, you can open up your browser and enter <em>http://localhost:8981/solr</em> to administering Solr. This we can use to find out if we&#8217;ve waited long enough and start our features. I&#8217;ve put this into a seperate class named <strong>CukeSunspot</strong> and created this file in the <strong>features/support</strong> directory:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;net/http&quot;</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> CukeSunspot
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> initialize
    <span style="color:#0066ff; font-weight:bold;">@server</span> = <span style="color:#6666ff; font-weight:bold;">Sunspot::Rails::Server</span>.<span style="color:#9900CC;">new</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> start
    <span style="color:#0066ff; font-weight:bold;">@started</span> = <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">now</span>
    <span style="color:#0066ff; font-weight:bold;">@server</span>.<span style="color:#9900CC;">start</span>
    up
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  private
  <span style="color:#9966CC; font-weight:bold;">def</span> port
    <span style="color:#0066ff; font-weight:bold;">@server</span>.<span style="color:#9900CC;">port</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> uri
    <span style="color:#996600;">&quot;http://0.0.0.0:#{port}/solr/&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> up
    <span style="color:#9966CC; font-weight:bold;">while</span> starting
      <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;Sunspot server is starting...&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;Sunspot server took #{'%.2f' % (Time.now - @started)} sec. to get up and running. Let's cuke!&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> starting
    <span style="color:#9966CC; font-weight:bold;">begin</span>
      <span style="color:#CC0066; font-weight:bold;">sleep</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      request = <span style="color:#6666ff; font-weight:bold;">Net::HTTP</span>.<span style="color:#9900CC;">get_response</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">URI</span>.<span style="color:#9900CC;">parse</span><span style="color:#006600; font-weight:bold;">&#40;</span>uri<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      <span style="color:#0000FF; font-weight:bold;">false</span>
    <span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#6666ff; font-weight:bold;">Errno::ECONNREFUSED</span>
      <span style="color:#0000FF; font-weight:bold;">true</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now we can the alternative start method and remove the explicit sleep statement in our global before hook. <strong>features/support/env.rb</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">CukeSunspot.<span style="color:#9900CC;">new</span>.<span style="color:#9900CC;">start</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">at_exit</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  <span style="color:#6666ff; font-weight:bold;">Sunspot::Rails::Server</span>.<span style="color:#9900CC;">new</span>.<span style="color:#9900CC;">stop</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>And voila, if you run cucumber, you scenario&#8217;s should run successfully. On my machine:</p>
<pre>Sunspot server is starting...
Sunspot server is starting...
Sunspot server took 3.74 sec. to get up and running. Let's cuke!</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.kabisa.nl/2010/02/03/running-cucumber-features-with-sunspot_rails/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using transactions with Ruby DataMapper</title>
		<link>http://blog.kabisa.nl/2010/01/21/using-transactions-with-ruby-datamapper/</link>
		<comments>http://blog.kabisa.nl/2010/01/21/using-transactions-with-ruby-datamapper/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 19:25:38 +0000</pubDate>
		<dc:creator>Ludo van den Boom</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.kabisa.nl/?p=52</guid>
		<description><![CDATA[With DataMapper, it can be quite a challenge to perform tasks that seem so simple at first. DataMapper is an object-relational mapper (ORM) written in Ruby, with a lot of great features and innovative approaches to common ORM-tasks. But it lacks documentation for some of the less-used features and even the more popular search engines [...]]]></description>
			<content:encoded><![CDATA[<p>With <a href="http://datamapper.org">DataMapper</a>, it can be quite a challenge to perform tasks that seem so simple at first. DataMapper is an object-relational mapper (ORM) written in Ruby, with a lot of great features and innovative approaches to common ORM-tasks. But it lacks documentation for some of the less-used features and even the more popular search engines don&#8217;t have the answer to all questions.</p>
<p>Note: the following examples have been tested with DataMapper version 0.10.2.</p>
<p>One of the questions I had was how to perform multiple queries within a single (database) transaction, so that I can &#8217;stage&#8217; a number of database queries and commit (or rollback) them all in one go. Fortunately, after some investigation of the DataMapper source code, it turns out to be an extremely simple task:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">User.<span style="color:#9900CC;">transaction</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  User.<span style="color:#9900CC;">first</span>.<span style="color:#9900CC;">update</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:name</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#996600;">&quot;John Smith&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  Address.<span style="color:#9900CC;">first</span>.<span style="color:#9900CC;">update</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:street</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#996600;">&quot;&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#008000; font-style:italic;"># Invalid: street must not be blank</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>With this code neither the address nor the user will be updated in the database if one of the updates fails. The syntax is actually the same as for the <a href="http://api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html">ActiveRecord</a> ORM. However, triggering a rollback is done differently, as can be seen in the following example.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">User.<span style="color:#9900CC;">transaction</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>t<span style="color:#006600; font-weight:bold;">|</span>
  User.<span style="color:#9900CC;">first</span>.<span style="color:#9900CC;">update</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:name</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#996600;">&quot;John Smith&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  Address.<span style="color:#9900CC;">first</span>.<span style="color:#9900CC;">update</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:street</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#996600;">&quot;Oak St. 400&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  t.<span style="color:#9900CC;">rollback</span> <span style="color:#008000; font-style:italic;"># Transaction will be rolled back even when updates are OK.</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>That&#8217;s it for now. I&#8217;m sure there are some additional features that I haven&#8217;t mentioned here, but this is all I had to know at this point.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kabisa.nl/2010/01/21/using-transactions-with-ruby-datamapper/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to setup Ruby on Rails, Apache and Passenger on Debian Linux</title>
		<link>http://blog.kabisa.nl/2009/12/08/how-to-setup-ruby-on-rails-apache-and-passenger-on-debian-linux/</link>
		<comments>http://blog.kabisa.nl/2009/12/08/how-to-setup-ruby-on-rails-apache-and-passenger-on-debian-linux/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 21:05:05 +0000</pubDate>
		<dc:creator>Harm</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[lenny]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[passenger]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.kabisa.nl/?p=40</guid>
		<description><![CDATA[For this article I&#8217;m going to install a single (virtual) server to run a standard Ruby on Rails application. I will be using Apache2 and passenger for the webserver stack and MySQL as a database server. 
Let&#8217;s start by installing Ruby and all tools:

# apt-get install build-essential
# apt-get install ruby irb ri rdoc libopenssl-ruby ruby1.8-dev
# [...]]]></description>
			<content:encoded><![CDATA[<p>For this article I&#8217;m going to install a single (virtual) server to run a standard Ruby on Rails application. I will be using Apache2 and passenger for the webserver stack and MySQL as a database server. </p>
<p>Let&#8217;s start by installing Ruby and all tools:</p>
<pre><code>
# apt-get install build-essential
# apt-get install ruby irb ri rdoc libopenssl-ruby ruby1.8-dev
# ruby -v
# cd /usr/local/src
# wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz # replace with latest version of rubygems
# tar xfvz rubygems-1.3.5.tgz
# cd rubygems-1.3.5
# ruby setup.rb
# ln -s /usr/bin/gem1.8 /usr/bin/gem
# gem -v
# gem install gemcutter
# gem tumble
# apt-get install mysql-server # this will ask for a password during installation
# apt-get install libmysqlclient15-dev
# gem install mysql
# gem install rails
# apt-get install git-core
# apt-get install apache2
# gem install passenger
# passenger-install-apache2-module</code></pre>
<p>Copy the following lines from the output and paste them at the end of the file /etc/apache2/apache2.conf. They should look something like this:</p>
<pre><code>
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.7
PassengerRuby /usr/bin/ruby1.8
</code></pre>
<p>Finally let&#8217;s restart apache2: </p>
<pre><code>/etc/init.d/apache2 restart</pre>
<p></code></p>
<p>Phew! That's it... We now have all the software we need on the server that's required to deploy your Ruby on Rails app on Debian Linux (Lenny)!</p>
<p>In a future article I'll cover the basics of deployment using <a href="http://capify.org">Capistrano</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kabisa.nl/2009/12/08/how-to-setup-ruby-on-rails-apache-and-passenger-on-debian-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ruby and SSL Certificate Validation</title>
		<link>http://blog.kabisa.nl/2009/12/04/ruby-and-ssl-certificate-validation/</link>
		<comments>http://blog.kabisa.nl/2009/12/04/ruby-and-ssl-certificate-validation/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 14:35:38 +0000</pubDate>
		<dc:creator>Ariejan de Vroom</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[ssl]]></category>

		<guid isPermaLink="false">http://blog.kabisa.nl/?p=31</guid>
		<description><![CDATA[If your ruby app is doing SSL, you have probably seen one of the following errors:
doc = Hpricot(open("https://www.cert.org/blogs/vuls/rss.xml")) # => /usr/lib/ruby/1.8/net/http.rb:590:in `connect': certificate verify failed (OpenSSL::SSL::SSLError)
or
warning: peer certificate won't be verified in this SSL session
The solution is to make sure ruby has access to the right set of root certificates.

The easiest way to get hold [...]]]></description>
			<content:encoded><![CDATA[<p>If your ruby app is doing SSL, you have probably seen one of the following errors:</p>
<p><code>doc = Hpricot(open("https://www.cert.org/blogs/vuls/rss.xml")) # => /usr/lib/ruby/1.8/net/http.rb:590:in `connect': certificate verify failed (OpenSSL::SSL::SSLError)</code></p>
<p>or</p>
<p><code>warning: peer certificate won't be verified in this SSL session</code></p>
<p>The solution is to make sure ruby has access to the right set of root certificates.<br />
<span id="more-31"></span><br />
The easiest way to get hold of those root certificates is by downloading this file <a href="http://curl.haxx.se/ca/cacert.pem">cacert.pem</a> (<a href="http://curl.haxx.se/docs/caextract.html">details</a>) (updated weekly by the developers of CURL, based on the Mozilla browser). Download this file and store it somewhere in your app. </p>
<p>If you&#8217;re really keen on security, don&#8217;t trust the guys from CURL and download the different root certificates from their providers manually. However, in most cases, the file from CURL will suffice.</p>
<p>Then, in your ruby code, setup the connection like this and you&#8217;ll have a validated SSL connection:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;">#! /usr/bin/env ruby</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'net/https'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'uri'</span>
&nbsp;
uri = <span style="color:#CC00FF; font-weight:bold;">URI</span>.<span style="color:#9900CC;">parse</span><span style="color:#006600; font-weight:bold;">&#40;</span>ARGV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">||</span> <span style="color:#996600;">'https://localhost/'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
http = <span style="color:#6666ff; font-weight:bold;">Net::HTTP</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>uri.<span style="color:#9900CC;">host</span>, uri.<span style="color:#9900CC;">port</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">if</span> uri.<span style="color:#9900CC;">scheme</span> == <span style="color:#996600;">&quot;https&quot;</span>  <span style="color:#008000; font-style:italic;"># enable SSL/TLS</span>
  http.<span style="color:#9900CC;">use_ssl</span> = <span style="color:#0000FF; font-weight:bold;">true</span>
  <span style="color:#008000; font-style:italic;"># Only needed for ruby 1.8.6</span>
  <span style="color:#008000; font-style:italic;"># http.enable_post_connection_check = true</span>
  http.<span style="color:#9900CC;">verify_mode</span> = <span style="color:#6666ff; font-weight:bold;">OpenSSL::SSL::VERIFY_PEER</span>
  http.<span style="color:#9900CC;">ca_file</span> = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">dirname</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">__FILE__</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#996600;">&quot;cacert.pem&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
http.<span style="color:#9900CC;">start</span> <span style="color:#006600; font-weight:bold;">&#123;</span>
  http.<span style="color:#9900CC;">request_get</span><span style="color:#006600; font-weight:bold;">&#40;</span>uri.<span style="color:#9900CC;">path</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>res<span style="color:#006600; font-weight:bold;">|</span>
    <span style="color:#CC0066; font-weight:bold;">print</span> res.<span style="color:#9900CC;">body</span>
  <span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.kabisa.nl/2009/12/04/ruby-and-ssl-certificate-validation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Giving Love To the Community</title>
		<link>http://blog.kabisa.nl/2009/11/27/giving-love-to-the-community/</link>
		<comments>http://blog.kabisa.nl/2009/11/27/giving-love-to-the-community/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 11:09:27 +0000</pubDate>
		<dc:creator>Ludo van den Boom</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[railsconf]]></category>
		<category><![CDATA[rumble]]></category>

		<guid isPermaLink="false">http://blog.kabisa.nl/?p=3</guid>
		<description><![CDATA[Earlier this month Kabisa attended the Ruby en Rails 2009 conference in Amsterdam. Ruby en Rails is the largest dedicated Ruby and Rails conference in the Netherlands.
For the first time in its history Ruby en Rails was a multiple day event. The first day, October 31, was packed with interesting presentations on various Ruby and [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier this month Kabisa attended the <a title="Ruby en Rails 2009 Homepage" href="http://2009.rubyenrails.nl">Ruby en Rails 2009</a> conference in Amsterdam. Ruby en Rails is the largest dedicated Ruby and Rails conference in the Netherlands.</p>
<p>For the first time in its history Ruby en Rails was a multiple day event. The first day, October 31, was packed with interesting presentations on various Ruby and Rails related topics, by great speakers including renowned community idols like Yehuda Katz, Jeremy Kemper, Jonathan Weiss and many more. The second day (the &#8216;geek-day&#8217;) focused on more practical sessions and lightning talks. On this day another event was held: The RubyEnRails Rumble (RERR), a competition where teams of two had to complete an assignment within a certain time.<br />
<span id="more-3"></span><br />
Since we from Kabisa consider ourselves to be Ruby programmers we wanted to take the challenge and see how we would do in this competition. Michel de Graaf and Ludo van den Boom were given the honor to rumble for Kabisa. This post will describe how we prepared for the RubyEnRails Rumble and how we have experienced it.</p>
<h2>Rumble Preparations</h2>
<p>After deciding that we would partake in the Rumble we knew that we would have to prepare ourselves as good as possible so that we could utilize our time at the Rumble as efficiently as possible. Neither of us had ever participated in an event like this, so we started of with a session in which we tried to decide what we could do to help us prepare for the Rumble. Together with our Kabisa colleagues we made a list of items and topics that could prove to be handy during the Rumble.</p>
<p>The hard part was that we had no experience and that we did not know what the assignment would be, so we dove into a broad range of subjects. With help from our colleagues we were able to refresh our knowledge of Ruby and Rails related technologies and built up a collection of snippets/links to quickly be able to perform standard tasks like retrieving tweets from Twitter and adding jQuery UI sugar to an application. In the end we prepared a <a href="http://github.com/ludo/rerr_template">Rails application template</a> so that we would be able to quickly set-up a Rails skeleton application including basic functionality like authentication and authorization. Besides this template we also prepared a user interface template builder that could help us to quickly apply a &#8216;theme/skin&#8217; to an application (<a href="http://github.com/michel/interfaceLift">interfaceLift</a>).</p>
<p>For scaffolding we used <a href="http://github.com/grimen/dry_scaffold">dry_scaffold</a>: This gem contains a rails generator that will replace the default rails scaffolding with more up to date DRY controllers and views. Controllers are implemented using <a href="http://github.com/josevalim/inherited_resources/tree/master">inherited_resources</a>. And the views are generated in <a href="http://haml-lang.com/">haml</a> that make use of <a href="http://github.com/justinfrench/formtastic">Formtastic Forms</a> to generate nice looking forms. The <a href="http://github.com/michel/dry_scaffold">fork</a> we where using also generated a search form that was implemented using <a href="http://github.com/binarylogic/searchlogic">searchlogic</a>.</p>
<p>Another challenge was that we had not worked together before. So, apart from the technical toolkit that we set-up, we also had to find a way to get more acquainted with each others good and bad sides. We decided that the best way to do this would be to simulate a Rumble, and that&#8217;s what we did. Our colleague Ralph came up with an assignment that we worked on for about six hours. In these six hours we managed to crank out some decent results and learned how we could best divide the development tasks to our individual skill sets. This simulation prepared us for lots of things but it did not really simulate the most vital element of a competition: stress.</p>
<h2>Rumble Ramblings</h2>
<p>Some hints on what the assignment would be were dropped during the presentations on the first day. Still, we could only guess what exactly to expect. At the start of the Rumble the assignment was introduced and explained, the assignment was titled &#8216;Community Love&#8217;. It turned out that we had to create a system that would keep users of Ruby libraries up-to-date with updates about these libraries. The assignment was kept vague on purpose so that the teams had the ability to put their creative minds to work with finding a solution to the problems laid out in the assignment description.</p>
<p>So, now we had a little under eight hours left to design and build something that would convince the jury of our programming skills. After a short stand-up meeting we came up with a rough idea for what we would create.</p>
<h3>The Plan&#8230;</h3>
<p>As a Ruby/Rails developer you will probably make use of lots of gems in your application. You can specify these gem dependencies in your Rails configuration. Or make use of the awesome gem <a href="http://github.com/wycats/bundler">bundler</a>. This will help you manage gem dependencies but they will not inform you when there are updates to the gems you are using. We figured that, as a developer who uses gems in a Ruby project you should be able to send a list of gem dependencies you use in a specific application to a service that will inform you when there are updates to the gems that you are using. An update could, for example, be a new version, a reported security vulnerability or a blog post. Since we had only one day to build something, we decided to focus on Rubygems exclusively. Mostly because there are already good centralized repositories where we would be able to easily find information about gems (gemcutter).</p>
<h3>&#8230; And the Solution &#8230;</h3>
<p>Our solution consists of three parts: (1) a gem that you use locally to update the list of gems you use in particular applications, (2) an online service (Rails application) where you can see the gems you use and (3) notification channels (i.e. email and twitter) through which news about gems is pushed to you. We named our solution &#8216;gemstreamer&#8217;, for it would stream information about gems to you as a user of these gems. For those of you who are interested to see what we actually made: you can see the &#8216;online service&#8217; Rails application that is used as the central &#8216;information hub&#8217; where information is gathered and distributed at <a href="http://github.com/ludo/rerr2009">http://github.com/ludo/rerr2009</a>. For the gem that you would use locally to push the gems you use to the central hub see <a href="http://github.com/michel/gemstreamer">http://github.com/michel/gemstreamer</a>. We deliberately kept the code as simple as possible and leveraged as many existing tools as possible to be able to quickly get things done. The end result is pretty simple, but the ideas behind it might actually be useful when extended and polished for real-life usage. This was also one of the comments from the jury, where they believed that something like this could make a great extension to <a href="http://gemcutter.org">http://gemcutter.org</a>.</p>
<h3>&#8230; At a Price</h3>
<p>Did we mention the stress? Apparently we were both not very satisfied with how we made progress. There was so much that we wanted to do, and so little time to do it all. This is probably the biggest flaw in how we approached the Rumble. Before the Rumble we had already discussed that it would be best to make something small that works instead of something big that does not work. This reasoning sounded really good before the Rumble and after the Rumble, but we actually forgot it during the Rumble&#8230; Still, we managed to get our main ideas implemented which we were able to present at the end of the day.</p>
<h2>Rumble Opponents</h2>
<p>With five pretty strong teams the competition was fierce. It was interesting to see that every team approached the assignment from a different angle. Where our end result can be seen as an interesting prototype, others had created something that could be of use to developers right away. Here is a short summary of what the other teams created:</p>
<ul>
<li>The Fingertips team created <a href="http://www.fngtps.com/2009/11/apprise">Apprise</a> for which they patched <a href="http://github.com/wycats/bundler">Bundler</a>. This patch to was applied to Bundler By Yehuda the very next day.</li>
<li>Iain Hecker and Marcel de Graaf built an extension to Webistrano that shows outdated gems, named &#8216;<a href="http://github.com/Thyraon/rer09">deproll</a>&#8216;.</li>
<li>The i76 team (Tom-Eric Gerritsen and Rik Tonnard) built a Rails plugin that you can hook-up in your application so that you can see the dependencies that your app uses through a web interface (<a href="http://github.com/i76/rrrer2009">http://github.com/i76/rrrer2009</a>).</li>
<li>Leon Berenschot and Klaas-Jan Wierenga gave a cool presentation and won the Twitter vote (<a href="http://github.com/LeipeLeon/Dev-Enter">http://github.com/LeipeLeon/Dev-Enter</a>).</li>
</ul>
<h2>Rumble Results</h2>
<p>Victory! Completely unexpected we were awarded the first prize: two tickets to <a title="RailsConf 2010 Homepage" href="http://en.oreilly.com/rails2010">RailsConf 2010</a> in Baltimore, MD. The winner was selected by a jury and through public voting via Twitter. In the Twitter vote we ended as third, which we thought was already a great achievement. But the professional jury had unanimously picked us! These two votes combined made us the overall winners of the Ruby en Rails Rumble 2009: awesome!</p>
<p>In hindsight we can conclude that our plan was a little too ambitious as it turned out that eight hours is really not that much. Nonetheless, the rumble turned out to be a great experience that was really fun doing. It was a crazy day with a lot of stress, but it was also an interesting experiment to see how we would do against some other very good teams. The end result turned out to be even better than what we&#8217;ve hoped for. We want to thank the jury for choosing us as well as the people who voted for us on Twitter. Last but not least many thanks to the people who made Ruby en Rails possible this year, we had a great time!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kabisa.nl/2009/11/27/giving-love-to-the-community/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
