Rename Middleman::Base to Middleman::Application

This commit is contained in:
Thomas Reynolds 2012-04-14 14:04:10 -07:00
parent 2130e902c2
commit d2d40079cc
11 changed files with 27 additions and 27 deletions

View file

@ -11,4 +11,4 @@ module Middleman; end
require "middleman-core/version" require "middleman-core/version"
require "middleman-core/util" require "middleman-core/util"
require "middleman-core/extensions" require "middleman-core/extensions"
require "middleman-core/base" require "middleman-core/application"

View file

@ -18,7 +18,7 @@ require "middleman-core/sitemap"
# Core Middleman Class # Core Middleman Class
module Middleman module Middleman
class Base class Application
# Uses callbacks # Uses callbacks
include Hooks include Hooks
@ -49,7 +49,7 @@ module Middleman
# Get the static instance # Get the static instance
# #
# @private # @private
# @return [Middleman::Base] # @return [Middleman::Application]
def inst(&block) def inst(&block)
@inst ||= begin @inst ||= begin
mm = new(&block) mm = new(&block)
@ -61,7 +61,7 @@ module Middleman
# Set the shared instance # Set the shared instance
# #
# @private # @private
# @param [Middleman::Base] inst # @param [Middleman::Application] inst
# @return [void] # @return [void]
def inst=(inst) def inst=(inst)
@inst = inst @inst = inst
@ -427,7 +427,7 @@ module Middleman
# Backwards compatibilty with old Sinatra template interface # Backwards compatibilty with old Sinatra template interface
# #
# @return [Middleman::Base] # @return [Middleman::Application]
def settings def settings
self self
end end
@ -517,7 +517,7 @@ module Middleman
end end
class << self class << self
# Create a new Class which is based on Middleman::Base # Create a new Class which is based on Middleman::Application
# Used to create a safe sandbox into which extensions and # Used to create a safe sandbox into which extensions and
# configuration can be included later without impacting # configuration can be included later without impacting
# other classes and instances. # other classes and instances.
@ -526,7 +526,7 @@ module Middleman
def server(&block) def server(&block)
@@servercounter ||= 1 @@servercounter ||= 1
@@servercounter += 1 @@servercounter += 1
const_set("MiddlemanBase#{@@servercounter}", Class.new(Middleman::Base)) const_set("MiddlemanApplication#{@@servercounter}", Class.new(Middleman::Application))
end end
# Creates a new Rack::Server # Creates a new Rack::Server

View file

@ -57,9 +57,9 @@ module Middleman::Cli
true true
end end
# Middleman::Base singleton # Middleman::Application singleton
# #
# @return [Middleman::Base] # @return [Middleman::Application]
def shared_instance(verbose=false) def shared_instance(verbose=false)
@_shared_instance ||= ::Middleman.server.inst do @_shared_instance ||= ::Middleman.server.inst do
set :environment, :build set :environment, :build
@ -67,9 +67,9 @@ module Middleman::Cli
end end
end end
# Middleman::Base class singleton # Middleman::Application class singleton
# #
# @return [Middleman::Base] # @return [Middleman::Application]
def shared_server def shared_server
@_shared_server ||= shared_instance.class @_shared_server ||= shared_instance.class
end end
@ -86,7 +86,7 @@ module Middleman::Cli
end end
end end
# Set the root path to the Middleman::Base's root # Set the root path to the Middleman::Application's root
def source_root def source_root
shared_instance.root shared_instance.root
end end

View file

@ -14,7 +14,7 @@ module Middleman::CoreExtensions::Assets
alias :included :registered alias :included :registered
end end
# Methods to be mixed-in to Middleman::Base # Methods to be mixed-in to Middleman::Application
module InstanceMethod module InstanceMethod
# Get the URL of an asset given a type/prefix # Get the URL of an asset given a type/prefix

View file

@ -78,7 +78,7 @@ module Middleman::CoreExtensions::Data
# Setup data store # Setup data store
# #
# @param [Middleman::Base] app The current instance of Middleman # @param [Middleman::Application] app The current instance of Middleman
def initialize(app) def initialize(app)
@app = app @app = app
@local_data = {} @local_data = {}

View file

@ -20,7 +20,7 @@
# activate MyExtension # activate MyExtension
# #
# This will call the `registered` method in your extension and provide you # This will call the `registered` method in your extension and provide you
# with the `app` parameter which is a Middleman::Base context. From here # with the `app` parameter which is a Middleman::Application context. From here
# you can choose to respond to requests for certain paths or simply attach # you can choose to respond to requests for certain paths or simply attach
# Rack middleware to the stack. # Rack middleware to the stack.
# #

View file

@ -116,7 +116,7 @@ module Middleman::CoreExtensions::FrontMatter
class FrontMatter class FrontMatter
# Initialize frontmatter with current app # Initialize frontmatter with current app
# @param [Middleman::Base] app # @param [Middleman::Application] app
def initialize(app) def initialize(app)
@app = app @app = app
@source = File.expand_path(@app.source, @app.root) @source = File.expand_path(@app.source, @app.root)

View file

@ -5,7 +5,7 @@ module Middleman::Sitemap
class Resource class Resource
include Middleman::Sitemap::Extensions::Traversal include Middleman::Sitemap::Extensions::Traversal
# @return [Middleman::Base] # @return [Middleman::Application]
attr_reader :app attr_reader :app
# @return [Middleman::Sitemap::Store] # @return [Middleman::Sitemap::Store]

View file

@ -12,11 +12,11 @@ module Middleman::Sitemap
# extensions. All "path" parameters used in this class are source paths. # extensions. All "path" parameters used in this class are source paths.
class Store class Store
# @return [Middleman::Base] # @return [Middleman::Application]
attr_accessor :app attr_accessor :app
# Initialize with parent app # Initialize with parent app
# @param [Middleman::Base] app # @param [Middleman::Application] app
def initialize(app) def initialize(app)
@app = app @app = app
@resources = [] @resources = []

View file

@ -94,7 +94,7 @@ module Middleman
end end
end end
# Start an instance of Middleman::Base # Start an instance of Middleman::Application
# @return [void] # @return [void]
def bootup def bootup
env = (@options[:environment] || "development").to_sym env = (@options[:environment] || "development").to_sym

View file

@ -51,17 +51,17 @@ module Middleman
# Setup renderers # Setup renderers
require "coffee_script" require "coffee_script"
Base.register Middleman::Renderers::Haml Application.register Middleman::Renderers::Haml
Base.register Middleman::Renderers::Sass Application.register Middleman::Renderers::Sass
Base.register Middleman::Renderers::Markdown Application.register Middleman::Renderers::Markdown
Base.register Middleman::Renderers::Liquid Application.register Middleman::Renderers::Liquid
Base.register Middleman::Renderers::Slim Application.register Middleman::Renderers::Slim
# Compass framework # Compass framework
Base.register Middleman::CoreExtensions::Compass Application.register Middleman::CoreExtensions::Compass
# Sprockets asset handling # Sprockets asset handling
Base.register Middleman::CoreExtensions::Sprockets Application.register Middleman::CoreExtensions::Sprockets
# Register the optional extensions # Register the optional extensions
Extensions.register(:cache_buster) { Extensions.register(:cache_buster) {