matth-growl-atom 0.0.3-universal-darwin-9 → 0.0.4-universal-darwin-9

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 (4) hide show
  1. data/bin/growl-atom +1 -0
  2. data/config +4 -0
  3. data/lib/growl-atom.rb +12 -11
  4. metadata +1 -1
data/bin/growl-atom CHANGED
@@ -28,6 +28,7 @@
28
28
  # Atom entry IDs are stored in them once a notification has been shown. They can be found in
29
29
  # ~/.growl-atom/caches/
30
30
  #
31
+ $:.unshift 'lib'
31
32
 
32
33
  require 'rubygems'
33
34
  require 'growl-atom'
data/config CHANGED
@@ -7,6 +7,10 @@
7
7
  # global:
8
8
  # growl_host : localhost
9
9
  # growl_pass : your_pass
10
+ # proxy_host: your.proxy
11
+ # proxy_port: 80
12
+ # proxy_user: username
13
+ # proxy_pass: password
10
14
  #
11
15
  # feeds:
12
16
  # name: Growl Application Name
data/lib/growl-atom.rb CHANGED
@@ -9,7 +9,7 @@ require 'rexml/document'
9
9
 
10
10
  module GrowlAtom
11
11
 
12
- VERSION = "0.0.3"
12
+ VERSION = "0.0.4"
13
13
 
14
14
  class Error < StandardError; end
15
15
 
@@ -46,10 +46,11 @@ module GrowlAtom
46
46
 
47
47
  uri = URI.parse(options['url'])
48
48
 
49
- http = Net::HTTP.new(uri.host, uri.port)
50
-
51
- req = Net::HTTP::Get.new(uri.path)
49
+ http = Net::HTTP::Proxy(options['proxy_host'], options['proxy_port'],
50
+ options['proxy_user'], options['proxy_pass']).new(uri.host, uri.port)
52
51
 
52
+ req = Net::HTTP::Get.new(uri.path)
53
+
53
54
  if (uri.scheme == 'https')
54
55
  http.use_ssl = true
55
56
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
@@ -61,20 +62,20 @@ module GrowlAtom
61
62
 
62
63
  if (options['cert'])
63
64
  File.open(File.expand_path(options['cert'])) do |cert_file|
64
- key_data = cert_file.read
65
- http.cert = OpenSSL::X509::Certificate.new(key_data)
66
- http.key = OpenSSL::PKey::RSA.new(key_data, nil)
67
- end
65
+ key_data = cert_file.read
66
+ http.cert = OpenSSL::X509::Certificate.new(key_data)
67
+ http.key = OpenSSL::PKey::RSA.new(key_data, nil)
68
+ end
68
69
  end
69
-
70
+
70
71
  response = http.request(req)
71
72
 
72
73
  if (!response.kind_of?(Net::HTTPClientError) && !response.kind_of?(Net::HTTPServerError))
73
74
  return response.body
74
75
  end
75
76
 
76
- raise Error, "#{response.code} Error in HTTP Response for #{options['url']}"
77
-
77
+ raise Error, "#{response.code} Error in HTTP Response for #{options['url']}"
78
+
78
79
  end
79
80
 
80
81
  # Parse feed xml
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matth-growl-atom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: universal-darwin-9
6
6
  authors:
7
7
  - Matt Haynes