update the extension template to new class system

This commit is contained in:
Thomas Reynolds 2013-05-01 09:37:33 -07:00
parent fa17134c0a
commit b4edf7cf16
3 changed files with 21 additions and 19 deletions

View file

@ -6,14 +6,14 @@ source 'http://rubygems.org'
gemspec
group :development do
gem "rake", "~> 0.9.2"
gem "rdoc", "~> 3.9"
gem "yard", "~> 0.8.0"
gem "rake"
gem "rdoc"
gem "yard"
end
group :test do
gem "cucumber", "~> 1.2.0"
gem "cucumber"
gem "fivemat"
gem "aruba", "~> 0.4.11"
gem "rspec", "~> 2.7"
gem "aruba"
gem "rspec"
end

View file

@ -1,2 +1,5 @@
# Ignore bundler lock file
Gemfile.lock
/Gemfile.lock
# Ignore pkg folder
/pkg

View file

@ -2,19 +2,16 @@
require "middleman-core"
# Extension namespace
module MyExtension < Middleman::Extension
class MyExtension < ::Middleman::Extension
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
super
# Require libraries only when activated
# require 'necessary/library'
# Include helpers or instance methods for the Middleman app
# app.send :include, Helpers
# set up your extension
# puts options.my_option
end
@ -23,7 +20,11 @@ module MyExtension < Middleman::Extension
# Do something
end
# module Helpers
# A Sitemap Manipulator
# def manipulate_resource_list(resources)
# end
# module do
# def a_helper
# end
# end
@ -32,9 +33,7 @@ end
# Register extensions which can be activated
# Make sure we have the version of Middleman we expect
# ::Middleman::Extensions.register(:extension_name) do
#
# # Return the extension class
# ::MyExtension
#
# end
# Name param may be omited, it will default to underscored
# version of class name
# MyExtension.register(:my_extension)