<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Robby on Rails: Tag rak</title>
    <link>http://www.robbyonrails.com/articles/tag/rak</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>thoughts.sort_by{|t| t[:topic]}.collect </description>
    <item>
      <title>Get to Know a Gem: Rak</title>
      <description>&lt;p&gt;A few months ago, I posted about an article that showed you &lt;a href="http://www.robbyonrails.com/articles/2007/10/06/spice-up-your-terminal-with-colored-grep-pattern-results"&gt;how to colorize your grep search results&lt;/a&gt;. Since then, I&amp;#8217;ve heard people talking about &lt;a href="http://petdance.com/ack/"&gt;ack&lt;/a&gt;, which describes itself as&amp;#8230;&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;&amp;#8220;a tool like grep, aimed at programmers with large trees of heterogeneous source code.&amp;#8221;&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;It&amp;#8217;s written in Perl, which is fine and dandy&amp;#8230; but before I installed it, I heard that there was a Ruby version named &lt;a href="http://rak.rubyforge.org/"&gt;rak&lt;/a&gt;, which describes itself as&amp;#8230;&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;&amp;#8220;a grep replacement in pure Ruby. It accepts Ruby syntax regular expressions and automatically recurses directories, skipping .svn/, .cvs/, pkg/ and more things you don&amp;#8217;t care about. &amp;#8220;&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;Sounds great. Let&amp;#8217;s see what this thing can do.&lt;/p&gt;


	&lt;h2&gt;Installing rak&lt;/h2&gt;


	&lt;p&gt;Daniel Lucraft, the author of rak, was kind enough to package it up as a Rubygem. So, all we have to do is install it via &lt;code&gt;gem install rak&lt;/code&gt;.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
   &amp;gt; sudo gem install rak                                                                                                                                                                                                     
  Password:
  Bulk updating Gem source index for: http://gems.rubyforge.org
  Successfully installed rak-0.8.0
  Installing ri documentation for rak-0.8.0...
  Installing RDoc documentation for rak-0.8.0...
  ~ &amp;gt;
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Great, let&amp;#8217;s move on.&lt;/p&gt;


	&lt;h2&gt;Using rak&lt;/h2&gt;


	&lt;p&gt;Now that it&amp;#8217;s installed, we can use Rak by typing &lt;code&gt;rak&lt;/code&gt; from the command line. You&amp;#8217;d typically want to run this from within the root of your application.&lt;/p&gt;


	&lt;p&gt;For example, basic usage would look like the following.&lt;/p&gt;


&lt;code&gt;$ rak search-pattern&lt;/code&gt;

	&lt;p&gt;In my first test, I ran &lt;code&gt;rak README&lt;/code&gt;.&lt;/p&gt;


	&lt;p&gt;&lt;img src="http://myskitch.com/robbyrussell/rak_output_1-20071211-083456.jpg" alt="" /&gt;&lt;/p&gt;


	&lt;p&gt;Immediately, I see a greater advantage to &lt;code&gt;rak&lt;/code&gt; over using &lt;code&gt;grep&lt;/code&gt; and that&amp;#8217;s because it&amp;#8217;s giving me line numbers for free, which takes remembering a few extra options with grep.&lt;/p&gt;


	&lt;p&gt;Like &lt;code&gt;grep&lt;/code&gt;, we can specify a specific path to search with. For example, we use a view helper named &lt;code&gt;link_to_unimplemented&lt;/code&gt; to help us track actions that aren&amp;#8217;t implemented yet. Looking at a current project, I can run &lt;code&gt;rak link_to_unimplemented app/views&lt;/code&gt; and produce the following results.&lt;/p&gt;


	&lt;p&gt;&lt;img src="http://myskitch.com/robbyrussell/terminal__less__160x49-20071211-085748.jpg" alt="" /&gt;&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;m going to keep playing with it, but wanted to help get the word out. If you have any tips on using it, please share them in the comments. :-)&lt;/p&gt;
</description>
      <pubDate>Tue, 11 Dec 2007 11:10:00 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:ae4ad314-4ef2-4c9d-9388-152a1d7c956c</guid>
      <author>Robby Russell</author>
      <link>http://www.robbyonrails.com/articles/2007/12/11/get-to-know-a-gem-rak</link>
      <category>Ruby</category>
      <category>Programming</category>
      <category>gems</category>
      <category>rubyforge</category>
      <category>rak</category>
      <category>grep</category>
      <category>terminal</category>
      <category>unix</category>
      <category>tip</category>
      <category>development</category>
      <category>code</category>
      <category>ruby</category>
    </item>
  </channel>
</rss>
