bogo 0.1.18 → 0.1.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/bogo/http_proxy.rb +39 -0
- data/lib/bogo/lazy.rb +7 -1
- data/lib/bogo/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 802b39d900a5909611b6aaffd3a419e2a82492a4
|
4
|
+
data.tar.gz: 13faec66be7d72b8150a2edb8ad30a5df28adac0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 714a82d0202b13f31c40238104551710a4754b92d25166b76d07b4410a102572f9c0a378ec1173bd2ba69241b9a7f1bada30baa03fd253969a01c0ddb6ba5ec7
|
7
|
+
data.tar.gz: 08f764cf4ebac3f9e88b36af71da9696f844c6d51d7a437ff42d0ad473b9888ff0a8c7c24ca9ecdce23a8f34837ef9e8faa176541e13fa128e801106b1523f24
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'resolv'
|
2
|
+
require 'http'
|
3
|
+
require 'http/request'
|
4
|
+
|
5
|
+
# NOTE: This is a simple monkey patch to the httprb library to provide
|
6
|
+
# implicit proxy support to requests. It is defined within this
|
7
|
+
# library to allow easy sharing. It is the responsibility of the user
|
8
|
+
# to ensure the http gem is available!
|
9
|
+
class HTTP::Request
|
10
|
+
|
11
|
+
# Override to implicitly apply proxy as required
|
12
|
+
def proxy
|
13
|
+
if((@proxy.nil? || @proxy.empty?) && ENV["#{uri.scheme}_proxy"] && proxy_is_allowed?)
|
14
|
+
_proxy = URI.parse(ENV["#{uri.scheme}_proxy"])
|
15
|
+
Hash.new.tap do |opts|
|
16
|
+
opts[:proxy_address] = _proxy.host
|
17
|
+
opts[:proxy_port] = _proxy.port
|
18
|
+
opts[:proxy_username] = _proxy.user if _proxy.user
|
19
|
+
opts[:proxy_password] = _proxy.password if _proxy.password
|
20
|
+
end
|
21
|
+
else
|
22
|
+
@proxy if proxy_is_allowed?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Check `ENV['no_proxy']` and disable proxy if endpoint is listed
|
27
|
+
#
|
28
|
+
# @return [TrueClass, FalseClass]
|
29
|
+
def proxy_is_allowed?
|
30
|
+
if(ENV['no_proxy'])
|
31
|
+
ENV['no_proxy'].to_s.split(',').map(&:strip).none? do |item|
|
32
|
+
File.fnmatch(item, [uri.host, uri.port].compact.join(':'))
|
33
|
+
end
|
34
|
+
else
|
35
|
+
true
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
data/lib/bogo/lazy.rb
CHANGED
@@ -133,7 +133,13 @@ module Bogo
|
|
133
133
|
define_method(name) do
|
134
134
|
send(depends_on) if depends_on
|
135
135
|
self.class.on_missing(self) unless data.has_key?(name) || dirty.has_key?(name)
|
136
|
-
dirty
|
136
|
+
if(dirty.has_key?(name))
|
137
|
+
dirty[name]
|
138
|
+
elsif(data.has_key?(name))
|
139
|
+
data[name]
|
140
|
+
else
|
141
|
+
self.class.attributes[name][:default]
|
142
|
+
end
|
137
143
|
end
|
138
144
|
define_method("#{name}=") do |val|
|
139
145
|
values = multiple_values && val.is_a?(Array) ? val : [val]
|
data/lib/bogo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bogo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- lib/bogo/animal_strings.rb
|
82
82
|
- lib/bogo/constants.rb
|
83
83
|
- lib/bogo/ephemeral_file.rb
|
84
|
+
- lib/bogo/http_proxy.rb
|
84
85
|
- lib/bogo/lazy.rb
|
85
86
|
- lib/bogo/memoization.rb
|
86
87
|
- lib/bogo/priority_queue.rb
|