jgm-cloudlib 0.2.6 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/cloudlib +11 -0
- data/cloudlib.gemspec +2 -2
- metadata +2 -2
data/bin/cloudlib
CHANGED
@@ -20,6 +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
24
|
"Options:"
|
24
25
|
end
|
25
26
|
opts.on("-h", "--help", "Show usage message") do
|
@@ -174,6 +175,16 @@ if ARGV.length >= 1
|
|
174
175
|
end
|
175
176
|
exit 0
|
176
177
|
end
|
178
|
+
if ARGV[0] == "stats"
|
179
|
+
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)
|
183
|
+
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)
|
186
|
+
exit 0
|
187
|
+
end
|
177
188
|
if ARGV[0] == "dump"
|
178
189
|
path = ARGV[1] || "."
|
179
190
|
new_entries = 0
|
data/cloudlib.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "cloudlib"
|
3
|
-
s.version = "0.
|
4
|
-
s.date = "2008-12-
|
3
|
+
s.version = "0.3.0"
|
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"
|
7
7
|
s.homepage = "http://github.com/jgm/cloudlib"
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John MacFarlane
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-12-
|
12
|
+
date: 2008-12-29 00:00:00 -08:00
|
13
13
|
default_executable: cloudlib
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|