@@ -10,13 +10,15 @@ class Gzip
1010 # writes contents to the `file` passed in. Sets `mtime` of
1111 # written file to passed in `mtime`
1212 module ZlibArchiver
13- def self . call ( file , source , mtime )
13+ MTIME = RUBY_VERSION >= "2.7" ? 0 : 1
14+
15+ def self . call ( file , source )
1416 gz = Zlib ::GzipWriter . new ( file , Zlib ::BEST_COMPRESSION )
15- gz . mtime = mtime
17+ gz . mtime = MTIME
1618 gz . write ( source )
1719 gz . close
1820
19- File . utime ( mtime , mtime , file . path )
21+ nil
2022 end
2123 end
2224
@@ -28,8 +30,8 @@ def self.call(file, source, mtime)
2830 # writes contents to the `file` passed in. Sets `mtime` of
2931 # written file to passed in `mtime`
3032 module ZopfliArchiver
31- def self . call ( file , source , mtime )
32- compressed_source = Autoload ::Zopfli . deflate ( source , format : :gzip , mtime : mtime )
33+ def self . call ( file , source )
34+ compressed_source = Autoload ::Zopfli . deflate ( source , format : :gzip )
3335 file . write ( compressed_source )
3436 file . close
3537
@@ -90,7 +92,8 @@ def cannot_compress?
9092 # Returns nothing.
9193 def compress ( file , target )
9294 mtime = Sprockets ::PathUtils . stat ( target ) . mtime
93- archiver . call ( file , source , mtime )
95+ archiver . call ( file , source )
96+ File . utime ( mtime , mtime , file . path )
9497
9598 nil
9699 end
0 commit comments