hockeybrake 0.0.3 → 0.0.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.
@@ -18,32 +18,28 @@ module HockeyBrake
18
18
  # generate the log
19
19
  logstr = HockeyLog.generate(data)
20
20
 
21
- # store the data into temp file
22
- file = Tempfile.new('hockey-exception')
23
- file.write(logstr)
24
- file.close
21
+ # generate the stirng io
22
+ logio = StringIO.new(logstr)
25
23
 
26
24
  # buidl the url
27
25
  url = URI.parse(HockeyBrake.configuration.hockey_url)
28
26
 
29
27
  # send the request
30
28
  response = begin
31
- File.open(file.path) do |log|
32
29
 
33
- req = Net::HTTP::Post::Multipart.new url.path,
34
- "log" => UploadIO.new(log, 'application/octet-stream', "log.txt")
35
- Net::HTTP.start(url.host, url.port, :use_ssl => url.scheme == 'https') do |http|
36
- http.request(req)
37
- end
30
+ # build the request
31
+ req = Net::HTTP::Post::Multipart.new( url.path, "log" => UploadIO.new(logio, 'application/octet-stream', "log.txt") )
32
+
33
+ # start the upload
34
+ Net::HTTP.start(url.host, url.port, :use_ssl => url.scheme == 'https') do |http|
35
+ http.request(req)
38
36
  end
37
+
39
38
  rescue *HTTP_ERRORS => e
40
39
  log :error, "Unable to contact the HockeyApp server. HTTP Error=#{e}"
41
40
  nil
42
41
  end
43
42
 
44
- # remove the file
45
- file.unlink
46
-
47
43
  case response
48
44
  when Net::HTTPSuccess then
49
45
  log :info, "Success: #{response.class}", response
@@ -1,4 +1,4 @@
1
1
  module HockeyBrake
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hockeybrake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-01 00:00:00.000000000 Z
12
+ date: 2012-09-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: airbrake