Class: VagrantPlugins::Ebcommon::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::Ebcommon::Config
- Defined in:
- lib/vagrant-ebcommon/config.rb
Instance Attribute Summary collapse
-
#git_hook_repos ⇒ Object
Returns the value of attribute git_hook_repos.
-
#git_hook_root_dir ⇒ Object
Returns the value of attribute git_hook_root_dir.
-
#vpn_timeout ⇒ Object
Returns the value of attribute vpn_timeout.
-
#vpn_urls ⇒ Object
Returns the value of attribute vpn_urls.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
9 10 11 12 13 14 |
# File 'lib/vagrant-ebcommon/config.rb', line 9 def initialize @vpn_urls = UNSET_VALUE @vpn_timeout = UNSET_VALUE @git_hook_repos = UNSET_VALUE @git_hook_root_dir = UNSET_VALUE end |
Instance Attribute Details
#git_hook_repos ⇒ Object
Returns the value of attribute git_hook_repos.
6 7 8 |
# File 'lib/vagrant-ebcommon/config.rb', line 6 def git_hook_repos @git_hook_repos end |
#git_hook_root_dir ⇒ Object
Returns the value of attribute git_hook_root_dir.
7 8 9 |
# File 'lib/vagrant-ebcommon/config.rb', line 7 def git_hook_root_dir @git_hook_root_dir end |
#vpn_timeout ⇒ Object
Returns the value of attribute vpn_timeout.
5 6 7 |
# File 'lib/vagrant-ebcommon/config.rb', line 5 def vpn_timeout @vpn_timeout end |
#vpn_urls ⇒ Object
Returns the value of attribute vpn_urls.
4 5 6 |
# File 'lib/vagrant-ebcommon/config.rb', line 4 def vpn_urls @vpn_urls end |
Instance Method Details
#finalize! ⇒ Object
16 17 18 19 20 21 |
# File 'lib/vagrant-ebcommon/config.rb', line 16 def finalize! @vpn_urls = nil if @vpn_urls == UNSET_VALUE @vpn_timeout = 5 if @vpn_timeout == UNSET_VALUE @git_hook_repos = nil if @git_hook_repos == UNSET_VALUE @git_hook_root_dir = nil if @git_hook_root_dir == UNSET_VALUE end |
#validate(machine) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/vagrant-ebcommon/config.rb', line 23 def validate(machine) errors = [] if @vpn_urls if !@vpn_urls.is_a?(Array) errors << '`vpn_urls` must be a list of urls to test vpn connection' else @vpn_urls.each { |url| uri = URI(url) if !(uri.host && uri.port) errors << "`vpn_urls` must be a list of urls: '#{url}' is not valid." end } end end if @vpn_timeout && !@vpn_timeout.is_a?(Integer) errors << '`vpn_timeout` must be an integer which represents the timeout in seconds to wait' end if @git_hook_repos && !@git_hook_repos.is_a?(Array) errors << '`git_hook_repos` must be a list of paths to copy hooks to' end if @git_hook_repos && !@git_hook_root_dir errors << '`git_hook_root_dir` must be set to the directory containing directories in `git_hook_repos`' end return { 'ebcommon' => errors } end |