vagrant-group 0.1.0 → 0.2.0

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: 39eca5aa8acf36b1fc3c41caaaa027738774e252
4
- data.tar.gz: 51b3a5bd47bb2b72723556855eec8e0c52d6c8b5
3
+ metadata.gz: 6a760544d3f71b0a17d173f8679fae04a8dc0128
4
+ data.tar.gz: 3e31e279fc715245f468d8d2c8a664a0a2abf3c3
5
5
  SHA512:
6
- metadata.gz: 1e532f76205b836bebb742aaec640ab98c501979c5b5d08bd49864a3cfe5980cc1229f9fb924d26b0cce59e96522a3e7b8978b4dc1bdb84bb95009bdc1591b58
7
- data.tar.gz: 814ddb50b83c35d24ebf8302ea8e82c152c677aabeb2bd9ec4bcd9cda9635bfddbefcd5b509234974aeb555efc8d29225f3f539d8ab99664ec16b84128906ba0
6
+ metadata.gz: 96a0ed8ac11d66a9e188d3b0aa0e2de8a7e0144ca4145b9e044d25826973d85d410c9d16666bbfccb910333afec1449ca574c72d00636627b160e62f81d20775
7
+ data.tar.gz: f701445d7c405c6972c2d77e133969ab3f1f665d13b2ac7e06370b6797c208cc3cc2e08fca7fb40995cc0c50746afb23860d582f87d926538aebf6b7a71b5cf4
data/README.md CHANGED
@@ -1,7 +1,58 @@
1
1
  # Vagrant Group Plugin
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/vagrant-group.svg)](http://badge.fury.io/rb/vagrant-group)
4
+
3
5
  With this plugin you can associate VMs to groups and then perform
4
6
  basic operations like up/halt/provision/destroy on specific group.
7
+ One host may belong to multiple groups.
8
+
9
+ ## How to install
10
+
11
+ ```sh
12
+ vagrant plugin install vagrant-group
13
+ ```
14
+
15
+ ## How to configure
16
+
17
+ ```ruby
18
+ Vagrant.configure("2") do |config|
19
+ config.vm.define "web1" do |web|
20
+ web.vm.box = "apache"
21
+ end
22
+
23
+ config.vm.define "web2" do |web|
24
+ web.vm.box = "apache"
25
+ end
26
+
27
+ config.vm.define "db1" do |db|
28
+ db.vm.box = "mysql"
29
+ end
30
+
31
+ config.vm.define "db2" do |db|
32
+ db.vm.box = "mysql"
33
+ end
34
+
35
+ config.group.groups = {
36
+ "webservers" => [ "web1", "web2" ],
37
+ "databases" => [ "db1", "db2" ]
38
+ }
39
+ end
40
+ ```
41
+
42
+ ## How to use
43
+
44
+ ```sh
45
+ $ vagrant group webservers up
46
+ $ vagrant group databases halt
47
+ ```
48
+
49
+ At the moment you use commands `up`, `halt`, `provision` and `destroy`.
50
+ Parameters are not supported.
51
+
52
+ In order to list hosts associated to group issue below command:
53
+ ```
54
+ $ vagrant group webservers hosts
55
+ ```
5
56
 
6
57
  ## Contributing
7
58
 
@@ -9,7 +9,7 @@ module VagrantPlugins
9
9
  def execute
10
10
  options = {}
11
11
  opts = OptionParser.new do |o|
12
- o.banner = 'Usage: vagrant group <group-name> <up|halt|destroy|provision>'
12
+ o.banner = 'Usage: vagrant group <group-name> <up|halt|destroy|provision|hosts>'
13
13
  o.separator ''
14
14
 
15
15
  o.on('-h', '--help', 'Print this help') do
@@ -21,15 +21,28 @@ module VagrantPlugins
21
21
 
22
22
  group, action = argv[0], argv[1]
23
23
 
24
- if !group || !action || !['up', 'halt', 'destroy', 'provision'].include?(action)
24
+ if !group || !action || !['up', 'halt', 'destroy', 'provision', 'hosts'].include?(action)
25
25
  safe_puts(opts.help)
26
26
  return nil
27
27
  end
28
28
 
29
- with_target_vms() do |machine|
30
- if machine.config.group.groups.has_key?(group)
31
- if machine.config.group.groups[group].include? machine.name.to_s
32
- machine.action(action)
29
+ if action == 'hosts'
30
+ @env.ui.info(sprintf('Hosts in %s group:', group))
31
+
32
+ with_target_vms() do |machine|
33
+ if machine.config.group.groups.has_key?(group)
34
+ @env.ui.info(sprintf(' - %s', machine.name))
35
+ elsif
36
+ @env.ui.warn('No hosts associated.')
37
+ break
38
+ end
39
+ end
40
+ elsif
41
+ with_target_vms() do |machine|
42
+ if machine.config.group.groups.has_key?(group)
43
+ if machine.config.group.groups[group].include? machine.name.to_s
44
+ machine.action(action)
45
+ end
33
46
  end
34
47
  end
35
48
  end
@@ -1,7 +1,7 @@
1
1
  module VagrantPlugins
2
2
  module Group
3
3
 
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
 
6
6
  end # Group
7
7
  end # VagrantPlugins
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-group
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Krzysztof Magosa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-01 00:00:00.000000000 Z
11
+ date: 2015-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -55,8 +55,6 @@ files:
55
55
  - lib/vagrant-group/config.rb
56
56
  - lib/vagrant-group/plugin.rb
57
57
  - lib/vagrant-group/version.rb
58
- - lib/vagrant/vm/group.rb
59
- - lib/vagrant/vm/group/version.rb
60
58
  - vagrant-group.gemspec
61
59
  homepage: ''
62
60
  licenses:
@@ -1,7 +0,0 @@
1
- module Vagrant
2
- module Vm
3
- module Group
4
- VERSION = "0.0.1"
5
- end
6
- end
7
- end
@@ -1,9 +0,0 @@
1
- require "vagrant/vm/group/version"
2
-
3
- module Vagrant
4
- module Vm
5
- module Group
6
- # Your code goes here...
7
- end
8
- end
9
- end