Merge pull request #3220 from inukshuk/patch-1

This commit is contained in:
Matt Rogers 2015-01-13 19:02:41 -06:00
commit ce78ea7818
2 changed files with 4 additions and 3 deletions

View File

@ -81,6 +81,7 @@ module Jekyll
FileUtils.mkdir_p(File.dirname(dest_path)) FileUtils.mkdir_p(File.dirname(dest_path))
FileUtils.rm(dest_path) if File.exist?(dest_path) FileUtils.rm(dest_path) if File.exist?(dest_path)
FileUtils.cp(path, dest_path) FileUtils.cp(path, dest_path)
File.utime(@@mtimes[path], @@mtimes[path], dest_path)
true true
end end

View File

@ -132,7 +132,6 @@ class TestSite < Test::Unit::TestCase
@site.metadata.clear @site.metadata.clear
@site.process @site.process
some_static_file = @site.static_files[0].path
dest = File.expand_path(@site.static_files[0].destination(@site.dest)) dest = File.expand_path(@site.static_files[0].destination(@site.dest))
mtime1 = File.stat(dest).mtime.to_i # first run must generate dest file mtime1 = File.stat(dest).mtime.to_i # first run must generate dest file
@ -144,16 +143,17 @@ class TestSite < Test::Unit::TestCase
# simulate destination file deletion # simulate destination file deletion
File.unlink dest File.unlink dest
refute File.exists?(dest)
sleep 1 sleep 1
@site.process @site.process
mtime3 = File.stat(dest).mtime.to_i mtime3 = File.stat(dest).mtime.to_i
assert_not_equal mtime2, mtime3 # must be regenerated and differ! assert_equal mtime2, mtime3 # must be regenerated and with original mtime!
sleep 1 sleep 1
@site.process @site.process
mtime4 = File.stat(dest).mtime.to_i mtime4 = File.stat(dest).mtime.to_i
assert_equal mtime3, mtime4 # no modifications, so must be the same assert_equal mtime3, mtime4 # no modifications, so remain the same
end end
should "setup plugins in priority order" do should "setup plugins in priority order" do