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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b019c25adda9c8e40538b849609ac968f062ca5
4
- data.tar.gz: d78ae3e5e2817df7d0a29615e0fcf862715f454d
3
+ metadata.gz: 41f2cdb330bc6c5db558512050257300f45c9bc4
4
+ data.tar.gz: 34a48fc9b84bb9780515468bfc7b519c452b3e68
5
5
  SHA512:
6
- metadata.gz: 3a880ef5b0054e052bcf788c9ba35fd23ed8bde4c85569b3367dbdb0d784e7697ba73f41525b453a64081060ec8d82d60be7ac7c9846882adf3c11ff96454a6e
7
- data.tar.gz: c818d2f8bb075b950fb41dcab484a11a97f5a7ff4bf3f671ff1f3e3fd0fed5dbeefdbe56a03bbe337824e86265683f174af2b82862d2d510b971eb90551357a3
6
+ metadata.gz: 0c2b612642739dafc1d66acdaadb138b42449d1ff476882032327cc1573bdbf04ea26ca2f200c8a49aab55a53d30a143142af2eddc4d7b174327f169f7483302
7
+ data.tar.gz: 22d62cf656e4b1eeb28da47f67017a7e05a0cda83f2c998f084410db2c30211c851c4401a815fe1837a3058d563cc50e0ff58bf4a3379b10867812b993634cee
@@ -4,6 +4,12 @@ IMPROVEMENTS:
4
4
 
5
5
  - Defining and running multi-machine Vagrant environment without Vagrantfile.
6
6
 
7
+ ## 0.1.1 (September 13, 2016)
8
+
9
+ FEATURES:
10
+
11
+ - Add support for `ports` option.
12
+
7
13
  ## 0.1.0 (September 12, 2016)
8
14
 
9
15
  FEATURES:
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Vagrant Compose Yaml
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/vagrant-compose-yaml.svg)](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
- To set up current directory to be a Vagrant-managed multi-machine environment by `vagrant-compose.yml`, run the following commands:
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
- compose_yaml_data= YAML.load_file(Pathname.new(options[:file]).expand_path(@env.cwd))
45
- contents = Vagrant::Util::TemplateRenderer.render(template_path, compose_yaml_data)
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
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module ComposeYaml
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
@@ -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.0
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-12 00:00:00.000000000 Z
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.