Sha256: cd5c5926bca201efbfbe9b64bec15f00e3b6cf2dbe0fe6d4b66b08c82386d288

Contents?: true

Size: 1.88 KB

Versions: 15

Compression:

Stored size: 1.88 KB

Contents

require "sitepress-core"

module Sitepress
  autoload :Compiler,                 "sitepress/compiler"
  autoload :Model,                    "sitepress/model"
  module Models
    autoload :Collection,             "sitepress/models/collection"
  end
  autoload :RailsConfiguration,       "sitepress/rails_configuration"
  module Renderers
    autoload :Controller,             "sitepress/renderers/controller"
    autoload :Server,                 "sitepress/renderers/server"
  end
  autoload :Rendition,                "sitepress/rendition"
  autoload :RouteConstraint,          "sitepress/route_constraint"
  module BuildPaths
    autoload :RootPath,               "sitepress/build_paths/root_path"
    autoload :IndexPath,              "sitepress/build_paths/index_path"
    autoload :DirectoryIndexPath,     "sitepress/build_paths/directory_index_path"
  end

  # Base class for errors if Sitepress can't find a resource, model, etc.
  NotFoundError = Class.new(StandardError)

  # Rescued by ActionController to display page not found error.
  ResourceNotFoundError = Class.new(NotFoundError)
  # Accidentally left out `Error` in the constant name, so I'm setting
  # that up here for backwards compatability.
  ResourceNotFound = ResourceNotFoundError

  # Raised if a model isn't found.
  ModelNotFoundError = Class.new(NotFoundError)

  # Raised when any of the Render subclasses can't render a page.
  RenderingError = Class.new(RuntimeError)

  # Make site available via Sitepress.site from Rails app.
  def self.site
    configuration.site
  end

  # Default configuration object for Sitepress Rails integration.
  def self.configuration
    @configuration ||= RailsConfiguration.new
  end

  def self.reset_configuration
    @configuration = nil
  end

  def self.configure(&block)
    block.call configuration
  end
end

# This can't be autoloaded; otherwise Rails won't pick up the engine.
require "sitepress/engine"

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
sitepress-rails-4.0.5 lib/sitepress/rails.rb
sitepress-rails-4.0.4 lib/sitepress/rails.rb
sitepress-rails-4.0.3 lib/sitepress/rails.rb
sitepress-rails-4.0.2 lib/sitepress/rails.rb
sitepress-rails-4.0.1 lib/sitepress/rails.rb
sitepress-rails-4.0.0 lib/sitepress/rails.rb
sitepress-rails-4.0.0.beta1 lib/sitepress/rails.rb
sitepress-rails-3.2.2 lib/sitepress/rails.rb
sitepress-rails-3.2.1 lib/sitepress/rails.rb
sitepress-rails-3.2.0 lib/sitepress/rails.rb
sitepress-rails-3.1.4 lib/sitepress/rails.rb
sitepress-rails-3.1.3 lib/sitepress/rails.rb
sitepress-rails-3.1.2 lib/sitepress/rails.rb
sitepress-rails-3.1.1 lib/sitepress/rails.rb
sitepress-rails-3.0.1 lib/sitepress/rails.rb