I've decided to branch off the project so I can start to Learn both Ruby and
RadiantCMS for more than how to powerhouse and run a server for it.  Can
anyone help me with this error: undefined method `cache_page' for module
`Radiant::Cache'

static_html_cache_extension.rb
class StaticHtmlCacheExtension < Radiant::Extension
        version "0.1a"
        description "\"Static\" (X)HTML Caching"
        def activate 
                Radiant::Cache.instance_eval { include StaticHTMLCache } 
        end
        def deactivate 
                return
        end
end

/lib/static_html_cache.rb:
module StaticHTMLCache
        def self.included(base)
                base.instance_eval do alias_method_chain :cache_page, :html
end
        end
        def cache_page_with_html(metadata,content,path)
                return unless perform_caching
                cache_path=html_cache_path(path)
                logger.info("Caching Page: #{cache_path}")
                metadata = YAML.load(metadata)
                if (File.extname(cache_path).blank? ||
File.extname(cache_path) == ".seo") && (metadata['Content-Type'].nil? ||
metadata['Content-Type'].starts_with?('text/html'))
                        cache_path = cache_path + '.html'
                end
                begin
                        FileUtils.makedirs(File.dirname(cache_path))
                        File.open(cache_path, 'wb') { |f| f.write(content) }
                        rescue Errno::EISDIR, Errno::EEXIST
                        logger.error "StaticHTMLCache::NameCollisionError
(Directory MisRepresentation):\n Strange Naming Scheme for URI: #{path}"
                nil
        end
        end
        def html_cache_path(path)
                cache_path = page_cache_path(path)
                if (cache_path.ends_with?('_site-root'))
                        cache_path.sub!(/_site-root$/, 'index')
        end
        cache_path
        end
end


-----Original Message-----
From: radiant-boun...@radiantcms.org [mailto:radiant-boun...@radiantcms.org]
On Behalf Of Jim Gay
Sent: Wednesday, July 01, 2009 3:42 PM
To: radiant@radiantcms.org
Subject: Re: [Radiant] Static caching

On Jul 1, 2009, at 4:34 PM, Jordon Bedwell wrote:

> Does anybody know of a plugin that "actually" works for static  
> caching? Or a
> way I can pull the Radiant Cache Files with NGINX. Right now we  
> would like
> to maintain control over output speed, and with Flickr having such  
> horrible
> response times on their API we tend to lock up for a second and a  
> refresh on
> a page causing RadiantCMS to avoid it's own internal cache and  
> refresh,
> which tends to lead to a slow page. We tried the simple static_caching
> extension listed on the extensions page, however, we get horrible  
> errors.
>
>
>
> www:/var/app/radiant# script/extension install static_caching
>
> Initialized empty Git repository in /tmp/static_caching/.git/
>
> remote: Counting objects: 175, done.
>
> remote: Compressing objects: 100% (145/145), done.
>
> remote: Total 175 (delta 61), reused 49 (delta 21)
>
> Receiving objects: 100% (175/175), 28.31 KiB, done.
>
> Resolving deltas: 100% (61/61), done.
>
> rake aborted!
>
> Don't know how to build task  
> 'radiant:extensions:static_caching:migrate'
>

This likely means there is no migrate task.

>
> (See full trace by running task with --trace)
>
> rake aborted!
>
> Don't know how to build task  
> 'radiant:extensions:static_caching:update'
>

Also, there is probably no update task.

>
> (See full trace by running task with --trace)
>
> www:/var/app/ radiant# rake production db:migrate:extensions
>
> (in /var/app/ radiant)
>
> rake aborted!
>
> uninitialized constant StaticCachingExtension::ResponseCache
>

I'm assuming you are running on Radiant 0.8.0 which has done away with  
ResponseCache and now uses Radiant::Cache
So this static_caching extension probably has not been updated for  
Radiant 0.8.0

>
>
> (See full trace by running task with --trace)
>
>
>
> Actually tbh, the migrate and update happens on ALL extensions I  
> install,
> but that's not an issue because if I run rake production
> db:migrate:extensions the extensions work and install.  However, I  
> cannot
> get this one to play nice at all.  So any help is appreciated (and  
> if this
> is the wrong place to ask sorry) since I am new to RadiantCMS.

This is the right place to ask.
Extension development is usually done by their respective authors, so  
you may want to contact them directly too if this list doesn't help.

-Jim
_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

_______________________________________________
Radiant mailing list
Post:   Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to