vagrant-multiplug 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1f0fc8d069b49f2d4a8d02316ea962cf4bce669a
4
+ data.tar.gz: 3e608a90546481e3af3a4bf702621bedc9116b90
5
+ SHA512:
6
+ metadata.gz: d5388cb5e3e27261360d72122e919d782151ab5b924f9eeebf73b5115fca5fb64be7237345fe202a67b4285777e608a46a9c68789cff844c00d159963797aefa
7
+ data.tar.gz: b857bac5140bd010f0b60dba841bb15ec12a29f06d406f865d0732ec12cf1267e5ba4dad83bf129a25ca27dfbd00592c90f97ccbe89203fa87ce77f63a963c5a
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.vagrant
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "https://rubygems.org"
2
+
3
+ group :development do
4
+ gem "vagrant", git: "https://github.com/mitchellh/vagrant.git"
5
+ end
6
+
7
+ group :plugins do
8
+ gemspec
9
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Ryo Nakamura
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # vagrant-multiplug
2
+ [Vagrant](https://github.com/mitchellh/vagrant) plug-in to manage plug-in dependencies.
3
+
4
+ ## Usage
5
+ This plug-in will automatically install dependent plug-in before running vagrant actions.
6
+
7
+ ```
8
+ $ vagrant plugin install vagrant-multiplug
9
+ ```
10
+
11
+ After installing, you can specify the required plug-in dependencies in your Vagrantfile like so:
12
+
13
+ ```rb
14
+ # Vagrantfile
15
+ Vagrant.configure("2") do |config|
16
+ config.plugin.add_dependency "vagrant-serverkit", "0.0.2"
17
+ config.plugin.add_dependency "serverkit-defaults"
18
+ config.plugin.add_dependency "serverkit-homebrew"
19
+ config.plugin.add_dependency "serverkit-karabiner"
20
+ config.plugin.add_dependency "serverkit-rbenv"
21
+ ...
22
+ end
23
+ ```
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/Vagrantfile ADDED
@@ -0,0 +1,9 @@
1
+ Vagrant.configure("2") do |config|
2
+ config.vm.box = "ubuntu/trusty64"
3
+
4
+ config.plugin.add_dependency "vagrant-serverkit", "0.0.2"
5
+ config.plugin.add_dependency "serverkit-defaults"
6
+ config.plugin.add_dependency "serverkit-homebrew"
7
+ config.plugin.add_dependency "serverkit-karabiner"
8
+ config.plugin.add_dependency "serverkit-rbenv"
9
+ end
@@ -0,0 +1,3 @@
1
+ require "vagrant"
2
+ require "vagrant/multiplug/version"
3
+ require "vagrant_plugins/multiplug/plugin"
@@ -0,0 +1,5 @@
1
+ module Vagrant
2
+ module Multiplug
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,31 @@
1
+ module VagrantPlugins
2
+ module Multiplug
3
+ module Action
4
+ class InstallPlugins
5
+ def initialize(app, *)
6
+ @app = app
7
+ end
8
+
9
+ def call(env)
10
+ restart if env[:machine].config.plugin.dependencies.any? do |dependency|
11
+ case
12
+ when dependency.installed?
13
+ false
14
+ when system("vagrant plugin install #{dependency.name} #{dependency.options}")
15
+ true
16
+ else
17
+ exit(1)
18
+ end
19
+ end
20
+ @app.call(env)
21
+ end
22
+
23
+ private
24
+
25
+ def restart
26
+ exec "#{$0} #{ARGV * ' '}"
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,35 @@
1
+ require "vagrant"
2
+
3
+ module VagrantPlugins
4
+ module Multiplug
5
+ class Config < Vagrant.plugin("2", :config)
6
+ def add_dependency(name, version = nil)
7
+ dependencies << Dependency.new(name, version)
8
+ end
9
+
10
+ def dependencies
11
+ @dependencies ||= []
12
+ end
13
+ end
14
+
15
+ class Dependency
16
+ attr_reader :name, :version
17
+
18
+ def initialize(name, version = nil)
19
+ @name = name
20
+ @version = version
21
+ end
22
+
23
+ def installed?
24
+ ::Vagrant.has_plugin?(@name, @version)
25
+ end
26
+
27
+ # @return [String] Command-line options for `vagrant plugin install NAME`
28
+ def options
29
+ if @version
30
+ "--plugin-version #{@version}"
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,22 @@
1
+ require "vagrant"
2
+
3
+ module VagrantPlugins
4
+ module Multiplug
5
+ class Plugin < Vagrant.plugin("2")
6
+ name "multiplug"
7
+
8
+ config(:plugin) do
9
+ require_relative "config"
10
+ Config
11
+ end
12
+
13
+ action_hook(:install_plugins, Plugin::ALL_ACTIONS) do |hook|
14
+ require_relative "action/install_plugins"
15
+ hook.before(
16
+ Vagrant::Action::Builtin::ConfigValidate,
17
+ VagrantPlugins::Multiplug::Action::InstallPlugins,
18
+ )
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,19 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "vagrant/multiplug/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "vagrant-multiplug"
7
+ spec.version = Vagrant::Multiplug::VERSION
8
+ spec.authors = ["Ryo Nakamura"]
9
+ spec.email = ["r7kamura@gmail.com"]
10
+ spec.summary = "Vagrant plug-in to manage plug-in dependencies."
11
+ spec.homepage = "https://github.com/r7kamura/vagrant-multiplug"
12
+ spec.license = "MIT"
13
+
14
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
15
+ spec.require_paths = ["lib"]
16
+
17
+ spec.add_development_dependency "bundler"
18
+ spec.add_development_dependency "rake", "~> 10.0"
19
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-multiplug
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ryo Nakamura
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-14 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: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
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
+ - r7kamura@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".travis.yml"
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - Vagrantfile
55
+ - lib/vagrant/multiplug.rb
56
+ - lib/vagrant/multiplug/version.rb
57
+ - lib/vagrant_plugins/multiplug/action/install_plugins.rb
58
+ - lib/vagrant_plugins/multiplug/config.rb
59
+ - lib/vagrant_plugins/multiplug/plugin.rb
60
+ - vagrant-multiplug.gemspec
61
+ homepage: https://github.com/r7kamura/vagrant-multiplug
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.4.5
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: Vagrant plug-in to manage plug-in dependencies.
85
+ test_files: []