clc-promote 0.4.0.dev.9 → 0.4.0.dev.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2934a8168bb2623f8e419c319e74f3245c987cbe
4
- data.tar.gz: a9558f2c9e9edcc6a6a9ecf4b87f26ea4155fd47
3
+ metadata.gz: 7b8ab84ce0ba21d1a3b3f18d6b02abe59efa5a00
4
+ data.tar.gz: ee739681a924fe27a52e22f1a667614e51d4bc89
5
5
  SHA512:
6
- metadata.gz: e35fb4338176e5b364fd38c414096412e914dcc4dd3a6c5077bd080400184fe541e1ea3e6b50d847de5fc84555bb1c01e37f629441f271654143ebee03b9dca2
7
- data.tar.gz: ef0fe1e55d1ab7ec15b2fc7d75bfc0be0b645d1d1de87f249b1e766dfdc5154daa0ffcd71b760a1c8b9c700e2aad41eb9db0fdf7c0f0d65f6b95f51240582585
6
+ metadata.gz: 5b3a3be74b3fd8de3a9a45a8232422bbe1ef07a5dd744d869541c21405e577d283591971640152dc9d4b9b0c86f849a6b3da9396b3c7da234d5942da4c587a45
7
+ data.tar.gz: 6949e045d8623ea3266ca41a15ef85c5cc86021a2c08788aaec610acbf27552a455f1dd6be572fbc94e646fb3cef8cae41c647fd7e620383c6466e4852904994
@@ -19,6 +19,7 @@ module Promote
19
19
  define_sync_berksfile
20
20
  define_sync_berksfiles
21
21
  define_upload_cookbooks
22
+ define_upload_cookbook
22
23
  define_upload_environment
23
24
  define_upload_data_bags
24
25
  define_constrain_environment
@@ -122,6 +123,16 @@ module Promote
122
123
  end
123
124
  end
124
125
 
126
+ def define_upload_cookbook
127
+ namespace "Promote" do
128
+ desc "Upload a cookbooks and its dependencies to the chef server"
129
+ task "upload_cookbook", :cookbook do |task, args|
130
+ puts "Uploading cookbook #{args.cookbook}..."
131
+ @uploader.upload_cookbook(args.cookbook)
132
+ end
133
+ end
134
+ end
135
+
125
136
  def define_upload_environment
126
137
  namespace "Promote" do
127
138
  desc "Upload an environment to the chef server"
@@ -22,7 +22,26 @@ module Promote
22
22
  Chef::Config[:chef_repo_path] = config.repo_root
23
23
  end
24
24
 
25
+ def upload_cookbook(cookbook_name)
26
+ vendor_path='/tmp/promote_vendor'
27
+ FileUtils.rm_rf(vendor_path) if Dir.exist?(vendor_path)
28
+
29
+ berksfile_path = File.join(config.cookbook_directory, cookbook_name, "Berksfile")
30
+ Berkshelf.set_format :null
31
+ berksfile = Berkshelf::Berksfile.from_file(berksfile_path)
32
+ berksfile.vendor(vendor_path)
33
+
34
+ upload_filtered_cookbooks([vendor_path])
35
+ end
36
+
25
37
  def upload_cookbooks(environment = nil)
38
+ dirs = (Dir.glob(File.expand_path("~/.berkshelf/cookbooks/*")) <<
39
+ Dir.glob(File.join(config.cookbook_directory, "*"))).flatten!
40
+
41
+ upload_filtered_cookbooks(dirs, environment)
42
+ end
43
+
44
+ def upload_filtered_cookbooks(dirs, environment = nil)
26
45
  anything_to_upload = false
27
46
 
28
47
  server_cookbooks = Utils.chef_server_cookbooks(config)
@@ -35,8 +54,7 @@ module Promote
35
54
  FileUtils.rm_rf(config.temp_directory) if Dir.exist?(config.temp_directory)
36
55
  Dir.mkdir(config.temp_directory)
37
56
 
38
- (Dir.glob(File.expand_path("~/.berkshelf/cookbooks/*")) <<
39
- Dir.glob(File.join(config.cookbook_directory, "*"))).flatten!.each do | dir |
57
+ dirs.each do | dir |
40
58
  anything_to_upload = cookbooks_copied?(dir, server_cookbooks, env_versions) || anything_to_upload
41
59
  end
42
60
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clc-promote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.dev.9
4
+ version: 0.4.0.dev.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - CenturyLink Cloud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-02 00:00:00.000000000 Z
11
+ date: 2014-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef