<?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>The Lucid &#187; Rake</title>
	<atom:link href="http://thelucid.com/tag/rake/feed/" rel="self" type="application/rss+xml" />
	<link>http://thelucid.com</link>
	<description>The Lightweight Ramblings of Jamie Hill</description>
	<lastBuildDate>Sun, 11 Mar 2012 19:52:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Disabling plugin code in generators/migrations</title>
		<link>http://thelucid.com/2006/09/21/disabling-plugin-code-in-generators-migrations/</link>
		<comments>http://thelucid.com/2006/09/21/disabling-plugin-code-in-generators-migrations/#comments</comments>
		<pubDate>Thu, 21 Sep 2006 15:48:00 +0000</pubDate>
		<dc:creator>Jamie</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Rake]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://8b1c3f77-017c-4ab9-a302-4c6789c397d2</guid>
		<description><![CDATA[I have found on numerous occasions that I need to disable certain plugin functionality if running a generator / rake db:migrate etc. An easy way to disable certain functionality follows: def method_that_shouldnt_be_run_in_migrations_or_generators # Return if we are using a generator or migrations script = File.basename&#40;$0&#41; return if &#40;script == 'generate'&#41; &#124;&#124; &#40;script == 'rake' &#38;&#38; [...]]]></description>
			<content:encoded><![CDATA[<p>I have found on numerous occasions that I need to disable certain plugin functionality if running a generator / <code>rake db:migrate</code> etc.</p>
<p>An easy way to disable certain functionality follows:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> method_that_shouldnt_be_run_in_migrations_or_generators
  <span style="color:#008000; font-style:italic;"># Return if we are using a generator or migrations</span>
  script = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">basename</span><span style="color:#006600; font-weight:bold;">&#40;</span>$0<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>script == <span style="color:#996600;">'generate'</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;">&#40;</span>script == <span style="color:#996600;">'rake'</span> <span style="color:#006600; font-weight:bold;">&amp;&amp;</span> ARGV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span> =~ <span style="color:#006600; font-weight:bold;">/</span>migrate$<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></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://thelucid.com/2006/09/21/disabling-plugin-code-in-generators-migrations/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

