vagrant-berkshelf-multi-berksfile 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e45015965633d325e719534d5925e875b94b9939
4
+ data.tar.gz: 984a9193fb796fcd93f207cd9dace661ff0c03c1
5
+ SHA512:
6
+ metadata.gz: 560e9ead294b86f2ab54a05d68a8b152f03a8ca686458e601cf392f2be39d62db1065619d771ec30c3bd3beefd6a8e4ef28333825a8cc7aec20cfe30ddfb84a1
7
+ data.tar.gz: b7a124a49733b91629d515b2c8614b0564b3e1f3a7fd1625a1b0b2958f690c46aadc790197a04e7293523439e23a77dc9b39038fd4ac3321a3cd85757e26d4ce
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vagrant-berkshelf-multi-berksfile.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 nuex
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.
@@ -0,0 +1,19 @@
1
+ vagrant-berkshelf multivm Berksfile support
2
+ ===========================================
3
+
4
+ ## Description
5
+
6
+ This vagrant plugin hacks the vagrant-berkshelf plugin to add support for multiple
7
+ Berksfile's for each VM.
8
+
9
+ This is a temporary solution until [vagrant-berkshelf issue #123](https://github.com/berkshelf/vagrant-berkshelf/issues/123) gets resolved.
10
+
11
+ ## Install
12
+
13
+ $ vagrant plugin install vagrant-berkshelf-multi-berksfile
14
+
15
+ ## Usage
16
+
17
+ In your Vagrantfile
18
+
19
+ Vagrant.require_plugin 'vagrant-berkshelf-multi-berksfile'
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,52 @@
1
+ module Berkshelf
2
+ module Vagrant
3
+ module Action
4
+ # @author Jamie Winsor <jamie@vialstudios.com>
5
+ class Install
6
+ def call(env)
7
+ if provision_disabled?(env)
8
+ env[:berkshelf].ui.info "Skipping Berkshelf with --no-provision"
9
+
10
+ return @app.call(env)
11
+ end
12
+
13
+ unless berkshelf_enabled?(env)
14
+ if File.exist?(env[:machine].config.berkshelf.berksfile_path)
15
+ warn_disabled_but_berksfile_exists(env)
16
+ end
17
+
18
+ return @app.call(env)
19
+ end
20
+
21
+ env[:berkshelf].berksfile = Berkshelf::Berksfile.from_file(env[:machine].config.berkshelf.berksfile_path)
22
+
23
+ if chef_solo?(env)
24
+ install(env)
25
+ end
26
+
27
+ @app.call(env)
28
+ rescue Berkshelf::BerkshelfError => e
29
+ raise Berkshelf::VagrantWrapperError.new(e)
30
+ end
31
+
32
+ private
33
+
34
+ def install(env)
35
+ check_vagrant_version(env)
36
+ env[:berkshelf].ui.info "Updating Vagrant's berkshelf: '#{env[:berkshelf].shelf}'"
37
+ opts = {
38
+ path: env[:berkshelf].shelf
39
+ }.merge(env[:machine].config.berkshelf.to_hash).symbolize_keys!
40
+ env[:berkshelf].berksfile.install(opts)
41
+ end
42
+
43
+ def warn_disabled_but_berksfile_exists(env)
44
+ env[:berkshelf].ui.warn "Berkshelf plugin is disabled but a Berksfile was found at" +
45
+ " your configured path: #{env[:machine].config.berkshelf.berksfile_path}"
46
+ env[:berkshelf].ui.warn "Enable the Berkshelf plugin by setting 'config.berkshelf.enabled = true'" +
47
+ " in your vagrant config"
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,18 @@
1
+ module Berkshelf
2
+ module Vagrant
3
+ # @author Jamie Winsor <jamie@vialstudios.com>
4
+ #
5
+ # A module of common helper functions that can be mixed into Berkshelf::Vagrant actions
6
+ module EnvHelpers
7
+
8
+ # Determine if the Berkshelf plugin should be run for the given environment
9
+ #
10
+ # @param [Vagrant::Environment] env
11
+ #
12
+ # @return [Boolean]
13
+ def berkshelf_enabled?(env)
14
+ env[:machine].config.berkshelf.enabled
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,6 @@
1
+ module MultiBerksfile
2
+ class Plugin < ::Vagrant.plugin('2')
3
+ name 'berkshelf multi berksfile'
4
+ description 'Adds multiple Berksfile support to vagrant-berkshelf plugin'
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Vagrant
2
+ module MultiBerksfile
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ require 'multi_berksfile/version'
2
+ require 'multi_berksfile/plugin'
3
+ require 'multi_berksfile/env_helpers'
4
+ require 'multi_berksfile/action/install'
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'multi_berksfile/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vagrant-berkshelf-multi-berksfile"
8
+ spec.version = Vagrant::MultiBerksfile::VERSION
9
+ spec.authors = ["nuex"]
10
+ spec.email = ["nx@nu-ex.com"]
11
+ spec.description = %q{vagrant-berkshelf Berksfile support for multiple vms}
12
+ spec.summary = %q{This gem will add multiple vm Berksfile support to the vagrant-berkshelf plugin}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
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_dependency 'vagrant-berkshelf'
22
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-berkshelf-multi-berksfile
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - nuex
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: vagrant-berkshelf
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: vagrant-berkshelf Berksfile support for multiple vms
28
+ email:
29
+ - nx@nu-ex.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - .gitignore
35
+ - Gemfile
36
+ - LICENSE.txt
37
+ - README.md
38
+ - Rakefile
39
+ - lib/multi_berksfile/action/install.rb
40
+ - lib/multi_berksfile/env_helpers.rb
41
+ - lib/multi_berksfile/plugin.rb
42
+ - lib/multi_berksfile/version.rb
43
+ - lib/vagrant-berkshelf-multi-berksfile.rb
44
+ - vagrant-berkshelf-multi-berksfile.gemspec
45
+ homepage: ''
46
+ licenses:
47
+ - MIT
48
+ metadata: {}
49
+ post_install_message:
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ requirements: []
64
+ rubyforge_project:
65
+ rubygems_version: 2.0.2
66
+ signing_key:
67
+ specification_version: 4
68
+ summary: This gem will add multiple vm Berksfile support to the vagrant-berkshelf
69
+ plugin
70
+ test_files: []
71
+ has_rdoc: