rubygems-noproxy 0.0.1.alpha

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in rubygems-noproxy.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,5 @@
1
+ module Rubygems
2
+ module Noproxy
3
+ VERSION = "0.0.1.alpha"
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require "rubygems-noproxy/version"
2
+
3
+ module Rubygems
4
+ module Noproxy
5
+ # Your code goes here...
6
+ end
7
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "rubygems-noproxy/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "rubygems-noproxy"
7
+ s.version = Rubygems::Noproxy::VERSION
8
+ s.authors = ["Darrin Wortlehock"]
9
+ s.email = ["darrin@exempla.co.uk"]
10
+ s.homepage = "http://github.com/exempla/rubygems-noproxy"
11
+ s.summary = %q{Fix ENV['no_proxy'] behavior in rubygems}
12
+ s.description = %q{A rubygems plugin that monkey-patches rubygems to support the no_proxy environment variable}
13
+
14
+ s.rubyforge_project = "rubygems-noproxy"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ # s.add_runtime_dependency "rest-client"
24
+ end
@@ -0,0 +1,52 @@
1
+ class Gem::RemoteFetcher
2
+
3
+ def no_proxy_patterns
4
+ @no_proxy_patterns ||= begin
5
+ env_no_proxy = ENV['no_proxy'] || ENV['NO_PROXY']
6
+ if env_no_proxy.nil? or env_no_proxy.empty?
7
+ []
8
+ else
9
+ env_no_proxy.split(/\s*,\s*/)
10
+ end
11
+ end
12
+ end
13
+
14
+ def no_proxy?(host)
15
+ host = host.downcase
16
+ no_proxy_patterns.each do |pattern|
17
+ pattern = pattern.downcase
18
+ return true if host[-pattern.length, pattern.length] == pattern
19
+ end
20
+ return false
21
+ end
22
+
23
+ def connection_for(uri)
24
+ net_http_args = [uri.host, uri.port]
25
+
26
+ if @proxy_uri && !no_proxy?(uri.host) then
27
+ net_http_args += [
28
+ @proxy_uri.host,
29
+ @proxy_uri.port,
30
+ @proxy_uri.user,
31
+ @proxy_uri.password
32
+ ]
33
+ end
34
+
35
+ connection_id = [Thread.current.object_id, *net_http_args].join ':'
36
+ @connections[connection_id] ||= Net::HTTP.new(*net_http_args)
37
+ connection = @connections[connection_id]
38
+
39
+ if uri.scheme == 'https' and not connection.started? then
40
+ require 'net/https'
41
+ connection.use_ssl = true
42
+ connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
43
+ end
44
+
45
+ connection.start unless connection.started?
46
+
47
+ connection
48
+ rescue Errno::EHOSTDOWN => e
49
+ raise FetchError.new(e.message, uri)
50
+ end
51
+
52
+ end
metadata ADDED
@@ -0,0 +1,53 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubygems-noproxy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.alpha
5
+ prerelease: 6
6
+ platform: ruby
7
+ authors:
8
+ - Darrin Wortlehock
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-17 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: A rubygems plugin that monkey-patches rubygems to support the no_proxy
15
+ environment variable
16
+ email:
17
+ - darrin@exempla.co.uk
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gitignore
23
+ - Gemfile
24
+ - Rakefile
25
+ - lib/rubygems-noproxy.rb
26
+ - lib/rubygems-noproxy/version.rb
27
+ - rubygems-noproxy.gemspec
28
+ - rubygems_plugin.rb
29
+ homepage: http://github.com/exempla/rubygems-noproxy
30
+ licenses: []
31
+ post_install_message:
32
+ rdoc_options: []
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>'
45
+ - !ruby/object:Gem::Version
46
+ version: 1.3.1
47
+ requirements: []
48
+ rubyforge_project: rubygems-noproxy
49
+ rubygems_version: 1.8.10
50
+ signing_key:
51
+ specification_version: 3
52
+ summary: Fix ENV['no_proxy'] behavior in rubygems
53
+ test_files: []