jgm-cloudlib 0.3.0 → 0.3.1

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.
Files changed (3) hide show
  1. data/bin/cloudlib +10 -7
  2. data/cloudlib.gemspec +1 -1
  3. metadata +1 -1
data/bin/cloudlib CHANGED
@@ -20,7 +20,7 @@ opts = OptionParser.new do |opts|
20
20
  " #{PROGNAME} delete-library - delete library and all its entries\n" +
21
21
  " #{PROGNAME} dump [PATH] - create a local backup of library in PATH\n" +
22
22
  " #{PROGNAME} restore [PATH] - restore library from local backup in PATH\n" +
23
- " #{PROGNAME} stats - print statistics for library.\n" +
23
+ " #{PROGNAME} list - list entries in library and print statistics\n" +
24
24
  "Options:"
25
25
  end
26
26
  opts.on("-h", "--help", "Show usage message") do
@@ -175,14 +175,17 @@ if ARGV.length >= 1
175
175
  end
176
176
  exit 0
177
177
  end
178
- if ARGV[0] == "stats"
178
+ if ARGV[0] == "list"
179
+ STDERR.puts "Generating list of entries (this may take a while)..."
179
180
  dummy, entries = Cloudlib::Entry.query("", nil)
180
- total_size = entries.inject(0) {|accum, e| accum + e.attributes['size'][0].to_i}
181
- num_entries = entries.length
182
- size_in_mb = total_size / (1024.0 * 1024.0)
181
+ total_size = entries.inject(0) do |accum, e|
182
+ size = e.attributes['size'][0].to_i / (1024.0 * 1024.0)
183
+ printf "%7.2f MB %s\n", size, e.to_s
184
+ accum + size
185
+ end
183
186
  rate_gb_month = 0.15
184
- printf("The library contains %d entries, with a total size of %.2f megabytes.\n", num_entries, size_in_mb)
185
- printf("This will cost $%.2f to store for a year at $%.2f/month.\n", (size_in_mb / 1000) * rate_gb_month * 12, rate_gb_month)
187
+ printf("\n%7.2f MB TOTAL (%d entries). ", total_size, entries.length)
188
+ printf("This will cost $%.2f to store for a year at $%.2f/month.\n", (total_size / 1024.0) * rate_gb_month * 12, rate_gb_month)
186
189
  exit 0
187
190
  end
188
191
  if ARGV[0] == "dump"
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.0"
3
+ s.version = "0.3.1"
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.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John MacFarlane