<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.1" -->
<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/"
	>

<channel>
	<title>ClayValet, Inc.</title>
	<link>http://blog.clayvalet.com</link>
	<description>Online shopping experiences</description>
	<pubDate>Fri, 08 Aug 2008 05:17:28 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
	<language>en</language>
			<item>
		<title>Finding unused partials</title>
		<link>http://blog.clayvalet.com/blog/2008/07/26/finding-unused-partials/</link>
		<comments>http://blog.clayvalet.com/blog/2008/07/26/finding-unused-partials/#comments</comments>
		<pubDate>Sat, 26 Jul 2008 02:12:37 +0000</pubDate>
		<dc:creator>Mikhail Seregine</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://blog.clayvalet.com/blog/2008/07/26/finding-unused-partials/</guid>
		<description><![CDATA[There&#8217;s a large set of view template changes in my client, part of the soon-to-be-deployed redesign. As I was making some of these changes, I wasn&#8217;t very careful to delete partials that aren&#8217;t used anymore. So I thought I would whip up some ruby one-liners to find these for me.
The following mix of Ruby and [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a large set of view template changes in my client, part of the soon-to-be-deployed redesign. As I was making some of these changes, I wasn&#8217;t very careful to delete partials that aren&#8217;t used anymore. So I thought I would whip up some ruby one-liners to find these for me.</p>
<p>The following mix of Ruby and zsh is not the cleanest way to do it, but it gets the job done:</p>
<p>1. List all partials in my client</p>
<blockquote><p>find . -name &#8220;_*.rhtml&#8221; | ruby -ane &#8216;<br />
return unless $_ =~ /\/_(.*).rhtml/<br />
puts $1<br />
&#8216; &gt; partial_names.txt
</p></blockquote>
<p>2. Count the number of times each is referenced.</p>
<blockquote><p>for i in `cat partial_names.txt`<br />
echo `grep -r &#8220;render.*:partial.*$i&#8221; ./shopperview/app/views ./shopperview/app/controllers  | wc -l` $i &gt;&gt; partial_frequency.txt
</p></blockquote>
<p>3. Sort partials by the number of times they&#8217;re referenced</p>
<blockquote><p>sort -g partial_frequency.txt</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.clayvalet.com/blog/2008/07/26/finding-unused-partials/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
