vagrant-properties 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vagrant-properties/config.rb +25 -6
- data/lib/vagrant-properties/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: 74f0fcbbde803227a7a5dfd16a141a537ea6f31e
|
4
|
+
data.tar.gz: 79be3d53388dfb0a07c836817fd219decf0cd83f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d38245e83577471651c1c4c7d88ad2b0a676292320359ffbf1b8c521c2826bfca2ea0d4635ef74f64b305daad21681cc27647fd424999c9b6d40c13971b91f93
|
7
|
+
data.tar.gz: 4978f21a8187193fb25c08c797eee47a8457a0cbc813f887539ec437bfb90714a78325dfd2782c832f30fd498f52b58227abe9ded7c4c7a26ccb20960c208143
|
@@ -15,15 +15,34 @@ module VagrantPlugins
|
|
15
15
|
@properties ||= build_properties
|
16
16
|
end
|
17
17
|
|
18
|
+
def repo_valide?(repo)
|
19
|
+
repo && repo.is_a?(Array) && !repo.empty?
|
20
|
+
end
|
21
|
+
|
22
|
+
def domains_valid?(domains)
|
23
|
+
domains && domains.is_a?(Array) && !domains.empty?
|
24
|
+
end
|
25
|
+
|
26
|
+
def hostname_valid?(hostname)
|
27
|
+
hostname && hostname.is_a?(String) && !hostname.empty?
|
28
|
+
end
|
29
|
+
|
30
|
+
def ip_valid?(hostname)
|
31
|
+
ip && ip.is_a?(String) && !ip.empty?
|
32
|
+
end
|
33
|
+
|
18
34
|
def build_properties
|
19
35
|
load_properties.each_with_object({}) do |(name, property), memo|
|
20
|
-
if property['repo']
|
36
|
+
if repo_valide?(property['repo'])
|
21
37
|
property['path'] = pull_project(property['repo'])
|
22
38
|
end
|
23
39
|
|
24
|
-
if property['
|
25
|
-
|
26
|
-
|
40
|
+
if !domains_valid?(property['domains']) && hostname_valid?(property['hostname'])
|
41
|
+
property['domains'] = [property['hostname']]
|
42
|
+
end
|
43
|
+
|
44
|
+
if ip_valid?(property['ip']) && domains_valid?(property['domains'])
|
45
|
+
write_to_hosts(property['ip'], property['domains'])
|
27
46
|
end
|
28
47
|
|
29
48
|
keys = property.keys.inject([]) { |m, k| m << k.to_sym }
|
@@ -59,9 +78,9 @@ module VagrantPlugins
|
|
59
78
|
path
|
60
79
|
end
|
61
80
|
|
62
|
-
def write_to_hosts(ip,
|
81
|
+
def write_to_hosts(ip, domains)
|
63
82
|
`test 0 -ne $(cat /etc/hosts | grep -q #{ip} ; echo $?) && \
|
64
|
-
echo "#{ip} #{
|
83
|
+
echo "#{ip} #{domains.join(' ')}" | sudo tee -a /etc/hosts`
|
65
84
|
end
|
66
85
|
|
67
86
|
def path_matcher
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-properties
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- linyows
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|