jgm-cloudlib 0.3.4 → 0.3.5

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 +19 -1
  2. data/cloudlib.gemspec +1 -1
  3. 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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cloudlib"
3
- s.version = "0.3.4"
3
+ s.version = "0.3.5"
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.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - John MacFarlane