berkshelf 0.5.0 → 0.5.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.
data/lib/berkshelf/berksfile.rb
CHANGED
|
@@ -32,7 +32,9 @@ module Berkshelf
|
|
|
32
32
|
|
|
33
33
|
scratch = Berkshelf.mktmpdir
|
|
34
34
|
cookbooks.each do |cb|
|
|
35
|
-
|
|
35
|
+
dest = File.join(scratch, cb.cookbook_name, "/")
|
|
36
|
+
FileUtils.mkdir_p(dest)
|
|
37
|
+
FileUtils.cp_r(Dir.glob(File.join(cb.path, "*")), dest)
|
|
36
38
|
end
|
|
37
39
|
|
|
38
40
|
FileUtils.remove_dir(path, force: true)
|
data/lib/berkshelf/vagrant.rb
CHANGED
|
@@ -18,12 +18,12 @@ module Berkshelf
|
|
|
18
18
|
|
|
19
19
|
class << self
|
|
20
20
|
# @param [Vagrant::Action::Environment] env
|
|
21
|
+
#
|
|
22
|
+
# @return [String, nil]
|
|
21
23
|
def shelf_for(env)
|
|
22
|
-
|
|
23
|
-
return nil
|
|
24
|
-
end
|
|
24
|
+
return nil if env[:vm].uuid.nil?
|
|
25
25
|
|
|
26
|
-
File.join(Berkshelf.berkshelf_path, "vagrant", env[:
|
|
26
|
+
File.join(Berkshelf.berkshelf_path, "vagrant", env[:vm].uuid)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
# @param [Symbol] shortcut
|
|
@@ -64,7 +64,7 @@ module Berkshelf
|
|
|
64
64
|
::Vagrant.actions[action].insert(::Vagrant::Action::VM::Provision, Berkshelf::Vagrant::Middleware.upload)
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
-
::Vagrant.actions[:destroy].insert(::Vagrant::Action::VM::
|
|
67
|
+
::Vagrant.actions[:destroy].insert(::Vagrant::Action::VM::ProvisionerCleanup, Berkshelf::Vagrant::Middleware.clean)
|
|
68
68
|
end
|
|
69
69
|
end
|
|
70
70
|
end
|
|
@@ -11,7 +11,7 @@ module Berkshelf
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def call(env)
|
|
14
|
-
if Berkshelf::Vagrant.chef_solo?(env[:
|
|
14
|
+
if Berkshelf::Vagrant.chef_solo?(env[:vm].config) && self.shelf
|
|
15
15
|
Berkshelf.formatter.msg "cleaning Vagrant's shelf"
|
|
16
16
|
FileUtils.remove_dir(self.shelf, fore: true)
|
|
17
17
|
end
|
|
@@ -11,14 +11,14 @@ module Berkshelf
|
|
|
11
11
|
def initialize(app, env)
|
|
12
12
|
@app = app
|
|
13
13
|
@shelf = Berkshelf::Vagrant.shelf_for(env)
|
|
14
|
-
@config = env[:
|
|
14
|
+
@config = env[:vm].config.berkshelf
|
|
15
15
|
Berkshelf.config_path = @config.config_path
|
|
16
16
|
Berkshelf.load_config
|
|
17
17
|
@berksfile = Berksfile.from_file(@config.berksfile_path)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def call(env)
|
|
21
|
-
if Berkshelf::Vagrant.chef_solo?(env[:
|
|
21
|
+
if Berkshelf::Vagrant.chef_solo?(env[:vm].config)
|
|
22
22
|
configure_cookbooks_path(env)
|
|
23
23
|
install(env)
|
|
24
24
|
end
|
|
@@ -37,7 +37,7 @@ module Berkshelf
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def configure_cookbooks_path(env)
|
|
40
|
-
Berkshelf::Vagrant.provisioners(:chef_solo, env[:
|
|
40
|
+
Berkshelf::Vagrant.provisioners(:chef_solo, env[:vm].config).each do |provisioner|
|
|
41
41
|
provisioner.config.cookbooks_path.unshift(self.shelf)
|
|
42
42
|
end
|
|
43
43
|
end
|
|
@@ -10,14 +10,14 @@ module Berkshelf
|
|
|
10
10
|
|
|
11
11
|
def initialize(app, env)
|
|
12
12
|
@app = app
|
|
13
|
-
@node_name = env[:
|
|
14
|
-
@client_key = env[:
|
|
15
|
-
@ssl_verify = env[:
|
|
16
|
-
@berksfile = Berksfile.from_file(env[:
|
|
13
|
+
@node_name = env[:vm].config.berkshelf.node_name
|
|
14
|
+
@client_key = env[:vm].config.berkshelf.client_key
|
|
15
|
+
@ssl_verify = env[:vm].config.berkshelf.ssl_verify
|
|
16
|
+
@berksfile = Berksfile.from_file(env[:vm].config.berkshelf.berksfile_path)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def call(env)
|
|
20
|
-
if Berkshelf::Vagrant.chef_client?(env[:
|
|
20
|
+
if Berkshelf::Vagrant.chef_client?(env[:vm].config)
|
|
21
21
|
upload(env)
|
|
22
22
|
end
|
|
23
23
|
|
|
@@ -27,7 +27,7 @@ module Berkshelf
|
|
|
27
27
|
private
|
|
28
28
|
|
|
29
29
|
def upload(env)
|
|
30
|
-
Berkshelf::Vagrant.provisioners(:chef_client, env[:
|
|
30
|
+
Berkshelf::Vagrant.provisioners(:chef_client, env[:vm].config).each do |provisioner|
|
|
31
31
|
Berkshelf.formatter.msg "uploading cookbooks to '#{provisioner.config.chef_server_url}'"
|
|
32
32
|
berksfile.upload(
|
|
33
33
|
server_url: provisioner.config.chef_server_url,
|
data/lib/berkshelf/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: berkshelf
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -12,7 +12,7 @@ authors:
|
|
|
12
12
|
autorequire:
|
|
13
13
|
bindir: bin
|
|
14
14
|
cert_chain: []
|
|
15
|
-
date: 2012-09-
|
|
15
|
+
date: 2012-09-28 00:00:00.000000000 Z
|
|
16
16
|
dependencies:
|
|
17
17
|
- !ruby/object:Gem::Dependency
|
|
18
18
|
name: ridley
|
|
@@ -591,7 +591,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
591
591
|
version: '0'
|
|
592
592
|
segments:
|
|
593
593
|
- 0
|
|
594
|
-
hash:
|
|
594
|
+
hash: -3087057702069049964
|
|
595
595
|
requirements: []
|
|
596
596
|
rubyforge_project:
|
|
597
597
|
rubygems_version: 1.8.23
|