update the extension template to new class system
This commit is contained in:
parent
fa17134c0a
commit
b4edf7cf16
|
@ -6,14 +6,14 @@ source 'http://rubygems.org'
|
||||||
gemspec
|
gemspec
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
gem "rake", "~> 0.9.2"
|
gem "rake"
|
||||||
gem "rdoc", "~> 3.9"
|
gem "rdoc"
|
||||||
gem "yard", "~> 0.8.0"
|
gem "yard"
|
||||||
end
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
gem "cucumber", "~> 1.2.0"
|
gem "cucumber"
|
||||||
gem "fivemat"
|
gem "fivemat"
|
||||||
gem "aruba", "~> 0.4.11"
|
gem "aruba"
|
||||||
gem "rspec", "~> 2.7"
|
gem "rspec"
|
||||||
end
|
end
|
|
@ -1,2 +1,5 @@
|
||||||
# Ignore bundler lock file
|
# Ignore bundler lock file
|
||||||
Gemfile.lock
|
/Gemfile.lock
|
||||||
|
|
||||||
|
# Ignore pkg folder
|
||||||
|
/pkg
|
|
@ -2,19 +2,16 @@
|
||||||
require "middleman-core"
|
require "middleman-core"
|
||||||
|
|
||||||
# Extension namespace
|
# Extension namespace
|
||||||
module MyExtension < Middleman::Extension
|
class MyExtension < ::Middleman::Extension
|
||||||
option :my_option, "default", "An example option"
|
option :my_option, "default", "An example option"
|
||||||
|
|
||||||
def initialize(app, options_hash={})
|
def initialize(app, options_hash={}, &block)
|
||||||
# Call super to build options from the options_hash
|
# Call super to build options from the options_hash
|
||||||
super
|
super
|
||||||
|
|
||||||
# Require libraries only when activated
|
# Require libraries only when activated
|
||||||
# require 'necessary/library'
|
# require 'necessary/library'
|
||||||
|
|
||||||
# Include helpers or instance methods for the Middleman app
|
|
||||||
# app.send :include, Helpers
|
|
||||||
|
|
||||||
# set up your extension
|
# set up your extension
|
||||||
# puts options.my_option
|
# puts options.my_option
|
||||||
end
|
end
|
||||||
|
@ -23,7 +20,11 @@ module MyExtension < Middleman::Extension
|
||||||
# Do something
|
# Do something
|
||||||
end
|
end
|
||||||
|
|
||||||
# module Helpers
|
# A Sitemap Manipulator
|
||||||
|
# def manipulate_resource_list(resources)
|
||||||
|
# end
|
||||||
|
|
||||||
|
# module do
|
||||||
# def a_helper
|
# def a_helper
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
|
@ -32,9 +33,7 @@ end
|
||||||
|
|
||||||
# Register extensions which can be activated
|
# Register extensions which can be activated
|
||||||
# Make sure we have the version of Middleman we expect
|
# Make sure we have the version of Middleman we expect
|
||||||
# ::Middleman::Extensions.register(:extension_name) do
|
# Name param may be omited, it will default to underscored
|
||||||
#
|
# version of class name
|
||||||
# # Return the extension class
|
|
||||||
# ::MyExtension
|
# MyExtension.register(:my_extension)
|
||||||
#
|
|
||||||
# end
|
|
||||||
|
|
Loading…
Reference in a new issue