Class: Downspout::Config
- Inherits:
-
Object
- Object
- Downspout::Config
- Defined in:
- lib/downspout/config.rb
Constant Summary collapse
- @@tmp_dir =
Default Values
"/tmp/downloads/"- @@network_enabled =
true- @@credentials =
[]
- @@curb_allowed =
true- @@curb_enabled =
true- @@prefix =
'downspout'- @@max_redirects =
2- @@ssl_verification =
true
Class Method Summary collapse
- .add_credential(options = nil) ⇒ Object
- .credentials ⇒ Object
- .curb_available? ⇒ Boolean
- .default_prefix ⇒ Object
- .default_prefix=(name) ⇒ Object
- .disable_curb! ⇒ Object
- .disable_networking! ⇒ Object
- .enable_curb! ⇒ Object
- .enable_networking! ⇒ Object
- .max_redirects ⇒ Object
- .max_redirects=(num) ⇒ Object
- .network_enabled? ⇒ Boolean
- .ssl_verification? ⇒ Boolean
- .tmp_dir ⇒ Object
- .tmp_dir=(some_path) ⇒ Object
- .use_curb? ⇒ Boolean
Class Method Details
.add_credential(options = nil) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/downspout/config.rb', line 85 def self.add_credential( = nil ) return nil unless if (.class == Downspout::Credential) then c = else return nil unless .respond_to?(:keys) = {:scheme => 'ftp'}.merge!( ) # defaults to FTP c = Credential.new( ) end $logger.debug("downspout | config | add_credential | #{c.host}, #{c.user_name}, #{c.scheme} ") @@credentials << c return c end |
.credentials ⇒ Object
30 31 32 |
# File 'lib/downspout/config.rb', line 30 def self.credentials return @@credentials end |
.curb_available? ⇒ Boolean
59 60 61 62 63 64 65 66 |
# File 'lib/downspout/config.rb', line 59 def self.curb_available? begin require 'curb' return true rescue LoadError return false end end |
.default_prefix ⇒ Object
22 23 24 |
# File 'lib/downspout/config.rb', line 22 def self.default_prefix @@prefix end |
.default_prefix=(name) ⇒ Object
26 27 28 |
# File 'lib/downspout/config.rb', line 26 def self.default_prefix=( name ) @@prefix = name end |
.disable_curb! ⇒ Object
80 81 82 83 |
# File 'lib/downspout/config.rb', line 80 def self.disable_curb! $logger.debug("downspout | config | disable_curb! | will fall back to Net/HTTP.") @@curb_enabled = false end |
.disable_networking! ⇒ Object
46 47 48 49 |
# File 'lib/downspout/config.rb', line 46 def self.disable_networking! @@network_enabled = false return !(@@network_enabled) end |
.enable_curb! ⇒ Object
72 73 74 75 76 77 78 |
# File 'lib/downspout/config.rb', line 72 def self.enable_curb! if self.curb_available? then @@curb_enabled = true else @@curb_enabled = false end end |
.enable_networking! ⇒ Object
51 52 53 |
# File 'lib/downspout/config.rb', line 51 def self.enable_networking! @@network_enabled = true end |
.max_redirects ⇒ Object
34 35 36 |
# File 'lib/downspout/config.rb', line 34 def self.max_redirects @@max_redirects end |
.max_redirects=(num) ⇒ Object
38 39 40 |
# File 'lib/downspout/config.rb', line 38 def self.max_redirects=( num ) @@max_redirects = num end |
.network_enabled? ⇒ Boolean
42 43 44 |
# File 'lib/downspout/config.rb', line 42 def self.network_enabled? return @@network_enabled end |
.ssl_verification? ⇒ Boolean
55 56 57 |
# File 'lib/downspout/config.rb', line 55 def self.ssl_verification? @@ssl_verification end |
.tmp_dir ⇒ Object
14 15 16 |
# File 'lib/downspout/config.rb', line 14 def self.tmp_dir return @@tmp_dir end |
.tmp_dir=(some_path) ⇒ Object
18 19 20 |
# File 'lib/downspout/config.rb', line 18 def self.tmp_dir=( some_path ) @@tmp_dir = some_path end |
.use_curb? ⇒ Boolean
68 69 70 |
# File 'lib/downspout/config.rb', line 68 def self.use_curb? @@curb_enabled unless !(self.curb_available?) end |