vagrant-ebcommon 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Vagrantfile +2 -2
- data/lib/vagrant-ebcommon/actions/setup_provision.rb +8 -7
- data/lib/vagrant-ebcommon/config.rb +11 -7
- data/lib/vagrant-ebcommon/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ea352a431f45e190c9272fd34568584e4ba2b08
|
4
|
+
data.tar.gz: 6a01faa03b7b5efbcbaf24b187c9e672c44fabfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
'
|
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
|
66
|
+
if !ENV['FORCE_PROVISION'] && @ebcommon.vpn_urls
|
67
67
|
vpn_valid = false
|
68
68
|
@ebcommon.vpn_urls.each { |url|
|
69
|
-
vpn_valid =
|
69
|
+
vpn_valid = test_url_timeout url, @ebcommon.vpn_timeout
|
70
70
|
break if vpn_valid
|
71
71
|
}
|
72
|
-
if
|
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
|
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
|
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
|
-
|
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(
|
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
|
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
|
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 @
|
35
|
-
|
36
|
-
|
37
|
-
|
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
|
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 }
|
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.
|
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-
|
11
|
+
date: 2014-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|