kitchen-environment 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bac8de38904840e06b96d8e1bf8af5a551b359d3
4
+ data.tar.gz: 5500ca6d40f88c400748944ce9d6df125f15db01
5
+ SHA512:
6
+ metadata.gz: 91f58cf010860f2e1c97ef08579735279e75d3b41a998d681e3500502d0ab776d30569a657f7827fdd7fe7573f8815584aa2de6ca5380b186c56f33b50561227
7
+ data.tar.gz: 4e247c03ae30db68a16aa648825a3d8340e07ee344e73bffb281c5a833552fc87e4558fa1a110e6350dbeed77e85d1210450917694d5244e41cf87cf74042df8
@@ -0,0 +1,48 @@
1
+ require "kitchen/provisioner/chef_zero"
2
+
3
+ module Kitchen
4
+
5
+ module Provisioner
6
+
7
+ class Environment < ChefZero
8
+
9
+ def create_sandbox
10
+ super
11
+ prepare_environment_dependencies
12
+ end
13
+
14
+ private
15
+
16
+ def prepare_environment_dependencies
17
+ if !config.has_key?(:environment_cookbook)
18
+ raise "You need to provide a environment_cookbook config setting with the name of the environment cookbook"
19
+ end
20
+
21
+ tmp_env = "TMP_ENV"
22
+ path = File.join(tmpbooks_dir, tmp_env)
23
+ env_berksfile = File.expand_path(
24
+ "../#{config[:environment_cookbook]}/Berksfile",
25
+ config[:kitchen_root])
26
+
27
+ info("Vendoring environment cookbook")
28
+ ::Berkshelf.set_format :null
29
+ ::Berkshelf::Berksfile.from_file(env_berksfile).vendor(path)
30
+
31
+ Dir.glob(File.join(tmpbooks_dir, "*")).each do | dir |
32
+ cookbook = File.basename(dir)
33
+ if cookbook != tmp_env
34
+ comm_cookbook = File.join(path, cookbook)
35
+ debug("copying #{comm_cookbook} to #{dir}")
36
+ FileUtils.copy_entry(comm_cookbook, dir)
37
+ end
38
+ end
39
+ FileUtils.rm_rf(path)
40
+ end
41
+
42
+ def tmpbooks_dir
43
+ File.join(sandbox_path, "cookbooks")
44
+ end
45
+
46
+ end
47
+ end
48
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kitchen-environment
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - CenturyLink Cloud
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: berkshelf
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 3.1.4
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '3.1'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 3.1.4
33
+ - !ruby/object:Gem::Dependency
34
+ name: rspec
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.0'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 3.0.0
43
+ type: :development
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '3.0'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 3.0.0
53
+ - !ruby/object:Gem::Dependency
54
+ name: rake
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '10.3'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 10.3.2
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '10.3'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 10.3.2
73
+ description:
74
+ email: matt.wrock@CenturyLinkCloud.com
75
+ executables: []
76
+ extensions: []
77
+ extra_rdoc_files: []
78
+ files:
79
+ - lib/kitchen/provisioner/environment.rb
80
+ homepage: https://github.com/tier3/DevOps/gems/kitchen-environment
81
+ licenses: []
82
+ metadata: {}
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.2.1
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: Adds all cookbook dependencies of an environment cookbook.
103
+ test_files: []
104
+ has_rdoc: