vagrant-compose-yaml 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8625cb28d869fcb8ff3f25ca1a1fa934004a4be3
4
- data.tar.gz: ab06f4a1d9200131ced9cf9314dc773a702be45a
3
+ metadata.gz: cddd3b1850ab03d4c493ef24b1f9a960ef334dcc
4
+ data.tar.gz: b54da77a93d2d4a01d33eb4ce0435a54f516bd46
5
5
  SHA512:
6
- metadata.gz: 215b73f7dd1324f2214a276af5f7c1c93da6c5743815d4c3e8081bc6a007630ecf52fd452329a6c7b1a271b1d31896c8e19d1e1ce5e27b6ca28e2ba9bc6e7d5f
7
- data.tar.gz: 3f94b61fbffb24a18c7f79c65f5a8757242b882f6025434990e0aca578e760207c0d57f18e2dac49746ada606b1ae760c84b865f20241a542a131f5df231feaa
6
+ metadata.gz: 8d02fe94b6c748276a8980d1c3d5e5a97fe9a20920a81315acb3e87b01fb609516260cd500d7359a1ed17bbc299f99e3206454a9e6d7b337dc7862b4c1cf62ed
7
+ data.tar.gz: ae056d157800f7e02e70f885d6531c4c9a0e549f9254e960e3ca192034b54da1269e067952aaa54c740a425e9f6ce7f7ef51dacaabd46c7705646499af389dc5
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ IMPROVEMENTS:
4
4
 
5
5
  - Defining and running multi-machine Vagrant environment without Vagrantfile.
6
6
 
7
+ ## 0.1.3 (September 16, 2016)
8
+
9
+ FEATURES:
10
+
11
+ - Add support for connection directly by using the hostname.
12
+
7
13
  ## 0.1.2 (September 14, 2016)
8
14
 
9
15
  FEATURES:
@@ -63,7 +63,16 @@ module VagrantPlugins
63
63
 
64
64
  def yaml2vagrantdata(yaml_path)
65
65
  yaml = YAML.load_file(yaml_path)
66
- yaml['services'].each do |name, service|
66
+ add_basic_parameters(yaml['services'])
67
+ add_links(yaml['services'])
68
+ yaml
69
+ end
70
+
71
+ def add_basic_parameters(services)
72
+ services.each_with_index do |(name, service), index|
73
+ if service['ip'] == nil
74
+ service['ip'] = "192.168.33.1#{index}"
75
+ end
67
76
  if service['ports'] != nil
68
77
  service['forwarded_port'] = Array.new
69
78
  service['ports'].each do |port|
@@ -79,7 +88,18 @@ module VagrantPlugins
79
88
  end
80
89
  end
81
90
  end
82
- yaml
91
+ end
92
+
93
+ def add_links(services)
94
+ services.each_with_index do |(name, service), index|
95
+ service['links'] = Array.new
96
+ services.each_with_index do |(name2, service2), index2|
97
+ if index == index2
98
+ next
99
+ end
100
+ service['links'].push({'host' => name2, 'ip' => service2['ip']})
101
+ end
102
+ end
83
103
  end
84
104
  end
85
105
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module ComposeYaml
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
4
4
  end
5
5
  end
@@ -5,19 +5,17 @@ Vagrant.configure("2") do |config|
5
5
  <%- services.each do |k, v| -%>
6
6
  config.vm.define :<%= k %> do |c|
7
7
  c.vm.box = "<%= v['box'] %>"
8
- c.vm.synced_folder ".", "/vagrant", disabled: true
9
8
  <%- if v['url'] -%>
10
9
  c.vm.box_url = "<%= v['url'] %>"
11
10
  <%- end -%>
12
11
  c.vm.hostname = "<%= k %>"
13
- <%- if v['ip'] -%>
14
12
  c.vm.network "private_network", ip: "<%= v['ip'] %>"
15
- <%- end -%>
16
13
  <%- if v['forwarded_port'] -%>
17
14
  <%- v['forwarded_port'].each do |port| -%>
18
15
  c.vm.network "forwarded_port", guest: <%= port['guest'] %>, host: <%= port['host'] %>
19
16
  <%- end -%>
20
17
  <%- end -%>
18
+ c.vm.synced_folder ".", "/vagrant", disabled: true
21
19
  <%- if v['synced_folder'] -%>
22
20
  <%- v['synced_folder'].each do |volume| -%>
23
21
  c.vm.synced_folder "<%= volume['host'] %>", "<%= volume['guest'] %>"
@@ -28,6 +26,9 @@ Vagrant.configure("2") do |config|
28
26
  vb.customize ["modifyvm", :id, "--memory", "<%= v['memory'] %>"]
29
27
  end
30
28
  <%- end -%>
29
+ <%- if v['links'] -%>
30
+ c.vm.provision "shell", inline: "<%- v['links'].each do |link| -%>echo '<%= link['ip'] %> <%= link['host'] %>' >> /etc/hosts;<%- end -%>"
31
+ <%- end -%>
31
32
  end
32
33
  <%- end -%>
33
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-compose-yaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - innossh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-14 00:00:00.000000000 Z
11
+ date: 2016-09-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Sets up your working directory to be a Vagrant-managed multi-machine
14
14
  environment by YAML.