Sha256: 19f2b620807a97d5d782b6157288dfa8a9189daecb95d9129544e175fce49a61

Contents?: true

Size: 908 Bytes

Versions: 8

Compression:

Stored size: 908 Bytes

Contents

require "forwardable"

module Sitepress
  # Configuration object for rails application.
  class RailsConfiguration
    # Store in ./app/content by default.
    DEFAULT_SITE_ROOT = "app/content".freeze

    attr_accessor :site, :parent_engine, :routes, :cache_resources

    # Delegates configuration points into the Sitepress site.
    extend Forwardable
    def_delegators :site, :cache_resources, :cache_resources=, :cache_resources?

    # Set defaults.
    def initialize
      self.routes = true
    end

    def parent_engine
      @parent_engine ||= Rails.application
    end

    def site
      @site ||= Site.new(root_path: default_root).tap do |site|
        site.resources_pipeline << Extensions::PartialsRemover.new
        site.resources_pipeline << Extensions::RailsRequestPaths.new
      end
    end

    private
    def default_root
      Rails.root.join(DEFAULT_SITE_ROOT)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sitepress-rails-1.0.0 lib/sitepress/rails_configuration.rb
sitepress-rails-0.1.29 lib/sitepress/rails_configuration.rb
sitepress-rails-0.1.28 lib/sitepress/rails_configuration.rb
sitepress-rails-0.1.27 lib/sitepress/rails_configuration.rb
sitepress-rails-0.1.26 lib/sitepress/rails_configuration.rb
sitepress-rails-0.1.25 lib/sitepress/rails_configuration.rb
sitepress-rails-0.1.24 lib/sitepress/rails_configuration.rb
sitepress-rails-0.1.23 lib/sitepress/rails_configuration.rb