jgm-cloudlib 0.3.4 → 0.3.5
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.
- data/bin/cloudlib +19 -1
- data/cloudlib.gemspec +1 -1
- metadata +1 -1
data/bin/cloudlib
CHANGED
|
@@ -80,6 +80,20 @@ def show_items(items, more=false)
|
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
|
|
83
|
+
def html_version(entries)
|
|
84
|
+
"<html>\n" +
|
|
85
|
+
"<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\n" +
|
|
86
|
+
"<body>\n" +
|
|
87
|
+
"<ol>\n" +
|
|
88
|
+
entries.map do |entry|
|
|
89
|
+
"<li><a href=\"" + CGI.escape(entry.name) + "\">" +
|
|
90
|
+
CGI.escapeHTML(entry.to_s) + "</a></li>"
|
|
91
|
+
end.join("\n") +
|
|
92
|
+
"</ol>\n" +
|
|
93
|
+
"</body>\n" +
|
|
94
|
+
"</html>"
|
|
95
|
+
end
|
|
96
|
+
|
|
83
97
|
def menu(items)
|
|
84
98
|
token = query = ""
|
|
85
99
|
while true
|
|
@@ -185,7 +199,7 @@ if ARGV.length >= 1
|
|
|
185
199
|
end
|
|
186
200
|
rate_gb_month = 0.15
|
|
187
201
|
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)
|
|
202
|
+
printf("This will cost $%.2f to store for a year at $%.2f/GB/month.\n", (total_size / 1024.0) * rate_gb_month * 12, rate_gb_month)
|
|
189
203
|
exit 0
|
|
190
204
|
end
|
|
191
205
|
if ARGV[0] == "dump"
|
|
@@ -198,6 +212,10 @@ if ARGV.length >= 1
|
|
|
198
212
|
STDERR.puts "Backing up metadata..."
|
|
199
213
|
file.write(YAML.dump(entries))
|
|
200
214
|
end
|
|
215
|
+
open("#{path}/index.html", 'w') do |file|
|
|
216
|
+
STDERR.puts "Writing HTML index..."
|
|
217
|
+
file.write(html_version(entries))
|
|
218
|
+
end
|
|
201
219
|
STDERR.puts "Backing up files:"
|
|
202
220
|
entries.each do |entry|
|
|
203
221
|
if not File.exists?("#{path}/#{entry.name}")
|
data/cloudlib.gemspec
CHANGED