s3_meta_sync 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b7eb9e8cfbb4fba93e16b088470bc62f9d32795
4
- data.tar.gz: 0998403f3dea548319c2f793da82333e3eaf50da
3
+ metadata.gz: 86108185353e54e6adf0bc50b1c5661b30056ab3
4
+ data.tar.gz: d0f3ecc3597c3d4095106e12cbc690f2486ed716
5
5
  SHA512:
6
- metadata.gz: 0dd7baa033fbac76e2f5f85bdcc5d9206a57684c45b0cc444114821e39d8c7b3b8fdc543d7c5fc9b82f82bb4813a194a0c05b778887e64f9beaa77f45da55f85
7
- data.tar.gz: c74e6809f4c2cf48e6aa6eec94358e1ccd4663bf45bb3d04d5ac0cc7bb7a5d18457f0d33856a301649e30081a38989d7424e17f07be67daffbdcd71a8708928f
6
+ metadata.gz: 587e5b34cf058fb84d488632eec7e0a3322c440395e7e24ca62d0741977beba613cea4b2a10fd2481c0e705a6239b32fbad2f6b06634859496552dac17d0a637
7
+ data.tar.gz: 4025e4bdf77f15b72d5922e6a1c3ab8ad2974090444bb860be8dfdad2e9f6e4df2bd14fd0bba6e1b097d96c414c1c5bb187a1bd0f341f24cb36f74d3f5bbe21c
checksums.yaml.gz.sig CHANGED
@@ -1 +1,2 @@
1
- G�^_`�ގ�� �����Gc��ɶT:�-��K3˜L��B��x˩s���/0�2�ʌ��J3��y6ZPߕ�®�fowgd�i/�����ȴ�8ur?���t���R���4Cc�ȴ 6
1
+ %w1�"無%h%���x�2)1D8��98zR���5WG1��:�ogx�崗����{��4X
2
+ YQm ��C �� �3��cL�8��Ƣ0�����f�[����*L�}�r��:���͏Q��׼X
@@ -1,3 +1,3 @@
1
1
  module S3MetaSync
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
data/lib/s3_meta_sync.rb CHANGED
@@ -76,7 +76,7 @@ module S3MetaSync
76
76
  download_file(source, META_FILE, staging_area)
77
77
  verify_integrity!(staging_area, destination)
78
78
  delete_empty_folders(staging_area)
79
- swap_in_directory(destination, staging_area)
79
+ self.class.swap_in_directory(destination, staging_area)
80
80
  end
81
81
  end
82
82
  end
@@ -85,10 +85,24 @@ module S3MetaSync
85
85
  system "cp -R #{destination}/* #{dir} 2>/dev/null"
86
86
  end
87
87
 
88
- def swap_in_directory(destination, dir)
89
- Dir.mktmpdir { |landfill| FileUtils.mv(destination, landfill) }
90
- FileUtils.mv(dir, destination)
91
- FileUtils.mkdir(dir) # make ensure in outside mktmpdir not blow up
88
+ # almost atomic when destination and temp dir are not on the same device
89
+ def self.swap_in_directory(destination, dir)
90
+ next_dir = ".#{destination}-next"
91
+ delete = ".#{destination}-delete"
92
+
93
+ # clean up potential leftovers from last run
94
+ FileUtils.remove_dir(next_dir) if File.exist?(next_dir)
95
+ FileUtils.remove_dir(delete) if File.exist?(delete)
96
+
97
+ # move onto the same device
98
+ FileUtils.mv(dir, next_dir)
99
+
100
+ # swap
101
+ FileUtils.mv(destination, delete)
102
+ FileUtils.mv(next_dir, destination)
103
+
104
+ # cleanup old
105
+ FileUtils.remove_dir(delete)
92
106
  end
93
107
 
94
108
  def verify_integrity!(staging_area, destination)
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3_meta_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
@@ -30,20 +30,20 @@ cert_chain:
30
30
  F5etKHZg0j3eHO31/i2HnswY04lqGImUu6aM5EnijFTB7PPW2KwKKM4+kKDYFdlw
31
31
  /0WV1Ng2/Y6qsHwmqGg2VlYj2h4=
32
32
  -----END CERTIFICATE-----
33
- date: 2014-03-03 00:00:00.000000000 Z
33
+ date: 2014-03-31 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: aws-sdk
37
37
  requirement: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  type: :runtime
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  description:
@@ -66,17 +66,17 @@ require_paths:
66
66
  - lib
67
67
  required_ruby_version: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - '>='
69
+ - - ">="
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
78
  rubyforge_project:
79
- rubygems_version: 2.0.14
79
+ rubygems_version: 2.2.2
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: Sync folders with s3 using a metadata file and md5 diffs
metadata.gz.sig CHANGED
Binary file