<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Diego Carrion</title>
	
	<link>http://www.diegocarrion.com</link>
	<description>loves bits, tits and beers</description>
	<pubDate>Thu, 01 Jul 2010 15:52:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/diegocarrion" /><feedburner:info uri="diegocarrion" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2Fdiegocarrion" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fdiegocarrion" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2Fdiegocarrion" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/diegocarrion" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fdiegocarrion" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fdiegocarrion" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fdiegocarrion" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><item>
		<title>Test today your JavaScript code in a Rails 3 application with Blue Ridge</title>
		<link>http://feedproxy.google.com/~r/diegocarrion/~3/PXpLAkoTxqA/</link>
		<comments>http://www.diegocarrion.com/2010/07/01/test-today-your-javascript-code-in-a-rails-3-application-with-blue-ridge/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 15:52:58 +0000</pubDate>
		<dc:creator>dc.rec1</dc:creator>
		
		<category><![CDATA[BDD]]></category>

		<category><![CDATA[Blue Ridge]]></category>

		<category><![CDATA[Rails 3]]></category>

		<category><![CDATA[TDD]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[rails3]]></category>

		<guid isPermaLink="false">http://www.diegocarrion.com/?p=119</guid>
		<description><![CDATA[Case you want to test today your JavaScript code in a Rails 3 application in a simple way, Kristian Mandrup forked Blue Ridge and migrated the generators to the new interface. The commits haven&#8217;t been merged yet into the official repository and the code has some minor bugs, so I created another fork and fixed [...]]]></description>
			<content:encoded><![CDATA[<p>Case you want to test today your JavaScript code in a <a href="http://rubyonrails.org/">Rails</a> 3 application in a simple way, <a href="http://twitter.com/kmandrup">Kristian Mandrup</a> forked <a href="http://github.com/relevance/blue-ridge">Blue Ridge</a> and migrated the generators to the new interface. The commits haven&#8217;t been merged yet into the official repository and the code has some minor bugs, so I created <a href="http://github.com/dcrec1/blue-ridge/tree/rails3">another fork</a> and fixed them.</p>
<p>Until all the commits got merged in both repositories, you can execute the following commands to get a configured environment:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git submodule add <span style="color: #660033;">-b</span> rails3 git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>dcrec1<span style="color: #000000; font-weight: bold;">/</span>blue-ridge.git .<span style="color: #000000; font-weight: bold;">/</span>vendor<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>blue-ridge
rails g blue_ridge:skeleton
rails g blue_ridge:javascript_spec core
rake spec:javascripts</pre></div></div>

<p>Case you don&#8217;t know <a href="http://github.com/relevance/blue-ridge">Blue Ridge</a>, <a href="http://twitter.com/drnic">Dr. Nic</a> posted some time ago about the tool and he uploaded also a video from a presentation he gave at <a href="http://skillsmatter.com/event/ajax-ria/rails-underground-2009">Rails Underground 2009</a>.</p>
<p><em>If you appreciate this work, please consider to <a href="http://workingwithrails.com/recommendation/new/person/13580-diego-carrion">recommend me</a> at <a href="http://workingwithrails.com/">Working With Rails</a>.</em></p>
<img src="http://feeds.feedburner.com/~r/diegocarrion/~4/PXpLAkoTxqA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.diegocarrion.com/2010/07/01/test-today-your-javascript-code-in-a-rails-3-application-with-blue-ridge/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.diegocarrion.com/2010/07/01/test-today-your-javascript-code-in-a-rails-3-application-with-blue-ridge/</feedburner:origLink></item>
		<item>
		<title>Develop Rails 3 applications with your favorites gems without headaches</title>
		<link>http://feedproxy.google.com/~r/diegocarrion/~3/T4spOKvV7Is/</link>
		<comments>http://www.diegocarrion.com/2010/06/10/develop-rails-3-applications-with-your-favorites-gems-without-headaches/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 10:50:42 +0000</pubDate>
		<dc:creator>dc.rec1</dc:creator>
		
		<category><![CDATA[Rails 3]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[template]]></category>

		<category><![CDATA[rails3]]></category>

		<guid isPermaLink="false">http://www.diegocarrion.com/?p=115</guid>
		<description><![CDATA[As today, starting developing a Rails 3 application using the default libraries is very easy, but when we want to use those tools that were great in Rails 2, some problems begin to appear.
These problems aren&#8217;t caused in any way due that Rails or the libraries are unstable. What happens is that a lot of [...]]]></description>
			<content:encoded><![CDATA[<p>As today, starting developing a <a href="http://rubyonrails.org/">Rails</a> 3 application using the default libraries is very easy, but when we want to use those tools that were great in <a href="http://rubyonrails.org/">Rails</a> 2, some problems begin to appear.</p>
<p>These problems aren&#8217;t caused in any way due that <a href="http://rubyonrails.org/">Rails</a> or the libraries are unstable. What happens is that a lot of plugins and gems had to update their integration with the framework and some chose to create pre-release versions, others to create branches and others just to bump to a new version, which means we have to hunt which version to use and from where in order to get compatible features.</p>
<p>To simplify the work of many people and to encourage the adoption of <a href="http://rubyonrails.org/">Rails</a> 3, I decided to create a <a href="http://github.com/dcrec1/rails3_template/">template</a> that configures the gems I most use in my projects and installs them in the application, along with other tasks that can be easily followed in the <a href="http://github.com/dcrec1/rails3_template/blob/master/main.rb">script</a>.</p>
<p><em>If you appreciate this work, please consider to <a href="http://workingwithrails.com/recommendation/new/person/13580-diego-carrion">recommend me</a> at <a href="http://workingwithrails.com/">Working With Rails</a>.</em></p>
<img src="http://feeds.feedburner.com/~r/diegocarrion/~4/T4spOKvV7Is" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.diegocarrion.com/2010/06/10/develop-rails-3-applications-with-your-favorites-gems-without-headaches/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.diegocarrion.com/2010/06/10/develop-rails-3-applications-with-your-favorites-gems-without-headaches/</feedburner:origLink></item>
		<item>
		<title>Ruby annotations</title>
		<link>http://feedproxy.google.com/~r/diegocarrion/~3/cq9LMFS3lh8/</link>
		<comments>http://www.diegocarrion.com/2010/05/27/ruby-annotations/#comments</comments>
		<pubDate>Fri, 28 May 2010 03:36:02 +0000</pubDate>
		<dc:creator>dc.rec1</dc:creator>
		
		<category><![CDATA[Metaprogramming]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[canivete]]></category>

		<category><![CDATA[method_added]]></category>

		<guid isPermaLink="false">http://www.diegocarrion.com/?p=110</guid>
		<description><![CDATA[In the programming world, an annotation is a way to mark the code that is below it for many purposes. In Cucumber, the tags it uses are a kind of annotation to apply callbacks and classify some features and scenarios:

@billing
Feature: Verify billing
&#160;
  @important
  Scenario: Missing product description
&#160;
  Scenario: Several products

In the case [...]]]></description>
			<content:encoded><![CDATA[<p>In the programming world, an annotation is a way to mark the code that is below it for many purposes. In <a href="http://cukes.info/">Cucumber</a>, the tags it uses are a kind of annotation to apply callbacks and classify some features and scenarios:</p>

<div class="wp_syntax"><div class="code"><pre class="cucumber" style="font-family:monospace;">@billing
Feature: Verify billing
&nbsp;
  @important
  Scenario: Missing product description
&nbsp;
  Scenario: Several products</pre></div></div>

<p>In the case of <a href="http://vraptor.caelum.com.br/">VRaptor</a>, we can use annotations to specify a controller as a <a href="http://pt.wikipedia.org/wiki/REST">REST</a> resource or to restrict the access method to an action:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">@Resource
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ShoppingCartController <span style="color: #009900;">&#123;</span>
    ...
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ProductsController <span style="color: #009900;">&#123;</span>
    @Post
    @Path<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/products&quot;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> add<span style="color: #009900;">&#40;</span>Product product<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>...<span style="color: #009900;">&#125;</span>
    ...
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>In the <a href="http://www.ruby-lang.org/">Ruby</a> language, two annotations that are very used are the methods <a href="http://ruby-doc.org/core/classes/Module.html#M001640">protected</a> and <a href="http://ruby-doc.org/core/classes/Module.html#M001641">private</a>, which without arguments restrict the visibility of the methods defined below them:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> User
  <span style="color:#9966CC; font-weight:bold;">def</span> jump; <span style="color:#9966CC; font-weight:bold;">end</span>;
&nbsp;
  protected
  <span style="color:#9966CC; font-weight:bold;">def</span> eat; <span style="color:#9966CC; font-weight:bold;">end</span>;
  <span style="color:#9966CC; font-weight:bold;">def</span> flirt; <span style="color:#9966CC; font-weight:bold;">end</span>;
&nbsp;
  private
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#CC0066; font-weight:bold;">sleep</span>; <span style="color:#9966CC; font-weight:bold;">end</span>;
  <span style="color:#9966CC; font-weight:bold;">def</span> dream; <span style="color:#9966CC; font-weight:bold;">end</span>;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>In some situations we may want to annotate our code like this, for example to specify that a method is deprecated, functionality that is offered by the gem <a href="http://github.com/qmx/canivete">Canivete</a> from <a href="http://twitter.com/qmx">Douglas Campos</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Bomb
  deprecate
  <span style="color:#9966CC; font-weight:bold;">def</span> explode; <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>In the previous code, when somebody calls Bomp#explode, the interpreter will effectively execute the method, but also will output: <em>Warning: calling deprecated method Bomb.explode</em>.</p>
<p>The key to this behavior is the <a href="http://ruby-doc.org/core/classes/Module.html#M001662">method_added</a> method which is present in all Ruby modules and which is called every time a method is defined, receiving the name of the method as the parameter.</p>
<p>We can use this method, for example, to create an annotation that specifies that the methods declared below it can only be called by an admin, something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#9966CC; font-weight:bold;">Module</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> method_added<span style="color:#006600; font-weight:bold;">&#40;</span>name<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">unless</span> <span style="color:#0066ff; font-weight:bold;">@_admin_only</span>.<span style="color:#0000FF; font-weight:bold;">nil</span>? <span style="color:#9966CC; font-weight:bold;">or</span> <span style="color:#0066ff; font-weight:bold;">@_proxy_method</span>
      <span style="color:#0066ff; font-weight:bold;">@_proxy_method</span> = <span style="color:#0000FF; font-weight:bold;">true</span>
      alias_method <span style="color:#996600;">&quot;_admin_#{name}&quot;</span>, name
      module_eval <span style="color:#006600; font-weight:bold;">&lt;&lt;-</span><span style="color:#CC0066; font-weight:bold;">STRING</span>
        <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#008000; font-style:italic;">#{name}(*args, &amp;block)</span>
          _admin_<span style="color:#008000; font-style:italic;">#{name}(*args, &amp;block) if admin?</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
      <span style="color:#CC0066; font-weight:bold;">STRING</span>
      <span style="color:#0066ff; font-weight:bold;">@_proxy_method</span> = <span style="color:#0000FF; font-weight:bold;">false</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;">def</span> admin_only
    <span style="color:#0066ff; font-weight:bold;">@_admin_only</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;">class</span> User
  <span style="color:#9966CC; font-weight:bold;">def</span> admin?
    <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#0000FF; font-weight:bold;">true</span>, <span style="color:#0000FF; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0066; font-weight:bold;">rand</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  admin_only
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> update_password
    <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;password updated&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> restart_server
    <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;server restarted&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>In the previous code, #admin? will randonmly return true or false and depending of the result the called method will be executed or not.</p>
<img src="http://feeds.feedburner.com/~r/diegocarrion/~4/cq9LMFS3lh8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.diegocarrion.com/2010/05/27/ruby-annotations/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.diegocarrion.com/2010/05/27/ruby-annotations/</feedburner:origLink></item>
		<item>
		<title>Following Pivotal Tracker projects with Kilt</title>
		<link>http://feedproxy.google.com/~r/diegocarrion/~3/NnFIPyG6t50/</link>
		<comments>http://www.diegocarrion.com/2010/03/30/following-pivotal-tracker-projects-with-kilt/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 20:11:49 +0000</pubDate>
		<dc:creator>dc.rec1</dc:creator>
		
		<category><![CDATA[Pivotal Tracker]]></category>

		<category><![CDATA[RubyGems]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[gem]]></category>

		<category><![CDATA[kilt]]></category>

		<guid isPermaLink="false">http://www.diegocarrion.com/?p=107</guid>
		<description><![CDATA[I&#8217;m a big fan of Pivotal Tracker. When we used it at Gonow, the team I was part of did sit at a single table and that was very cool, because even when using the tool, it was very easy to tell everybody what task we were picking or delivering.
When I had the opportunity to work with [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a big fan of <a href="http://www.pivotaltracker.com/">Pivotal Tracker</a>. When we used it at <a href="http://www.gonow.com.br/">Gonow</a>, the team I was part of did sit at a single table and that was very cool, because even when using the tool, it was very easy to tell everybody what task we were picking or delivering.</p>
<p>When I had the opportunity to work with Pivotal in a remote team, I did miss to know what was happening in real time, so I decided to create <a href="http://github.com/dcrec1/kilt">Kilt</a>.</p>
<p><a href="http://github.com/dcrec1/kilt">Kilt</a> is a daemon created with Ruby that requests the updates of the projects an user is involved with and notifies about them:</p>
<p><img src="http://img684.imageshack.us/img684/4875/screenshot20100319at349.png" alt="Kilt" /></p>
<p>With <a href="http://github.com/dcrec1/kilt">Kilt</a> I can keep working and at the same time being informed of what is happening in the projects I&#8217;m working on.</p>
<p>To install <a href="http://github.com/dcrec1/kilt">Kilt</a> you just need to download the gem and execute <em>kilt-install</em> with your token:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> kilt
kilt-install TOKEN</pre></div></div>

<p>In the case you don&#8217;t know your token, you can execute this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">curl <span style="color: #660033;">-u</span> USERNAME:PASSWORD <span style="color: #660033;">-X</span> GET https:<span style="color: #000000; font-weight: bold;">//</span>www.pivotaltracker.com<span style="color: #000000; font-weight: bold;">/</span>services<span style="color: #000000; font-weight: bold;">/</span>v3<span style="color: #000000; font-weight: bold;">/</span>tokens<span style="color: #000000; font-weight: bold;">/</span>active</pre></div></div>

<p>The previous command will return a xml document with the token and id of the given user. Case you didn&#8217;t like the command, another ways of retrieving the token can be found in the Pivotal Tracker <a href="http://www.pivotaltracker.com/help/api?version=v3#retrieve_token">documentation</a>.</p>
<p>Once installed <a href="http://github.com/dcrec1/kilt">Kilt</a>, you can initialize it by executing:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">kilt-app</pre></div></div>

<img src="http://feeds.feedburner.com/~r/diegocarrion/~4/NnFIPyG6t50" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.diegocarrion.com/2010/03/30/following-pivotal-tracker-projects-with-kilt/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.diegocarrion.com/2010/03/30/following-pivotal-tracker-projects-with-kilt/</feedburner:origLink></item>
		<item>
		<title>Full text search in JRuby with ActiveLucene</title>
		<link>http://feedproxy.google.com/~r/diegocarrion/~3/MKwA83OFMh0/</link>
		<comments>http://www.diegocarrion.com/2010/02/04/full-text-search-in-jruby-with-activelucene/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 18:00:46 +0000</pubDate>
		<dc:creator>dc.rec1</dc:creator>
		
		<category><![CDATA[Search]]></category>

		<category><![CDATA[jruby]]></category>

		<category><![CDATA[lucene]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[active_lucene]]></category>

		<category><![CDATA[active_model]]></category>

		<category><![CDATA[active_record]]></category>

		<category><![CDATA[query]]></category>

		<category><![CDATA[Solr]]></category>

		<category><![CDATA[sphinx]]></category>

		<category><![CDATA[syntax]]></category>

		<guid isPermaLink="false">http://www.diegocarrion.com/?p=104</guid>
		<description><![CDATA[ActiveLucene is a Lucene interface similar to the one used by ActiveRecord and ActiveModel. 
This means that you can generate a scaffold in a Rails application, go to the model, replace ActiveRecord::Base with ActiveLucene::Document and everything should be still working with the difference that the model should be being saved in a Lucene index rather [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/dcrec1/active_lucene">ActiveLucene</a> is a <a href="http://lucene.apache.org/java/docs/index.html">Lucene</a> interface similar to the one used by <a href="http://api.rubyonrails.org/classes/ActiveRecord/Base.html">ActiveRecord</a> and <a href="http://github.com/rails/rails/tree/master/activemodel">ActiveModel</a>. </p>
<p>This means that you can generate a <a href="http://en.wikipedia.org/wiki/Scaffold_(programming)">scaffold</a> in a <a href="http://rubyonrails.org/">Rails</a> application, go to the model, replace ActiveRecord::Base with ActiveLucene::Document and everything should be still working with the difference that the model should be being saved in a Lucene index rather than in a relational database. </p>
<p>As the documents are now being saved in a Lucene index, we can find them using the <a href="http://lucene.apache.org/java/3_0_0/queryparsersyntax.html">Lucene query syntax</a>, without forgetting that as ActiveLucene has a similar interface to ActiveRecord, we can also find them by an id, find the first, find the last, etc.</p>
<p>The base class of ActiveLucene is called Document because as the documents of another systems, it doesn&#8217;t have a defined structure and all the attributes are dynamic, so you do not have to worry about them. </p>
<p>ActiveLucene was extracted from <a href="http://github.com/dcrec1/lunr">Lunr</a>, a not-enterprise search server from which I will speak in a future post, but as today, it can also be used in applications where having a relational database doesn&#8217;t make much sense and especially in the ones where you want to search documents by text. </p>
<p>The restriction of ActiveLucene is that it only works with <a href="http://jruby.org/">JRuby</a>, since Lucene is a <a href="http://java.sun.com/">Java</a> library that runs on the JVM. Case this isn&#8217;t a problem, using ActiveLucene should be much simpler and lighter than using a solution such as Sphinx or Solr, depending of the case this may result in great benefits.</p>
<p>Lucene has a lot of features and ActiveLucene doesn&#8217;t support them all, but they will be added to the project as needed. As today, there is support for highlighting and a little for paging, as can be seen in the following video, along with a basic demonstration of the tool:</p>
<p><object width="501" height="313"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=9010209&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=9010209&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="501" height="313"></embed></object> </p>
<p><a href="http://vimeo.com/9010209">Full text search in JRuby with ActiveLucene</a> from <a href="http://vimeo.com/user1245982">Diego Carrion</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p><em>If you appreciate this work, please consider to <a href="http://workingwithrails.com/recommendation/new/person/13580-diego-carrion">recommend me</a> at <a href="http://workingwithrails.com/">Working With Rails</a>.</em></p>
<img src="http://feeds.feedburner.com/~r/diegocarrion/~4/MKwA83OFMh0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.diegocarrion.com/2010/02/04/full-text-search-in-jruby-with-activelucene/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.diegocarrion.com/2010/02/04/full-text-search-in-jruby-with-activelucene/</feedburner:origLink></item>
		<item>
		<title>ThinkingSphinx exits, enters ActsAsSolrReloaded</title>
		<link>http://feedproxy.google.com/~r/diegocarrion/~3/qXhynz42q-s/</link>
		<comments>http://www.diegocarrion.com/2010/01/18/thinkingsphinx-exits-enters-actsassolrreloaded/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 04:42:47 +0000</pubDate>
		<dc:creator>dc.rec1</dc:creator>
		
		<category><![CDATA[ActsAsSolr]]></category>

		<category><![CDATA[ActsAsSolrReloaded]]></category>

		<category><![CDATA[Solr]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[ActiveRecord]]></category>

		<category><![CDATA[acts_as_solr]]></category>

		<category><![CDATA[acts_as_solr_reloaded]]></category>

		<category><![CDATA[acts_as_taggable_on]]></category>

		<category><![CDATA[plugin]]></category>

		<category><![CDATA[sphinx]]></category>

		<category><![CDATA[thinking_sphinx]]></category>

		<guid isPermaLink="false">http://www.diegocarrion.com/?p=91</guid>
		<description><![CDATA[I used to work with ThinkingSphinx until the day I needed to index documents with dynamic attributes. As Sphinx indexes data from the result of an SQL query, the goal didn&#8217;t seem possible. 
I decided then to take another look at Solr. Solr, differently from Sphinx, is an HTTP server and indexes data from posted [...]]]></description>
			<content:encoded><![CDATA[<p>I used to work with <a href="http://freelancing-god.github.com/ts/en/">ThinkingSphinx</a> until the day I needed to index documents with dynamic attributes. As <a href="http://www.sphinxsearch.com/">Sphinx</a> indexes data from the result of an SQL query, the goal didn&#8217;t seem possible. </p>
<p>I decided then to take another look at <a href="http://lucene.apache.org/solr/">Solr</a>. Solr, differently from Sphinx, is an HTTP server and indexes data from posted XML documents. Each document can have a different structure, so it fits perfectly with the model of dynamic attributes.</p>
<p><a href="http://www.railsfreaks.com/">Thiago Jackwin</a>, aka RailsFreaks, created a plugin that integrates Rails with Solr called <a href="http://github.com/railsfreaks/acts_as_solr/tree/master">acts_as_solr</a>. The plugin is very good, but Thiago disappeared from the map some time ago, he lost the domain, left <a href="http://www.github.com">GitHub</a> and doesn&#8217;t answer emails any more. As a result of this, different forks and forks of forks have been created and the <a href="http://git-scm.com/">Git</a> tree became a mess.</p>
<p>Annoyed with the situation of the project, I decided to fork the fork I liked the most and created a new repository called <a href="http://github.com/dcrec1/acts_as_solr_reloaded/tree">acts_as_solr_reloaded</a>, with new features. This way, I hope the project gets easier to be found and that it gives more trust. I&#8217;m also compromising myself to keep the repository up to date and to pull contributions.</p>
<p>As today, the new features acts_as_solr_reloaded comes with are:</p>
<ul>
<li>support for dynamic attributes</li>
<li>geo-localization or geo-spatial search</li>
<li>integration with <a href="http://github.com/mbleigh/acts-as-taggable-on">acts-as-taggable-on</a></li>
<li>highlighting</li>
<li>relevance ranking</li>
</ul>
<p>To support geo-localization in Solr, it needed to be updated to the version 1.4 .</p>
<p>To make easier the experience of working with dynamic attributes and geo-localization, a few generators that setup the database were added to the project. You can use them like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">script<span style="color: #000000; font-weight: bold;">/</span>generate dynamic_attributes_migration
script<span style="color: #000000; font-weight: bold;">/</span>generate local_migration</pre></div></div>

<p>You can after define your model this way:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Document <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  acts_as_solr <span style="color:#ff3333; font-weight:bold;">:dynamic_attributes</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>,
               <span style="color:#ff3333; font-weight:bold;">:spatial</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>,
               <span style="color:#ff3333; font-weight:bold;">:taggable</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Note that with <em>:taggable => true </em>you dont need to define your model as <em>acts_as_taggable_on :tags</em>, it&#8217;s done automatically.</p>
<p>To better demonstrate the new features in acts_as_solr_reloaded, I recorded a small video of five minutes showing the functionalities in action, hope you like it:</p>
<p><object width="501" height="313"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8728276&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=8728276&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="501" height="313"></embed></object>
<p><a href="http://vimeo.com/8728276">New features in ActsAsSolrReloaded</a> from <a href="http://vimeo.com/user1245982">Diego Carrion</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>Note that in the video I used <em>acts_as_taggable_on :tags</em> and <em>:taggable => true</em>, at the time of the recording this both declarations were necessary, not anymore.</p>
<p><em>If you appreciate this work, please consider to <a href="http://workingwithrails.com/recommendation/new/person/13580-diego-carrion">recommend me</a> at <a href="http://workingwithrails.com/">Working With Rails</a>.</em></p>
<img src="http://feeds.feedburner.com/~r/diegocarrion/~4/qXhynz42q-s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.diegocarrion.com/2010/01/18/thinkingsphinx-exits-enters-actsassolrreloaded/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.diegocarrion.com/2010/01/18/thinkingsphinx-exits-enters-actsassolrreloaded/</feedburner:origLink></item>
		<item>
		<title>Summary of new features in Inploy</title>
		<link>http://feedproxy.google.com/~r/diegocarrion/~3/6ehr2Ju5iNA/</link>
		<comments>http://www.diegocarrion.com/2009/12/18/summary-of-new-features-in-inploy/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 01:03:31 +0000</pubDate>
		<dc:creator>dc.rec1</dc:creator>
		
		<category><![CDATA[Deploy]]></category>

		<category><![CDATA[Inploy]]></category>

		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.diegocarrion.com/?p=88</guid>
		<description><![CDATA[After announcing Inploy 2 months ago, several people colaborated with it and now it has more features, the ones I will expose in this post. 
First of all, I want to thank these people for the contributions: 
Andy Shen
Carlos Brando
Douglas Campos
Erik Dahlstrand
Joris Troost
Josh Owens 
If you upgrade Inploy today and do nothing else, the two [...]]]></description>
			<content:encoded><![CDATA[<p>After <a href="http://www.diegocarrion.com/2009/10/30/really-easy-continuous-integration-with-signal/">announcing</a> <a href="http://github.com/dcrec1/inploy">Inploy</a> 2 months ago, several people colaborated with it and now it has more features, the ones I will expose in this post. </p>
<p>First of all, I want to thank these people for the contributions: </p>
<p>Andy Shen<br />
Carlos Brando<br />
Douglas Campos<br />
Erik Dahlstrand<br />
Joris Troost<br />
Josh Owens </p>
<p>If you upgrade Inploy today and do nothing else, the two features you will automatically earn out of the box are: </p>
<p><strong>control of submodules</strong></p>
<p>This functionality initializes/updates the Git submodules on each deploy, so that the code is always updated without the possibility of forgetting. </p>
<p><strong>Hoptoad notification</strong></p>
<p>For those who use <a href="http://hoptoadapp.com/pages/home">Hoptoad</a>, Inploy will notify the tool on every code update, sending the environment and the revision code. </p>
<p>Besides the new features mentioned, Inploy now also has the following optional settings, which can be specified in the deploy.rb file: </p>
<p><strong>sudo</strong> </p>
<p>Case you want to run the commands in the server as sudo.</p>
<p><strong>server (Unicorn support) </strong></p>
<p>Inploy works now with <a href="http://unicorn.bogomips.org/">Unicorn</a>, too, being <a href="http://www.modrails.com/">Passenger</a> the default server. </p>
<p><strong>environment </strong></p>
<p>Inploy works with production environment as default, but now we can use another one, like staging. </p>
<p><strong>branch</strong> </p>
<p>Such times we have a branch with the configurations of our deploy and we want to use it, we can do it  with the branch option.</p>
<p><strong>ssh_opts </strong></p>
<p>If you want to connect to the server using some ssh parameter, we can specified it in this option.</p>
<p>Here&#8217;s an example of how to use the options mentioned:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">if</span> ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'environment'</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">eql</span>? <span style="color:#996600;">'staging'</span>
  deploy.<span style="color:#9900CC;">ssh_opts</span> = <span style="color:#996600;">'-A'</span>
  deploy.<span style="color:#9900CC;">server</span> = <span style="color:#ff3333; font-weight:bold;">:unicorn</span>
  deploy.<span style="color:#9900CC;">environment</span> = <span style="color:#ff3333; font-weight:bold;">:staging</span>
<span style="color:#9966CC; font-weight:bold;">else</span>
  deploy.<span style="color:#9900CC;">branch</span> = <span style="color:#ff3333; font-weight:bold;">:deploy</span>
  deploy.<span style="color:#9900CC;">sudo</span> = <span style="color:#0000FF; font-weight:bold;">true</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p><em>Please consider to <a href="http://workingwithrails.com/recommendation/new/person/13580-diego-carrion">recommend me</a> at <a href="http://workingwithrails.com/">Working With Rails</a>.</em></p>
<img src="http://feeds.feedburner.com/~r/diegocarrion/~4/6ehr2Ju5iNA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.diegocarrion.com/2009/12/18/summary-of-new-features-in-inploy/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.diegocarrion.com/2009/12/18/summary-of-new-features-in-inploy/</feedburner:origLink></item>
		<item>
		<title>Following the status of your projects in Signal from CCMenu</title>
		<link>http://feedproxy.google.com/~r/diegocarrion/~3/9o-fi_01T-w/</link>
		<comments>http://www.diegocarrion.com/2009/12/03/following-the-status-of-your-projects-in-signal-from-ccmenu/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 19:38:27 +0000</pubDate>
		<dc:creator>dc.rec1</dc:creator>
		
		<category><![CDATA[CCMenu]]></category>

		<category><![CDATA[continuous integration]]></category>

		<category><![CDATA[signal]]></category>

		<category><![CDATA[cctray]]></category>

		<guid isPermaLink="false">http://www.diegocarrion.com/?p=82</guid>
		<description><![CDATA[After announcing Signal, one of the firsts feedbacks I received was from Raphael, asking if I was planning to add a feed compatible with CCMenu.
I found the functionality very interesting and today, in order to integrate Signal with CCMenu (OS X) or CCTray (Windows), you just need to point to the URL http://host/projects/status.xml and select [...]]]></description>
			<content:encoded><![CDATA[<p>After <a href="http://www.diegocarrion.com/2009/10/30/really-easy-continuous-integration-with-signal/">announcing</a> Signal, one of the firsts feedbacks I received was from <a href="http://www.accolade.ch/">Raphael</a>, asking if I was planning to add a feed compatible with <a href="http://ccmenu.sourceforge.net/">CCMenu</a>.</p>
<p>I found the functionality very interesting and today, in order to integrate Signal with CCMenu (OS X) or CCTray (Windows), you just need to point to the URL http://host/projects/status.xml and select the desired project.</p>
<p>I recorded a short video (01:13 minutes) demonstrating how to configure the tool and how it works, hope you like it:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="501" height="313" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=7423131&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="501" height="313" src="http://vimeo.com/moogaloop.swf?clip_id=7423131&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p><em>If you liked Signal, please consider to <a href="http://www.workingwithrails.com/recommendation/new/person/13580-diego-carrion">recommend</a> at <a href="http://workingwithrails.com/">Working With Rails</a>.</em></p>
<p>E99DUHF5W855</p>
<img src="http://feeds.feedburner.com/~r/diegocarrion/~4/9o-fi_01T-w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.diegocarrion.com/2009/12/03/following-the-status-of-your-projects-in-signal-from-ccmenu/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.diegocarrion.com/2009/12/03/following-the-status-of-your-projects-in-signal-from-ccmenu/</feedburner:origLink></item>
		<item>
		<title>Really easy continuous integration with Signal</title>
		<link>http://feedproxy.google.com/~r/diegocarrion/~3/5Kq8LGRc4gc/</link>
		<comments>http://www.diegocarrion.com/2009/10/30/really-easy-continuous-integration-with-signal/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 22:36:24 +0000</pubDate>
		<dc:creator>dc.rec1</dc:creator>
		
		<category><![CDATA[continuous integration]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[signal]]></category>

		<guid isPermaLink="false">http://www.diegocarrion.com/?p=70</guid>
		<description><![CDATA[Signal is a continuous integration server written in Rails which I think takes the best features of similar systems and merges them in a very simple to use application.
When I started working with Rails, the first continuous integration server I tried was CruiseControl.rb. The CC.rb was also written in Rails and what bothers me the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/dcrec1/signal">Signal</a> is a continuous integration server written in Rails which I think takes the best features of similar systems and merges them in a very simple to use application.</p>
<p>When I started working with Rails, the first continuous integration server I tried was <a href="http://cruisecontrolrb.thoughtworks.com/">CruiseControl.rb</a>. The CC.rb was also written in Rails and what bothers me the most about it is that to add a project you have to connect to the server and execute:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>cruise add <span style="color: #7a0874; font-weight: bold;">&#91;</span>project-name<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #660033;">-r</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>repository<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #660033;">-s</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #c20cb9; font-weight: bold;">svn</span><span style="color: #000000; font-weight: bold;">|</span>git<span style="color: #000000; font-weight: bold;">|</span>hg<span style="color: #000000; font-weight: bold;">|</span>bzr<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>After running the previous command you can open a <a href="http://www.yaml.org/">YAML</a> file and configure the recipient of the emails that are sent by the application when the build breaks. In the scaffolding land, this makes no sense to me. It&#8217;s much more simpler to have a page where any user can register a project without much difficulty, like <a href="https://hudson.dev.java.net/">Hudson</a>, <a href="http://integrityapp.com/">Integrity</a> and <a href="http://github.com/dcrec1/signal">Signal</a> does.</p>
<p>Another thing that bothers me about CC.rb is that it creates a lot of <em>cruise</em> processes and sometimes they hang. For a while I thought the problem was only happening with me but after talking with some people I found it wasn&#8217;t so uncommon.</p>
<p>The third thing I&#8217;ll complain about CC.rb is that at the home page it shows the last five builds of each project. IMHO the last two builds is already too much information. To know that the old builds were broken or not doesn&#8217;t mean anything to me. The only thing I care about is to know if the project is in a good state or not, information that Integrity and Signal display very well.</p>
<p>Integrity does a lot of things in a cool way, but I don&#8217;t like the fact that to install it you have to download the gem and then execute a command. The worst thing is that depending of the server you want to use, the command takes different parameters. Before explaining why this installation method is a problem, let me confess that another thing I don&#8217;t like about Integrity is that it doesn&#8217;t come with email support. Besides this lack of support be ugly, to include it you have to download another gem and modify a file. It looks simple but didn&#8217;t work for me, apparently because the version of the plugin gem was not compatible with the version of the application gem. Now, how do you change the version of an application that was installed by executing a command from a gem? Would it only require to download the second version of the gem and delete the first? Would it require to reinstall the application? I don&#8217;t know, maybe I did something stupid but nothing worked for me and this is why I believe that this way of dealing with applications is a problem.</p>
<p>Signal tries to take advantage of <a href="http://git-scm.com/">Git</a>. To install Signal you can run:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git clone git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>dcrec1<span style="color: #000000; font-weight: bold;">/</span>signal.git
<span style="color: #7a0874; font-weight: bold;">cd</span> signal
rake inploy:<span style="color: #7a0874; font-weight: bold;">local</span>:setup</pre></div></div>

<p>If you ever want to go back to an specific version you just can <em>git reset &#8211;hard COMMIT</em>; simple, and it can take advantage of history by knowing where we are and what we are undoing.</p>
<p>One characteristic CC.rb has and I miss in Integrity is to show the date of each build on the home page. Signal shows how long ago each project was built, so we can easily know when was the last build and if they are being created.</p>
<p><a href="http://github.com/thoughtbot/report_card">report_card</a> is a project that integrates <a href="http://metric-fu.rubyforge.org/">metric_fu</a> with Integrity, but it&#8217;s necessary to install another application and run a few commands, what is very complicated to me. It&#8217;s for this reason I decided that Signal has native integration with metric_fu, <a href="http://rspec.info/">RSpec</a> and <a href="http://cukes.info/ ">Cucumber</a>.</p>
<p>Signal&#8217;s integration with RSpec, Cucumber and metric_fu is very simple. In each project page there are three links: specs, features, and metrics, which point to ROOT/docs/specs.html, ROOT/docs/features.html and ROOT/tmp/metric_fu/output/index.html, metric_fu&#8217;s default path. This means that if we are generating HTML specifications, they can be accessed from the project page.</p>
<p>Another integration that Signal has is with <a href="http://github.com/dcrec1/inploy">Inploy</a>. If we want to deploy an application, we can do it from the project page by clicking on deploy, the rake task <em>inploy:remote:update</em> will be executed.</p>
<p>Hudson is an very good integration server, but I think Signal overcomes it by being a little more simpler to use and by being developed in <a href="http://rubyonrails.org/">Rails</a> and being hosted on <a href="https://github.com/">GitHub</a>.</p>
<p>Being developed in Rails is an advantage because this type of projects usually have several plugins and Rails has native support to plugins. Almost every railer knows how to install a plugin and how do they work, so it will not be a problem to create them.</p>
<p>Being on GitHub is an advantage because it facilitates further collaboration with the project. As today, Signal has a lot of conventions, but if for some reason anyone need some special configuration, he can fork the project and start contributing. Since Signal was developed with Rails and it&#8217;s pretty simple, people will not have difficulties to understand how it works.</p>
<p>One of the conventions of Signal is that each build is created by running the rake task <em>build</em>, which depending of the project I have something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">task: build <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'db:migrate'</span>, <span style="color:#ff3333; font-weight:bold;">:spec</span>, <span style="color:#ff3333; font-weight:bold;">:cucumber</span>, <span style="color:#996600;">'metrics:all'</span><span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>

<p>I recorded a short video of nearly three minutes demonstrating how easy it is to install and use Signal. In the video I download the application and install it using Inploy. Then I register a new project and create a new build. The build is not automatically created along with the project because sometimes we need to perform some actions before running it. Just for demonstration purposes, I chose a project in Ruby that has a very fast build, given it does not run the Cucumber features neither the metrics. After the first build, I do start <a href="http://github.com/tobi/delayed_job">delayed_job</a> and create a build from the command line, like being in a Git hook. The video ends with me showing a build of the project Signal and how easily it is to view the specs, the stories and metrics from the project page.</p>
<p><object width="501" height="313"><param name="allowfullscreen" value="true" /><param name="wmode" value="Window" /><param name = "movie" value = "http://vimeo.com/moogaloop.swf?clip_id=7318013&#038;server=vimeo.com&#038;show_title=1&#038;show_byline=1&#038;show_portrait=0&#038;color=00ADEF&#038;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=7318013&#038;server=vimeo.com&#038;show_title=1&#038;show_byline=1&#038;show_portrait=0&#038;color=00ADEF&#038;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="501" height ="313"></embed></object> <a href =" http://vimeo.com/7318013 " >Really easy integration with continuous Signal</a> from <a href="http://vimeo.com/user1245982">Diego Carrion</ a> on <a href="http://vimeo.com">Vimeo</a>. </p>
<p><em>If you liked Signal, please consider to <a href="http://www.workingwithrails.com/recommendation/new/person/13580-diego-carrion">recommend</a> at <a href="http://workingwithrails.com/">Working With Rails</a>.</em></p>
<img src="http://feeds.feedburner.com/~r/diegocarrion/~4/5Kq8LGRc4gc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.diegocarrion.com/2009/10/30/really-easy-continuous-integration-with-signal/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.diegocarrion.com/2009/10/30/really-easy-continuous-integration-with-signal/</feedburner:origLink></item>
		<item>
		<title>Rails deployment made easy with Inploy</title>
		<link>http://feedproxy.google.com/~r/diegocarrion/~3/iSbpq5IEMG4/</link>
		<comments>http://www.diegocarrion.com/2009/10/19/rails-deployment-made-easy-with-inploy/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 00:41:41 +0000</pubDate>
		<dc:creator>dc.rec1</dc:creator>
		
		<category><![CDATA[Inploy]]></category>

		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[plugin]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[capistrano]]></category>

		<category><![CDATA[deployment]]></category>

		<guid isPermaLink="false">http://www.diegocarrion.com/?p=65</guid>
		<description><![CDATA[After working in some systems made in Rails, Capistrano became one of the things that began to bother me more and more. I tried to find other alternatives, including Vlad, but none satisfied me, so I decided to create a solution and called it Inploy.
Before Capistrano fans crucify me, I wanted to let it clear [...]]]></description>
			<content:encoded><![CDATA[<p>After working in some systems made in Rails, Capistrano became one of the things that began to bother me more and more. I tried to find other alternatives, including <a href="http://rubyhitsquad.com/Vlad_the_Deployer.html">Vlad</a>, but none satisfied me, so I decided to create a solution and called it <a href="http://github.com/dcrec1/inploy">Inploy</a>.</p>
<p>Before Capistrano fans crucify me, I wanted to let it clear that I don&#8217;t think Capistrano is a bad tool, just that it&#8217;s bad for my needs, which are much simpler than Capistrano can attend.</p>
<p>One of the things I don&#8217;t like about Capistrano is that it creates a lot of folders, one for each release. Some people argued with me that they are useful when you want to rollback a release, but that never happened to me, as never happened with most of the people I talked with. The rest of the people told me that in some circumstance they had to rollback a deploy, but the circumstance was that the deployed code broke the build. </p>
<p>Inploy uses <a href="http://git-scm.com/">Git</a>, so in case we need to rollback our deploy to a version, we can use <em>git reset</em>. Of course this solution is more limited that the one that Capistrano uses, but it&#8217;s a solution to a problem that probably should never occur, a problem caused probably by bad practices in the development.</p>
<p>As a consequence of Capistrano strategies, they deploys are a little slow for my taste. I know there are some configurations that can speed up the process, but to configure is a thing I don&#8217;t want to do. I want to use a tool that works the best way by default and in most cases, the best way to a fast deploy is the simplest one: <em>git clone</em> in the setup and <em>git pull</em> in the update, the same that Inploy does.</p>
<p>Speaking about defaults, it&#8217;s very annoying to me having to define in Capistrano how to restart the server, how to clean the cache and what tasks it should rake, like <em>more:parse</em> and <em>asset:packager:build_all</em>. Inploy tries to solve this problems by executing common tasks by default, being smart enough to identify what tasks it should rake and in which order. The idea behind the plugin is that you shouldn&#8217;t worry about how to deploy that new tool you&#8217;re using, that things just work without the possibility of something going wrong.</p>
<p>Another advantage from Inploy over Capistrano for most cases is that it just have one way to deploy and its called <em>update</em>. This task updates the code, migrates the database, does some other tasks and restarts the server. It makes not sense to me to update the code without running migrations. In all teams I worked with, everyone could deploy the application and in most cases someone executed <em>cap deploy</em> instead of <em>cap deploy:migrations</em>. I know this is a human error but I prefer to use a tool that doesn&#8217;t let people make mistakes.</p>
<p>A need I had with deployment tools is that it could work both remotely and locally. I worked in a project that was delivered to a foreign client and the people responsible of updating the application in each release couldn&#8217;t do it otherwise that by connecting to a server and running a script. All of them used Windows and were used to work with Java systems that required them to access a machine, replace a war file and execute some commands. In that opportunity, the solution was to create a deploy.sh file in the root folder on the application. This file was executed by somebody from the client every time they needed to update the application.</p>
<p>The problem mentioned above doesn&#8217;t happen with Inploy, as it can be run both remotely or locally. When running remotely, the only only thing it does is to connect to a list of servers and run the tasks like being locally logged. It&#8217;s because of this that Inploy is delivered as a plugin, so it&#8217;s available in all environments.</p>
<p>As today, Inploy will only work for you if you&#8217;re working with Git and <a href="http://www.modrails.com/">Passenger</a>.</p>
<p>To install Inploy you can execute:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">script<span style="color: #000000; font-weight: bold;">/</span>plugin <span style="color: #c20cb9; font-weight: bold;">install</span> git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>dcrec1<span style="color: #000000; font-weight: bold;">/</span>inploy.git</pre></div></div>

<p>On installation, Inploy will write to a file in config/deploy.rb. This file is read by the plugin and it should be something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">deploy.<span style="color:#9900CC;">application</span> = <span style="color:#996600;">&quot;inploy&quot;</span>
deploy.<span style="color:#9900CC;">repository</span> = <span style="color:#996600;">'git://github.com/dcrec1/inploy.git'</span>
deploy.<span style="color:#9900CC;">user</span> = <span style="color:#996600;">'dcrec1'</span>
deploy.<span style="color:#9900CC;">hosts</span> = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'hooters'</span>, <span style="color:#996600;">'geni'</span><span style="color:#006600; font-weight:bold;">&#93;</span>
deploy.<span style="color:#9900CC;">path</span> = <span style="color:#996600;">'/var/local/apps'</span></pre></div></div>

<p>After that, we&#8217;re ready to execute the tasks that the plugin has:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rake inploy:<span style="color: #7a0874; font-weight: bold;">local</span>:setup
rake inploy:<span style="color: #7a0874; font-weight: bold;">local</span>:update
rake inploy:remote:setup
rake inploy:remote:update</pre></div></div>

<p>I created a short video in which I demonstrate how to use the different tasks of the plugin. In the video I&#8217;m inside the <a href="http://github.com/dcrec1/signal">Signal</a> project, which already has Inploy installed and I remove it along with the configuration file to demonstrate how easily it is to install and configure it. After that I execute a remote setup and then a remote update. We can see in the video that the commands that Inploy runs are logged with the corresponding outputs and that config/*.sample files are renamed to config/*, another feature of Inploy. In the second part of the video a local update is ran and then deleted the repository, cloned and executed another setup, this time locally. </p>
<p><object width="501" height="313"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=7116773&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=7116773&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="501" height="313"></embed></object>
<p><a href="http://vimeo.com/7116773">Deploy easily to Locaweb with Inploy</a> from <a href="http://vimeo.com/user1245982">Diego Carrion</a> on <a href="http://vimeo.com">Vimeo</a>.</p>
<p>More details about the plugin can be obtained in the official <a href="http://github.com/dcrec1/inploy">Inploy</a> repository, where I&#8217;ll try to keep the README up-to-date. I hope it&#8217;s clear the way that Inploy works, but just in case, looking at the code is an option to eliminate doubts. The code is quite small (50 LoC moreless) and also self explanatory. Follows an snippet:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> local_setup
  copy_sample_files
  create_folders <span style="color:#996600;">'tmp/pids'</span>, <span style="color:#996600;">'db'</span>
  run <span style="color:#996600;">&quot;./init.sh&quot;</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">exists</span>?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;init.sh&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  after_update_code
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> remote_update
  remote_run <span style="color:#996600;">&quot;cd #{application_path} &amp;&amp; rake inploy:local:update&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> local_update
  run <span style="color:#996600;">&quot;git pull origin master&quot;</span>
  after_update_code
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> after_update_code
  install_gems
  migrate_database
  run <span style="color:#996600;">&quot;rm -R -f public/cache&quot;</span>
  rake_if_included <span style="color:#996600;">&quot;more:parse&quot;</span>
  rake_if_included <span style="color:#996600;">&quot;asset:packager:build_all&quot;</span>
  run <span style="color:#996600;">&quot;touch tmp/restart.txt&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>I wish this simple code motivates people to contribute with the project and make it smarter. </p>
<p><em>If this plugins helps you, please consider to <a href="http://workingwithrails.com/recommendation/new/person/13580-diego-carrion">recommend me</a> at <a href="http://workingwithrails.com/">Working With Rails</a>.</em></p>
<img src="http://feeds.feedburner.com/~r/diegocarrion/~4/iSbpq5IEMG4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.diegocarrion.com/2009/10/19/rails-deployment-made-easy-with-inploy/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.diegocarrion.com/2009/10/19/rails-deployment-made-easy-with-inploy/</feedburner:origLink></item>
	</channel>
</rss>
