Yan Pritzker photographer, entrepreneur, software engineer, musician, skier

Blog :: Git Workflows Book :: Dotfiles :: Photography :: About Me

TwitterCounter for @skwp

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

hello, i'm yan

I am a photographer, entrepreneur, software engineer, guitarist, climber, and telemark skier

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

Enterprise intelligence with prediction markets

Find out what your team, colleagues and partners really know about the future — and leverage their knowledge to improve business decisions.

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

Archives

Contact

Reach me at yan at pritzker.ws

Creating your own ruby gems

Posted 19 August 2006 @ 5pm | Tagged thoughts


Submit to HN

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