jgm-cloudlib 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/cloudlib +10 -7
- data/cloudlib.gemspec +1 -1
- 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}
|
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] == "
|
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)
|
181
|
-
|
182
|
-
|
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("
|
185
|
-
printf("This will cost $%.2f to store for a year at $%.2f/month.\n", (
|
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