jgm-cloudlib 0.3.2 → 0.3.3

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-web +16 -6
  2. data/cloudlib.gemspec +1 -1
  3. metadata +1 -1
data/bin/cloudlib-web CHANGED
@@ -44,6 +44,7 @@ post '/' do
44
44
  end
45
45
 
46
46
  get '/upload' do
47
+ @error = params[:error]
47
48
  haml :upload
48
49
  end
49
50
 
@@ -51,11 +52,16 @@ post '/upload' do
51
52
  tempfile = params[:fileToUpload][:tempfile]
52
53
  tempfilepath = tempfile.path
53
54
  tempfile.close
54
- entry = Cloudlib::Entry.from_file(tempfilepath, params[:fileToUpload][:filename])
55
- FileUtils.rm tempfilepath
56
- set_attributes_from_form(entry)
57
- entry.save
58
- redirect "/"
55
+ origname = params[:fileToUpload][:filename] || ""
56
+ if origname == ""
57
+ redirect "/upload?error=Please+select+a+file+to+upload."
58
+ else
59
+ entry = Cloudlib::Entry.from_file(tempfilepath, params[:fileToUpload][:filename])
60
+ FileUtils.rm tempfilepath
61
+ set_attributes_from_form(entry)
62
+ entry.save
63
+ redirect "/"
64
+ end
59
65
  end
60
66
 
61
67
  get '/*/bibtex' do
@@ -148,6 +154,8 @@ __END__
148
154
 
149
155
  @@ upload
150
156
  %form{:method => 'POST', :action => '/upload', :enctype => 'multipart/form-data'}
157
+ %p.error
158
+ = @error
151
159
  %label Select file to upload:
152
160
  %br
153
161
  %input{:type => 'file', :name => 'fileToUpload', :size => 40}
@@ -203,4 +211,6 @@ li
203
211
  padding-top: 1em
204
212
  font-size: x-small
205
213
  text-align: center
206
-
214
+ p.error
215
+ color: red
216
+ font-weight: bold
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.2"
3
+ s.version = "0.3.3"
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.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John MacFarlane