split out core extensions from features
This commit is contained in:
parent
a6ad06f3e6
commit
7a35c1f48e
5 changed files with 27 additions and 23 deletions
|
@ -72,6 +72,15 @@ module Middleman
|
||||||
autoload :CoffeeScript, "middleman/renderers/coffee_script"
|
autoload :CoffeeScript, "middleman/renderers/coffee_script"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module CoreExtensions
|
||||||
|
# DefaultHelpers are the built-in dynamic template helpers.
|
||||||
|
autoload :DefaultHelpers, "middleman/core_extensions/default_helpers"
|
||||||
|
|
||||||
|
# Data looks at the data/ folder for YAML files and makes them available
|
||||||
|
# to dynamic requests.
|
||||||
|
autoload :Data, "middleman/core_extensions/data"
|
||||||
|
end
|
||||||
|
|
||||||
# Features API
|
# Features API
|
||||||
autoload :Features, "middleman/features"
|
autoload :Features, "middleman/features"
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,18 +2,18 @@ require "yaml"
|
||||||
require "httparty"
|
require "httparty"
|
||||||
require "thor"
|
require "thor"
|
||||||
|
|
||||||
module Middleman::Features::Data
|
module Middleman::CoreExtensions::Data
|
||||||
class << self
|
class << self
|
||||||
def registered(app)
|
def registered(app)
|
||||||
app.extend ClassMethods
|
app.extend ClassMethods
|
||||||
app.helpers Middleman::Features::Data::Helpers
|
app.helpers Helpers
|
||||||
end
|
end
|
||||||
alias :included :registered
|
alias :included :registered
|
||||||
end
|
end
|
||||||
|
|
||||||
module Helpers
|
module Helpers
|
||||||
def data
|
def data
|
||||||
@@data ||= Middleman::Features::Data::DataObject.new(self)
|
@@data ||= Middleman::CoreExtensions::Data::DataObject.new(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -82,11 +82,11 @@ module Middleman::Features::Data
|
||||||
#
|
#
|
||||||
# data.my_json
|
# data.my_json
|
||||||
def data_source(name, url)
|
def data_source(name, url)
|
||||||
Middleman::Features::Data::DataObject.add_source(name, url)
|
Middleman::CoreExtensions::Data::DataObject.add_source(name, url)
|
||||||
end
|
end
|
||||||
|
|
||||||
def data_content(name, content)
|
def data_content(name, content)
|
||||||
Middleman::Features::Data::DataObject.data_content(name, content)
|
Middleman::CoreExtensions::Data::DataObject.data_content(name, content)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,7 +1,13 @@
|
||||||
module Middleman::Features::DefaultHelpers
|
require "padrino-helpers"
|
||||||
|
|
||||||
|
module Middleman::CoreExtensions::DefaultHelpers
|
||||||
class << self
|
class << self
|
||||||
def registered(app)
|
def registered(app)
|
||||||
app.helpers Middleman::Features::DefaultHelpers::Helpers
|
# Use Padrino Helpers
|
||||||
|
app.register Padrino::Helpers
|
||||||
|
|
||||||
|
# Middleman Helpers
|
||||||
|
app.helpers Helpers
|
||||||
end
|
end
|
||||||
alias :included :registered
|
alias :included :registered
|
||||||
end
|
end
|
|
@ -43,9 +43,6 @@ module Middleman::Features
|
||||||
# browser caches failing to update to your new content.
|
# browser caches failing to update to your new content.
|
||||||
autoload :CacheBuster, "middleman/features/cache_buster"
|
autoload :CacheBuster, "middleman/features/cache_buster"
|
||||||
|
|
||||||
# DefaultHelpers are the built-in dynamic template helpers.
|
|
||||||
autoload :DefaultHelpers, "middleman/features/default_helpers"
|
|
||||||
|
|
||||||
# AutomaticImageSizes inspects the images used in your dynamic templates and
|
# AutomaticImageSizes inspects the images used in your dynamic templates and
|
||||||
# automatically adds width and height attributes to their HTML elements.
|
# automatically adds width and height attributes to their HTML elements.
|
||||||
autoload :AutomaticImageSizes, "middleman/features/automatic_image_sizes"
|
autoload :AutomaticImageSizes, "middleman/features/automatic_image_sizes"
|
||||||
|
@ -67,10 +64,6 @@ module Middleman::Features
|
||||||
# paragraphs, fake images, names and email addresses.
|
# paragraphs, fake images, names and email addresses.
|
||||||
autoload :Lorem, "middleman/features/lorem"
|
autoload :Lorem, "middleman/features/lorem"
|
||||||
|
|
||||||
# Data looks at the data/ folder for YAML files and makes them available
|
|
||||||
# to dynamic requests.
|
|
||||||
autoload :Data, "middleman/features/data"
|
|
||||||
|
|
||||||
# Parse YAML metadata from templates
|
# Parse YAML metadata from templates
|
||||||
autoload :FrontMatter, "middleman/features/front_matter"
|
autoload :FrontMatter, "middleman/features/front_matter"
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ require "sinatra/base"
|
||||||
|
|
||||||
# Use the padrino project's helpers
|
# Use the padrino project's helpers
|
||||||
require "padrino-core/application/rendering"
|
require "padrino-core/application/rendering"
|
||||||
require "padrino-helpers"
|
|
||||||
|
|
||||||
module Middleman
|
module Middleman
|
||||||
class Server < Sinatra::Base
|
class Server < Sinatra::Base
|
||||||
|
@ -34,18 +33,15 @@ module Middleman
|
||||||
# Disable Padrino cache buster until explicitly enabled
|
# Disable Padrino cache buster until explicitly enabled
|
||||||
set :asset_stamp, false
|
set :asset_stamp, false
|
||||||
|
|
||||||
# Use Padrino Helpers
|
# Activate built-in helpers
|
||||||
register Padrino::Helpers
|
register Middleman::CoreExtensions::DefaultHelpers
|
||||||
|
|
||||||
|
# Activate Yaml Data package
|
||||||
|
register Middleman::CoreExtensions::Data
|
||||||
|
|
||||||
# Activate custom features
|
# Activate custom features
|
||||||
register Middleman::Features
|
register Middleman::Features
|
||||||
|
|
||||||
# Activate built-in helpers
|
|
||||||
register Middleman::Features::DefaultHelpers
|
|
||||||
|
|
||||||
# Activate Yaml Data package
|
|
||||||
register Middleman::Features::Data
|
|
||||||
|
|
||||||
# Activate Webservices Proxy package
|
# Activate Webservices Proxy package
|
||||||
# register Middleman::Features::Proxy
|
# register Middleman::Features::Proxy
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue