<?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>A Tempest of Thoughts &#187; Ruby on Rails</title>
	<atom:link href="http://tempe.st/category/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://tempe.st</link>
	<description>aka blog.to_int(:inig)</description>
	<lastBuildDate>Thu, 13 May 2010 09:54:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>The importance of being up-to-date</title>
		<link>http://tempe.st/2010/02/the-importance-of-being-up-to-date/</link>
		<comments>http://tempe.st/2010/02/the-importance-of-being-up-to-date/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 09:19:34 +0000</pubDate>
		<dc:creator>Giovanni Intini</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[mikamai]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[rails 3]]></category>

		<guid isPermaLink="false">http://tempe.st/?p=312</guid>
		<description><![CDATA[Since I started working in the web development business the release of Rails 3 has been the first time I really felt I had to understand what was going on because otherwise I would be left behind. There were simpler times where just reading the feeds of the most important blogs allowed me to be [...]]]></description>
			<content:encoded><![CDATA[	<p>Since I started working in the web development business the release of Rails 3 has been the first time I really felt I <em>had</em> to understand what was going on because otherwise I would be left behind.</p>
	<p>There were simpler times where just reading the feeds of the most important blogs allowed me to be up-to-date, but either I&#8217;m getting old or the information has become too fractioned, because this time the only reason for me (and everyone in MIKAMAI) to get started with Rails 3 was to resume a practice that unfortunately we left behind in the past year: the internal presentations.</p>
	<p>Starting last thursday, and hopefully never stopping, thursday afternoons aren&#8217;t about working for others, but are about everyone sharing his knoweledge with the others.</p>
	<p>Last thursday was obviously all about Rails 3, so a couple of us connected their macs to the big screen and demoed new features of Rails 3.</p>
	<p>It was nice, interesting questions were asked during the demos, and the overall mood was pretty good. I look forward to the next session.</p>

 ]]></content:encoded>
			<wfw:commentRss>http://tempe.st/2010/02/the-importance-of-being-up-to-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Continous Integration with RunCodeRun</title>
		<link>http://tempe.st/2010/02/continous-integration-with-runcoderun/</link>
		<comments>http://tempe.st/2010/02/continous-integration-with-runcoderun/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 14:09:36 +0000</pubDate>
		<dc:creator>Giovanni Intini</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[mikamai]]></category>
		<category><![CDATA[rsc]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[ruby social club]]></category>
		<category><![CDATA[runcoderun]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://tempe.st/?p=308</guid>
		<description><![CDATA[Last thursday MIKAMAI hosted a Ruby Social Club meeting. Here&#8217;s the slides for my presentation. Continous Integration For The Lazy ProgrammerView more presentations from intinig.]]></description>
			<content:encoded><![CDATA[	<p>Last thursday MIKAMAI hosted a Ruby Social Club meeting. Here&#8217;s the slides for my presentation. </p>
<div style="width:425px;text-align:left" id="__ss_3074998"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/intinig/continous-integration-for-the-lazy-programmer" title="Continous Integration For The Lazy Programmer">Continous Integration For The Lazy Programmer</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=continousintegrationforthelazyprogrammer-100204174823-phpapp02&#38;rel=0&#38;stripped_title=continous-integration-for-the-lazy-programmer" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=continousintegrationforthelazyprogrammer-100204174823-phpapp02&#38;rel=0&#38;stripped_title=continous-integration-for-the-lazy-programmer" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object><div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/intinig">intinig</a>.</div></div>

 ]]></content:encoded>
			<wfw:commentRss>http://tempe.st/2010/02/continous-integration-with-runcoderun/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Legacy Path Handler, a Radiant Extension</title>
		<link>http://tempe.st/2008/09/legacy-path-handler-a-radiant-extension/</link>
		<comments>http://tempe.st/2008/09/legacy-path-handler-a-radiant-extension/#comments</comments>
		<pubDate>Mon, 08 Sep 2008 23:42:58 +0000</pubDate>
		<dc:creator>Giovanni Intini</dc:creator>
				<category><![CDATA[Radiant]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[extensions]]></category>

		<guid isPermaLink="false">http://tempe.st/?p=245</guid>
		<description><![CDATA[We&#8217;re preparing to deploy the new Mikamai site (not up at the time of this post), that runs on the wonderful Rails-based RadiantCMS. The VPS we&#8217;re deploying to runs on Phusion Passenger, and that means we can&#8217;t use mod_alias or mod_rewrite to 301-redirect the old URLs, already indexed by Google, to their new locations. To [...]]]></description>
			<content:encoded><![CDATA[	<p>We&#8217;re preparing to deploy the new <a href="http://mikamai.com">Mikamai</a> site (not up at the time of this post), that runs on the wonderful Rails-based <a href="http://radiantcms.org">RadiantCMS</a>.</p>
	<p>The VPS we&#8217;re deploying to runs on <a href="http://modrails.com">Phusion Passenger</a>, and that means we can&#8217;t use mod_alias or mod_rewrite to 301-redirect the old URLs, already indexed by Google, to their new locations.</p>
	<p>To solve this problem I wrote a little Radiant Extension, called <a href="http://github.com/intinig/legacy_path_handler/tree/master">LegacyPathHandler</a>, that reads a simple list of URLs from a text file and does a 301 redirection on them before handling the control to Radiant&#8217;s default SiteController.</p>
	<p>It works quite fine for us, but it has no specs/tests or documentation. Please feel free to contribute to the project if you feel you can improve it.</p>

 ]]></content:encoded>
			<wfw:commentRss>http://tempe.st/2008/09/legacy-path-handler-a-radiant-extension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How I made Autotest RedGreen and Growl party together</title>
		<link>http://tempe.st/2008/05/how-i-made-autotest-redgreen-and-growl-party-together/</link>
		<comments>http://tempe.st/2008/05/how-i-made-autotest-redgreen-and-growl-party-together/#comments</comments>
		<pubDate>Sat, 31 May 2008 11:22:19 +0000</pubDate>
		<dc:creator>Giovanni Intini</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[autotest]]></category>
		<category><![CDATA[growl]]></category>
		<category><![CDATA[redgreen]]></category>

		<guid isPermaLink="false">http://tempe.st/?p=217</guid>
		<description><![CDATA[If you&#8217;re like me and like autotest as a sort of private continous integration system, and if you like pretty output, you will probably have used some kind of autotest + redgreen and/or growl. Unfortunately I had strange quirks in my growl notifications. Sometimes they worked, sometimes they didn&#8217;t (I was using the standard :ran_command [...]]]></description>
			<content:encoded><![CDATA[	<p>If you&#8217;re like me and like autotest as a sort of private continous integration system, and if you like pretty output, you will probably have used some kind of autotest + redgreen and/or growl.</p>
	<p>Unfortunately I had strange quirks in my growl notifications. Sometimes they worked, sometimes they didn&#8217;t (I was using the standard :ran_command autotest hook at the time), so I switched to the newer :red and :green hooks, and only worsened the problem. No matter what the test output was, I always got a green notification.</p>
	<p>I was able to trace the problem to the redgreen gem. Its colorized output wasn&#8217;t being recognized correctly by autotest and it kept thinking everything was ok.</p>
	<p>A little ruby fiddling and this is my new improved (and working!) .autotest file:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># -*- ruby -*-</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">module</span> <span style="color:#6666ff; font-weight:bold;">Autotest::RedGreen</span>
  Autotest.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:alias_method</span>, <span style="color:#ff3333; font-weight:bold;">:real_ruby</span>, <span style="color:#ff3333; font-weight:bold;">:ruby</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  Autotest.<span style="color:#9900CC;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:define_method</span>, <span style="color:#ff3333; font-weight:bold;">:ruby</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|*</span>args<span style="color:#006600; font-weight:bold;">|</span>
      real_ruby <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#006600; font-weight:bold;">%</span><span style="color:#006600; font-weight:bold;">&#91;</span> <span style="color:#006600; font-weight:bold;">-</span>rrubygems <span style="color:#006600; font-weight:bold;">-</span>e <span style="color:#996600;">&quot;require 'redgreen'&quot;</span> <span style="color:#006600; font-weight:bold;">&#93;</span> 
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Clean the output so other modules can work correctly</span>
  Autotest.<span style="color:#9900CC;">add_hook</span> <span style="color:#ff3333; font-weight:bold;">:ran_command</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>at<span style="color:#006600; font-weight:bold;">|</span>
    at.<span style="color:#9900CC;">results</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>r<span style="color:#006600; font-weight:bold;">|</span>
      r.<span style="color:#CC0066; font-weight:bold;">gsub!</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;<span style="color:#000099;">\0</span>33[31m&quot;</span>, <span style="color:#996600;">&quot;&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      r.<span style="color:#CC0066; font-weight:bold;">gsub!</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;<span style="color:#000099;">\0</span>33[32m&quot;</span>, <span style="color:#996600;">&quot;&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      r.<span style="color:#CC0066; font-weight:bold;">gsub!</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;<span style="color:#000099;">\0</span>33[33m&quot;</span>, <span style="color:#996600;">&quot;&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
      r.<span style="color:#CC0066; font-weight:bold;">gsub!</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;<span style="color:#000099;">\0</span>33[0m&quot;</span>, <span style="color:#996600;">&quot;&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</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;">module</span> <span style="color:#6666ff; font-weight:bold;">Autotest::Growl</span>
  AUTOTEST_IMAGE_ROOT = <span style="color:#996600;">&quot;~/.autotest_images&quot;</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">growl</span><span style="color:#006600; font-weight:bold;">&#40;</span>title, msg, img, pri=<span style="color:#006666;">0</span>, sticky=<span style="color:#996600;">&quot;&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#CC0066; font-weight:bold;">system</span> <span style="color:#996600;">&quot;growlnotify -n autotest --image #{img} -p #{pri} -m '#{msg.inspect} #{title}' #{sticky}&quot;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  Autotest.<span style="color:#9900CC;">add_hook</span> <span style="color:#ff3333; font-weight:bold;">:red</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>at<span style="color:#006600; font-weight:bold;">|</span>
    growl<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;FAIL&quot;</span>, <span style="color:#996600;">&quot;#{get_results(at)}&quot;</span>, <span style="color:#996600;">&quot;#{AUTOTEST_IMAGE_ROOT}/fail.png&quot;</span>, <span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  Autotest.<span style="color:#9900CC;">add_hook</span> <span style="color:#ff3333; font-weight:bold;">:green</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>at<span style="color:#006600; font-weight:bold;">|</span>
    growl<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Pass&quot;</span>, <span style="color:#996600;">&quot;#{get_results(at)}&quot;</span>, <span style="color:#996600;">&quot;#{AUTOTEST_IMAGE_ROOT}/pass.png&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  private
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">get_results</span><span style="color:#006600; font-weight:bold;">&#40;</span>at<span style="color:#006600; font-weight:bold;">&#41;</span>
    results = <span style="color:#006600; font-weight:bold;">&#91;</span>at.<span style="color:#9900CC;">results</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">flatten</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;<span style="color:#000099;">\n</span>&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
    <span style="color:#9966CC; font-weight:bold;">if</span> results.<span style="color:#9966CC; font-weight:bold;">include</span>? <span style="color:#996600;">'tests'</span>
      output = results.<span style="color:#9900CC;">slice</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span>\s<span style="color:#006600; font-weight:bold;">+</span>tests?,\s<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span>\s<span style="color:#006600; font-weight:bold;">+</span>assertions?,\s<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span>\s<span style="color:#006600; font-weight:bold;">+</span>failures?<span style="color:#006600; font-weight:bold;">&#40;</span>,\s<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span>\s<span style="color:#006600; font-weight:bold;">+</span>errors<span style="color:#006600; font-weight:bold;">&#41;</span>?<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">else</span>
      output = results.<span style="color:#9900CC;">slice</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span>\s<span style="color:#006600; font-weight:bold;">+</span>examples?,\s<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span>\s<span style="color:#006600; font-weight:bold;">+</span>failures?<span style="color:#006600; font-weight:bold;">&#40;</span>,\s<span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#40;</span>\d<span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#41;</span>\s<span style="color:#006600; font-weight:bold;">+</span><span style="color:#9966CC; font-weight:bold;">not</span> implemented<span style="color:#006600; font-weight:bold;">&#41;</span>?<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
    output
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Esclusioni</span>
Autotest.<span style="color:#9900CC;">add_hook</span> <span style="color:#ff3333; font-weight:bold;">:initialize</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>at<span style="color:#006600; font-weight:bold;">|</span>
  <span style="color:#006600; font-weight:bold;">%</span>w<span style="color:#006600; font-weight:bold;">&#123;</span>.<span style="color:#9900CC;">hg</span> .<span style="color:#9900CC;">git</span> .<span style="color:#9900CC;">svn</span> stories tmtags Rakefile Capfile README spec<span style="color:#006600; font-weight:bold;">/</span>spec.<span style="color:#9900CC;">opts</span> spec<span style="color:#006600; font-weight:bold;">/</span>rcov.<span style="color:#9900CC;">opts</span> vendor<span style="color:#006600; font-weight:bold;">/</span>gems autotest svn<span style="color:#006600; font-weight:bold;">-</span>commit .<span style="color:#9900CC;">DS_Store</span> <span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>exception<span style="color:#006600; font-weight:bold;">|</span>
    at.<span style="color:#9900CC;">add_exception</span><span style="color:#006600; font-weight:bold;">&#40;</span>exception<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  at.<span style="color:#9900CC;">add_mapping</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span>spec\<span style="color:#006600; font-weight:bold;">/</span>defaults.<span style="color:#9900CC;">rb</span><span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>f, _<span style="color:#006600; font-weight:bold;">|</span>
    at.<span style="color:#9900CC;">files_matching</span> <span style="color:#006600; font-weight:bold;">%</span>r<span style="color:#006600; font-weight:bold;">%</span>^spec<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#40;</span>controllers<span style="color:#006600; font-weight:bold;">|</span>helpers<span style="color:#006600; font-weight:bold;">|</span>lib<span style="color:#006600; font-weight:bold;">|</span>models<span style="color:#006600; font-weight:bold;">|</span>views<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#006600; font-weight:bold;">*</span>\.<span style="color:#9900CC;">rb</span>$<span style="color:#006600; font-weight:bold;">%</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

 
	<p>Our setup had apache as webserver so I don&#8217;t need any special code to restart the application. In addition to this recipe, made to deploy to production I also wrote a couple of tasks that shine during development. </p>
	<p>Drupal has the problem of storing most of the important stuff in the database, and if you do local development, showing the status of the work to your clients can be a chore. The following tasks allow you to easily dump the development db and import the dump to the staging server to show your progresses to your customers and allow testing the site:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># Callbacks</span>
before <span style="color:#996600;">'deploy:start'</span>, <span style="color:#996600;">'drupal:db:import:production'</span>
&nbsp;
before <span style="color:#996600;">'deploy:restart'</span>, <span style="color:#996600;">'mikamai:permissions:fix'</span>, <span style="color:#996600;">'mikamai:production:symlink'</span>, <span style="color:#996600;">'drupal:configure:production'</span>
before <span style="color:#996600;">'deploy:start'</span>, <span style="color:#996600;">'mikamai:permissions:fix'</span>, <span style="color:#996600;">'mikamai:production:symlink'</span>, <span style="color:#996600;">'drupal:configure:production'</span>
before <span style="color:#996600;">'deploy:cold'</span>, <span style="color:#996600;">'drupal:db:dump:development'</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># DB Stuff</span>
&nbsp;
set <span style="color:#ff3333; font-weight:bold;">:mysqldump</span>, <span style="color:#996600;">&quot;/opt/local/bin/mysqldump5&quot;</span> <span style="color:#008000; font-style:italic;"># your path to mysqldump</span>
<span style="color:#008000; font-style:italic;"># local db credentials</span>
set <span style="color:#ff3333; font-weight:bold;">:local_db_user</span>, <span style="color:#996600;">&quot;root&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:local_db_password</span>, <span style="color:#996600;">&quot;&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:local_db_name</span>, <span style="color:#996600;">&quot;database&quot;</span>
<span style="color:#008000; font-style:italic;"># remote db credentials</span>
set <span style="color:#ff3333; font-weight:bold;">:db_user</span>, <span style="color:#996600;">&quot;user&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:db_password</span>, <span style="color:#996600;">&quot;secret&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:db_name</span>, <span style="color:#996600;">&quot;database&quot;</span>
&nbsp;
namespace <span style="color:#ff3333; font-weight:bold;">:drupal</span> <span style="color:#9966CC; font-weight:bold;">do</span>
&nbsp;
  namespace <span style="color:#ff3333; font-weight:bold;">:configure</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    task <span style="color:#ff3333; font-weight:bold;">:production</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      sudo <span style="color:#996600;">&quot;cp #{latest_release}/sites/default/settings.production.php #{latest_release}/sites/default/settings.php&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    task <span style="color:#ff3333; font-weight:bold;">:development</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      sudo <span style="color:#996600;">&quot;cp #{latest_release}/sites/default/settings.development.php #{latest_release}/sites/default/settings.php&quot;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  namespace <span style="color:#ff3333; font-weight:bold;">:db</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    namespace <span style="color:#ff3333; font-weight:bold;">:dump</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      task <span style="color:#ff3333; font-weight:bold;">:development</span> <span style="color:#9966CC; font-weight:bold;">do</span>
        <span style="color:#CC0066; font-weight:bold;">raise</span> <span style="color:#CC00FF; font-weight:bold;">RuntimeError</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;failed dump&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">unless</span> <span style="color:#CC0066; font-weight:bold;">system</span> <span style="color:#996600;">&quot;#{mysqldump} -u #{local_db_user} --password=#{local_db_password} #{local_db_name} &gt; dump.sql&quot;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
    namespace <span style="color:#ff3333; font-weight:bold;">:import</span> <span style="color:#9966CC; font-weight:bold;">do</span>
      task <span style="color:#ff3333; font-weight:bold;">:production</span> <span style="color:#9966CC; font-weight:bold;">do</span>
        ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;FILES&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">&quot;dump.sql&quot;</span>
        deploy::upload
        run <span style="color:#996600;">&quot;mysql -u #{db_user} --password=#{db_password} #{db_name} &lt; #{latest_release}/dump.sql&quot;</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>



 ]]></content:encoded>
			<wfw:commentRss>http://tempe.st/2008/05/how-i-made-autotest-redgreen-and-growl-party-together/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How I worked with thirty amazing people and lived to tell: Stacktrace</title>
		<link>http://tempe.st/2007/12/how-i-worked-with-thirty-amazing-people-and-lived-to-tell-stacktrace/</link>
		<comments>http://tempe.st/2007/12/how-i-worked-with-thirty-amazing-people-and-lived-to-tell-stacktrace/#comments</comments>
		<pubDate>Sun, 16 Dec 2007 23:41:10 +0000</pubDate>
		<dc:creator>Giovanni Intini</dc:creator>
				<category><![CDATA[Italy]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Random Stuff]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Stacktrace]]></category>

		<guid isPermaLink="false">http://tempe.st/2007/12/how-i-worked-with-thirty-amazing-people-and-lived-to-tell-stacktrace/</guid>
		<description><![CDATA[I&#8217;ve had the pleasure of working with thirty brilliant techies for the launch of Stacktrace, an Italian website about technology in its various forms. Stacktrace was and idea of Antonio Cangiano. He felt that Italy missed an authoritative and original technology reference, and contacted about thirty of the best Italy has to offer, people I [...]]]></description>
			<content:encoded><![CDATA[	<p>I&#8217;ve had the pleasure of working with thirty brilliant techies for the launch of <a href="http://stacktrace.it">Stacktrace</a>, an Italian website about technology in its various forms.</p>
	<p>Stacktrace was and idea of <a href="http://antoniocangiano.com">Antonio Cangiano</a>. He felt that Italy missed an authoritative and original technology reference, and contacted about thirty of the best Italy has to offer, people I am very proud I could work with, to prepare the lightning quick launch of a wonderful site, full of original, well written and interesting content.</p>
	<p>If you can understand Italian, even a bit of it, I strongly suggest you check <a href="http://stacktrace.it">Stacktrace</a>. You&#8217;ll be glad you did.</p>

 ]]></content:encoded>
			<wfw:commentRss>http://tempe.st/2007/12/how-i-worked-with-thirty-amazing-people-and-lived-to-tell-stacktrace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A couple of capistrano 2 recipes libraries</title>
		<link>http://tempe.st/2007/09/a-couple-of-capistrano-2-recipes-libraries/</link>
		<comments>http://tempe.st/2007/09/a-couple-of-capistrano-2-recipes-libraries/#comments</comments>
		<pubDate>Thu, 20 Sep 2007 15:26:58 +0000</pubDate>
		<dc:creator>Giovanni Intini</dc:creator>
				<category><![CDATA[Capistrano]]></category>
		<category><![CDATA[Nimboo]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://tempe.st/2007/09/a-couple-of-capistrano-2-recipes-libraries/</guid>
		<description><![CDATA[I kept playing with Capistrano 2 after my last article, and I&#8217;ve refactored quite a bit my recipes, finally moving them in their own subversion repository. This allows much quicker deployment with my new rails applications. Here&#8217;s how I do it: $ rails my_new_application $ cd my_new_application $ capify . Then I edit Capfile: load [...]]]></description>
			<content:encoded><![CDATA[	<p>I kept playing with Capistrano 2 after my last article, and I&#8217;ve refactored quite a bit my recipes, finally moving them in their own subversion repository. This allows much quicker deployment with my new rails applications. Here&#8217;s how I do it:</p>
<pre>
$ rails my_new_application
$ cd my_new_application
$ capify .
</pre>
	<p>Then I edit <em>Capfile</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">load</span> <span style="color:#996600;">'deploy'</span> <span style="color:#9966CC; font-weight:bold;">if</span> respond_to?<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:namespace</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#008000; font-style:italic;"># cap2 differentiator</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">load</span> <span style="color:#996600;">'lib/recipes/site5'</span> <span style="color:#008000; font-style:italic;"># This is my site5 recipe</span>
<span style="color:#CC0066; font-weight:bold;">load</span> <span style="color:#996600;">'lib/recipes/medlar'</span> <span style="color:#008000; font-style:italic;"># The general use recipes</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">load</span> <span style="color:#996600;">'config/deploy'</span></pre></div></div>

	<p>The <em>site5</em> and <em>medlar</em> namespaces hold default configuration values, define some callbacks and the following tasks:</p>
<pre>
cap deploy:medlar:rails:freezer:edge   # Fetch Rails edge and puts it into sh...
cap deploy:medlar:rails:freezer:stable # Fetch Rails stable and puts it into ...
cap deploy:medlar:rails:link           # Links Rails to application/vendor
cap deploy:medlar:rails:update         # Updates the fetched version of rails.
	<p>cap deploy:site5:kill_dispatch_fcgi    # Kills Ruby instances on Site5<br />
cap deploy:site5:link_public_html      # Links public_html to current_path/pu...<br />
</pre></p>
	<p>Last but not least, here&#8217;s the simple, clean and elegant <em>deploy.rb</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">set <span style="color:#ff3333; font-weight:bold;">:application</span>, <span style="color:#996600;">&quot;my_new_application&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:user</span>, <span style="color:#996600;">&quot;the_username&quot;</span>
&nbsp;
set <span style="color:#ff3333; font-weight:bold;">:repository</span>,  <span style="color:#996600;">&quot;repo_address&quot;</span>
set <span style="color:#ff3333; font-weight:bold;">:deploy_to</span>, <span style="color:#996600;">&quot;/home/#{user}/apps/#{application}&quot;</span>
&nbsp;
role <span style="color:#ff3333; font-weight:bold;">:app</span>, <span style="color:#996600;">&quot;server.com&quot;</span>
role <span style="color:#ff3333; font-weight:bold;">:web</span>, <span style="color:#996600;">&quot;server.com&quot;</span>
role <span style="color:#ff3333; font-weight:bold;">:db</span>,  <span style="color:#996600;">&quot;server.com&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:primary</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span></pre></div></div>

	<p>Quite readable, isn&#8217;t it? <img src='http://tempe.st/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
	<p>The recipes are available via anonymous subversion: <a href="https://svn1.hosted-projects.com/medlar/recipes/">https://svn1.hosted-projects.com/medlar/recipes/</a></p>
	<p>Enjoy and let me know if you found them useful.</p>

 ]]></content:encoded>
			<wfw:commentRss>http://tempe.st/2007/09/a-couple-of-capistrano-2-recipes-libraries/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Rails and JavaScript: page.call gotchas</title>
		<link>http://tempe.st/2007/08/rails-and-javascript-pagecall-gotchas/</link>
		<comments>http://tempe.st/2007/08/rails-and-javascript-pagecall-gotchas/#comments</comments>
		<pubDate>Fri, 31 Aug 2007 13:38:17 +0000</pubDate>
		<dc:creator>Giovanni Intini</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Prototype.js]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://tempe.st/2007/08/rails-and-javascript-pagecall-gotchas/</guid>
		<description><![CDATA[Ruby on Rails has wonderful out of the box javascript support, but sometimes implementing dynamic user interfaces is not so easy as it seems. In an application I&#8217;m working on I have a list of people with a checkbox each. In the load event of the page I add a click handler to every checkbox [...]]]></description>
			<content:encoded><![CDATA[	<p>Ruby on Rails has wonderful out of the box javascript support, but sometimes implementing dynamic user interfaces is not so easy as it seems.</p>
	<p>In an application I&#8217;m working on I have a list of people with a checkbox each. In the load event of the page I add a click handler to every checkbox using this javascript code:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">  $$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.ConfermaInvitati'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>element<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    Event.<span style="color: #660066;">observe</span><span style="color: #009900;">&#40;</span>element<span style="color: #339933;">,</span> <span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</span> clickHandler<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// ... </span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> clickHandler<span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> e <span style="color: #339933;">=</span> Event.<span style="color: #660066;">element</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">new</span> Ajax.<span style="color: #660066;">Updater</span><span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">up</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'my/invited/toggle'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
    parameters<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> id<span style="color: #339933;">:</span> e.<span style="color: #660066;">up</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">up</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">id</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    onLoading<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> e.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;/images/admin/spinner.gif&quot;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    onSuccess<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #003366; font-weight: bold;">new</span> Ajax.<span style="color: #660066;">Request</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'my/refresh'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
<span style="color: #009900;">&#125;</span></pre></div></div>

	<p>This works fine until I add a new person via an Ajax call. That person won&#8217;t have a <em>clickHandler</em> because the element wasn&#8217;t on the page when I called the click handler. So I thought it was time to test <em>page.call</em> in the  <em>render :update</em> block I had in the rails application.</p>
	<p>I tried this code:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">render <span style="color:#ff3333; font-weight:bold;">:update</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>page<span style="color:#006600; font-weight:bold;">|</span>
  <span style="color:#008000; font-style:italic;"># Do stuff that creates the new objects and adds it to the page</span>
  <span style="color:#008000; font-style:italic;"># The data I need is in @invited</span>
  page.<span style="color:#9900CC;">call</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Event.observe($$('##{@invited.permalink} .ConfermaInvitati').first()), 'click', clickHandler)&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

	<p>Obviously that didn&#8217;t work, and it turned out I have to read documentation before doing fancy things <img src='http://tempe.st/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
	<p>The rails docs told me that I had to use <em>call</em> passing the function name as the first argument and an array of parameters as the second argument, the problem is that <em>call</em> turns all the parameters into strings&#8212;this means I could not pass the <em>clickHandler</em> function to <em>Event.observe</em>. </p>
	<p>I found the solution in <em><<</em>. If you do <em>page << "foo"</em>, foo will be evaluated as raw javascripts. This meant I was able to do</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">page <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#996600;">&quot;Event.observe($$('##{@invited.permalink} .ConfermaInvitati').first()), 'click', clickHandler)</span></pre></div></div>

	<p>and finally have the functionality I was looking for. So remember, don&#8217;t <em>page.call</em> if you need to pass javascript variables to your functions.</p>

 ]]></content:encoded>
			<wfw:commentRss>http://tempe.st/2007/08/rails-and-javascript-pagecall-gotchas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sudoless Rails Stack on OSX</title>
		<link>http://tempe.st/2007/08/sudoless-rails-stack-on-osx/</link>
		<comments>http://tempe.st/2007/08/sudoless-rails-stack-on-osx/#comments</comments>
		<pubDate>Tue, 28 Aug 2007 08:38:02 +0000</pubDate>
		<dc:creator>Giovanni Intini</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://tempe.st/2007/08/sudoless-rails-stack-on-osx/</guid>
		<description><![CDATA[More and more of my developer friends are switching to OSX as time goes by, and they keep asking me for directions on the best setup for rails development: how to install ruby, how to install the missing libraries, and so on. My professional development life started on a PB Titanium running OSX 10.2, and [...]]]></description>
			<content:encoded><![CDATA[	<p>More and more of my developer friends are switching to OSX as time goes by, and they keep asking me for directions on the best setup for rails development: how to install ruby, how to install the missing libraries, and so on.</p>
	<p>My professional development life started on a PB Titanium running OSX 10.2, and continued through a PB Aluminium and a Macbook Pro. Each time I changed laptop I also reinstalled everything again, and each time I tried to come up with a better setup. </p>
	<p>Now I&#8217;ve finally found a setup I&#8217;m comfortable with, and it has the following advantages:</p>
	<ul>
		<li>Sudoless: everything runs from my user directory</li>
		<li>Non-system-tampering: doesn&#8217;t touch files in the original osx installation</li>
		<li>Crash-proof-easy-reinstall: you can just delete everything and reinstall without fear of rendering your system unstable</li>
		<li>Fink based: uses everything it can use from the fink repositories</li>
	</ul>
	<p>Now that I&#8217;ve sold you on my setup <img src='http://tempe.st/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  it&#8217;s time to explain how to implement it. </p>
	<h3>Step one: XCode and Developer Tools</h3>
	<p>If you don&#8217;t have XCode already installed you can install it from the disks you got with your Mac or, better, download the newest version from <a href="http://connect.apple.com">Apple Developer Connection</a>. Once you got it installed you can proceed to the next step.</p>
	<h3>Step two: Fink</h3>
	<p>Go to the <a href="http://www.finkproject.org/download/index.php?phpLang=en">Fink Download Page</a>, and get the package that works best on your Mac (intel or powerpc). Follow the installation instructions and install the base fink system. After you&#8217;ve done that add these lines to your <em><sub>/.profile</em></p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;"># Dev Enviroment
&nbsp;
LDFLAGS=-L/sw/lib
export LDFLAGS
&nbsp;
CPPFLAGS='-I/Users/your_username/unix/include -I/sw/include'
export CPPFLAGS</pre></div></div>

	<p>_/Users/your_username/unix/include_ doesn&#8217;t exist yet, but we&#8217;ll create it when installing ruby.</p>
	<h3>Step three: Ruby from Sources</h3>
	<p>This is the first tricky part. Before OSX 10.4.6 the Ruby version shipped by Apple didn&#8217;t work with rails, so you were on your own. Now it works, but I prefer to have ruby in my home directory so I can mess with the sources and with the gem files and upgrade painlessly. So <a href="http://www.ruby-lang.org/en/downloads">download the latest ruby</a> sources and unpack them wherever you wish (I like <em></sub>/src</em>).</p>
	<p>Now you&#8217;re ready to go. First make sure you have readline and readline5-shlibs installed via fink so you can have a comfortable irb environment:</p>
<pre>
user$ fink install readline readline5-shlibs
</pre> 
	<p>After that it&#8217;s time for ruby:</p>
<pre>
user$ cd &lt;sub&gt;/src/ruby-1.8.6
user$ ./configure &lt;del&gt;-prefix=/Users/your_username/unix
user$ make &#38;&#38; make install
</pre>
	<p>The whole magic (and it&#8217;s not a big magic btw) is in <em></del>-prefix</em>. Installing ruby will create the /Users/your_username/unix path. Now it&#8217; time to add the <em>unix</em> dir to $PATH. Edit <em></sub>/profile</em> once again and add these lines:</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">PATH=/Users/your_username/unix/bin:/usr/local/mysql/bin:/usr/local/sbin:$PATH
export PATH</pre></div></div>

	<h3>Step four: MySQL</h3>
	<p>Quite simple with the packages from <a href="http://mysql.com">mysql.com</a>.</p>
	<h3>Step five: Last but not least, rubygems</h3>
	<p>Fetch the gem package from <a href="http://rubyforge.org/frs/?group_id=126">RubyForge</a> and install it:</p>
<pre>
user$ cd src/unpacked-rubygems-directory
user$ ruby setup.rb
</pre>
	<h3>Step six: This is the real last step <img src='http://tempe.st/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  &#8211; Rails and a little hack</h3>
	<p>Now you&#8217;re free to install rails (and friends) using</p>
<pre>
user$ gem install rails --include-dependencies
user$ gem install mysql-ruby
user$ gem install capistrano --include-dependencies
user$ gem install mongrel --include-dependencies
</pre>
	<p>The small hack I was talking about is a symlink:</p>
<pre>
user$ sudo mv /usr/bin/ruby /usr/bin/ruby-apple
user$ sudo ln -s /Users/your_username/unix/bin/ruby /usr/bin/ruby
</pre>
	<p>This way applications that insist on using <em>/usr/bin/ruby</em> (TextMate&#8217;s RubyMate for example) will work fine. </p>
	<p>Have fun with your self-made rails stack <img src='http://tempe.st/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

 ]]></content:encoded>
			<wfw:commentRss>http://tempe.st/2007/08/sudoless-rails-stack-on-osx/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Capistrano 2 Callbacks</title>
		<link>http://tempe.st/2007/08/capistrano-2-callbacks/</link>
		<comments>http://tempe.st/2007/08/capistrano-2-callbacks/#comments</comments>
		<pubDate>Fri, 24 Aug 2007 09:09:28 +0000</pubDate>
		<dc:creator>Giovanni Intini</dc:creator>
				<category><![CDATA[Capistrano]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://tempe.st/2007/08/capistrano-2-callbacks/</guid>
		<description><![CDATA[Converting the callbacks in my cap recipes to the new capistrano 2 format wasn&#8217;t as easy as I thought it would be. It turned out I had to use fully qualified task names in the after callback instead of the non-namespaced-names. Here&#8217;s a sample of working callbacks: namespace :deploy do after &#34;deploy:setup&#34;, &#34;deploy:sposivip:create_galleries&#34;, &#34;deploy:sposivip:freeze_rails&#34; after [...]]]></description>
			<content:encoded><![CDATA[	<p>Converting the callbacks in my cap recipes to the new capistrano 2 format wasn&#8217;t as easy as I thought it would be. It turned out I had to use fully qualified task names in the after callback instead of the non-namespaced-names.</p>
	<p>Here&#8217;s a sample of working callbacks:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">namespace <span style="color:#ff3333; font-weight:bold;">:deploy</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  after <span style="color:#996600;">&quot;deploy:setup&quot;</span>, <span style="color:#996600;">&quot;deploy:sposivip:create_galleries&quot;</span>, <span style="color:#996600;">&quot;deploy:sposivip:freeze_rails&quot;</span>
  after <span style="color:#996600;">&quot;deploy:update&quot;</span>, <span style="color:#996600;">&quot;deploy:site5:link_public_html&quot;</span>, <span style="color:#996600;">&quot;deploy:sposivip:link_rails&quot;</span>, <span style="color:#996600;">&quot;deploy:sposivip:link_galleries&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

	<p>Here I have two callbacks. The first one runs after setup, creating shared paths and freezing rails in the shared directory, so I avoid having a copy on rails in each release.</p>
	<p>The second callback runs after deploy:update, so it will be called whenever I do a simple deploy or a cold deploy, it links back various directories in the shared path and it links the shared rails in vendor.</p>

 ]]></content:encoded>
			<wfw:commentRss>http://tempe.st/2007/08/capistrano-2-callbacks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cookies in Ruby on Rails. You can&#8217;t store Arrays in there</title>
		<link>http://tempe.st/2007/06/cookies-in-ruby-on-rails-you-cant-store-arrays-in-there/</link>
		<comments>http://tempe.st/2007/06/cookies-in-ruby-on-rails-you-cant-store-arrays-in-there/#comments</comments>
		<pubDate>Fri, 08 Jun 2007 07:54:07 +0000</pubDate>
		<dc:creator>Giovanni Intini</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://tempe.st/2007/06/cookies-in-ruby-on-rails-you-cant-store-arrays-in-there/</guid>
		<description><![CDATA[Yesterday I decide to implement a simple feature in iccfriends that allow people to track who is already their friend, but I didn&#8217;t want to use the db so I opted for local storage and went with a cookie. I read the rails docs about the cookies method and decided to give it a try [...]]]></description>
			<content:encoded><![CDATA[	<p>Yesterday I decide to implement a simple feature in <a href="http://iccfriends.net">iccfriends</a> that allow people to track who is already their friend, but I didn&#8217;t want to use the db so I opted for local storage and went with a cookie.</p>
	<p>I read the rails docs about the cookies method and decided to give it a try with this code:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> foo
  <span style="color:#9966CC; font-weight:bold;">if</span> cookies<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:friends</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">blank</span>?
    cookies<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:friends</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#006600; font-weight:bold;">&#91;</span>params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:id</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
  <span style="color:#9966CC; font-weight:bold;">else</span>
    cookies<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:friends</span><span style="color:#006600; font-weight:bold;">&#93;</span> = cookies<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:friends</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:id</span><span style="color:#006600; font-weight:bold;">&#93;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

	<p>It seemed to work correctly but the Array was converted to a String before going in the cookie. This is where my cookie ignorance showed as I tried again and again to store an Array in it, to no avail.</p>
	<p>After googling around for a little while I discovered there was no way I could store an object in the cookie without some sort of serialization, so I had to use good old Array#join and String#split.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> bar_write
  <span style="color:#9966CC; font-weight:bold;">if</span> cookies<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:friends</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">blank</span>?
    cookies<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:friends</span><span style="color:#006600; font-weight:bold;">&#93;</span> = params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:id</span><span style="color:#006600; font-weight:bold;">&#93;</span>
  <span style="color:#9966CC; font-weight:bold;">else</span>
    cookies<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:friends</span><span style="color:#006600; font-weight:bold;">&#93;</span> = cookies<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:friends</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#996600;">&quot;,#{params[:id]}&quot;</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> bar_read
  <span style="color:#0066ff; font-weight:bold;">@var</span> = cookies<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:friends</span><span style="color:#006600; font-weight:bold;">&#93;</span> ? cookies<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:friends</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;,&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">||</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>



 ]]></content:encoded>
			<wfw:commentRss>http://tempe.st/2007/06/cookies-in-ruby-on-rails-you-cant-store-arrays-in-there/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
