berkshelf-vagrant 1.1.2 → 1.1.3

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,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ODdiNzQxMTZkMDhmMzdmOTgyYjBhZjEwZDUxYjYxZDc3YmYxNDU0OA==
5
+ data.tar.gz: !binary |-
6
+ ODRiNTAzMDQwOWJjNDNhZjNhZDEyMmI0NTBjOTRkNjEyODZlNTlkZg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MDhhNDRiZDY3YjY4NDU4YTY4ZGIxMjA0ODQ5MDk3MjllMDk3Njk3YzIyYjVi
10
+ ZWZiNGViOTUyNGRkNTQxMDAyNzRhODFmNmIxMGUyODY3NjM5N2EyY2QwOGFi
11
+ OTQ0MzdkYmNiM2ExYmY2ODhmZTZiNmQ2NTY3MTQwYWQ3ODY5Zjk=
12
+ data.tar.gz: !binary |-
13
+ ZWM5YWUzZTU4ZmU3YTU2ZWQyODJiOGQ5YmY2YmY5Njc0NTliNmExMmVhMGRi
14
+ YzVlYzQxMmZlYTZhN2EzYzQwZjU2MmQ3N2Q2M2RmZGQxMDIzNzU3NzU5NWQx
15
+ Y2QyYzliNDhhNzQ1ZWMyMGQ0YzQyNTA4ZmUwZmVmNjRjOWM2MTk=
@@ -1 +1 @@
1
- require 'berkshelf/vagrant'
1
+
metadata CHANGED
@@ -1,255 +1,60 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berkshelf-vagrant
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
5
- prerelease:
4
+ version: 1.1.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jamie Winsor
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-16 00:00:00.000000000 Z
11
+ date: 2013-04-19 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: berkshelf
14
+ name: vagrant-berkshelf
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
21
- version: 1.3.0
19
+ version: 1.2.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
29
- version: 1.3.0
30
- - !ruby/object:Gem::Dependency
31
- name: activesupport
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: 3.2.0
38
- - - <
39
- - !ruby/object:Gem::Version
40
- version: 3.2.13
41
- type: :runtime
42
- prerelease: false
43
- version_requirements: !ruby/object:Gem::Requirement
44
- none: false
45
- requirements:
46
- - - ! '>='
47
- - !ruby/object:Gem::Version
48
- version: 3.2.0
49
- - - <
50
- - !ruby/object:Gem::Version
51
- version: 3.2.13
52
- - !ruby/object:Gem::Dependency
53
- name: i18n
54
- requirement: !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
57
- - - ~>
58
- - !ruby/object:Gem::Version
59
- version: 0.6.0
60
- type: :runtime
61
- prerelease: false
62
- version_requirements: !ruby/object:Gem::Requirement
63
- none: false
64
- requirements:
65
- - - ~>
66
- - !ruby/object:Gem::Version
67
- version: 0.6.0
68
- - !ruby/object:Gem::Dependency
69
- name: json
70
- requirement: !ruby/object:Gem::Requirement
71
- none: false
72
- requirements:
73
- - - ! '>='
74
- - !ruby/object:Gem::Version
75
- version: 1.5.1
76
- - - <
77
- - !ruby/object:Gem::Version
78
- version: 1.8.0
79
- type: :runtime
80
- prerelease: false
81
- version_requirements: !ruby/object:Gem::Requirement
82
- none: false
83
- requirements:
84
- - - ! '>='
85
- - !ruby/object:Gem::Version
86
- version: 1.5.1
87
- - - <
88
- - !ruby/object:Gem::Version
89
- version: 1.8.0
90
- - !ruby/object:Gem::Dependency
91
- name: net-ssh
92
- requirement: !ruby/object:Gem::Requirement
93
- none: false
94
- requirements:
95
- - - ~>
96
- - !ruby/object:Gem::Version
97
- version: 2.6.6
98
- type: :runtime
99
- prerelease: false
100
- version_requirements: !ruby/object:Gem::Requirement
101
- none: false
102
- requirements:
103
- - - ~>
104
- - !ruby/object:Gem::Version
105
- version: 2.6.6
106
- - !ruby/object:Gem::Dependency
107
- name: net-scp
108
- requirement: !ruby/object:Gem::Requirement
109
- none: false
110
- requirements:
111
- - - ~>
112
- - !ruby/object:Gem::Version
113
- version: 1.1.0
114
- type: :runtime
115
- prerelease: false
116
- version_requirements: !ruby/object:Gem::Requirement
117
- none: false
118
- requirements:
119
- - - ~>
120
- - !ruby/object:Gem::Version
121
- version: 1.1.0
122
- - !ruby/object:Gem::Dependency
123
- name: bundler
124
- requirement: !ruby/object:Gem::Requirement
125
- none: false
126
- requirements:
127
- - - ~>
128
- - !ruby/object:Gem::Version
129
- version: '1.3'
130
- type: :development
131
- prerelease: false
132
- version_requirements: !ruby/object:Gem::Requirement
133
- none: false
134
- requirements:
135
- - - ~>
136
- - !ruby/object:Gem::Version
137
- version: '1.3'
138
- - !ruby/object:Gem::Dependency
139
- name: spork
140
- requirement: !ruby/object:Gem::Requirement
141
- none: false
142
- requirements:
143
- - - ! '>='
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- none: false
150
- requirements:
151
- - - ! '>='
152
- - !ruby/object:Gem::Version
153
- version: '0'
154
- - !ruby/object:Gem::Dependency
155
- name: rspec
156
- requirement: !ruby/object:Gem::Requirement
157
- none: false
158
- requirements:
159
- - - ! '>='
160
- - !ruby/object:Gem::Version
161
- version: '0'
162
- type: :development
163
- prerelease: false
164
- version_requirements: !ruby/object:Gem::Requirement
165
- none: false
166
- requirements:
167
- - - ! '>='
168
- - !ruby/object:Gem::Version
169
- version: '0'
170
- - !ruby/object:Gem::Dependency
171
- name: thor
172
- requirement: !ruby/object:Gem::Requirement
173
- none: false
174
- requirements:
175
- - - ! '>='
176
- - !ruby/object:Gem::Version
177
- version: '0'
178
- type: :development
179
- prerelease: false
180
- version_requirements: !ruby/object:Gem::Requirement
181
- none: false
182
- requirements:
183
- - - ! '>='
184
- - !ruby/object:Gem::Version
185
- version: '0'
186
- description: A Vagrant plugin to add Berkshelf integration to the Chef provisioners
26
+ version: 1.2.0
27
+ description: Renamed to vagrant-berkshelf
187
28
  email:
188
29
  - reset@riotgames.com
189
30
  executables: []
190
31
  extensions: []
191
32
  extra_rdoc_files: []
192
33
  files:
193
- - .gitignore
194
- - .travis.yml
195
- - CHANGELOG.md
196
- - CONTRIBUTING.md
197
- - Gemfile
198
- - Guardfile
199
- - LICENSE.txt
200
- - README.md
201
- - Thorfile
202
- - berkshelf-vagrant.gemspec
203
34
  - lib/berkshelf-vagrant.rb
204
- - lib/berkshelf/vagrant.rb
205
- - lib/berkshelf/vagrant/action.rb
206
- - lib/berkshelf/vagrant/action/clean.rb
207
- - lib/berkshelf/vagrant/action/configure_chef.rb
208
- - lib/berkshelf/vagrant/action/install.rb
209
- - lib/berkshelf/vagrant/action/load_shelf.rb
210
- - lib/berkshelf/vagrant/action/set_ui.rb
211
- - lib/berkshelf/vagrant/action/upload.rb
212
- - lib/berkshelf/vagrant/config.rb
213
- - lib/berkshelf/vagrant/env.rb
214
- - lib/berkshelf/vagrant/env_helpers.rb
215
- - lib/berkshelf/vagrant/errors.rb
216
- - lib/berkshelf/vagrant/plugin.rb
217
- - lib/berkshelf/vagrant/version.rb
218
- - spec/spec_helper.rb
219
- - spec/unit/berkshelf/vagrant/config_spec.rb
220
- - spec/unit/berkshelf/vagrant/errors_spec.rb
221
- - spec/unit/berkshelf/vagrant_spec.rb
222
35
  homepage: http://berkshelf.com
223
36
  licenses:
224
37
  - Apache 2.0
38
+ metadata: {}
225
39
  post_install_message:
226
40
  rdoc_options: []
227
41
  require_paths:
228
42
  - lib
229
43
  required_ruby_version: !ruby/object:Gem::Requirement
230
- none: false
231
44
  requirements:
232
45
  - - ! '>='
233
46
  - !ruby/object:Gem::Version
234
47
  version: 1.9.1
235
48
  required_rubygems_version: !ruby/object:Gem::Requirement
236
- none: false
237
49
  requirements:
238
50
  - - ! '>='
239
51
  - !ruby/object:Gem::Version
240
52
  version: '0'
241
- segments:
242
- - 0
243
- hash: -547127228269075134
244
53
  requirements: []
245
54
  rubyforge_project:
246
- rubygems_version: 1.8.23
55
+ rubygems_version: 2.0.3
247
56
  signing_key:
248
- specification_version: 3
249
- summary: A Vagrant plugin to add Berkshelf integration to the Chef provisioners
250
- test_files:
251
- - spec/spec_helper.rb
252
- - spec/unit/berkshelf/vagrant/config_spec.rb
253
- - spec/unit/berkshelf/vagrant/errors_spec.rb
254
- - spec/unit/berkshelf/vagrant_spec.rb
57
+ specification_version: 4
58
+ summary: Renamed to vagrant-berkshelf
59
+ test_files: []
255
60
  has_rdoc:
data/.gitignore DELETED
@@ -1,18 +0,0 @@
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
18
- .rspec
@@ -1,11 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 1.9.3
4
- - 2.0.0
5
- notifications:
6
- irc:
7
- channels:
8
- - "irc.freenode.org#berkshelf"
9
- skip_join: true
10
- use_notice: true
11
- script: 'bundle exec thor spec:ci'
@@ -1,6 +0,0 @@
1
- # 1.1.0
2
- - Plugin defaults to disabled. Set 'config.berkshelf.enabled = true' in Vagrant config
3
-
4
- # 1.0.0
5
- - Separated Berkshelf Vagrant plugin into it's own gem (this one)
6
- - Support Vagrant 1.1.x
@@ -1,44 +0,0 @@
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
10
- future version unintentionally.
11
- 4. Commit. **Do not touch any unrelated code, such as the gemspec or version.**
12
- If you must change unrelated code, do it in a commit by itself, so that it
13
- can be ignored.
14
- 5. Send a pull request.
15
-
16
- ## Testing
17
-
18
- ### Install prerequisites
19
-
20
- Install the latest version of [Bundler](http://gembundler.com)
21
-
22
- $ gem install bundler
23
-
24
- Clone the project
25
-
26
- $ git clone git://github.com/RiotGames/berkshelf-vagrant.git
27
-
28
- and run:
29
-
30
- $ cd berkshelf-vagrant
31
- $ bundle-vagrant install
32
-
33
- Bundler will install all gems and their dependencies required for testing and developing.
34
-
35
- ### Running unit (RSpec) tests
36
-
37
- One-time run with Thor
38
-
39
- $ bundle exec thor spec
40
-
41
- Or you can setup a quick feedback loop with Guard
42
-
43
- $ bundle exec guard start
44
- guard> rspec
data/Gemfile DELETED
@@ -1,35 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- group :development do
6
- gem 'vagrant', github: "mitchellh/vagrant", tag: "v1.1.2"
7
- gem 'coolline'
8
- gem 'guard', '>= 1.5.0'
9
- gem 'guard-rspec'
10
- gem 'guard-spork'
11
- gem 'guard-yard'
12
- gem 'redcarpet'
13
- gem 'yard'
14
- gem 'fuubar'
15
-
16
- require 'rbconfig'
17
-
18
- if RbConfig::CONFIG['target_os'] =~ /darwin/i
19
- gem 'growl', require: false
20
- gem 'rb-fsevent', require: false
21
-
22
- if `uname`.strip == 'Darwin' && `sw_vers -productVersion`.strip >= '10.8'
23
- gem 'terminal-notifier-guard', '~> 1.5.3', require: false
24
- end rescue Errno::ENOENT
25
-
26
- elsif RbConfig::CONFIG['target_os'] =~ /linux/i
27
- gem 'libnotify', '~> 0.8.0', require: false
28
- gem 'rb-inotify', require: false
29
-
30
- elsif RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
31
- gem 'rb-notifu', '>= 0.0.4', require: false
32
- gem 'wdm', require: false
33
- gem 'win32console', require: false
34
- end
35
- end
data/Guardfile DELETED
@@ -1,16 +0,0 @@
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
@@ -1,13 +0,0 @@
1
- Copyright (c) 2012-2013 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.
data/README.md DELETED
@@ -1,35 +0,0 @@
1
- # Berkshelf::Vagrant
2
- [![Gem Version](https://badge.fury.io/rb/berkshelf-vagrant.png)](http://badge.fury.io/rb/berkshelf-vagrant)
3
- [![Build Status](https://travis-ci.org/RiotGames/berkshelf-vagrant.png?branch=master)](https://travis-ci.org/RiotGames/berkshelf-vagrant)
4
- [![Dependency Status](https://gemnasium.com/RiotGames/berkshelf-vagrant.png)](https://gemnasium.com/RiotGames/berkshelf-vagrant)
5
- [![Code Climate](https://codeclimate.com/github/RiotGames/berkshelf-vagrant.png)](https://codeclimate.com/github/RiotGames/berkshelf-vagrant)
6
-
7
- A Vagrant plugin to add Berkshelf integration to the Chef provisioners
8
-
9
- ## Installation
10
-
11
- Install Vagrant 1.1.x from the [Vagrant downloads page](http://downloads.vagrantup.com/)
12
-
13
- Install the Berkshelf Vagrant plugin
14
-
15
- $ vagrant plugin install berkshelf-vagrant
16
-
17
- ## Usage
18
-
19
- Once the Berkshelf Vagrant plugin is installed it can be enabled in your Vagrantfile
20
-
21
-
22
- Vagrant.configure("2") do |config|
23
- ...
24
- config.berkshelf.enabled = true
25
- ...
26
- end
27
-
28
- The plugin will look in your current working directory for your `Berksfile` by default. Just ensure that your Berksfile exists and when you run `vagrant up`, `vagrant provision`, or `vagrant destroy` the Berkshelf integration will automatically kick in!
29
-
30
- # Authors
31
- - Jamie Winsor (<reset@riotgames.com>)
32
-
33
- Thank you to all of our [Contributors](https://github.com/RiotGames/berkshelf-vagrant/graphs/contributors), testers, and users.
34
-
35
- If you'd like to contribute, please see our [contribution guidelines](https://github.com/RiotGames/berkshelf-vagrant/blob/master/CONTRIBUTING.md) first.
data/Thorfile DELETED
@@ -1,58 +0,0 @@
1
- # encoding: utf-8
2
- $:.push File.expand_path("../lib", __FILE__)
3
-
4
- require 'bundler'
5
- require 'bundler/setup'
6
- require 'thor/rake_compat'
7
-
8
- require 'berkshelf/vagrant'
9
-
10
- class Default < Thor
11
- class Gem < Thor
12
- include Thor::RakeCompat
13
- Bundler::GemHelper.install_tasks
14
-
15
- namespace :gem
16
-
17
- desc "build", "Build berkshelf-vagrant-#{Berkshelf::Vagrant::VERSION}.gem into the pkg directory"
18
- def build
19
- Rake::Task["build"].execute
20
- end
21
-
22
- desc "release", "Create tag v#{Berkshelf::Vagrant::VERSION} and build and push berkshelf-vagrant-#{Berkshelf::Vagrant::VERSION}.gem to Rubygems"
23
- def release
24
- Rake::Task["release"].execute
25
- end
26
-
27
- desc "install", "Build and install berkshelf-vagrant-#{Berkshelf::Vagrant::VERSION}.gem into system gems"
28
- def install
29
- Rake::Task["install"].execute
30
- end
31
- end
32
-
33
- class Spec < Thor
34
- include Thor::Actions
35
-
36
- namespace :spec
37
- default_task :unit
38
-
39
- desc "ci", "Run all possible tests on Travis-CI"
40
- def ci
41
- ENV['CI'] = 'true' # Travis-CI also sets this, but set it here for local testing
42
- invoke(:unit)
43
- end
44
-
45
- desc "unit", "Run unit tests"
46
- def unit
47
- unless run_unit
48
- exit 1
49
- end
50
- end
51
-
52
- no_tasks do
53
- def run_unit(*flags)
54
- run "rspec --color --format=documentation #{flags.join(' ')} spec"
55
- end
56
- end
57
- end
58
- end
@@ -1,36 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'berkshelf/vagrant/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "berkshelf-vagrant"
8
- spec.version = Berkshelf::Vagrant::VERSION
9
- spec.authors = [ "Jamie Winsor" ]
10
- spec.email = [ "reset@riotgames.com" ]
11
- spec.description = %q{A Vagrant plugin to add Berkshelf integration to the Chef provisioners}
12
- spec.summary = spec.description
13
- spec.homepage = "http://berkshelf.com"
14
- spec.license = "Apache 2.0"
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
- spec.required_ruby_version = ">= 1.9.1"
21
-
22
- spec.add_dependency 'berkshelf', '>= 1.3.0'
23
- # activesupport 3.2.13 contains an incompatible hard lock on i18n (= 0.6.1)
24
- spec.add_dependency 'activesupport', '>= 3.2.0', '< 3.2.13'
25
-
26
- # Explicit locks to ensure we activate the proper gem versions for Vagrant
27
- spec.add_dependency "i18n", "~> 0.6.0"
28
- spec.add_dependency "json", ">= 1.5.1", "< 1.8.0"
29
- spec.add_dependency "net-ssh", "~> 2.6.6"
30
- spec.add_dependency "net-scp", "~> 1.1.0"
31
-
32
- spec.add_development_dependency 'bundler', '~> 1.3'
33
- spec.add_development_dependency 'spork'
34
- spec.add_development_dependency 'rspec'
35
- spec.add_development_dependency 'thor'
36
- end
@@ -1,40 +0,0 @@
1
- require 'vagrant'
2
- require 'berkshelf'
3
- require 'berkshelf/vagrant/version'
4
- require 'berkshelf/vagrant/errors'
5
- require 'tmpdir'
6
- require 'fileutils'
7
-
8
- module Berkshelf
9
- # @author Jamie Winsor <reset@riotgames.com>
10
- module Vagrant
11
- autoload :Action, 'berkshelf/vagrant/action'
12
- autoload :Config, 'berkshelf/vagrant/config'
13
- autoload :Env, 'berkshelf/vagrant/env'
14
- autoload :EnvHelpers, 'berkshelf/vagrant/env_helpers'
15
-
16
- class << self
17
- # The path to where shelfs are created on the host machine to be mounted in
18
- # Vagrant guests
19
- #
20
- # @return [String]
21
- def shelf_path
22
- File.join(Berkshelf.berkshelf_path, 'vagrant')
23
- end
24
-
25
- # Generate a new shelf to be mounted in a Vagrant guest
26
- #
27
- # @return [String]
28
- # path to the generated shelf
29
- def mkshelf
30
- unless File.exist?(shelf_path)
31
- FileUtils.mkdir_p(shelf_path)
32
- end
33
-
34
- Dir.mktmpdir('berkshelf-', shelf_path)
35
- end
36
- end
37
- end
38
- end
39
-
40
- require 'berkshelf/vagrant/plugin'
@@ -1,63 +0,0 @@
1
- module Berkshelf
2
- module Vagrant
3
- module Action
4
- autoload :Clean, 'berkshelf/vagrant/action/clean'
5
- autoload :ConfigureChef, 'berkshelf/vagrant/action/configure_chef'
6
- autoload :Install, 'berkshelf/vagrant/action/install'
7
- autoload :LoadShelf, 'berkshelf/vagrant/action/load_shelf'
8
- autoload :SetUI, 'berkshelf/vagrant/action/set_ui'
9
- autoload :Upload, 'berkshelf/vagrant/action/upload'
10
-
11
- class << self
12
- # Return the Berkshelf install middleware stack. When placed in the action chain
13
- # this stack will find retrieve and resolve the cookbook dependencies describe
14
- # in your configured Berksfile.
15
- #
16
- # Cookbooks will installed into a temporary directory, called a Shelf, and mounted
17
- # into the VM. This mounted path will be appended to the chef_solo.cookbooks_path value.
18
- #
19
- # @return [::Vagrant::Action::Builder]
20
- def install
21
- @install ||= ::Vagrant::Action::Builder.new.tap do |b|
22
- b.use Berkshelf::Vagrant::Action::Install
23
- end
24
- end
25
-
26
- # Return the Berkshelf upload middleware stack. When placed in the action chain
27
- # this stack will upload cookbooks to a Chef Server if the Chef-Client provisioner
28
- # is used. The Chef Server where the cookbooks will be uploaded to is the same Chef
29
- # Server used in the Chef-Client provisioner.
30
- #
31
- # Nothing will be done if the Chef-Solo provisioner is used.
32
- #
33
- # @return [::Vagrant::Action::Builder]
34
- def upload
35
- @upload ||= ::Vagrant::Action::Builder.new.tap do |b|
36
- b.use Berkshelf::Vagrant::Action::Upload
37
- end
38
- end
39
-
40
- # Return the Berkshelf clean middleware stack. When placed in the action chain
41
- # this stack will clean up any temporary directories or files created by the other
42
- # middleware stacks.
43
- #
44
- # @return [::Vagrant::Action::Builder]
45
- def clean
46
- @clean ||= ::Vagrant::Action::Builder.new.tap do |b|
47
- b.use setup
48
- b.use Berkshelf::Vagrant::Action::Clean
49
- end
50
- end
51
-
52
- def setup
53
- @setup ||= ::Vagrant::Action::Builder.new.tap do |b|
54
- b.use ::Vagrant::Action::Builtin::EnvSet, berkshelf: Berkshelf::Vagrant::Env.new
55
- b.use Berkshelf::Vagrant::Action::SetUI
56
- b.use Berkshelf::Vagrant::Action::LoadShelf
57
- b.use Berkshelf::Vagrant::Action::ConfigureChef
58
- end
59
- end
60
- end
61
- end
62
- end
63
- end
@@ -1,28 +0,0 @@
1
- module Berkshelf
2
- module Vagrant
3
- module Action
4
- # @author Jamie Winsor <reset@riotgames.com>
5
- class Clean
6
- include Berkshelf::Vagrant::EnvHelpers
7
-
8
- def initialize(app, env)
9
- @app = app
10
- end
11
-
12
- def call(env)
13
- if env[:berkshelf].shelf && File.exist?(env[:berkshelf].shelf)
14
- env[:berkshelf].ui.info "Cleaning Vagrant's berkshelf"
15
-
16
- FileUtils.remove_dir(env[:berkshelf].shelf, force: true)
17
- FileUtils.rm_f(cache_file)
18
- env[:berkshelf].shelf = nil
19
- end
20
-
21
- @app.call(env)
22
- rescue Berkshelf::BerkshelfError => e
23
- raise Berkshelf::VagrantWrapperError.new(e)
24
- end
25
- end
26
- end
27
- end
28
- end
@@ -1,28 +0,0 @@
1
- module Berkshelf
2
- module Vagrant
3
- module Action
4
- # @author Jamie Winsor <reset@riotgames.com>
5
- class ConfigureChef
6
- include Berkshelf::Vagrant::EnvHelpers
7
-
8
- def initialize(app, env)
9
- @app = app
10
- end
11
-
12
- def call(env)
13
- unless berkshelf_enabled?(env)
14
- return @app.call(env)
15
- end
16
-
17
- if chef_solo?(env) && shelf = env[:berkshelf].shelf
18
- provisioners(:chef_solo, env).each do |provisioner|
19
- provisioner.config.cookbooks_path = provisioner.config.send(:prepare_folders_config, shelf)
20
- end
21
- end
22
-
23
- @app.call(env)
24
- end
25
- end
26
- end
27
- end
28
- end
@@ -1,51 +0,0 @@
1
- module Berkshelf
2
- module Vagrant
3
- module Action
4
- # @author Jamie Winsor <reset@riotgames.com>
5
- class Install
6
- include Berkshelf::Vagrant::EnvHelpers
7
-
8
- def initialize(app, env)
9
- @app = app
10
- end
11
-
12
- def call(env)
13
- unless berkshelf_enabled?(env)
14
- if File.exist?(env[:global_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[:global_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
- env[:berkshelf].ui.info "Updating Vagrant's berkshelf: '#{env[:berkshelf].shelf}'"
36
- opts = {
37
- path: env[:berkshelf].shelf
38
- }.merge(env[:global_config].berkshelf.to_hash).symbolize_keys!
39
- env[:berkshelf].berksfile.install(opts)
40
- end
41
-
42
- def warn_disabled_but_berksfile_exists(env)
43
- env[:berkshelf].ui.warn "Berkshelf plugin is disabled but a Berksfile was found at" +
44
- " your configured path: #{env[:global_config].berkshelf.berksfile_path}"
45
- env[:berkshelf].ui.warn "Enable the Berkshelf plugin by setting 'config.berkshelf.enabled = true'" +
46
- " in your vagrant config"
47
- end
48
- end
49
- end
50
- end
51
- end
@@ -1,50 +0,0 @@
1
- module Berkshelf
2
- module Vagrant
3
- module Action
4
- # @author Jamie Winsor <reset@riotgames.com>
5
- class LoadShelf
6
- include Berkshelf::Vagrant::EnvHelpers
7
-
8
- def initialize(app, env)
9
- @app = app
10
- end
11
-
12
- def call(env)
13
- unless berkshelf_enabled?(env)
14
- return @app.call(env)
15
- end
16
-
17
- shelf = load_shelf
18
-
19
- if shelf.nil?
20
- shelf = cache_shelf(Berkshelf::Vagrant.mkshelf)
21
- end
22
-
23
- env[:berkshelf].shelf = shelf
24
-
25
- @app.call(env)
26
- end
27
-
28
- # @param [String] path
29
- #
30
- # @return [String]
31
- def cache_shelf(path)
32
- FileUtils.mkdir_p(File.dirname(path))
33
-
34
- File.open(cache_file, 'w+') do |f|
35
- f.write(path)
36
- end
37
-
38
- path
39
- end
40
-
41
- # @return [String, nil]
42
- def load_shelf
43
- return nil unless File.exist?(cache_file)
44
-
45
- File.read(cache_file).chomp
46
- end
47
- end
48
- end
49
- end
50
- end
@@ -1,17 +0,0 @@
1
- module Berkshelf
2
- module Vagrant
3
- module Action
4
- # @author Jamie Winsor <reset@riotgames.com>
5
- class SetUI
6
- def initialize(app, env)
7
- @app = app
8
- end
9
-
10
- def call(env)
11
- Berkshelf.ui = env[:berkshelf].ui
12
- @app.call(env)
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,44 +0,0 @@
1
- module Berkshelf
2
- module Vagrant
3
- module Action
4
- # @author Jamie Winsor <reset@riotgames.com>
5
- class Upload
6
- include Berkshelf::Vagrant::EnvHelpers
7
-
8
- def initialize(app, env)
9
- @app = app
10
- end
11
-
12
- def call(env)
13
- unless berkshelf_enabled?(env)
14
- return @app.call(env)
15
- end
16
-
17
- if chef_client?(env)
18
- upload(env)
19
- end
20
-
21
- @app.call(env)
22
- rescue Berkshelf::BerkshelfError => e
23
- raise Berkshelf::VagrantWrapperError.new(e)
24
- end
25
-
26
- private
27
-
28
- def upload(env)
29
- provisioners(:chef_client, env).each do |provisioner|
30
- env[:berkshelf].ui.info "Uploading cookbooks to '#{provisioner.config.chef_server_url}'"
31
- env[:berkshelf].berksfile.upload(
32
- server_url: provisioner.config.chef_server_url,
33
- client_name: env[:berkshelf].config.chef.node_name,
34
- client_key: env[:berkshelf].config.chef.client_key,
35
- ssl: {
36
- verify: env[:berkshelf].config.ssl.verify
37
- }
38
- )
39
- end
40
- end
41
- end
42
- end
43
- end
44
- end
@@ -1,91 +0,0 @@
1
- module Berkshelf
2
- module Vagrant
3
- # @author Jamie Winsor <reset@riotgames.com>
4
- class Config < ::Vagrant.plugin("2", :config)
5
- # @return [String]
6
- # path to the Berksfile to use with Vagrant
7
- attr_reader :berksfile_path
8
-
9
- # @return [Boolean]
10
- # disable of use Berks in Vagrant
11
- attr_accessor :enabled
12
-
13
- # @return [Array<Symbol>]
14
- # only cookbooks in these groups will be installed and copied to
15
- # Vagrant's shelf
16
- attr_accessor :only
17
-
18
- # @return [Array<Symbol>]
19
- # cookbooks in all other groups except for these will be installed
20
- # and copied to Vagrant's shelf
21
- attr_accessor :except
22
-
23
- # @return [String]
24
- # the Chef node name (client name) to use to authenticate with the remote
25
- # chef server to upload cookbooks when using the chef client provisioner
26
- attr_accessor :node_name
27
-
28
- # @return [String]
29
- # a filepath to a chef client key to use to authenticate with the remote
30
- # chef server to upload cookbooks when using the chef client provisioner
31
- attr_accessor :client_key
32
-
33
- def initialize
34
- super
35
-
36
- @berksfile_path = File.join(Dir.pwd, Berkshelf::DEFAULT_FILENAME)
37
- @except = Array.new
38
- @only = Array.new
39
- @node_name = Berkshelf::Config.instance.chef.node_name
40
- @client_key = Berkshelf::Config.instance.chef.client_key
41
- @enabled = false
42
- end
43
-
44
- # @param [String] value
45
- def berksfile_path=(value)
46
- @berksfile_path = File.expand_path(value)
47
- end
48
-
49
- # @param [String] value
50
- def client_key=(value)
51
- @client_key = File.expand_path(value)
52
- end
53
-
54
- alias_method :to_hash, :instance_variables_hash
55
-
56
- def validate(machine)
57
- errors = Array.new
58
-
59
- unless [TrueClass, FalseClass].include?(enabled.class)
60
- errors << "A value for berkshelf.enabled can be true or false."
61
- end
62
-
63
- if enabled
64
- if machine.config.berkshelf.berksfile_path.nil?
65
- errors << "berkshelf.berksfile_path cannot be nil."
66
- end
67
-
68
- unless File.exist?(machine.config.berkshelf.berksfile_path)
69
- errors << "No Berskfile was found at #{machine.config.berkshelf.berksfile_path}."
70
- end
71
-
72
- if !except.empty? && !only.empty?
73
- errors << "A value for berkshelf.empty and berkshelf.only cannot both be defined."
74
- end
75
-
76
- if machine.env.config_global.vm.provisioners.any? { |prov| prov.name == :chef_client }
77
- if machine.config.berkshelf.node_name.nil?
78
- errors << "A configuration must be set for chef.node_name when using the chef_client provisioner. Run 'berks configure' or edit your configuration."
79
- end
80
-
81
- if machine.config.berkshelf.client_key.nil?
82
- errors << "A configuration must be set for chef.client_key when using the chef_client provisioner. Run 'berks configure' or edit your configuration."
83
- end
84
- end
85
- end
86
-
87
- { "berkshelf configuration" => errors }
88
- end
89
- end
90
- end
91
- end
@@ -1,26 +0,0 @@
1
- module Berkshelf
2
- module Vagrant
3
- # @author Jamie Winsor <reset@riotgames.com>
4
- #
5
- # Environment data to build up and persist through the middleware chain
6
- class Env
7
- # @return [Vagrant::UI::Colored]
8
- attr_accessor :ui
9
- # @return [Berkshelf::Berksfile]
10
- attr_accessor :berksfile
11
- # @return [String]
12
- attr_accessor :shelf
13
- # @return [Berkshelf::Config]
14
- attr_accessor :config
15
-
16
- def initialize
17
- if Gem::Version.new(::Vagrant::VERSION) >= Gem::Version.new("1.2")
18
- @ui = ::Vagrant::UI::Colored.new.scope('Berkshelf')
19
- else
20
- @ui = ::Vagrant::UI::Colored.new('Berkshelf')
21
- end
22
- @config = Berkshelf::Config.instance
23
- end
24
- end
25
- end
26
- end
@@ -1,55 +0,0 @@
1
- module Berkshelf
2
- module Vagrant
3
- # @author Jamie Winsor <reset@riotgames.com>
4
- #
5
- # A module of common helper functions that can be mixed into Berkshelf::Vagrant actions
6
- module EnvHelpers
7
- # A file to persist berkshelf-vagrant specific information in between
8
- # Vagrant runs.
9
- #
10
- # @return [String]
11
- def cache_file
12
- File.join('.vagrant', 'berkshelf')
13
- end
14
-
15
- # Filter all of the provisioners of the given vagrant environment with the given name
16
- #
17
- # @param [Symbol] name
18
- # name of provisioner to filter
19
- # @param [Vagrant::Environment, Hash] env
20
- # environment to inspect
21
- #
22
- # @return [Array]
23
- def provisioners(name, env)
24
- env[:machine].config.vm.provisioners.select { |prov| prov.name == name }
25
- end
26
-
27
- # Determine if the given vagrant environment contains a chef_solo provisioner
28
- #
29
- # @param [Vagrant::Environment] env
30
- #
31
- # @return [Boolean]
32
- def chef_solo?(env)
33
- provisioners(:chef_solo, env).any?
34
- end
35
-
36
- # Determine if the given vagrant environment contains a chef_client provisioner
37
- #
38
- # @param [Vagrant::Environment] env
39
- #
40
- # @return [Boolean]
41
- def chef_client?(env)
42
- provisioners(:chef_client, env).any?
43
- end
44
-
45
- # Determine if the Berkshelf plugin should be run for the given environment
46
- #
47
- # @param [Vagrant::Environment] env
48
- #
49
- # @return [Boolean]
50
- def berkshelf_enabled?(env)
51
- env[:global_config].berkshelf.enabled
52
- end
53
- end
54
- end
55
- end
@@ -1,33 +0,0 @@
1
- require 'vagrant/errors'
2
-
3
- module Berkshelf
4
- # @author Jamie Winsor <reset@riotgames.com>
5
- #
6
- # A wrapper for a BerkshelfError for Vagrant. All Berkshelf exceptions should be
7
- # wrapped in this proxy object so they are properly handled when Vagrant encounters
8
- # an exception.
9
- #
10
- # @example wrapping an error encountered within the Vagrant plugin
11
- # rescue BerkshelfError => e
12
- # VagrantWrapperError.new(e)
13
- # end
14
- class VagrantWrapperError < ::Vagrant::Errors::VagrantError
15
- # @param [BerkshelfError]
16
- attr_reader :original
17
-
18
- # @param [BerkshelfError] original
19
- def initialize(original)
20
- @original = original
21
- end
22
-
23
- def to_s
24
- "#{original.class}: #{original.to_s}"
25
- end
26
-
27
- private
28
-
29
- def method_missing(fun, *args, &block)
30
- original.send(fun, *args, &block)
31
- end
32
- end
33
- end
@@ -1,34 +0,0 @@
1
- module Berkshelf
2
- module Vagrant
3
- # @author Jamie Winsor <reset@riotgames.com>
4
- class Plugin < ::Vagrant.plugin("2")
5
- class << self
6
- def provision(hook)
7
- hook.after(::Vagrant::Action::Builtin::Provision, Berkshelf::Vagrant::Action.upload)
8
- hook.after(::Vagrant::Action::Builtin::Provision, Berkshelf::Vagrant::Action.install)
9
- hook.before(::Vagrant::Action::Builtin::ConfigValidate, Berkshelf::Vagrant::Action.setup)
10
- end
11
- end
12
-
13
- name "berkshelf"
14
- description <<-DESC
15
- Automatically make available cookbooks to virtual machines provisioned by Chef Solo
16
- or Chef Client using Berkshelf.
17
- DESC
18
-
19
- action_hook(:berkshelf_provision, :machine_action_up, &method(:provision))
20
- action_hook(:berkshelf_provision, :machine_action_provision, &method(:provision))
21
-
22
- action_hook(:berkshelf_cleanup, :machine_action_destroy) do |hook|
23
- # @todo this should be appended to the middleware stack instead of hooked in after the
24
- # Virtualbox specific destroy step but there is a bug in Vagrant (1.1.0) which
25
- # causes appended middleware to run multiple times.
26
- hook.after(VagrantPlugins::ProviderVirtualBox::Action::DestroyUnusedNetworkInterfaces, Berkshelf::Vagrant::Action.clean)
27
- end
28
-
29
- config(:berkshelf) do
30
- Berkshelf::Vagrant::Config
31
- end
32
- end
33
- end
34
- end
@@ -1,5 +0,0 @@
1
- module Berkshelf
2
- module Vagrant
3
- VERSION = "1.1.2"
4
- end
5
- end
@@ -1,22 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
- require 'spork'
4
-
5
- Spork.prefork do
6
- APP_ROOT = File.expand_path('../../', __FILE__)
7
- ENV["BERKSHELF_PATH"] = File.join(APP_ROOT, 'spec', 'tmp', 'berkshelf')
8
-
9
- require 'rspec'
10
-
11
- RSpec.configure do |config|
12
- config.treat_symbols_as_metadata_keys_with_true_values = true
13
- config.run_all_when_everything_filtered = true
14
- config.filter_run focus: true
15
-
16
- config.order = 'random'
17
- end
18
- end
19
-
20
- Spork.each_run do
21
- require 'berkshelf/vagrant'
22
- end
@@ -1,81 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Berkshelf::Vagrant::Config do
4
- let(:unset_value) { described_class::UNSET_VALUE }
5
- let(:config) { described_class.new }
6
-
7
- it "sets a path to a Berksfile in the current working directory for berksfile_path" do
8
- subject.berksfile_path.should eql(File.join(Dir.pwd, "Berksfile"))
9
- end
10
-
11
- it "set the value of disabled to a false" do
12
- config.enabled.should be false
13
- end
14
-
15
- it "sets the value of only to an empty array" do
16
- subject.only.should be_a(Array)
17
- subject.only.should be_empty
18
- end
19
-
20
- it "sets the value of except to an empty array" do
21
- subject.except.should be_a(Array)
22
- subject.except.should be_empty
23
- end
24
-
25
- it "sets the value of node_name to the value in the Berkshelf::Config.instance" do
26
- subject.node_name.should eql(Berkshelf::Config.instance.chef.node_name)
27
- end
28
-
29
- it "sets the value of client_key to the value in Berkshelf::Config.instance" do
30
- subject.client_key.should eql(Berkshelf::Config.instance.chef.client_key)
31
- end
32
-
33
- describe "#validate" do
34
- let(:env) { double('env') }
35
- let(:config) { double('config', berkshelf: subject) }
36
- let(:machine) { double('machine', config: config, env: env) }
37
-
38
- before do
39
- subject.finalize!
40
- end
41
-
42
- context "when the plugin is enabled" do
43
- before(:each) do
44
- subject.stub(enabled: true)
45
- env.stub_chain(:config_global, :vm, :provisioners, :any?)
46
- end
47
-
48
- let(:result) { subject.validate(machine) }
49
-
50
- it "returns a Hash with a 'berkshelf configuration' key" do
51
- result.should be_a(Hash)
52
- result.should have_key("berkshelf configuration")
53
- end
54
-
55
- context "when all validations pass" do
56
- before(:each) do
57
- File.should_receive(:exist?).with(subject.berksfile_path).and_return(true)
58
- end
59
-
60
- it "contains an empty Array for the 'berkshelf configuration' key" do
61
- result["berkshelf configuration"].should be_a(Array)
62
- result["berkshelf configuration"].should be_empty
63
- end
64
- end
65
- end
66
-
67
- context "when the plugin is disabled" do
68
- let(:machine) { double('machine') }
69
-
70
- before do
71
- subject.stub(enabled: false)
72
- end
73
-
74
- it "does not perform any validations" do
75
- machine.should_not_receive(:config)
76
-
77
- subject.validate(machine)
78
- end
79
- end
80
- end
81
- end
@@ -1,12 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Berkshelf::VagrantWrapperError do
4
- subject { described_class }
5
-
6
- it "proxies messages to the original exception" do
7
- original = double('original_error')
8
- original.should_receive(:a_message)
9
-
10
- subject.new(original).a_message
11
- end
12
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Berkshelf::Vagrant do
4
- describe "ClassMethods" do
5
- describe "::shelf_path" do
6
- it "returns a String" do
7
- subject.shelf_path.should be_a(String)
8
- end
9
-
10
- it "is a pathname including the berkshelf_path" do
11
- subject.shelf_path.should include(Berkshelf.berkshelf_path)
12
- end
13
- end
14
-
15
- describe "::mkshelf" do
16
- it "returns a String" do
17
- subject.mkshelf.should be_a(String)
18
- end
19
-
20
- it "is a pathname including the shelf_path" do
21
- subject.mkshelf.should include(subject.shelf_path)
22
- end
23
- end
24
- end
25
- end