Fix some tests

feature/livereload-locales-data
Thomas Reynolds 2015-11-28 19:32:45 -08:00
parent e47b0ae29a
commit ae15d203a8
3 changed files with 6 additions and 7 deletions

View File

@ -94,7 +94,7 @@ module Middleman
# @return [void]
Contract IsA['Middleman::SourceFile'] => Any
def touch_file(file)
data_path = file[:full_path]
data_path = file[:relative_path]
extension = File.extname(data_path)
basename = File.basename(data_path, extension)
@ -124,7 +124,7 @@ module Middleman
# @return [void]
Contract IsA['Middleman::SourceFile'] => Any
def remove_file(file)
data_path = file[:full_path]
data_path = file[:relative_path]
extension = File.extname(data_path)
basename = File.basename(data_path, extension)

View File

@ -226,7 +226,7 @@ module Middleman
Contract ArrayOf[Pathname], ArrayOf[Pathname] => Any
def update(updated_paths, removed_paths)
valid_updates = updated_paths
.map { |p| ::Middleman::Util.path_to_source_file(p, @directory, @type) }
.map { |p| ::Middleman::Util.path_to_source_file(p, @directory, @type, @options.fetch(:destination_dir, false)) }
.select(&method(:valid?))
valid_updates.each do |f|

View File

@ -468,13 +468,12 @@ module Middleman
#
# @param [Pathname] path The path.
# @return [Middleman::SourceFile]
Contract Pathname, Pathname, Symbol => IsA['Middleman::SourceFile']
def path_to_source_file(path, directory, type)
Contract Pathname, Pathname, Symbol, Bool => IsA['Middleman::SourceFile']
def path_to_source_file(path, directory, type, destination_dir)
types = Set.new([type])
relative_path = path.relative_path_from(directory)
# destination_dir = @options.fetch(:destination_dir, false)
# relative_path = File.join(destination_dir, relative_path) if destination_dir
relative_path = File.join(destination_dir, relative_path) if destination_dir
::Middleman::SourceFile.new(Pathname(relative_path), path, directory, types)
end