geminabox 0.2.3 → 0.2.4

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.

Potentially problematic release.


This version of geminabox might be problematic. Click here for more details.

@@ -48,15 +48,23 @@ class Gem::Commands::InaboxCommand < Gem::Command
48
48
 
49
49
  File.open(@gemfile, "rb") do |file|
50
50
  url = URI.parse(geminabox_host)
51
- query, headers = Multipart::MultipartPost.new.prepare_query("file" => file)
51
+ request_body, request_headers = Multipart::MultipartPost.new.prepare_query("file" => file)
52
52
 
53
53
  Net::HTTP.start(url.host, url.port) {|con|
54
- con.read_timeout = 5
55
- response = con.post("/upload", query, headers)
56
- puts response.body
54
+ req = Net::HTTP::Post.new('/upload', request_headers)
55
+ req.basic_auth(url.user, url.password) if url.user
56
+ handle_response(con.request(req, request_body))
57
57
  }
58
58
  end
59
+ end
59
60
 
61
+ def handle_response(response)
62
+ case response
63
+ when Net::HTTPSuccess, Net::HTTPRedirection
64
+ puts response.body
65
+ else
66
+ response.error!
67
+ end
60
68
  end
61
69
 
62
70
  def config_path
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geminabox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Lea
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-24 00:00:00 +00:00
12
+ date: 2010-03-30 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency