Remove redundant extension version checking, we're using Bundler now
This commit is contained in:
parent
02871f5fcc
commit
556f82afbc
|
@ -17,34 +17,17 @@ module Middleman
|
||||||
#
|
#
|
||||||
# @param [Symbol] name The name of the extension
|
# @param [Symbol] name The name of the extension
|
||||||
# @param [Module] namespace The extension module
|
# @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
|
# @yield Instead of passing a module in namespace, you can provide
|
||||||
# a block which returns your extension module. This gives
|
# a block which returns your extension module. This gives
|
||||||
# you the ability to require other files only when the
|
# you the ability to require other files only when the
|
||||||
# extension is activated.
|
# 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
|
# If we've already got a matching extension that passed the
|
||||||
# version check, bail out.
|
# version check, bail out.
|
||||||
return if registered.has_key?(name.to_sym) &&
|
return if registered.has_key?(name.to_sym) &&
|
||||||
!registered[name.to_sym].is_a?(String)
|
!registered[name.to_sym].is_a?(String)
|
||||||
|
|
||||||
if block_given?
|
registered[name.to_sym] = 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?
|
|
||||||
block
|
block
|
||||||
elsif namespace
|
elsif namespace
|
||||||
namespace
|
namespace
|
||||||
|
|
|
@ -41,7 +41,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, ">= 3.0.0.beta.2") do
|
# ::Middleman::Extensions.register(:extension_name) do
|
||||||
#
|
#
|
||||||
# # Return the extension module
|
# # Return the extension module
|
||||||
# ::MyExtension
|
# ::MyExtension
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
# Using for version parsing
|
|
||||||
require "rubygems"
|
|
||||||
|
|
||||||
module Middleman
|
module Middleman
|
||||||
# Current Version
|
# Current Version
|
||||||
# @return [String]
|
# @return [String]
|
||||||
VERSION = '3.0.0.beta.3' unless const_defined?(:VERSION)
|
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue