<?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>catapult-creative.com &#187; remember-tip</title>
	<atom:link href="http://www.catapult-creative.com/tag/remember-tip/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.catapult-creative.com</link>
	<description>worldwide (web) whatnot</description>
	<lastBuildDate>Wed, 18 Aug 2010 13:33:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Make ruby-debug work better</title>
		<link>http://www.catapult-creative.com/2009/08/12/make-ruby-debug-work-better/</link>
		<comments>http://www.catapult-creative.com/2009/08/12/make-ruby-debug-work-better/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 16:18:50 +0000</pubDate>
		<dc:creator>Trevor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CodeDunce]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[remember-tip]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.catapult-creative.com/2009/08/12/end-some-of-the-pain-with-ruby-debug/</guid>
		<description><![CDATA[If you&#8217;ve written Ruby, chances are you&#8217;ve had to use ruby-debug.  You might&#8217;ve thought the experience sucked &#8212; especially the fact that the debugger defaults to a mode in which you have to use a keyword to get it to evaluate a statement.  Lost? Here&#8217;s what I mean:

Say you start the debugger here:

12result [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve written Ruby, chances are you&#8217;ve had to use <a href="http://rubyforge.org/projects/ruby-debug/">ruby-debug</a>.  You might&#8217;ve thought the experience sucked &#8212; especially the fact that the debugger defaults to a mode in which you have to use a keyword to get it to evaluate a statement.  Lost? Here&#8217;s what I mean:</p>

<p>Say you start the debugger here:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">result = resource[xml_obj.api_call_string].get<br />
(rdb:1)</div></td></tr></tbody></table></div>

<p>Then you want to take a look at the &#8220;xml_obj&#8221; variable.  If this were (for instance) <a href="http://docs.python.org/library/pdb.html">Python&#8217;s pdb</a>, we&#8217;d just type &#8220;xml_obj&#8221; and hit return and be done with it.  Not so in ruby-debug:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">(rdb:1) xml_obj.api_call_string<br />
*** Unknown command: &quot;xml_obj.api_call_string&quot;. &nbsp;Try &quot;help&quot;.</div></td></tr></tbody></table></div>

<p>This is because with default settings, the debugger needs a keyword (&#8217;p') to get it to actually evaluate your statement as Ruby and not a command to the debugger itself:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">(rdb:1) p xml_obj.api_call_string<br />
&quot;documentService/documentsByCommunity&quot;</div></td></tr></tbody></table></div>

<p>That gets really tedious, really fast.  The debugger&#8217;s help function (&#8217;help p&#8217;) will helpfully tell you that this is because the &#8220;autoeval&#8221; option is not enabled.  If you&#8217;re thick like me, you won&#8217;t see this and you&#8217;ll just continue doing &#8220;p &lt;whatever&gt;&#8221; until you get so frustrated you drop what you&#8217;re doing one day and go hunt down a fix.</p>

<p>Here is that fix from inside your code:</p>

<div class="codecolorer-container ruby blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br /></div></td><td><div class="ruby codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw3">require</span> <span class="st0">'ruby-debug'</span><br />
Debugger.<span class="me1">settings</span><span class="br0">&#91;</span><span class="re3">:autoeval</span><span class="br0">&#93;</span> = <span class="kw2">true</span></div></td></tr></tbody></table></div>

<p>You can also do this inside the debugger:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">(rdb:1) set autoeval<br />
autoeval is on.</div></td></tr></tbody></table></div>

<h3>Rails already does it via Rack middleware</h3>

<p>You might be wondering why the debugging experience is different in Rails than in Ruby you&#8217;ve written elsewhere.  I did too &#8212; remembering that this &#8216;p&#8217; business isn&#8217;t necessary when I run the debugger as an option when I start up Mongrel in a Rails app.  So I went digging for the code that Rails uses to set this stuff up.  Those settings come from a piece of Rack middleware that lives in <strong>lib/rails/rack/debugger.rb</strong>.  Here&#8217;s the class definition:</p>

<div class="codecolorer-container ruby blackboard" style="overflow:auto;white-space:nowrap;width:620px;height:300px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br /></div></td><td><div class="ruby codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw1">module</span> Rails<br />
&nbsp; <span class="kw1">module</span> Rack<br />
&nbsp; &nbsp; <span class="kw1">class</span> Debugger<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">def</span> initialize<span class="br0">&#40;</span>app<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re1">@app</span> = app<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; require_library_or_gem <span class="st0">'ruby-debug'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ::Debugger.<span class="me1">start</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ::Debugger.<span class="me1">settings</span><span class="br0">&#91;</span><span class="re3">:autoeval</span><span class="br0">&#93;</span> = <span class="kw2">true</span> <span class="kw1">if</span> ::Debugger.<span class="me1">respond_to</span>?<span class="br0">&#40;</span><span class="re3">:settings</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">puts</span> <span class="st0">&quot;=&gt; Debugger enabled&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">rescue</span> <span class="kw4">Exception</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">puts</span> <span class="st0">&quot;You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">exit</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">end</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">def</span> call<span class="br0">&#40;</span>env<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re1">@app</span>.<span class="me1">call</span><span class="br0">&#40;</span>env<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">end</span><br />
&nbsp; &nbsp; <span class="kw1">end</span><br />
&nbsp; <span class="kw1">end</span><br />
<span class="kw1">end</span></div></td></tr></tbody></table></div>

<p>For more info on how Rails uses Rack, this is a pretty <a href="http://guides.rubyonrails.org/rails_on_rack.html">handy page</a> from the Rails guides.</p>]]></content:encoded>
			<wfw:commentRss>http://www.catapult-creative.com/2009/08/12/make-ruby-debug-work-better/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Adding a source/repo to RubyGems</title>
		<link>http://www.catapult-creative.com/2009/03/10/adding-a-sourcerepo-to-rubygems/</link>
		<comments>http://www.catapult-creative.com/2009/03/10/adding-a-sourcerepo-to-rubygems/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 20:13:00 +0000</pubDate>
		<dc:creator>Trevor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[remember-tip]]></category>

		<guid isPermaLink="false">tag:www.catapult-creative.com,2009-03-10:94</guid>
		<description><![CDATA[Just because I can never remember this, here&#8217;s how to get a new repo source registered in RubyGems &#8211; you use the &#8220;sources&#8221; command &#8212; as in this piece for registering GitHub as a source for gems:



gem sources -a http://gems.github.com



There.  Now I won&#8217;t forget the damn command anymore.  Or if I do, it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Just because I can never remember this, here&#8217;s how to get a new repo source registered in <a href="http://www.rubygems.org/" title="RubyGems Manuals">RubyGems</a> &ndash; you use the &#8220;sources&#8221; command &#8212; as in this piece for registering <a href="http://github.com/" title="Secure source code hosting and collaborative development - GitHub">GitHub</a> as a source for gems:</p>

<p>

<pre>gem sources -a http://gems.github.com</pre>

</p>

<p>There.  Now I won&#8217;t forget the damn command anymore.  Or if I do, it&#8217;s here in my other brain&#8230;</p>]]></content:encoded>
			<wfw:commentRss>http://www.catapult-creative.com/2009/03/10/adding-a-sourcerepo-to-rubygems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Rails on CentOS 5</title>
		<link>http://www.catapult-creative.com/2009/02/04/installing-rails-on-centos-5/</link>
		<comments>http://www.catapult-creative.com/2009/02/04/installing-rails-on-centos-5/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 19:31:00 +0000</pubDate>
		<dc:creator>Trevor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[remember-tip]]></category>

		<guid isPermaLink="false">tag:www.catapult-creative.com,2009-02-04:91</guid>
		<description><![CDATA[Note: Since this post originally went up, some of the packages have changed/updated.  I&#8217;ve kept things pretty well up-to-date, but you might want to double check the latest versions and alter the bash commands accordingly.  Be aware that as of this writing, the Ruby team has made 1.9.1 the latest stable and only [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>Note:</strong> Since this post originally went up, some of the packages have changed/updated.  I&#8217;ve kept things pretty well up-to-date, but you might want to double check the latest versions and alter the bash commands accordingly.  Be aware that as of this writing, the Ruby team has made 1.9.1 the latest stable and only Rails itself is deemed compatible with Ruby 1.9x.  I.e., Rails passes all its own tests on 1.9.1, but most plugins, libraries, etc are likely to give you problems right now.  So your best bet is to use 1.8.7 for awhile until your favorite libraries jump on board the 1.9 wagon. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8211;Trevor (August 17, 2009)</em></p>


<p>I recently had to roll a new VM for work in order to run <a href="http://rubyonrails.org/" title="Ruby on Rails">Rails</a> and <a href="http://www.sinatrarb.com/" title="Sinatra">Sinatra</a> apps on <a href="http://www.modrails.com/" title="Overview &amp;#x2014; Phusion Passenger&amp;trade; (a.k.a. mod_rails / mod_rack)">Apache/Passenger</a>.  My company favors CentOS as the default distro for all our boxes, so I wasn&#8217;t able to use all the super-up-to-date packages that Ubuntu makes available, and I ended up building everything from source.  For posterity and for anyone else who needs it, here&#8217;s a list of what to do and how to do it.</p>

<h3>Dependencies</h3>

<p>You&#8217;ll need several libraries and the MySQL server, and you can use yum to install them all at once.  This set includes the gcc compiler, the gcc-c++ compiler, and the zlib development headers for Ruby.  <strong>Remember:</strong> not all libraries are the same &#8212; you&#8217;re going to need to make sure that you&#8217;re compiling Ruby w/ 32 or 64-bit development headers as appropriate for your architecture.</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">sudo yum install httpd-devel\<br />
&nbsp; openssl-devel\<br />
&nbsp; zlib-devel\<br />
&nbsp; gcc\ <br />
&nbsp; gcc-c++\ <br />
&nbsp; curl-devel\ <br />
&nbsp; expat-devel\ <br />
&nbsp; gettext-devel\ <br />
&nbsp; mysql-server\ <br />
&nbsp; mysql-devel</div></td></tr></tbody></table></div>

<h3>Ruby</h3>

<p>Next up is Ruby.  We&#8217;ll install 1.8.7-p72, the latest stable as of this writing.  First, we&#8217;ll make a &#8220;src&#8221; directory in /usr/local to hold everything:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">sudo mkdir /usr/local/src<br />
&nbsp; cd /usr/local/src<br />
&nbsp; sudo curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz<br />
&nbsp; sudo tar xzvf ruby-1.8.7-p72.tar.gz<br />
&nbsp; cd ruby-1.8.7-p72<br />
&nbsp; sudo ./configure --enable-shared --enable-pthread<br />
&nbsp; sudo make<br />
&nbsp; sudo make install</div></td></tr></tbody></table></div>

<p>Ok now for a weird thing &#8212; you need to remake and re-install Ruby after using it to run a script that helps you make a new makefile.  This is so that you can tell it where the zlib headers live:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">cd ext/zlib<br />
&nbsp; ruby extconf.rb --with-zlib-include=/usr/include --with-zlib-lib=/usr/lib<br />
&nbsp; cd ../../<br />
&nbsp; sudo make<br />
&nbsp; sudo make install</div></td></tr></tbody></table></div>

<p>After all that happens, you should have Ruby installed.  Check and see by doing:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">ruby --version</div></td></tr></tbody></table></div>

<p>You should see something like:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux]</div></td></tr></tbody></table></div>

<h3>Rubygems</h3>

<p>Now that you have Ruby installed, Rubygems is easy &#8212; the whole thing is in Ruby so there&#8217;s nothing to build/compile.</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">cd /usr/local/src<br />
&nbsp; sudo wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz<br />
&nbsp; sudo tar xzvf rubygems-1.3.5.tgz<br />
&nbsp; cd rubygems-1.3.5<br />
&nbsp; sudo ruby setup.rb</div></td></tr></tbody></table></div>

<h3>Rails, Passenger, MySQL and Sinatra</h3>

<p>Now that Ruby and Rubygems are installed, you can install Rails, Passenger, and Sinatra as gems:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">sudo gem install rails passenger sinatra</div></td></tr></tbody></table></div>

<p>That will take awhile, as there&#8217;s a ton of documentation to build for Rails, and Passenger has to compile some native extensions.</p>

<p>Once that&#8217;s done, finish the Passenger installation with their nifty installer tool:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">sudo passenger-install-apache2-module</div></td></tr></tbody></table></div>

<p>Follow the provided instructions at the end of the installer for adding lines to httpd.conf:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so<br />
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.6<br />
PassengerRuby /usr/local/bin/ruby</div></td></tr></tbody></table></div>

<p>After that, install the MySQL gem, making sure to specify where the config is:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">sudo gem install mysql -- --with-mysql-config=/usr/bin/mysql_config</div></td></tr></tbody></table></div>

<h3>Disabling <span class="caps">SEL</span>inux</h3>

<p>The RedHat family of distros (RHEL, CentOS, Fedora) come with <span class="caps">SEL</span>inux enabled by default.  If you want to learn how to make it work with Passenger, you can try <a href="http://www.modrails.com/documentation/Users%20guide.html#_the_apache_error_log_says_that_the_spawn_manager_script_does_not_exist_or_that_it_does_not_have_permission_to_execute_it" title="Phusion Passenger users guide">this tip</a> from the Passenger user&#8217;s guide.  I just turned it off because the box is only going to be used for these apps, and <span class="caps">SEL</span>inux seems like overkill.  Here&#8217;s how to shut it down:</p>

<p>First, disable it temporarily:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">sudo echo 0 &gt;/selinux/enforce</div></td></tr></tbody></table></div>

<p>That&#8217;s not a permanent fix though, because the next time the server boots, it&#8217;ll be turned back on again.  You need to edit the config file and turn it off.  Open it with your favorite editor and change one line.  You need to be root or running as sudo to edit this file, and I prefer Vim when on remote servers, so it&#8217;s:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">sudo vim /etc/sysconfig/selinux</div></td></tr></tbody></table></div>

<p>Change this:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">SELINUX=enforcing</div></td></tr></tbody></table></div>

<p>to this:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">SELINUX=disabled</div></td></tr></tbody></table></div>

<h3>Restart Apache</h3>

<p>You should be able to restart Apache now and have Passenger come up no problem.  There are several ways to restart Apache, but I like to use the service way to keep it simple:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">sudo /sbin/service httpd restart</div></td></tr></tbody></table></div>

<h3>Optional: Installing Git </h3>

<p>For <span class="caps">SCM, </span>there are a lot of reasons why I like <a href="http://git-scm.com/" title="Git - Fast Version Control System">Git</a> better than Subversion.  It&#8217;s got a bit of a learning curve, but once you go Git, you never go back.</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">cd /usr/local/src<br />
curl -O http://www.kernel.org/pub/software/scm/git/git-1.6.0.4.tar.gz<br />
tar zxf git-1.6.0.4.tar.gz<br />
cd git-1.6.0.4<br />
sudo make all<br />
sudo make install</div></td></tr></tbody></table></div>

<p>And the man pages:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">cd /usr/local/src <br />
curl -O http://www.kernel.org/pub/software/scm/git/git-manpages-1.6.0.4.tar.gz<br />
cd /usr/local/share/man<br />
tar -zxf /usr/local/src/git-manpages-1.6.0.4.tar.gz</div></td></tr></tbody></table></div>

<p>Now you should have Git installed and ready.  Prove it:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">git --version</div></td></tr></tbody></table></div>

<p>You should see something like:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">git version 1.6.0.4</div></td></tr></tbody></table></div>

<p>And that&#8217;s it &#8212; you now have a full Ruby stack ready to go on CentOS 5.  Much of this tutorial was adapted from the awesome <a href="http://hivelogic.com/articles/2008/02/ruby-rails-leopard" title="Hivelogic - Installing Ruby, Rubygems, Rails, and Mongrel on Mac OS X 10.5 (Leopard)">Hivelogic post</a> on installing the stack on OS X Leopard.</p>]]></content:encoded>
			<wfw:commentRss>http://www.catapult-creative.com/2009/02/04/installing-rails-on-centos-5/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>Profile your Rails RSpec and find your slow tests fast</title>
		<link>http://www.catapult-creative.com/2008/07/18/profile-your-rails-rspec-and-find-your-slow-tests-fast/</link>
		<comments>http://www.catapult-creative.com/2008/07/18/profile-your-rails-rspec-and-find-your-slow-tests-fast/#comments</comments>
		<pubDate>Fri, 18 Jul 2008 17:08:00 +0000</pubDate>
		<dc:creator>Trevor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CodeDunce]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[remember-tip]]></category>
		<category><![CDATA[RSpec]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">tag:www.catapult-creative.com,2008-07-18:69</guid>
		<description><![CDATA[Long-as-hell Ruby on Rails RSpec test running times are making you ask &#8220;what the deuce?&#8221;  Specs are taking way too long to run, but the prospect of looking through them all one at a time to find offending external dependencies, net calls that should be mocked, etc is driving you to drink. You just [...]]]></description>
			<content:encoded><![CDATA[<p>Long-as-hell Ruby on Rails RSpec test running times are making you ask &#8220;what the deuce?&#8221;  Specs are taking way too long to run, but the prospect of looking through them all one at a time to find offending external dependencies, net calls that should be mocked, etc is driving you to drink. You just want a read-out of the tests that are taking the longest so you can refactor <span class="caps">ASAP.</span></p>

<p>Sound familiar?</p>

<p>I was in this boat until I found out about the profiling command:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">$&gt;spec spec -f profile</div></td></tr></tbody></table></div>

<p>The double &#8220;spec&#8221; here can be a bit confusing.  The first is the command, and the second is the directory (RAILS_ROOT/spec) that you&#8217;re running it on.  The -f is the format flag.  You can see a list of all formats with:</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;width:620px"><table cellspacing="0" cellpadding="0"><tbody><tr><td class="line-numbers"><div>1<br /></div></td><td><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">$&gt;spec --help</div></td></tr></tbody></table></div>

<p>Basically you&#8217;re just passing the &#8220;profile&#8221; argument to the formatting command.  It gives you a readout of the 10 most time-intensive specs at the top and then a nicely verbose list of all pending and failed tests.  Using this list, I was able to go straight to the most obnoxious offenders and eliminate the external dependencies (these specs happened to be fetching feeds) that were slowing my test suite down.  In less than 15 minutes, I had chopped my execution time down to 10% of what it was before I started.</p>

<p>Huzzah!</p>]]></content:encoded>
			<wfw:commentRss>http://www.catapult-creative.com/2008/07/18/profile-your-rails-rspec-and-find-your-slow-tests-fast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
