Sha256: cdbae2dbca1e5d4fb0da04175a21a50926579f8f82f7bf5a35ac0141bb3c1fe4

Contents?: true

Size: 928 Bytes

Versions: 8

Compression:

Stored size: 928 Bytes

Contents

require 'metry'

load 'metry_authenticator.rb'

class MetryExtension < Radiant::Extension
  version "1.0"
  description "Provides Metry support to Radiant."
  url "http://terralien.com/projects"
  
  def activate
    Page.class_eval do
      include MetryTags
      
      def metry_active=(state)
        @metry_active = state
      end
      
      def metry_active?
        @metry_active
      end
      
      def cache_with_metry?
        (cache_without_metry? && !metry_active?)
      end
      alias_method_chain :cache?, :metry
    end

    Metry.init 'radiant-tracking'
    Rails.configuration.middleware.insert_after ActionController::Failsafe, Metry::Rack::Tracking
    Rails.configuration.middleware.use proc{Metry::Psycho}, {
      :path => "/admin/metry",
      :authorize => proc{|env| MetryAuthenticator.new(env).authorized?},
      :on_deny => proc {|env| MetryAuthenticator.new(env).redirect},
    }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
metry-2.0.4 radiant/extension/metry_extension.rb
metry-2.0.5 radiant/extension/metry_extension.rb
metry-2.1.0 radiant/extension/metry_extension.rb
metry-2.1.1 radiant/extension/metry_extension.rb
metry-2.0.0 radiant/extension/metry_extension.rb
metry-2.0.1 radiant/extension/metry_extension.rb
metry-2.0.2 radiant/extension/metry_extension.rb
metry-2.0.3 radiant/extension/metry_extension.rb