Hello
I have a standalone script, run as a cron job, that I use to clean out
old entries from my app''s database.  Because I''m using
caching, it''s
not enough to just delete an entry from the database - I also need to
expire any associated fragments...  so here''s my problem:
I''m trying to find the best way to expire a fragment from a standalone
script.  Here''s (a simplified version of) what I have so far:
#-----
# Run this script with:
# ruby script/runner "load ''myscript.rb''"
# "Fake" classes to allow us to use "expire_fragment"
class MyRequest
    attr_reader :protocol, :host_with_port, :path
    def initialize
       @protocol = ''http://''
       @host_with_port = ''localhost:3000''
       @path = ''/''
    end    
    
    def symbolized_path_parameters
        {}
    end
    def relative_url_root
        nil
    end
end
Controllers.const_load!(:ApplicationController, "application") unless
Controllers.const_defined?(:ApplicationController)
module ActionController
    class MyController < ApplicationController   
        def initialize
            @url = UrlRewriter.new(MyRequest.new, nil)    
        end
    end
end
c = ActionController::MyController.new
c.expire_fragment(:controller => ''cont'', :action =>
''act'', :id => 123)
#-----
(Note that I''m obtaining the full Rails environment using
script/runner)
Now.. this _does_ do what I want, but it seems very un-rails (and
un-ruby) like to have to create these fake classes just to expire a
fragment from outside of a web request.  Is there a better, "rails
way" of doing it?
Thanks a million for any help!