jgm-cloudlib 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/cloudlib +13 -16
  2. data/cloudlib.gemspec +1 -1
  3. metadata +1 -1
data/bin/cloudlib CHANGED
@@ -189,27 +189,24 @@ if ARGV.length >= 1
189
189
  exit 0
190
190
  end
191
191
  if ARGV[0] == "dump"
192
- path = ARGV[1] || "."
192
+ path = ARGV[1] || ask("Dump to which directory? ", String) { |q| q.default = "."; q.echo = true }
193
193
  new_entries = 0
194
194
  dummy, entries = Cloudlib::Entry.query("", nil)
195
195
  total_size = entries.inject(0) {|accum, e| accum + e.attributes['size'][0].to_i}
196
- printf("Total size is %.2f megabytes. Make a local copy (y/n)? ", (total_size / (1024.0 * 1024.0)))
197
- ans = STDIN.gets
198
- if ans =~ /^[Yy]/
199
- open("#{path}/#{ENV['CLOUDLIB_LIBRARY_NAME']}.db", 'w') do |file|
200
- STDERR.puts "Backing up metadata..."
201
- file.write(YAML.dump(entries))
202
- end
203
- STDERR.puts "Backing up files:"
204
- entries.each do |entry|
205
- if not File.exists?("#{path}/#{entry.name}")
206
- entry.download("#{path}/#{entry.name}")
207
- new_entries += 1
208
- STDERR.puts entry.to_s
209
- end
196
+ printf("Total size is %.2f megabytes.\n", (total_size / (1024.0 * 1024.0)))
197
+ open("#{path}/#{ENV['CLOUDLIB_LIBRARY_NAME']}.db", 'w') do |file|
198
+ STDERR.puts "Backing up metadata..."
199
+ file.write(YAML.dump(entries))
200
+ end
201
+ STDERR.puts "Backing up files:"
202
+ entries.each do |entry|
203
+ if not File.exists?("#{path}/#{entry.name}")
204
+ entry.download("#{path}/#{entry.name}")
205
+ new_entries += 1
206
+ STDERR.puts entry.to_s
210
207
  end
211
- STDERR.puts "Backed up metadata and #{new_entries} new files."
212
208
  end
209
+ STDERR.puts "Backed up metadata and #{new_entries} new files."
213
210
  exit 0
214
211
  end
215
212
  if ARGV[0] == "restore"
data/cloudlib.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cloudlib"
3
- s.version = "0.3.1"
3
+ s.version = "0.3.2"
4
4
  s.date = "2008-12-29"
5
5
  s.summary = "Tools for maintaining a library of books and articles in Amazon S3 and SimpleDB"
6
6
  s.email = "jgm@berkeley.edu"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jgm-cloudlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John MacFarlane