vagrant-compose-yaml 0.1.0 → 0.1.1
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +4 -1
- data/lib/vagrant-compose-yaml/command.rb +16 -2
- data/lib/vagrant-compose-yaml/version.rb +1 -1
- data/templates/Vagrantfile.erb +5 -0
- 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: 41f2cdb330bc6c5db558512050257300f45c9bc4
|
4
|
+
data.tar.gz: 34a48fc9b84bb9780515468bfc7b519c452b3e68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c2b612642739dafc1d66acdaadb138b42449d1ff476882032327cc1573bdbf04ea26ca2f200c8a49aab55a53d30a143142af2eddc4d7b174327f169f7483302
|
7
|
+
data.tar.gz: 22d62cf656e4b1eeb28da47f67017a7e05a0cda83f2c998f084410db2c30211c851c4401a815fe1837a3058d563cc50e0ff58bf4a3379b10867812b993634cee
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Vagrant Compose Yaml
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/vagrant-compose-yaml)
|
4
|
+
|
3
5
|
`vagrant-compose-yaml` is a plugin that sets up your working directory to be a Vagrant-managed multi-machine environment by YAML.
|
4
6
|
|
5
7
|
## Installation
|
@@ -10,7 +12,8 @@ $ vagrant plugin install vagrant-compose-yaml
|
|
10
12
|
|
11
13
|
## Usage
|
12
14
|
|
13
|
-
|
15
|
+
Put the YAML file named `vagrant-compose.yml` on your working directory. (e.g. [vagrant-compose.yml](/example/vagrant-compose.yml))
|
16
|
+
Then run the following commands:
|
14
17
|
|
15
18
|
```
|
16
19
|
$ vagrant compose-yaml
|
@@ -41,8 +41,8 @@ module VagrantPlugins
|
|
41
41
|
|
42
42
|
template = 'templates/Vagrantfile'
|
43
43
|
template_path = ::VagrantPlugins::ComposeYaml.source_root.join(template)
|
44
|
-
|
45
|
-
contents = Vagrant::Util::TemplateRenderer.render(template_path,
|
44
|
+
vagrantfile_data = yaml2vagrantdata(Pathname.new(options[:file]).expand_path(@env.cwd))
|
45
|
+
contents = Vagrant::Util::TemplateRenderer.render(template_path, vagrantfile_data)
|
46
46
|
|
47
47
|
if save_path
|
48
48
|
begin
|
@@ -60,6 +60,20 @@ module VagrantPlugins
|
|
60
60
|
|
61
61
|
0
|
62
62
|
end
|
63
|
+
|
64
|
+
def yaml2vagrantdata(yaml_path)
|
65
|
+
yaml = YAML.load_file(yaml_path)
|
66
|
+
yaml['services'].each do |name, service|
|
67
|
+
if service['ports'] != nil
|
68
|
+
service['forwarded_port'] = Array.new
|
69
|
+
service['ports'].each do |port|
|
70
|
+
host, guest = port.split(':')
|
71
|
+
service['forwarded_port'].push({'host' => host, 'guest' => guest})
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
yaml
|
76
|
+
end
|
63
77
|
end
|
64
78
|
end
|
65
79
|
end
|
data/templates/Vagrantfile.erb
CHANGED
@@ -12,6 +12,11 @@ Vagrant.configure("2") do |config|
|
|
12
12
|
<%- if v['ip'] -%>
|
13
13
|
c.vm.network "private_network", ip: "<%= v['ip'] %>"
|
14
14
|
<%- end -%>
|
15
|
+
<%- if v['forwarded_port'] -%>
|
16
|
+
<%- v['forwarded_port'].each do |port| -%>
|
17
|
+
c.vm.network "forwarded_port", guest: <%= port['guest'] %>, host: <%= port['host'] %>
|
18
|
+
<%- end -%>
|
19
|
+
<%- end -%>
|
15
20
|
<%- if v['memory'] -%>
|
16
21
|
c.vm.provider :virtualbox do |vb|
|
17
22
|
vb.customize ["modifyvm", :id, "--memory", "<%= v['memory'] %>"]
|
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.
|
4
|
+
version: 0.1.1
|
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-
|
11
|
+
date: 2016-09-13 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.
|