vagrant-berkshelf-nochefdk 6.0.0

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: 76368eac3ff70a04bdd42bf930fee647abbc55a5
4
+ data.tar.gz: 2858ac15765bfbc955abd4a7eb86f8262a4b60b9
5
+ SHA512:
6
+ metadata.gz: 1a7adc7be37d28542387ff364b3a382993126e2a20a09ef7c4656fb6acf8376f442c792a1a6daa9ebc0c1ce444cbceddfef66e82fe60420c6b60d4853bc6cd33
7
+ data.tar.gz: ed8d4862f814bbc5ed722000e31dd347dc9f04d9e9eb4c33cbe9b6bec43feabc3d6c9808e464233df3bfde98c52471a28e76eab787a43759ca7884adbe29fc02
@@ -0,0 +1,39 @@
1
+ ### Ruby ###
2
+ *.gem
3
+ *.rbc
4
+ /.config
5
+ /coverage/
6
+ /InstalledFiles
7
+ /pkg/
8
+ /spec/reports/
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+ /bin/
13
+
14
+ ## Specific to RubyMotion:
15
+ .dat*
16
+ .repl_history
17
+ build/
18
+
19
+ ## Documentation cache and generated files:
20
+ /.yardoc/
21
+ /_yardoc/
22
+ /doc/
23
+ /rdoc/
24
+
25
+ ## Environment normalisation:
26
+ /.bundle/
27
+ /lib/bundler/man/
28
+
29
+ # for a library or gem, you might want to ignore these files since the code is
30
+ # intended to run in multiple environments; otherwise, check them in:
31
+ Gemfile.lock
32
+ .ruby-version
33
+ .ruby-gemset
34
+
35
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
+ .rvmrc
37
+
38
+ ### Vagrant ###
39
+ .vagrant/
@@ -0,0 +1,19 @@
1
+ sudo: false
2
+ language: ruby
3
+ cache: bundler
4
+
5
+ branches:
6
+ only:
7
+ master
8
+
9
+ matrix:
10
+ include:
11
+ - rvm: 2.2.8
12
+ - rvm: 2.3.5
13
+ - rvm: 2.4.2
14
+ - rvm: ruby-head
15
+ allow_failures:
16
+ - rvm: 2.4.2
17
+ - rvm: ruby-head
18
+
19
+ script: bundle exec rake
@@ -0,0 +1,8 @@
1
+ # vagrant-berkshelf-nochef Changelog
2
+
3
+ ## 6.0.0
4
+
5
+ - Rebrand forked vagrant-berkshelf to vagrant-berkshelf-nochefdk
6
+ - Remove ChefDK dependency from vagrant-berkshelf
7
+
8
+ See [vagrant-berkshelf changelog up till version 5.1.2](https://github.com/spajus/vagrant-berkshelf-nochef/blob/v5.1.2/CHANGELOG.md) for historical changes.
@@ -0,0 +1,51 @@
1
+ # Contributing
2
+
3
+ ## Developing
4
+
5
+ If you'd like to submit a patch:
6
+
7
+ 1. Fork the project.
8
+ 2. Make your feature addition or bug fix.
9
+ 3. Add [tests](#testing) for it. This is important so that it isn't broken in a future version unintentionally.
10
+ 4. Commit. **Do not touch any unrelated code, such as the gemspec or version.** If you must change unrelated code, do it in a commit by itself, so that it can be ignored.
11
+ 5. Send a pull request.
12
+
13
+ ## Testing
14
+
15
+ ### Install prerequisites
16
+
17
+ Install the latest version of [Bundler](http://gembundler.com)
18
+
19
+ ```sh
20
+ $ gem install bundler
21
+ ```
22
+
23
+ Clone the project
24
+
25
+ ```sh
26
+ $ git clone https://github.com/berkshelf/vagrant-berkshelf-nochefdk.git
27
+ ```
28
+
29
+ and run:
30
+
31
+ ```sh
32
+ $ cd vagrant-berkshelf-nochefdk
33
+ $ bundle install
34
+ ```
35
+
36
+ Bundler will install all gems and their dependencies required for testing and developing.
37
+
38
+ ### Running tests
39
+
40
+ One-time run with Rake
41
+
42
+ ```sh
43
+ $ bundle exec rake spec
44
+ ```
45
+
46
+ Or you can setup a quick feedback loop with Guard
47
+
48
+ ```sh
49
+ $ bundle exec guard start
50
+ guard> rspec
51
+ ```
data/Gemfile ADDED
@@ -0,0 +1,43 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :development do
4
+ gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git'
5
+ gem 'spork'
6
+ gem 'rspec'
7
+ gem 'rake'
8
+ end
9
+
10
+ group :plugins do
11
+ gem 'vagrant-berkshelf-nochefdk', path: '.'
12
+ end
13
+
14
+ group :guard do
15
+ gem 'coolline'
16
+ gem 'fuubar'
17
+ gem 'guard', '>= 1.5.0'
18
+ gem 'guard-rspec'
19
+ gem 'guard-spork'
20
+ gem 'guard-yard'
21
+ gem 'redcarpet'
22
+ gem 'yard'
23
+
24
+ require 'rbconfig'
25
+
26
+ if RbConfig::CONFIG['target_os'] =~ /darwin/i
27
+ gem 'growl', require: false
28
+ gem 'rb-fsevent', require: false
29
+
30
+ if `uname`.strip == 'Darwin' && `sw_vers -productVersion`.strip >= '10.8'
31
+ gem 'terminal-notifier-guard', '~> 1.5.3', require: false
32
+ end rescue Errno::ENOENT
33
+
34
+ elsif RbConfig::CONFIG['target_os'] =~ /linux/i
35
+ gem 'libnotify', '~> 0.8.0', require: false
36
+ gem 'rb-inotify', require: false
37
+
38
+ elsif RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
39
+ gem 'rb-notifu', '>= 0.0.4', require: false
40
+ gem 'wdm', require: false
41
+ gem 'win32console', require: false
42
+ end
43
+ end
@@ -0,0 +1,16 @@
1
+ guard 'spork' do
2
+ watch('Gemfile')
3
+ watch('spec/spec_helper.rb') { :rspec }
4
+ end
5
+
6
+ guard 'yard', stdout: '/dev/null', stderr: '/dev/null' do
7
+ watch(%r{app/.+\.rb})
8
+ watch(%r{lib/.+\.rb})
9
+ watch(%r{ext/.+\.c})
10
+ end
11
+
12
+ guard 'rspec', cli: "--color --drb --format Fuubar", all_on_start: false, all_after_pass: false do
13
+ watch(%r{^spec/unit/.+_spec\.rb$})
14
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
15
+ watch('spec/spec_helper.rb') { "spec" }
16
+ end
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2012-2014 Riot Games
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -0,0 +1,89 @@
1
+ # Vagrant Berkshelf Plugin (without Chef DK dependency)
2
+
3
+ [![Gem Version](http://img.shields.io/gem/v/vagrant-berkshelf-nochefdk.svg)][gem] [![Build Status](http://img.shields.io/travis/spajus/vagrant-berkshelf-nochefdk.svg?branch=master)][travis]
4
+
5
+ Vagrant Berkshelf is a Vagrant plugin that adds Berkshelf integration to the Chef provisioners. Vagrant Berkshelf will automatically download and install cookbooks onto the Vagrant Virtual Machine.
6
+
7
+ ## Unofficial Fork Warning!
8
+
9
+ This is a simplified fork of [Vagrant Berkshelf](https://github.com/berkshelf/vagrant-berkshelf) plugin that has a dependency on Chef DK. This version just installs `berkshelf` gem into Vagrant embedded gems directory. Works out of the box, but your mileage may vary.
10
+
11
+ The plugin is identical to the original (up to v5.1.2), except for [this change](https://github.com/berkshelf/vagrant-berkshelf/pull/324).
12
+
13
+ ## vagrant-berkshelf-nochefdk vs. Test Kitchen
14
+
15
+ If you are about to use this plugin for testing your chef cookbooks, stop!
16
+ Please read the [motivation to use Test Kitchen instead](https://github.com/berkshelf/vagrant-berkshelf/tree/v5.1.2#vagrant-berkshelf-vs-test-kitchen). The only sane reason you would want to use this vagrant plugin is for bootstraping some development environments via Chef+Berkshelf, but not for testing your Chef cookbooks.
17
+
18
+ ## Installation
19
+
20
+ 1. Install the latest version of [Vagrant](https://www.vagrantup.com/downloads.html)
21
+ 3. Install the Vagrant Berkshelf plugin:
22
+
23
+ ```sh
24
+ $ vagrant plugin install vagrant-berkshelf-nochefdk
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ If the Vagrant Berkshelf plugin is installed, it will intelligently detect when a Berksfile is present in the same working directory as the Vagrantfile.
30
+
31
+ Here is an example Vagrantfile configuration section for Vagrant Berkshelf:
32
+
33
+ ```ruby
34
+ Vagrant.configure("2") do |config|
35
+ # The path to the Berksfile to use. The default value is "Berksfile" if one
36
+ # exists, or nil if it does not.
37
+ config.berkshelf.berksfile_path = "custom.Berksfile"
38
+
39
+ # Enable Berkshelf. If a Berksfile exists or a berksfile_path is given, this
40
+ # value is automatically set to true. If not, the value is false
41
+ config.berkshelf.enabled = true
42
+
43
+ # A list of Berkshelf groups to only install and sync to the Vagrant Virtual
44
+ # Machine. The default value is an empty array.
45
+ config.berkshelf.only = ["group_a", "group_b"]
46
+
47
+ # A list of Berkshelf groups to not install and sync to the Vagrant Virtual
48
+ # Machine. The default value is an empty array.
49
+ config.berkshelf.except = ["group_c", "group_d"]
50
+
51
+ # A list of extra values to pass to the `berks` executable. The default value
52
+ # is an empty array.
53
+ config.berkshelf.args = ["--format json"]
54
+ end
55
+ ```
56
+
57
+ ## Contributing
58
+
59
+ Thank you to all of our [Contributors](https://github.com/berkshelf/vagrant-berkshelf/graphs/contributors), testers, and users.
60
+
61
+ - Please report issues [on the GitHub issue tracker](https://github.com/berkshelf/berkshelf/issues)
62
+
63
+ If you'd like to contribute, please see our [contribution guidelines](https://github.com/berkshelf/vagrant-berkshelf/blob/master/CONTRIBUTING.md) first.
64
+
65
+ ## License & Authors
66
+
67
+ - Jamie Winsor (jamie@vialstudios.com)
68
+ - Michael Ivey (michael.ivey@riotgames.com)
69
+ - Seth Vargo (sethvargo@gmail.com)
70
+ - Tomas Varaneckas (tomas.varaneckas@gmail.com)
71
+
72
+ ```text
73
+ Copyright (c) 2012-2014 Riot Games
74
+
75
+ Licensed under the Apache License, Version 2.0 (the "License");
76
+ you may not use this file except in compliance with the License.
77
+ You may obtain a copy of the License at
78
+
79
+ http://www.apache.org/licenses/LICENSE-2.0
80
+
81
+ Unless required by applicable law or agreed to in writing, software
82
+ distributed under the License is distributed on an "AS IS" BASIS,
83
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
84
+ See the License for the specific language governing permissions and
85
+ limitations under the License.
86
+ ```
87
+
88
+ [gem]: https://rubygems.org/gems/vagrant-berkshelf-nochefdk
89
+ [travis]: https://travis-ci.org/berkshelf/vagrant-berkshelf-nochefdk
@@ -0,0 +1,14 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ require 'rspec/core/rake_task'
4
+ RSpec::Core::RakeTask.new do |t|
5
+ t.rspec_opts = [].tap do |a|
6
+ a.push('--color')
7
+ a.push('--format progress')
8
+ end.join(' ')
9
+ end
10
+
11
+ desc 'Run all tests'
12
+ task :test => [:spec]
13
+
14
+ task :default => [:test]
@@ -0,0 +1,17 @@
1
+ require 'vagrant'
2
+
3
+ require_relative 'vagrant-berkshelf/config'
4
+ require_relative 'vagrant-berkshelf/plugin'
5
+ require_relative 'vagrant-berkshelf/version'
6
+
7
+ module VagrantPlugins
8
+ module Berkshelf
9
+ def self.berkshelf_path
10
+ ENV['BERKSHELF_PATH'] || File.expand_path('~/.berkshelf')
11
+ end
12
+
13
+ def self.shelves_path
14
+ File.join(berkshelf_path, 'vagrant-berkshelf', 'shelves')
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,49 @@
1
+ require 'vagrant/action'
2
+
3
+ require_relative '../helpers'
4
+
5
+ module VagrantPlugins
6
+ module Berkshelf
7
+ module Action
8
+ class Base
9
+ # Cleanup any shared folders before destroying the VM.
10
+ def self.clean
11
+ Vagrant::Action::Builder.new.tap do |b|
12
+ b.use setup
13
+ b.use Action::Clean
14
+ end
15
+ end
16
+
17
+ # Provision the VM, calling setup, install, and upload.
18
+ def self.provision
19
+ Vagrant::Action::Builder.new.tap do |b|
20
+ b.use Action::Save
21
+ b.use Action::Install
22
+ b.use Action::Upload
23
+ end
24
+ end
25
+
26
+ # Setup all the required middlemare, including checking for the presence
27
+ # of Berkshelf, checking for the proper version of Berkshelf, and
28
+ # loading the datafile from disk.
29
+ def self.setup
30
+ Vagrant::Action::Builder.new.tap do |b|
31
+ b.use Action::Check
32
+ b.use Vagrant::Action::Builtin::EnvSet, berkshelf: Env.new
33
+ b.use Action::Load
34
+ b.use Action::Share
35
+ end
36
+ end
37
+
38
+ include VagrantPlugins::Berkshelf::Helpers
39
+
40
+ def initialize(app, env)
41
+ @app = app
42
+
43
+ klass = self.class.name.downcase.split('::').last
44
+ @logger = Log4r::Logger.new("vagrant::berkshelf::#{klass}")
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,49 @@
1
+ require_relative 'base'
2
+
3
+ module VagrantPlugins
4
+ module Berkshelf
5
+ module Action
6
+ class Check < Base
7
+ BERKS_REQUIREMENT = ">= 4.0"
8
+
9
+ def call(env)
10
+ if !berkshelf_enabled?(env)
11
+ @logger.info "Berkshelf disabled, skipping"
12
+ return @app.call(env)
13
+ end
14
+
15
+ check_berks_bin!(env)
16
+ berkshelf_version_check!(env)
17
+
18
+ @app.call(env)
19
+ end
20
+
21
+ # Check that the Berkshelf `berks` bin is in the PATH.
22
+ # @raise [BerkshelfNotFound]
23
+ def check_berks_bin!(env)
24
+ if berks_bin.nil?
25
+ raise BerkshelfNotFound
26
+ end
27
+ end
28
+
29
+ # Check that the installed version of Berkshelf is valid for this
30
+ # version of Vagrant Berkshelf.
31
+ # @raise [InvalidBerkshelfVersionError]
32
+ def berkshelf_version_check!(env)
33
+ result = berks("--version", "--format", "json")
34
+
35
+ begin
36
+ json = JSON.parse(result.stdout, symbolize_names: true)
37
+ version = Gem::Version.new(json[:version])
38
+
39
+ unless Gem::Requirement.new(BERKS_REQUIREMENT).satisfied_by?(version)
40
+ raise InvalidBerkshelfVersionError.new(berks_bin, BERKS_REQUIREMENT, version)
41
+ end
42
+ rescue JSON::ParserError
43
+ raise InvalidBerkshelfVersionError.new(berks_bin, BERKS_REQUIREMENT, version)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,29 @@
1
+ require_relative 'base'
2
+
3
+ module VagrantPlugins
4
+ module Berkshelf
5
+ module Action
6
+ class Clean < Base
7
+ def call(env)
8
+ if !berkshelf_enabled?(env)
9
+ @logger.info "Berkshelf disabled, skipping"
10
+ return @app.call(env)
11
+ end
12
+
13
+ env[:machine].ui.info "Running cleanup tasks for 'berkshelf'..."
14
+
15
+ if env[:berkshelf].shelf
16
+ if File.exist?(env[:berkshelf].shelf)
17
+ FileUtils.rm_rf(env[:berkshelf].shelf)
18
+ env[:berkshelf].shelf = nil
19
+ else
20
+ @logger.warn "The Berkshelf shelf did not exist for cleanup!"
21
+ end
22
+ end
23
+
24
+ @app.call(env)
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end