vagrant-ebcommon 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d6469c25ac5b137124b0c9594966b5714b14f4e
4
- data.tar.gz: a9d9140d6113310d885ccd9bc4eadbd18df82b8c
3
+ metadata.gz: 8ea352a431f45e190c9272fd34568584e4ba2b08
4
+ data.tar.gz: 6a01faa03b7b5efbcbaf24b187c9e672c44fabfa
5
5
  SHA512:
6
- metadata.gz: 93ef1d36f30a706546836393edc717a3059bf945f42822aac4242974a0dd0c894d1c0eaca3b349a1df77e529b6901968aa808d52bb4fd3626dac30d3939da29a
7
- data.tar.gz: 1c07561e75e7de6ef2db79018bddb3ffd741bd3c0c69d022930977c9668ff37e489e6c4cc4a75237013b2028dab96d49ab4489393b81cfe5dfd10b108439b2d1
6
+ metadata.gz: fc467c96c01dd841294c21a9d3bf8d2c9dae0dd8126cdc9c80fc4b3820c1d084a50d84d8c39359eba0abefcc27c289abb001b37757ef7f0281037f9163733337
7
+ data.tar.gz: e7e6826879b09515959e7bccc8a93067f0d7fb0e2b9a920edce6a38594203c7d30cf1b00ca4999b7f5138b71234f34b33fbf10e1ff623703112b9c54b24b47e1
data/Vagrantfile CHANGED
@@ -7,9 +7,9 @@ Vagrant.configure('2') do |config|
7
7
  config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
8
8
 
9
9
  config.ebcommon.vpn_urls = [
10
- 'https://docs.evbhome.com',
11
- 'https://reviews.evbhome.com',
10
+ 'http://packages',
12
11
  ]
12
+ config.ebcommon.vpn_timeout = 3
13
13
  config.ebcommon.git_hook_root_dir = '/Volumes/eb_home/work'
14
14
  config.ebcommon.git_hook_repos = [
15
15
  'vagrant-ebcommon',
@@ -63,13 +63,13 @@ module VagrantPlugins
63
63
  # internally and everything will fail miserably if you're not on our
64
64
  # network.
65
65
  def ensure_vpn
66
- if not ENV['FORCE_PROVISION'] and @ebcommon.vpn_urls
66
+ if !ENV['FORCE_PROVISION'] && @ebcommon.vpn_urls
67
67
  vpn_valid = false
68
68
  @ebcommon.vpn_urls.each { |url|
69
- vpn_valid = ping url
69
+ vpn_valid = test_url_timeout url, @ebcommon.vpn_timeout
70
70
  break if vpn_valid
71
71
  }
72
- if not vpn_valid
72
+ if !vpn_valid
73
73
  raise Ebcommon::Errors::VPNRequired.new
74
74
  end
75
75
  @env[:ui].success 'VPN connection verified, continuing provision.'
@@ -93,7 +93,7 @@ module VagrantPlugins
93
93
  end
94
94
  end
95
95
  end
96
- if not contents.empty?
96
+ if !contents.empty?
97
97
  creds = JSON.parse contents
98
98
  end
99
99
  return creds
@@ -139,7 +139,7 @@ module VagrantPlugins
139
139
  email = @env[:ui].ask 'Enter your eventbrite email: '
140
140
  write_git_commiter_details(full_name, email)
141
141
  end
142
- if not full_name.empty? or not email.empty?
142
+ if !full_name.empty? || !email.empty?
143
143
  @env[:ui].success "Will setup global github details in vagrant."\
144
144
  " Full Name: #{full_name}, Email: #{email}"
145
145
  end
@@ -168,10 +168,11 @@ module VagrantPlugins
168
168
 
169
169
  private
170
170
 
171
- def ping(url)
171
+ # Test that a URL is responding something given a timeout in seconds.
172
+ def test_url_timeout(url, timeout)
172
173
  uri = URI(url)
173
174
  begin
174
- timeout(1) do
175
+ timeout(timeout) do
175
176
  s = TCPSocket.new(uri.host, uri.port)
176
177
  s.close
177
178
  end
@@ -2,17 +2,20 @@ module VagrantPlugins
2
2
  module Ebcommon
3
3
  class Config < Vagrant.plugin(2, :config)
4
4
  attr_accessor :vpn_urls
5
+ attr_accessor :vpn_timeout
5
6
  attr_accessor :git_hook_repos
6
7
  attr_accessor :git_hook_root_dir
7
8
 
8
9
  def initialize
9
10
  @vpn_urls = UNSET_VALUE
11
+ @vpn_timeout = UNSET_VALUE
10
12
  @git_hook_repos = UNSET_VALUE
11
13
  @git_hook_root_dir = UNSET_VALUE
12
14
  end
13
15
 
14
16
  def finalize!
15
17
  @vpn_urls = nil if @vpn_urls == UNSET_VALUE
18
+ @vpn_timeout = 5 if @vpn_timeout == UNSET_VALUE
16
19
  @git_hook_repos = nil if @git_hook_repos == UNSET_VALUE
17
20
  @git_hook_root_dir = nil if @git_hook_root_dir == UNSET_VALUE
18
21
  end
@@ -20,23 +23,24 @@ module VagrantPlugins
20
23
  def validate(machine)
21
24
  errors = []
22
25
  if @vpn_urls
23
- if not @vpn_urls.kind_of?(Array)
26
+ if !@vpn_urls.is_a?(Array)
24
27
  errors << '`vpn_urls` must be a list of urls to test vpn connection'
25
28
  else
26
29
  @vpn_urls.each { |url|
27
30
  uri = URI(url)
28
- if not (uri.host and uri.port)
31
+ if !(uri.host && uri.port)
29
32
  errors << "`vpn_urls` must be a list of urls: '#{url}' is not valid."
30
33
  end
31
34
  }
32
35
  end
33
36
  end
34
- if @git_hook_repos
35
- if not @git_hook_repos.kind_of?(Array)
36
- errors << '`git_hook_repos` must be a list of paths to copy hooks to'
37
- end
37
+ if @vpn_timeout && !@vpn_timeout.is_a?(Integer)
38
+ errors << '`vpn_timeout` must be an integer which represents the timeout in seconds to wait'
39
+ end
40
+ if @git_hook_repos && !@git_hook_repos.is_a?(Array)
41
+ errors << '`git_hook_repos` must be a list of paths to copy hooks to'
38
42
  end
39
- if @git_hook_repos and not @git_hook_root_dir
43
+ if @git_hook_repos && !@git_hook_root_dir
40
44
  errors << '`git_hook_root_dir` must be set to the directory containing directories in `git_hook_repos`'
41
45
  end
42
46
  return { 'ebcommon' => errors }
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Ebcommon
3
- VERSION = "0.4.3"
3
+ VERSION = "0.4.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-ebcommon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hahn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-10 00:00:00.000000000 Z
11
+ date: 2014-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler