<?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>duck_punching &#187; plugins</title>
	<atom:link href="http://duckpunching.com/topics/plugins/feed" rel="self" type="application/rss+xml" />
	<link>http://duckpunching.com</link>
	<description>Ruby, Rails and tech. No ducks were harmed in the making of this blog.</description>
	<lastBuildDate>Thu, 24 Jun 2010 07:12:53 +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>Pagination for make_resourceful</title>
		<link>http://duckpunching.com/pagination-for-make_resourceful</link>
		<comments>http://duckpunching.com/pagination-for-make_resourceful#comments</comments>
		<pubDate>Thu, 25 Sep 2008 23:08:17 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[make_resourceful_with_pagination]]></category>
		<category><![CDATA[m_r]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://duckpunching.com/?p=61</guid>
		<description><![CDATA[Hampton Catlin the creator of make_resourceful has let his thoughts on pagination known and in summary he is not a fan. Hence there is no DRY way to add pagination to m_r without overriding the defaults methods repeatedly. I am not so anti pagination and often find it mildly useful. But mostly my clients want [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://hamptoncatlin.com/">Hampton Catlin</a> the creator of <a href="http://github.com/hcatlin/make_resourceful/tree/master">make_resourceful</a> has let his thoughts on pagination known and in summary he is not a fan. Hence there is no DRY way to add pagination to m_r without overriding the defaults methods repeatedly.</p>
<p>I am not so anti pagination and often find it mildly useful. But mostly my clients want it regardless. So I have abtracted my pagination solution for m_r into a plugin called funnily enough <a href="http://github.com/adzap/make_resourceful_with_pagination">make_resourceful_with_pagination</a>. Now it may sound like a fork of m_r but it is in fact an <a href="http://errtheblog.com/posts/67-evil-twin-plugin">&#8220;evil-twin&#8221;</a> plugin, which is a plugin pattern invented by Chris Wanstrath of GitHub. So basically you need to install both m_r and my plugin.</p>
<p>It works with will_paginate by default but should also work with paginating_find or any pagination that acts on the model. You just need to tweak the global options. It won&#8217;t work with classic pagination, but frankly I don&#8217;t see the appeal of that anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://duckpunching.com/pagination-for-make_resourceful/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mocked_fixtures: reuse fixtures as mocks without the database</title>
		<link>http://duckpunching.com/mocked_fixtures-reuse-fixtures-as-mocks-without-the-database</link>
		<comments>http://duckpunching.com/mocked_fixtures-reuse-fixtures-as-mocks-without-the-database#comments</comments>
		<pubDate>Wed, 03 Sep 2008 07:20:00 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[mocked_fixtures]]></category>
		<category><![CDATA[fixtures]]></category>
		<category><![CDATA[mocks]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://duckpunching.com/?p=52</guid>
		<description><![CDATA[For a while I have sitting on this plugin called mocked_fixtures. I wrote most of it a few months ago and added a few things here and there but just hadn&#8217;t got round to releasing it. Basically it loads your fixtures files as mock model objects with the values from the fixture stubbed out on [...]]]></description>
			<content:encoded><![CDATA[<p>For a while I have sitting on this plugin called mocked_fixtures. I wrote most of it a few months ago and added a few things here and there but just hadn&#8217;t got round to releasing it.</p>
<p>Basically it loads your fixtures files as mock model objects with the values from the fixture stubbed out on the mock. It saves you having to stub lots of attribute methods on your mocks with values that could have just as happily come from your fixtures. After all if you are still using fixtures then they often have a fair bit of thought behind them. So why not use them again but practice some good test isolation and remove the database from the picture.</p>
<p>I am using it in projects, mostly in controller and view specs to save myself a ton of stubbing code to get a passable mock object to use. Of course you can alter the mock object after you have created it to further customise it, after all it is just a mock.</p>
<p>The problem is I don&#8217;t how useful people will find it, given this huge push towards complete fixture replacements with <a href="http://github.com/thoughtbot/factory_girl/tree/master">FactoryGirl</a>, <a title="model_stubbing" href="http://github.com/technoweenie/model_stubbing">model_stubbing</a> , <a href="http://github.com/dan-manges/unit-record/tree/master">unit-record</a> and the like. Its not an answer to those or even one in the herd since it still relies on fixtures.</p>
<p>Its really for those who like fast tests, test isolation and still use fixtures. I will be interested to see if it gets used.</p>
<p>I am not even going to go in depth here coz the readme does just that. So if you want to have a look then go to the <a href="http://github.com/adzap/mocked_fixtures/tree/master">source</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://duckpunching.com/mocked_fixtures-reuse-fixtures-as-mocks-without-the-database/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Run plugin specs/tests with gem or vendored rails</title>
		<link>http://duckpunching.com/run-plugin-specstests-with-gem-or-vendored-rails</link>
		<comments>http://duckpunching.com/run-plugin-specstests-with-gem-or-vendored-rails#comments</comments>
		<pubDate>Mon, 07 Jul 2008 03:24:59 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[plugins]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[specs]]></category>
		<category><![CDATA[tests]]></category>
		<category><![CDATA[vendor]]></category>

		<guid isPermaLink="false">http://duckpunching.com/?p=13</guid>
		<description><![CDATA[When I create a plugin I set up the tests or specs to be able to run stand-alone, that is not inside Rails app. But when you want to try the plugin out inside a real app, it can help to be able run the specs against vendored version of Rails if the application has [...]]]></description>
			<content:encoded><![CDATA[<p>When I create a plugin I set up the tests or specs to be able to run stand-alone, that is not inside Rails app. But when you want to try the plugin out inside a real app, it can help to be able run the specs against vendored version of Rails if the application has one.</p>
<p>So to neatly auto-detect if the plugin is in an app with vendored Rails and to use that Rails for testing, I hacked this little snippet</p>
<pre lang="ruby">
vendored_rails = File.dirname(__FILE__) + '/../../../../vendor/rails'
if File.exists?(vendored_rails)
  Dir.glob(vendored_rails + "/**/lib").each { |dir| $:.unshift dir }
else
  gem 'rails', "=#{ENV['VERSION']}" if ENV['VERSION']
end
</pre>
<p>This checks for the Rails folder in vendor with extra care by going up to where the app root would be and down through &#8216;vendor/rails&#8217;, rather than directly to the rails. If a vendored Rails is found it puts each module&#8217;s parent folder at the front of the load path to make sure its used ahead of the gems.</p>
<p>For a bonus it also allows you to specify a version of the Rails gem if you want, by setting the VERSION parameter on the command line, when not inside an app.</p>
<p>Afterwards you just require the Rails parts you need as usual.</p>
<pre lang="ruby">
require 'active_support'
require 'active_record'
</pre>
<p>If the vendored rails exists the the libraries are required from there, otherwise the gems are used. Stick it in the top of your test or spec helper.</p>
]]></content:encoded>
			<wfw:commentRss>http://duckpunching.com/run-plugin-specstests-with-gem-or-vendored-rails/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ar_mailer gem forked on GitHub, goodies added</title>
		<link>http://duckpunching.com/ar_mailer-gem-forked-and-now-on-github</link>
		<comments>http://duckpunching.com/ar_mailer-gem-forked-and-now-on-github#comments</comments>
		<pubDate>Thu, 03 Jul 2008 23:36:37 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[ar_mailer]]></category>
		<category><![CDATA[patches]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[Dylan Egan]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[Eric Hodel]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[github]]></category>

		<guid isPermaLink="false">http://duckpunching.com/?p=11</guid>
		<description><![CDATA[Now that GitHub has a gem server it allows the process of managing your own fork or customisation of a gem ridiculously easy. No need for your own gem server or shipping around gem files, just put it up on github and nominate it as a gem in the project config. GitHub will automatically compile [...]]]></description>
			<content:encoded><![CDATA[<p>Now that <a href="http://github.com">GitHub</a> has a gem server it allows the process of managing your own fork or customisation of a gem ridiculously easy. No need for your own gem server or shipping around gem files, just put it up on github and nominate it as a gem in the project config. GitHub will automatically compile the gems using a gemspec file if present. All the info you need is <a href="http://gems.github.com/">here</a> so I won&#8217;t recap it any further.</p>
<p>A gem which I find essential for Rails apps which send out emails is <a href="http://seattlerb.rubyforge.org/ar_mailer/">ar_mailer</a> by Eric Hodel of Seattle Ruby Brigade and Ruby Hitsquad fame and now the maintainer of RubyGems. But there a couple of things missing. One is the need for pid files to be generated when running as a daemon to allow effective management with monitoring tools and such.</p>
<p>Well there just so happened to be a <a href="http://pastie.org/170654.txt">patch</a> by <a href="http://dylanegan.com/">Dylan Egan</a> in the ar_mailer forums to add this feature, but it has been overlooked for a long time. So I thought this would be a good chance to fork it and use the GitHub gem system as well. Its now forked it and patched with some tweaks to get it working and a few fixes for the tests which broke due to changes in the latest ZenTest gem.</p>
<p>The project for the gem is <a href="http://github.com/adzap/ar_mailer">here</a>. To use the new gem you need to remove the old one because of the way github names your gems. It uses github username as a prefix to the gem name. This means the old gem will be loaded instead of the new gem when required in your app. But the binary will be used from the new gem causing nasty problems.</p>
<p>To install, first add GitHub as a gem source</p>
<pre lang="bash">
sudo gem sources -a http://gems.github.com
</pre>
<p>Then</p>
<pre lang="bash">
sudo gem install adzap-ar_mailer
</pre>
<p>Now when the binary is run in daemon mode you will get the pid file you need. You can specify the pid file location in the command options like so</p>
<pre lang="bash">ar_sendmail -d -p ./log/ar_sendmail.pid</pre>
<p>Any relative paths are expanded from the app directory. You can of course use an absolute path if you wish. The file gets removed on exit as you would expect.</p>
<p>The other major addition is not as visible. Its a Ruby based init.d script for managing mailer startup for one or more apps. It uses a yaml based config file where you specify the app settings for each app that needs a mailer instance running. See the README and demo config for more info.</p>
<p>Ruby, my hammer, is starting to make everything look a nail!</p>
<p>Remember this is GitHub, don&#8217;t like what I have done, then <a href="http://railsontherun.com/2008/3/3/how-to-use-github-and-submit-a-patch">fork off</a>!</p>
<p>UPDATE:<br />
If you are getting an error running the ar_sendmail binary, this is due to GitHub to setting the permission on gem binary files incorrectly. The error would be</p>
<pre>/usr/bin/ar_sendmail:19:in `load': no such file to load -- ar_sendmail (LoadError)
	from /usr/bin/ar_sendmail:19</pre>
<p>To fix it you need to run this ugly (please let me know a better way to get a gem path!!)</p>
<pre>
GEMS_PATH=`gem env path`
GEM_NAME='adzap-ar_mailer'
sudo chmod 755 $GEMS_PATH/gems/$GEM_NAME*/bin/*</pre>
<p>Now you should be able to execute it as a normal user.</p>
<p>UPDATE 2:<br />
Fixed the update fix and made it version non-specific</p>
<p>UPDATE 3:<br />
GitHub fixed the file permissions issue so the work around is not needed anymore.</p>
]]></content:encoded>
			<wfw:commentRss>http://duckpunching.com/ar_mailer-gem-forked-and-now-on-github/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>date_time_text_field_helpers plugin moved to GitHub</title>
		<link>http://duckpunching.com/date_time_text_field_helpers-plugin-moved-to-github</link>
		<comments>http://duckpunching.com/date_time_text_field_helpers-plugin-moved-to-github#comments</comments>
		<pubDate>Tue, 17 Jun 2008 23:46:04 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[date_time_text_field_helpers]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[helpers]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://duckpunching.com/?p=9</guid>
		<description><![CDATA[My date_time_text_field_helpers plugin allows you to use text input fields for dates and times instead of the Rails standard select dropdowns. The plugin was up on Google Code but since I am mostly using git now, I just had to bring it over GitHub. Updates will only be pushed to git from now on. The [...]]]></description>
			<content:encoded><![CDATA[<p>My date_time_text_field_helpers plugin allows you to use text input fields for dates and times instead of the Rails standard select dropdowns. The plugin was up on <a href="http://code.google.com/p/date-time-text-field-helpers/">Google Code</a> but since I am mostly using git now, I just had to <a href="http://github.com/adzap/date_time_text_field_helpers/tree/master">bring it over GitHub</a>.</p>
<p>Updates will only be pushed to git from now on. The Google Code page will stay up for a while, until such time that I remember to pull it down.</p>
]]></content:encoded>
			<wfw:commentRss>http://duckpunching.com/date_time_text_field_helpers-plugin-moved-to-github/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using ActionView in standalone tests</title>
		<link>http://duckpunching.com/using-actionview-in-standalone-tests</link>
		<comments>http://duckpunching.com/using-actionview-in-standalone-tests#comments</comments>
		<pubDate>Thu, 12 Jun 2008 03:01:54 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[actionview]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[html-scanner]]></category>
		<category><![CDATA[tests]]></category>

		<guid isPermaLink="false">http://duckpunching.com/?p=6</guid>
		<description><![CDATA[When writing Rails plugins I like to be able to test them as a stand-alone library rather than inside a specific Rails project. I find it more productive and it avoids clashes with other plugins. It also allows you to test it against multiple rails versions. One frustration I have had is when just want [...]]]></description>
			<content:encoded><![CDATA[<p>When writing Rails plugins I like to be able to test them as a stand-alone library rather than inside a specific Rails project. I find it more productive and it avoids clashes with other plugins. It also allows you to test it against multiple rails versions.</p>
<p>One frustration I have had is when just want to use ActionView in your tests, because you might be writing a view plugin, if you require &#8216;action_view&#8217; you get the following error:</p>
<pre>MissingSourceFile: no such file to load -- html/document</pre>
<p>This is because the path to the html-scanner library has not been added to the loadpath. This only happens in ActionController. But if we don&#8217;t need or want the overhead of ActionController the following line will include html-scanner in the loadpath and all will be well.</p>
<pre lang="ruby">$:.unshift Gem.searcher.find('actionpack').full_gem_path
  + '/lib/action_controller/vendor/html-scanner'</pre>
<p>This finds the actionpack gem to get the full path. Then with the path to the html-scanner folder, adds it to the loadpath ($:). Now no more pesky load errors.</p>
<p>If there is a cleaner way, let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://duckpunching.com/using-actionview-in-standalone-tests/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>calendar_helper plugin forked</title>
		<link>http://duckpunching.com/calendar_helper-plugin-forked</link>
		<comments>http://duckpunching.com/calendar_helper-plugin-forked#comments</comments>
		<pubDate>Wed, 11 Jun 2008 07:36:29 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[calendar_helper]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://duckpunching.com/?p=5</guid>
		<description><![CDATA[I have been using Geoffrey Grosenbach&#8217;s calendar_helper plugin and needed a few changes. I am also using git for projects now and finding the submodule a workable strategy for plugins. So I imported it into git using git-svn and created a new project on GitHub. I plan to do some refactoring to make it a [...]]]></description>
			<content:encoded><![CDATA[<p>I have been using Geoffrey Grosenbach&#8217;s calendar_helper plugin and needed a few changes. I am also using git for projects now and finding the submodule a workable strategy for plugins. So I imported it into git using git-svn and created a <a href="http://github.com/adzap/calendar_helper">new project on GitHub</a>. I plan to do some refactoring to make it a little cleaner but mostly will just tweak for my own usage.</p>
<p>My first changes were to remove the requirement for the year and month to be passed in as options. These now default to the current month and year if not included in the options hash.</p>
<p>I have also added the :month_name_text option to override the default text for the month name. The month name is basically the calendar header so this makes it possible to include the year in the header for clarity.</p>
<p>Now that I have forked it, I removed the gem spec files as it will not be published as a gem as that would confuse everyone and just isn&#8217;t the done thing.</p>
<p>Feel free to use and fork of course, these are just my preferences and maybe more to come. Thanks of course go to the original authors and contributors of the plugin.</p>
]]></content:encoded>
			<wfw:commentRss>http://duckpunching.com/calendar_helper-plugin-forked/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

