The universal paperclip


Working in a dual Ruby web stack framework has it’s perks. Today I wanted to use Paperclip in my Merb app as well as my Rails app. So ten minutes later I packaged up Paperclip as a gem and tweaked it ever so slightly to work on both Rails and Merb. The hardest thing was getting the manifest right.

It just goes to prove how well designed and extracted plugins like Thinking Sphinx and Paperclip are in order to allow me to do this so quickly.

Gem can be found here if you’re interested. Any bugs let me know.

Meta

Posted by jonathan 2 months ago

Bookmark and Share

2 comments »

Thinking Sphinx for Merb... And Rails


Update 2008-04-17
Pat’s integrated my changes and also removed the horrible double Rake task hack I did. Now the Rake task works automatically. I’ve removed my branch and now I mirror Pat’s master branch. Please use Pat’s branch instead as his one will always be the most up to date.

It started off this morning before breakfast when I wanted to get Pat’s excellent Thinking Sphinx plugin going in Merb. The next thing I know, it was all done with enough time to spare for some tea. However my first attempt I made was too tightly coupled with Merb when it didn’t need to be. So tonight I cleaned it up and now it’s flexible enough to be used on both Merb and Rails apps.

My experiment can be found here but I warn you to tread with care as it’s still work in progress. However it works quite well for me as we use both Rails and Merb at work. The gem is based on Thinking Sphinx trunk so please read that first if you have any problems.

To get going:


git clone git://github.com/jaikoo/thinking-sphinx.git

cd thinking-sphinx

rake package

sudo gem install pkg/thinking-sphinx.0.8.0.gem


In your Merb app add the following:

init.rb:
dependency 'thinking_sphinx'

Rakefile
require 'thinking_sphinx/tasks/merb
For your Rails app:

Create an file called search.rb in your iniitializers dir and insert:
require 'thinking_sphinx'

Add a file called thinking_sphinx.rake in lib/tasks and add:
require 'thinking_sphinx/tasks/rails

Then do the usual Thinking Sphinx setup such as adding the index info to your models, rake thinking_sphinx:configure, rake ts:index etc…

Thanks again to Pat Allan for creating such a well designed and abstracted Sphinx plugin.

Future? I’m eyeing up adding DataMapper support which I’m quite excited about… Hopefully I’ll get sometime in the next few days to work on this.

Update Pat announced the release of his re-write of the Thinking Sphinx plugin. Check it out here !

Meta

Posted by jonathan 2 months ago

Bookmark and Share

4 comments »

Search


Archives


June 2008 (1)
May 2008 (1)
April 2008 (2)
March 2008 (4)
February 2008 (1)
January 2008 (1)
December 2007 (2)
November 2007 (5)
October 2007 (3)
September 2007 (4)
August 2007 (1)

Twitter


About


Online journal of Jonathan Conway a twenty something technologist, entrepreneur, husband, daddy of two, oh and lead architect at vzaar. Currently residing in London, UK.

You can find a little bit more about me here

Contact me at

Flickr


My babies Holiday in Dubai Holiday in Dubai My babies Holiday in Dubai Holiday in Dubai

Linkage


My tumbler
vzaar
Brightbox Rails Hosting
My Caboose Facebook Profile
New Bamboo
Luke Redpath
Jamie Van Dyke
Peter Cooper
Ismael
Caroline
Monster Gym
Scala
Pat Allan
Cristi Balan

Dopplr



I'm speaking at



I'm attending


dConstruct 2008 - Designing the Social Web

Sponsors


Brightbox Rails Hosting