skwpspace yan pritzker’s home on the web

skwpspace is Yan Pritzker's home on the web

Blog :: Photography :: About Me

TwitterCounter for @skwp

Get the news feed
Get updates by email
Follow me on twitter

hello, i'm yan

This blog is about startups, blogging, Ruby On Rails, virtualization and cloud computing, photography, customer service, marketing, ux and design, git, and lots more.

Top Posts

planypus

I'm the founder of Planypus, the place to share your plans!

cohesiveft

Accessible, manageable, virtualized application stacks ready to download or deploy to the cloud!

flickr

it's hailing in san franciscojessatianalyndaBird in the handkerimodeldanielle pettee and models-4449

Archives

Contact

Reach me at yan at pritzker.ws

Posted
19 August 2006 @ 5pm

Tagged
thoughts

Creating your own ruby gems

It’s very easy to create a gem from your own rails plugin. Thanks to http://blogs.cocoondev.org/crafterm/archives/004653.html for getting me started down this path. Here’s how I did it with the memcache_fragments plugin.

Put this into your plugin’s Rakefile:


require ‘rubygems’
require ‘rake/gempackagetask’

spec = Gem::Specification.new do |s|
s.name = “memcache_fragments”
s.version = “0.0.1″
s.author = “Yan Pritzker”
s.email = “yan@fifteenreasons.com”
s.homepage = “http://skwp.wordpress.com/memcache_fragments/”
s.platform = Gem::Platform::RUBY
s.summary = “Makes rails fragment cache play nicely with memcache-client and gives it a time-based expiry parameter”
s.files = FileList["lib/**/*"].to_a
s.require_path = “lib”
s.autorequire = “memcache_fragments”
s.test_files = FileList["{test}/**/*test.rb"].to_a
s.has_rdoc = true
s.extra_rdoc_files = ["README"]
s.add_dependency(”memcache-client”, “>= 1.0.3″)
end

Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_tar = true
end

Now, just rake gem and you’re done!

Don’t forget, if you install your plugin as a gem you will have to require it in your code.


No Comments Yet


There are no comments yet. You could be the first!

Leave a Comment

memcached on OSX running fast! Rails fragment cache with memcached-client and time-based :expire option