Fix some tests
This commit is contained in:
parent
e47b0ae29a
commit
ae15d203a8
|
@ -94,7 +94,7 @@ module Middleman
|
||||||
# @return [void]
|
# @return [void]
|
||||||
Contract IsA['Middleman::SourceFile'] => Any
|
Contract IsA['Middleman::SourceFile'] => Any
|
||||||
def touch_file(file)
|
def touch_file(file)
|
||||||
data_path = file[:full_path]
|
data_path = file[:relative_path]
|
||||||
extension = File.extname(data_path)
|
extension = File.extname(data_path)
|
||||||
basename = File.basename(data_path, extension)
|
basename = File.basename(data_path, extension)
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ module Middleman
|
||||||
# @return [void]
|
# @return [void]
|
||||||
Contract IsA['Middleman::SourceFile'] => Any
|
Contract IsA['Middleman::SourceFile'] => Any
|
||||||
def remove_file(file)
|
def remove_file(file)
|
||||||
data_path = file[:full_path]
|
data_path = file[:relative_path]
|
||||||
extension = File.extname(data_path)
|
extension = File.extname(data_path)
|
||||||
basename = File.basename(data_path, extension)
|
basename = File.basename(data_path, extension)
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,7 @@ module Middleman
|
||||||
Contract ArrayOf[Pathname], ArrayOf[Pathname] => Any
|
Contract ArrayOf[Pathname], ArrayOf[Pathname] => Any
|
||||||
def update(updated_paths, removed_paths)
|
def update(updated_paths, removed_paths)
|
||||||
valid_updates = updated_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?))
|
.select(&method(:valid?))
|
||||||
|
|
||||||
valid_updates.each do |f|
|
valid_updates.each do |f|
|
||||||
|
|
|
@ -468,13 +468,12 @@ module Middleman
|
||||||
#
|
#
|
||||||
# @param [Pathname] path The path.
|
# @param [Pathname] path The path.
|
||||||
# @return [Middleman::SourceFile]
|
# @return [Middleman::SourceFile]
|
||||||
Contract Pathname, Pathname, Symbol => IsA['Middleman::SourceFile']
|
Contract Pathname, Pathname, Symbol, Bool => IsA['Middleman::SourceFile']
|
||||||
def path_to_source_file(path, directory, type)
|
def path_to_source_file(path, directory, type, destination_dir)
|
||||||
types = Set.new([type])
|
types = Set.new([type])
|
||||||
|
|
||||||
relative_path = path.relative_path_from(directory)
|
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)
|
::Middleman::SourceFile.new(Pathname(relative_path), path, directory, types)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue