s3snapshot 0.0.9 → 0.0.10a

Sign up to get free protection for your applications and to get access to all the features.
@@ -47,11 +47,9 @@ module S3snapshot
47
47
  prefix_path = timepath(@prefix, @time)
48
48
 
49
49
 
50
- files.each do |file|
50
+ files.each do |remotefile|
51
51
  #We have to reload state from s3. Otherwise we can't download when the restore process takes a while
52
- file.reload()
53
-
54
- destination_path = "#{@local_dir}/#{file.key[prefix_path.length+1..-1]}"
52
+ destination_path = "#{@local_dir}/#{remotefile.key[prefix_path.length+1..-1]}"
55
53
 
56
54
  directory = destination_path[0..-File.basename(destination_path).length-1]
57
55
 
@@ -60,14 +58,20 @@ module S3snapshot
60
58
  FileUtils.mkdir(directory)
61
59
  end
62
60
 
63
- puts "downloading '#{file.key}' to '#{destination_path}'"
61
+ puts "downloading '#{remotefile.key}' to '#{destination_path}'"
64
62
 
65
- #Open the file in read/write and create it if it doesn't exist, then write the content from s3 into it
66
- File.open(destination_path, File::RDWR|File::CREAT){ |local| local.write(file.body)}
63
+ File.open(destination_path, File::RDWR|File::CREAT) do |file|
64
+ bucket.files.get(remotefile.key) do |chunk, remaining_bytes, total_bytes|
65
+ file.write(chunk)
66
+ percent = (1-remaining_bytes/total_bytes)*100
67
+ puts "#{percent}% complete"
68
+ end
69
+ end
67
70
 
68
71
  end
69
72
 
70
73
 
74
+
71
75
  puts "Writing complete marker"
72
76
 
73
77
 
@@ -1,3 +1,3 @@
1
1
  module S3snapshot
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10a"
3
3
  end
data/s3snapshot.gemspec CHANGED
File without changes
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3snapshot
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
5
- prerelease:
4
+ hash: 2
5
+ prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 9
10
- version: 0.0.9
9
+ - 10
10
+ - a
11
+ version: 0.0.10a
11
12
  platform: ruby
12
13
  authors:
13
14
  - Todd
@@ -15,7 +16,7 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2011-09-30 00:00:00 Z
19
+ date: 2011-10-11 00:00:00 Z
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: fog
@@ -114,16 +115,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
115
  required_rubygems_version: !ruby/object:Gem::Requirement
115
116
  none: false
116
117
  requirements:
117
- - - ">="
118
+ - - ">"
118
119
  - !ruby/object:Gem::Version
119
- hash: 3
120
+ hash: 25
120
121
  segments:
121
- - 0
122
- version: "0"
122
+ - 1
123
+ - 3
124
+ - 1
125
+ version: 1.3.1
123
126
  requirements: []
124
127
 
125
128
  rubyforge_project: s3snapshot
126
- rubygems_version: 1.8.3
129
+ rubygems_version: 1.8.2
127
130
  signing_key:
128
131
  specification_version: 3
129
132
  summary: Uploads to s3