clc-promote 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/promote/uploader.rb +12 -17
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 602f553a778d7101ac52edf230810a29cf238235
|
4
|
+
data.tar.gz: 99b38236925df3acc02278aeb5ca17f4b958e55e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2502cd2f02475e4db17af01f4ce40a52b00235424e543ffeaaaac815fd5fe3072b5ffaea9bed3dd8ca034073e41e10a8acfcf4ecd28f27398513b76dc9c5320a
|
7
|
+
data.tar.gz: f52ef0d6e040118f95e4a8025d61af02c0df6320058173516ce7d56d2807ebf93d1fd5d57cb5bdac61df001d05139235b93f1a70f4da8b87a9a295e3a533d483
|
data/lib/promote/uploader.rb
CHANGED
@@ -24,23 +24,16 @@ module Promote
|
|
24
24
|
|
25
25
|
def upload_cookbooks(environment)
|
26
26
|
anything_to_upload = false
|
27
|
+
|
27
28
|
server_cookbooks = Utils.chef_server_cookbooks(config)
|
29
|
+
env_versions = EnvironmentFile.new(environment, config).cookbook_versions
|
30
|
+
|
28
31
|
FileUtils.rm_rf(config.temp_directory) if Dir.exist?(config.temp_directory)
|
29
32
|
Dir.mkdir(config.temp_directory)
|
30
33
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
idx = cp_name.rindex('-')
|
35
|
-
cb_name = cp_name[0,idx]
|
36
|
-
cb_version = cp_name[idx+1,cp_name.length-idx]
|
37
|
-
anything_to_upload = cookbooks_copied?(cb_name, cb_version, dir, server_cookbooks, env_versions)
|
38
|
-
end
|
39
|
-
|
40
|
-
Dir.glob(File.join(config.cookbook_directory, "*")).each do | dir |
|
41
|
-
metadata = Chef::Cookbook::Metadata.new
|
42
|
-
metadata.from_file(File.join(dir, "metadata.rb"))
|
43
|
-
anything_to_upload = cookbooks_copied?(metadata.name, metadata.version, dir, server_cookbooks, env_versions) || anything_to_upload
|
34
|
+
(Dir.glob(File.expand_path("~/.berkshelf/cookbooks/*")) <<
|
35
|
+
Dir.glob(File.join(config.cookbook_directory, "*"))).flatten!.each do | dir |
|
36
|
+
anything_to_upload = cookbooks_copied?(dir, server_cookbooks, env_versions) || anything_to_upload
|
44
37
|
end
|
45
38
|
|
46
39
|
if anything_to_upload
|
@@ -71,10 +64,12 @@ module Promote
|
|
71
64
|
private
|
72
65
|
|
73
66
|
#only include versions in environment but exclude whats on the server
|
74
|
-
def cookbooks_copied?(
|
75
|
-
|
76
|
-
|
77
|
-
|
67
|
+
def cookbooks_copied?(dir, server_cookbooks, environment_cookbooks)
|
68
|
+
metadata = Chef::Cookbook::Metadata.new
|
69
|
+
metadata.from_file(File.join(dir, "metadata.rb"))
|
70
|
+
if !server_cookbooks.has_key?(metadata.name) || (server_cookbooks[metadata.name]["versions"].select {|v| v['version'] == metadata.version}).empty?
|
71
|
+
if environment_cookbooks.has_key?(metadata.name) && environment_cookbooks[metadata.name] == metadata.version
|
72
|
+
FileUtils.copy_entry(dir, File.join(config.temp_directory, metadata.name))
|
78
73
|
true
|
79
74
|
end
|
80
75
|
end
|