Sha256: 09067c4644c7ac5cc54faa1c3764ab3cb9181fd659b64ea7ffcf0f425d5b4147

Contents?: true

Size: 1.61 KB

Versions: 3

Compression:

Stored size: 1.61 KB

Contents

require 'tmpdir'

module Refinery
  module Application
    class << self
      def refine!
        ::ApplicationHelper.send :include, ::Refinery::ApplicationHelper

        [::ApplicationController, ::Admin::BaseController].each do |c|
          c.send :include, ::Refinery::ApplicationController
          c.send :helper, :application
        end

        ::Admin::BaseController.send :include, ::Refinery::Admin::BaseController
      end

      def included(base)
        self.instance_eval %(
          def self.method_missing(method_sym, *arguments, &block)
            #{base}.send(method_sym)
          end
        )

        # JavaScript files you want as :defaults (application.js is always included).
        base.config.action_view.javascript_expansions[:defaults] = %w()

        # Configure the default encoding used in templates for Ruby 1.9.
        base.config.encoding = "utf-8"

        # Configure sensitive parameters which will be filtered from the log file.
        base.config.filter_parameters += [:password, :password_confirmation]

        # Specify a cache store to use
        base.config.cache_store = :file_store, File.join(Dir.tmpdir, base.name.to_s.gsub(':', File::SEPARATOR))

        # Include the refinery controllers and helpers dynamically
        base.config.to_prepare do
          ::Refinery::Application.refine!
        end

        # load in any settings that the developer wants after the initialization.
        base.config.after_initialize do
          if (settings = Rails.root.join('config', 'settings.rb')).exist?
            require settings.to_s
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
refinerycms-core-0.9.9.8 lib/refinery/application.rb
refinerycms-core-0.9.9.7 lib/refinery/application.rb
refinerycms-core-0.9.9.5 lib/refinery/application.rb