<?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>game, game. repeat. &#187; rake</title>
	<atom:link href="http://ggr.com/tag/rake/feed" rel="self" type="application/rss+xml" />
	<link>http://ggr.com</link>
	<description>if Scott Bonds had a home on the interwebs, this would be it</description>
	<lastBuildDate>Tue, 09 Feb 2010 00:59:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How To Include a Gem&#8217;s Rake Tasks in Your Rails App</title>
		<link>http://ggr.com/how-to-include-a-gems-rake-tasks-in-your-rails-app.html</link>
		<comments>http://ggr.com/how-to-include-a-gems-rake-tasks-in-your-rails-app.html#comments</comments>
		<pubDate>Mon, 14 Sep 2009 19:21:32 +0000</pubDate>
		<dc:creator>Scott Bonds</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[facebooker]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[rake]]></category>
		<category><![CDATA[rake tasks]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby gem]]></category>

		<guid isPermaLink="false">http://ggr.com/?p=387</guid>
		<description><![CDATA[Rake tasks contained in a gem are not automatically available to a rails app that requires the gem. Whether that&#8217;s the right way to do things is under debate, but in the mean time there are a couple workarounds. Option #1: Use the gem as a plugin instead. Files that match the following pattern are [...]]]></description>
			<content:encoded><![CDATA[<p>Rake tasks contained in a gem are not automatically available to a rails app that requires the gem.  Whether that&#8217;s the right way to do things is <a href="https://rails.lighthouseapp.com/projects/8994/tickets/59">under debate</a>, but in the mean time there are a couple workarounds.</p>
<p><span id="more-387"></span></p>
<p><strong>Option #1</strong>: Use the gem as a plugin instead.  Files that match the following pattern are automatically pulled in, so you&#8217;re good to go:</p>
<p><code>"#{RAILS_ROOT}/vendor/plugins/*/**/tasks/**/*.rake"</code></p>
<p><strong>Option #2</strong>: Create a ruby file that loads the gem&#8217;s tasks, then require the ruby file you made in your rail app&#8217;s Rakefile.  For example, if you&#8217;ve installed the Facebooker gem and you want to use its rake tasks, you might create a file called &#8216;facebooker.rb&#8217; and save it to your <em>&lt;railsapproot&gt;/tasks</em> directory with these contents:</p>
<p><code>$VERBOSE = nil<br />
Dir["#{Gem.searcher.find('facebooker').full_gem_path}/lib/tasks/*.rake"].each { |ext| load ext }</code></p>
<p>Then add this line to your Rakefile:</p>
<p><code>require 'tasks/facebooker'</code></p>
<p>But as it turns out, Facebooker&#8217;s tasks uses relative paths to get at its config file in your rails app, which won&#8217;t work if its installed in the gem path as a gem rather than in your rails app as a plugin!  So be careful with using option #2, it may not be what the gem you&#8217;re trying to use expects.</p>
]]></content:encoded>
			<wfw:commentRss>http://ggr.com/how-to-include-a-gems-rake-tasks-in-your-rails-app.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
