over calling change callbacks which are unnecessary.

This commit is contained in:
Thomas Reynolds 2014-12-26 14:11:58 -08:00
parent ef0b996004
commit eb1a658b25
3 changed files with 4 additions and 4 deletions

View file

@ -146,9 +146,9 @@ module Middleman
# Get the URL path for an on-disk file
# @param [String] file
# @return [String]
Contract IsA['Middleman::SourceFile'] => String
Contract Or[Pathname, IsA['Middleman::SourceFile']] => String
def file_to_path(file)
relative_path = file[:relative_path].to_s
relative_path = file.is_a?(Pathname) ? file.to_s : file[:relative_path].to_s
# Replace a file name containing automatic_directory_matcher with a folder
unless @app.config[:automatic_directory_matcher].nil?

View file

@ -339,7 +339,7 @@ module Middleman
valid_updated = updated_files.select { |f| f[:types].include?(callback[:type]) }
valid_removed = removed_files.select { |f| f[:types].include?(callback[:type]) }
callback[:proc].call(valid_updated, valid_removed)
callback[:proc].call(valid_updated, valid_removed) unless valid_updated.empty? && valid_removed.empty?
end
end
end

View file

@ -1,5 +1,5 @@
module Middleman
# Current Version
# @return [String]
VERSION = '4.0.0.alpha.4' unless const_defined?(:VERSION)
VERSION = '4.0.0.alpha.5' unless const_defined?(:VERSION)
end