vagrant-group 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +22 -0
- data/README.md +12 -0
- data/Rakefile +2 -0
- data/lib/vagrant-group.rb +4 -0
- data/lib/vagrant-group/command.rb +40 -0
- data/lib/vagrant-group/config.rb +17 -0
- data/lib/vagrant-group/plugin.rb +20 -0
- data/lib/vagrant-group/version.rb +7 -0
- data/lib/vagrant/vm/group.rb +9 -0
- data/lib/vagrant/vm/group/version.rb +7 -0
- data/vagrant-group.gemspec +23 -0
- metadata +85 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 39eca5aa8acf36b1fc3c41caaaa027738774e252
|
4
|
+
data.tar.gz: 51b3a5bd47bb2b72723556855eec8e0c52d6c8b5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1e532f76205b836bebb742aaec640ab98c501979c5b5d08bd49864a3cfe5980cc1229f9fb924d26b0cce59e96522a3e7b8978b4dc1bdb84bb95009bdc1591b58
|
7
|
+
data.tar.gz: 814ddb50b83c35d24ebf8302ea8e82c152c677aabeb2bd9ec4bcd9cda9635bfddbefcd5b509234974aeb555efc8d29225f3f539d8ab99664ec16b84128906ba0
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Krzysztof Magosa
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# Vagrant Group Plugin
|
2
|
+
|
3
|
+
With this plugin you can associate VMs to groups and then perform
|
4
|
+
basic operations like up/halt/provision/destroy on specific group.
|
5
|
+
|
6
|
+
## Contributing
|
7
|
+
|
8
|
+
1. Fork it ( https://github.com/krzysztof-magosa/vagrant-group/fork )
|
9
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
10
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
11
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
12
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Group
|
3
|
+
class Command < Vagrant.plugin(2, :command)
|
4
|
+
|
5
|
+
def self.synopsis
|
6
|
+
"runs vagrant command on specific group of VMs"
|
7
|
+
end # self.synopsis
|
8
|
+
|
9
|
+
def execute
|
10
|
+
options = {}
|
11
|
+
opts = OptionParser.new do |o|
|
12
|
+
o.banner = 'Usage: vagrant group <group-name> <up|halt|destroy|provision>'
|
13
|
+
o.separator ''
|
14
|
+
|
15
|
+
o.on('-h', '--help', 'Print this help') do
|
16
|
+
safe_puts(opts.help)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
argv = parse_options(opts)
|
21
|
+
|
22
|
+
group, action = argv[0], argv[1]
|
23
|
+
|
24
|
+
if !group || !action || !['up', 'halt', 'destroy', 'provision'].include?(action)
|
25
|
+
safe_puts(opts.help)
|
26
|
+
return nil
|
27
|
+
end
|
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)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end # execute
|
37
|
+
|
38
|
+
end # Command
|
39
|
+
end # Group
|
40
|
+
end # VagrantPlugins
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Group
|
3
|
+
class Config < Vagrant.plugin(2, :config)
|
4
|
+
|
5
|
+
attr_accessor :groups
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@groups = UNSET_VALUE
|
9
|
+
end
|
10
|
+
|
11
|
+
def finalize!
|
12
|
+
@groups = {} if @groups == UNSET_VALUE
|
13
|
+
end
|
14
|
+
|
15
|
+
end # Config
|
16
|
+
end # Group
|
17
|
+
end # VagrantPlugins
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module Group
|
3
|
+
class Plugin < Vagrant.plugin(2)
|
4
|
+
|
5
|
+
name 'vagrant-vm-group'
|
6
|
+
description 'Plugin allows to group VMs'
|
7
|
+
|
8
|
+
command(:group) do
|
9
|
+
require_relative 'command'
|
10
|
+
Command
|
11
|
+
end
|
12
|
+
|
13
|
+
config(:group) do
|
14
|
+
require_relative 'config'
|
15
|
+
Config
|
16
|
+
end
|
17
|
+
|
18
|
+
end # Plugin
|
19
|
+
end # Group
|
20
|
+
end # VagrantPlugins
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vagrant-group/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vagrant-group"
|
8
|
+
spec.version = VagrantPlugins::Group::VERSION
|
9
|
+
spec.authors = ["Krzysztof Magosa"]
|
10
|
+
spec.email = ["krzysztof@magosa.pl"]
|
11
|
+
spec.summary = "Plugin allows to create groups of hosts and perform basic commands on them."
|
12
|
+
# spec.description = %q{TODO: Write a longer description. Optional.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-group
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Krzysztof Magosa
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- krzysztof@magosa.pl
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- lib/vagrant-group.rb
|
54
|
+
- lib/vagrant-group/command.rb
|
55
|
+
- lib/vagrant-group/config.rb
|
56
|
+
- lib/vagrant-group/plugin.rb
|
57
|
+
- lib/vagrant-group/version.rb
|
58
|
+
- lib/vagrant/vm/group.rb
|
59
|
+
- lib/vagrant/vm/group/version.rb
|
60
|
+
- vagrant-group.gemspec
|
61
|
+
homepage: ''
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubyforge_project:
|
81
|
+
rubygems_version: 2.0.14
|
82
|
+
signing_key:
|
83
|
+
specification_version: 4
|
84
|
+
summary: Plugin allows to create groups of hosts and perform basic commands on them.
|
85
|
+
test_files: []
|