<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
	>
<channel>
	<title>Comments on: Smart Requires in Ruby</title>
	<atom:link href="http://avdi.org/devblog/2009/03/02/smart-requires-in-ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://avdi.org/devblog/2009/03/02/smart-requires-in-ruby/</link>
	<description>"...the three great virtues of a programmer: laziness, impatience, and hubris." -- Larry Wall</description>
	<lastBuildDate>Thu, 29 Jul 2010 16:19:56 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Avdi Grimm</title>
		<link>http://avdi.org/devblog/2009/03/02/smart-requires-in-ruby/comment-page-1/#comment-959</link>
		<dc:creator>Avdi Grimm</dc:creator>
		<pubDate>Thu, 12 Mar 2009 19:20:01 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/?p=127#comment-959</guid>
		<description>Yeah, multiple requires because of different paths to the same file is something I&#039;ve had a lot of trouble with at my day job.  I agree that when it&#039;s practical, altering the load path and sticking with unqualified requires is the way to go.&lt;br&gt;&lt;br&gt;I&#039;m not sure I prefer that for specs, though, because I&#039;ve gotten used to always being able to run my specs as &#039;ruby my_spec.rb&#039; - no rake, no script/spec, no spec command.  This works well for e.g. Emacs &quot;run this file&quot; keybindings - it means the editor doesn&#039;t need to any special sniffing the file to determine what command to run the file with.&lt;br&gt;&lt;br&gt;I&#039;ve long wished the Ruby interpreter would just normalize and absolutize all require-d filenames before loading them.</description>
		<content:encoded><![CDATA[<p>Yeah, multiple requires because of different paths to the same file is something I&#39;ve had a lot of trouble with at my day job.  I agree that when it&#39;s practical, altering the load path and sticking with unqualified requires is the way to go.</p>
<p>I&#39;m not sure I prefer that for specs, though, because I&#39;ve gotten used to always being able to run my specs as &#39;ruby my_spec.rb&#39; &#8211; no rake, no script/spec, no spec command.  This works well for e.g. Emacs &#8220;run this file&#8221; keybindings &#8211; it means the editor doesn&#39;t need to any special sniffing the file to determine what command to run the file with.</p>
<p>I&#39;ve long wished the Ruby interpreter would just normalize and absolutize all require-d filenames before loading them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: technicalpickles</title>
		<link>http://avdi.org/devblog/2009/03/02/smart-requires-in-ruby/comment-page-1/#comment-958</link>
		<dc:creator>technicalpickles</dc:creator>
		<pubDate>Thu, 12 Mar 2009 19:10:47 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/?p=127#comment-958</guid>
		<description>For spec_helper, it&#039;s even easier to go:&lt;br&gt;&lt;br&gt;    require &#039;spec_helper&#039;&lt;br&gt;&lt;br&gt;And then modify the load path to contain the load path to contain the spec or test directory.&lt;br&gt;&lt;br&gt;This is a practice Rails adopted at one point. In addition to simplifying the require in your specs, it also prevents spec_helper.rb from being required multiple times.&lt;br&gt;&lt;br&gt;Imagine two specs, spec/foo_spec.rb and spec/bar/baz_spec.rb. foo_spec would end up requiring &#039;spec_helper.rb&#039; and bar/baz_spec.rb would end up requiring baz/../spec_helper.rb&lt;br&gt;&lt;br&gt;Normally, ruby only requires a file once... but, it&#039;s not smart enough to understand that spec_helper and baz/../spec_helper.rb. The result is that it gets required multiple times. This mostly is a problem if you define constants (you&#039;ll see warnings about constant already defined) or if you include/extend modules that do something with their callbacks (rr causes a system stack too deep if you include its module more than once).</description>
		<content:encoded><![CDATA[<p>For spec_helper, it&#39;s even easier to go:</p>
<p>    require &#39;spec_helper&#39;</p>
<p>And then modify the load path to contain the load path to contain the spec or test directory.</p>
<p>This is a practice Rails adopted at one point. In addition to simplifying the require in your specs, it also prevents spec_helper.rb from being required multiple times.</p>
<p>Imagine two specs, spec/foo_spec.rb and spec/bar/baz_spec.rb. foo_spec would end up requiring &#39;spec_helper.rb&#39; and bar/baz_spec.rb would end up requiring baz/../spec_helper.rb</p>
<p>Normally, ruby only requires a file once&#8230; but, it&#39;s not smart enough to understand that spec_helper and baz/../spec_helper.rb. The result is that it gets required multiple times. This mostly is a problem if you define constants (you&#39;ll see warnings about constant already defined) or if you include/extend modules that do something with their callbacks (rr causes a system stack too deep if you include its module more than once).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: avdi</title>
		<link>http://avdi.org/devblog/2009/03/02/smart-requires-in-ruby/comment-page-1/#comment-604</link>
		<dc:creator>avdi</dc:creator>
		<pubDate>Thu, 12 Mar 2009 12:20:01 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/?p=127#comment-604</guid>
		<description>Yeah, multiple requires because of different paths to the same file is something I&#039;ve had a lot of trouble with at my day job.  I agree that when it&#039;s practical, altering the load path and sticking with unqualified requires is the way to go.&lt;br&gt;&lt;br&gt;I&#039;m not sure I prefer that for specs, though, because I&#039;ve gotten used to always being able to run my specs as &#039;ruby my_spec.rb&#039; - no rake, no script/spec, no spec command.  This works well for e.g. Emacs &quot;run this file&quot; keybindings - it means the editor doesn&#039;t need to any special sniffing the file to determine what command to run the file with.&lt;br&gt;&lt;br&gt;I&#039;ve long wished the Ruby interpreter would just normalize and absolutize all require-d filenames before loading them.</description>
		<content:encoded><![CDATA[<p>Yeah, multiple requires because of different paths to the same file is something I&#39;ve had a lot of trouble with at my day job.  I agree that when it&#39;s practical, altering the load path and sticking with unqualified requires is the way to go.</p>
<p>I&#39;m not sure I prefer that for specs, though, because I&#39;ve gotten used to always being able to run my specs as &#39;ruby my_spec.rb&#39; &#8211; no rake, no script/spec, no spec command.  This works well for e.g. Emacs &#8220;run this file&#8221; keybindings &#8211; it means the editor doesn&#39;t need to any special sniffing the file to determine what command to run the file with.</p>
<p>I&#39;ve long wished the Ruby interpreter would just normalize and absolutize all require-d filenames before loading them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: technicalpickles</title>
		<link>http://avdi.org/devblog/2009/03/02/smart-requires-in-ruby/comment-page-1/#comment-603</link>
		<dc:creator>technicalpickles</dc:creator>
		<pubDate>Thu, 12 Mar 2009 12:10:47 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/?p=127#comment-603</guid>
		<description>For spec_helper, it&#039;s even easier to go:&lt;br&gt;&lt;br&gt;    require &#039;spec_helper&#039;&lt;br&gt;&lt;br&gt;And then modify the load path to contain the load path to contain the spec or test directory.&lt;br&gt;&lt;br&gt;This is a practice Rails adopted at one point. In addition to simplifying the require in your specs, it also prevents spec_helper.rb from being required multiple times.&lt;br&gt;&lt;br&gt;Imagine two specs, spec/foo_spec.rb and spec/bar/baz_spec.rb. foo_spec would end up requiring &#039;spec_helper.rb&#039; and bar/baz_spec.rb would end up requiring baz/../spec_helper.rb&lt;br&gt;&lt;br&gt;Normally, ruby only requires a file once... but, it&#039;s not smart enough to understand that spec_helper and baz/../spec_helper.rb. The result is that it gets required multiple times. This mostly is a problem if you define constants (you&#039;ll see warnings about constant already defined) or if you include/extend modules that do something with their callbacks (rr causes a system stack too deep if you include its module more than once).</description>
		<content:encoded><![CDATA[<p>For spec_helper, it&#39;s even easier to go:</p>
<p>    require &#39;spec_helper&#39;</p>
<p>And then modify the load path to contain the load path to contain the spec or test directory.</p>
<p>This is a practice Rails adopted at one point. In addition to simplifying the require in your specs, it also prevents spec_helper.rb from being required multiple times.</p>
<p>Imagine two specs, spec/foo_spec.rb and spec/bar/baz_spec.rb. foo_spec would end up requiring &#39;spec_helper.rb&#39; and bar/baz_spec.rb would end up requiring baz/../spec_helper.rb</p>
<p>Normally, ruby only requires a file once&#8230; but, it&#39;s not smart enough to understand that spec_helper and baz/../spec_helper.rb. The result is that it gets required multiple times. This mostly is a problem if you define constants (you&#39;ll see warnings about constant already defined) or if you include/extend modules that do something with their callbacks (rr causes a system stack too deep if you include its module more than once).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: avdi</title>
		<link>http://avdi.org/devblog/2009/03/02/smart-requires-in-ruby/comment-page-1/#comment-599</link>
		<dc:creator>avdi</dc:creator>
		<pubDate>Thu, 05 Mar 2009 13:27:14 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/?p=127#comment-599</guid>
		<description>The idea is to have no dependencies apart form the Ruby stdlib.  It&#039;s one of those chicken-and-egg things - usually it&#039;s the spec_helper.rb that requires rubygems et. al.</description>
		<content:encoded><![CDATA[<p>The idea is to have no dependencies apart form the Ruby stdlib.  It&#39;s one of those chicken-and-egg things &#8211; usually it&#39;s the spec_helper.rb that requires rubygems et. al.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe Grossberg</title>
		<link>http://avdi.org/devblog/2009/03/02/smart-requires-in-ruby/comment-page-1/#comment-598</link>
		<dc:creator>Joe Grossberg</dc:creator>
		<pubDate>Thu, 05 Mar 2009 12:52:17 +0000</pubDate>
		<guid isPermaLink="false">http://avdi.org/devblog/?p=127#comment-598</guid>
		<description>Keep going! Good idea, but it can be made even prettier:&lt;br&gt;&lt;br&gt;&lt;code&gt;&lt;br&gt;require &#039;simple_require&#039;&lt;br&gt;# this library would encapsulates the pathname stuff, ascend, etc. so we could then do this:&lt;br&gt;simple_require(&#039;spec_helper&#039;, &#039;some_other_file&#039;)&lt;br&gt;&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Keep going! Good idea, but it can be made even prettier:</p>
<p><code><br />require &#39;simple_require&#39;<br /># this library would encapsulates the pathname stuff, ascend, etc. so we could then do this:<br />simple_require(&#39;spec_helper&#39;, &#39;some_other_file&#39;)<br /></code></p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.286 seconds -->
