checksummer 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.7
1
+ 0.1.8
data/checksummer.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{checksummer}
8
- s.version = "0.1.7"
8
+ s.version = "0.1.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tobias Schwab"]
12
- s.date = %q{2011-03-09}
12
+ s.date = %q{2011-03-18}
13
13
  s.default_executable = %q{checksummer}
14
14
  s.description = %q{Replace files with links to md5 files}
15
15
  s.email = %q{tobias.schwab@dynport.de}
@@ -41,7 +41,8 @@ class ChecksummerFile
41
41
  new_path = md5_path(checksum_dir)
42
42
  status = if !File.exists?(new_path)
43
43
  FileUtils.mkdir_p(File.dirname(new_path))
44
- FileUtils.cp(path, new_path)
44
+ FileUtils.cp(path, "#{new_path}.tmp")
45
+ FileUtils.mv("#{new_path}.tmp", new_path)
45
46
  :copied
46
47
  else
47
48
  :symlinked
@@ -44,6 +44,7 @@ describe ChecksummerFile do
44
44
  FileUtils.stub!(:mkdir_p)
45
45
  FileUtils.stub!(:touch)
46
46
  FileUtils.stub(:ln_sf).and_return true
47
+ FileUtils.stub(:mv).and_return true
47
48
  File.stub!(:exists?).and_return false
48
49
  File.stub(:symlink?).and_return false
49
50
  File.stub!(:mtime).and_return time
@@ -68,7 +69,13 @@ describe ChecksummerFile do
68
69
  describe "with the file not being checksummed" do
69
70
  it "copys the file to it's md5" do
70
71
  File.stub!(:exists?).and_return false
71
- FileUtils.should_receive(:cp).with("/some/text.csv", "/tmp/data/f/d/e/8/fde8dad8ea43640b00cdd1e92e532ca9")
72
+ FileUtils.should_receive(:cp).with("/some/text.csv", "/tmp/data/f/d/e/8/fde8dad8ea43640b00cdd1e92e532ca9.tmp")
73
+ file.checksum_to!("/tmp/data")
74
+ end
75
+
76
+ it "renames the tmp file to the final name" do
77
+ File.stub!(:exists?).and_return false
78
+ FileUtils.should_receive(:mv).with("/tmp/data/f/d/e/8/fde8dad8ea43640b00cdd1e92e532ca9.tmp", "/tmp/data/f/d/e/8/fde8dad8ea43640b00cdd1e92e532ca9")
72
79
  file.checksum_to!("/tmp/data")
73
80
  end
74
81
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 7
9
- version: 0.1.7
8
+ - 8
9
+ version: 0.1.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Tobias Schwab
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-03-09 00:00:00 +01:00
17
+ date: 2011-03-18 00:00:00 +01:00
18
18
  default_executable: checksummer
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -155,7 +155,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - ">="
157
157
  - !ruby/object:Gem::Version
158
- hash: -1801041906280434529
158
+ hash: -2013251382581930018
159
159
  segments:
160
160
  - 0
161
161
  version: "0"