help on building a plugin

Hi,

I've developed some code that allows you to use s3 as a cache store (ie store your cache fragments at s3 instead of your web server).

It works great when I have the code in my lib/ folder.

Now I want to package it as a plugin. i'm stuck.

My plugin directory is structured:

- s3cache -- init.rb -- lib/ ----- s3_cache.rb ----- s3.rb

My init.rb file is this: require 's3_cache'

My lib/s3_cache file begins with:

require 'S3'

  class S3Cache < ActionController::Caching::Fragments::UnthreadedFileStore       def initialize(bucket, cache_directory)         @aws_access_key = 'YOURAWSACCESSKEY' # your AWS ACCESS KEY         @aws_secret_access_key = 'YOURAWSSECRETKEY' # your SECRET         @bucket = bucket

<snip>

Plugins are loaded *after* the environment is loaded. Subscribe to Rick Olson's blog and read these entries: http://weblog.techno-weenie.net/2007/1/24/understanding-the-rails-initialization-process

then

http://weblog.techno-weenie.net/2007/1/25/understanding-the-rails-initialization-process-part-2

Shortcut: in config/environments/development.rb put:

config.after_initialize do   config.action_controller.fragment_cache_store =   S3Cache.new("quizical", "cache") end

Doh! Of course. Thanks Chris. That was what I needed.