Class: Buildr::Options::Proxies

Inherits:
Object
  • Object
show all
Defined in:
lib/buildr/core/environment.rb

Overview

Wraps around the proxy environment variables:

  • :http – HTTP_PROXY

  • :https – HTTPS_PROXY

  • :exclude – NO_PROXY

Instance Method Summary collapse

Instance Method Details

#excludeObject

Returns list of hosts to exclude from proxying (NO_PROXY).



73
74
75
# File 'lib/buildr/core/environment.rb', line 73

def exclude
  @exclude ||= EnvArray.new('NO_PROXY')
end

#exclude=(url) ⇒ Object

Sets list of hosts to exclude from proxy (NO_PROXY). Accepts host name, array of names, or nil to clear the list.



79
80
81
82
83
# File 'lib/buildr/core/environment.rb', line 79

def exclude=(url)
  exclude.clear
  exclude.concat [url].flatten if url
  exclude
end

#httpObject

Returns the HTTP_PROXY URL.



51
52
53
# File 'lib/buildr/core/environment.rb', line 51

def http
  ENV['HTTP_PROXY'] || ENV['http_proxy']
end

#http=(url) ⇒ Object

Sets the HTTP_PROXY URL.



56
57
58
59
# File 'lib/buildr/core/environment.rb', line 56

def http=(url)
  ENV['http_proxy'] = nil
  ENV['HTTP_PROXY'] = url
end

#httpsObject

Returns the HTTPS_PROXY URL.



62
63
64
# File 'lib/buildr/core/environment.rb', line 62

def https
  ENV['HTTPS_PROXY'] || ENV['https_proxy']
end

#https=(url) ⇒ Object

Sets the HTTPS_PROXY URL.



67
68
69
70
# File 'lib/buildr/core/environment.rb', line 67

def https=(url)
  ENV['https_proxy'] = nil
  ENV['HTTPS_PROXY'] = url
end