Remove redundant extension version checking, we're using Bundler now
This commit is contained in:
parent
02871f5fcc
commit
556f82afbc
3 changed files with 3 additions and 28 deletions
|
@ -17,34 +17,17 @@ module Middleman
|
|||
#
|
||||
# @param [Symbol] name The name of the extension
|
||||
# @param [Module] namespace The extension module
|
||||
# @param [String] version A RubyGems-style version string stating
|
||||
# the versions of middleman this extension
|
||||
# is compatible with.
|
||||
# @yield Instead of passing a module in namespace, you can provide
|
||||
# a block which returns your extension module. This gives
|
||||
# you the ability to require other files only when the
|
||||
# extension is activated.
|
||||
def register(name, namespace=nil, version=nil, &block)
|
||||
def register(name, namespace=nil, &block)
|
||||
# If we've already got a matching extension that passed the
|
||||
# version check, bail out.
|
||||
return if registered.has_key?(name.to_sym) &&
|
||||
!registered[name.to_sym].is_a?(String)
|
||||
|
||||
if block_given?
|
||||
version = namespace
|
||||
end
|
||||
|
||||
passed_version_check = true
|
||||
if !version.nil?
|
||||
requirement = ::Gem::Requirement.create(version)
|
||||
if !requirement.satisfied_by?(Middleman::GEM_VERSION)
|
||||
passed_version_check = false
|
||||
end
|
||||
end
|
||||
|
||||
registered[name.to_sym] = if !passed_version_check
|
||||
"== #{name} failed version check. Requested #{version}, got #{Middleman::VERSION}"
|
||||
elsif block_given?
|
||||
registered[name.to_sym] = if block_given?
|
||||
block
|
||||
elsif namespace
|
||||
namespace
|
||||
|
|
|
@ -41,7 +41,7 @@ end
|
|||
|
||||
# Register extensions which can be activated
|
||||
# Make sure we have the version of Middleman we expect
|
||||
# ::Middleman::Extensions.register(:extension_name, ">= 3.0.0.beta.2") do
|
||||
# ::Middleman::Extensions.register(:extension_name) do
|
||||
#
|
||||
# # Return the extension module
|
||||
# ::MyExtension
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
# Using for version parsing
|
||||
require "rubygems"
|
||||
|
||||
module Middleman
|
||||
# Current Version
|
||||
# @return [String]
|
||||
VERSION = '3.0.0.beta.3' unless const_defined?(:VERSION)
|
||||
|
||||
# Parsed version for RubyGems
|
||||
# @private
|
||||
# @return [String]
|
||||
GEM_VERSION = ::Gem::Version.create(VERSION) unless const_defined?(:GEM_VERSION)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue