clutil 2011.009.1 → 2011.010.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/cl/util/file.rb +14 -2
- data/cl/util/test/filetest.rb +0 -14
- metadata +4 -4
data/cl/util/file.rb
CHANGED
|
@@ -117,12 +117,24 @@ class << File
|
|
|
117
117
|
else
|
|
118
118
|
set_ro = false
|
|
119
119
|
end
|
|
120
|
-
|
|
121
|
-
File.utime(new_atime, File.stat(src).mtime, dst)
|
|
120
|
+
match_mtime(src, dst)
|
|
122
121
|
File.chmod(0444, dst) if set_ro
|
|
123
122
|
return installed
|
|
124
123
|
end
|
|
125
124
|
|
|
125
|
+
# XP's utime appears to still have a bug when the file's time is within Daylight Saving Time, but
|
|
126
|
+
# the current system time is outside Daylight Saving Time. This method will ensure any difference
|
|
127
|
+
# is compensated for.
|
|
128
|
+
def match_mtime(src, dst)
|
|
129
|
+
new_atime = Time.now
|
|
130
|
+
File.utime(new_atime, File.mtime(src), dst)
|
|
131
|
+
if File.mtime(src) != File.mtime(dst)
|
|
132
|
+
new_mtime = File.mtime(src)
|
|
133
|
+
new_mtime += (File.mtime(src) - File.mtime(dst))
|
|
134
|
+
File.utime(new_atime, new_mtime, dst)
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
126
138
|
# human readable size
|
|
127
139
|
def h_size(filename)
|
|
128
140
|
size = File.size(filename)
|
data/cl/util/test/filetest.rb
CHANGED
|
@@ -201,20 +201,6 @@ class TestBackup < TempDirTest
|
|
|
201
201
|
dst = File.join(@b_dir, File.basename(src))
|
|
202
202
|
assert_equal(true, File.backup(src, dst))
|
|
203
203
|
|
|
204
|
-
File.utime(0, 0, dst)
|
|
205
|
-
assert_equal(true, File.backup(src, dst))
|
|
206
|
-
assert_equal(true, File.backup(src, dst))
|
|
207
|
-
end
|
|
208
|
-
|
|
209
|
-
def test_backed_up_because_exists_different_mtime_but_install_returns_false
|
|
210
|
-
# a complicated case: the dst file exists, has the exact same content,
|
|
211
|
-
# but has a different timestamp (perhaps due to time zone glitchery).
|
|
212
|
-
# the file should come back as backed up, but have its mtime updated to match
|
|
213
|
-
# the src so it won't trigger the next time a compare is done
|
|
214
|
-
src = make_sample_text_file('a')
|
|
215
|
-
dst = File.join(@b_dir, File.basename(src))
|
|
216
|
-
assert_equal(true, File.backup(src, dst))
|
|
217
|
-
|
|
218
204
|
File.utime(0, 0, dst)
|
|
219
205
|
assert_equal(true, File.backup(src, dst))
|
|
220
206
|
end
|
metadata
CHANGED
|
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
|
4
4
|
prerelease: false
|
|
5
5
|
segments:
|
|
6
6
|
- 2011
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
version: 2011.
|
|
7
|
+
- 10
|
|
8
|
+
- 0
|
|
9
|
+
version: 2011.010.0
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- chrismo
|
|
@@ -14,7 +14,7 @@ autorequire:
|
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
16
|
|
|
17
|
-
date: 2011-01-
|
|
17
|
+
date: 2011-01-10 00:00:00 -06:00
|
|
18
18
|
default_executable:
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|