clc-promote 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/promote/rake_tasks.rb +6 -12
- data/lib/promote/versioner.rb +45 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be0a71a3fcad72dd64f5a17a5697ac0f9e2ad9d3
|
4
|
+
data.tar.gz: 21f7a69d62f5a17ac227d84a780eb926acfa7bcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0223ecfd085ddfc069f88dfb3e8655a386866b0a108b1c122db9c9698e0620027ab6b49b35eb7bee5abf27716153297b4e4480a4145ce148758d56ce64e5300
|
7
|
+
data.tar.gz: f2b82702ca79dc2f05b34b51520b64991e7f706c12c17b4db1476c9fd118031083f6943437760c30d6983cfc2593f17aba48a5bda40f914224942d8d263aa7a5
|
data/lib/promote/rake_tasks.rb
CHANGED
@@ -32,10 +32,8 @@ module Promote
|
|
32
32
|
namespace "Promote" do
|
33
33
|
desc "Version all cookbooks"
|
34
34
|
task "version_cookbooks" do
|
35
|
-
|
36
|
-
cookbook
|
37
|
-
puts "versioning cookbook #{cookbook}"
|
38
|
-
@versioner.version_cookbook(cookbook)
|
35
|
+
@versioner.version_cookbooks.each do |result|
|
36
|
+
puts "Versioned cookbook: #{result[:cookbook]} v#{result[:version]}"
|
39
37
|
end
|
40
38
|
end
|
41
39
|
end
|
@@ -54,10 +52,8 @@ module Promote
|
|
54
52
|
namespace "Promote" do
|
55
53
|
desc "Version all environments"
|
56
54
|
task "version_environments" do
|
57
|
-
|
58
|
-
environment
|
59
|
-
puts "versioning environment #{environment}"
|
60
|
-
@versioner.version_environment(environment)
|
55
|
+
@versioner.version_environments.each do |result|
|
56
|
+
puts "Versioned environment: #{result[:artifact]} v#{result[:version]}"
|
61
57
|
end
|
62
58
|
end
|
63
59
|
end
|
@@ -76,10 +72,8 @@ module Promote
|
|
76
72
|
namespace "Promote" do
|
77
73
|
desc "Version all data_bags"
|
78
74
|
task "version_data_bags" do
|
79
|
-
|
80
|
-
data_bag
|
81
|
-
puts "versioning data_bag #{data_bag}"
|
82
|
-
@versioner.version_data_bag(data_bag)
|
75
|
+
@versioner.version_data_bags.each do |result|
|
76
|
+
puts "Versioned data_bag: #{result[:artifact]} v#{result[:version]}"
|
83
77
|
end
|
84
78
|
end
|
85
79
|
end
|
data/lib/promote/versioner.rb
CHANGED
@@ -30,22 +30,64 @@ module Promote
|
|
30
30
|
File.open(metadata_file, 'w') do |out|
|
31
31
|
out << outdata
|
32
32
|
end
|
33
|
+
return { :cookbook => cookbook_name, :version => version, :sha1 => sha1}
|
34
|
+
end
|
35
|
+
end
|
33
36
|
|
34
|
-
|
35
|
-
|
37
|
+
def version_cookbooks
|
38
|
+
cookbooks = Dir.glob(File.join(cookbook_directory, "*"))
|
39
|
+
results = []
|
40
|
+
cookbooks.each do |file|
|
41
|
+
cookbook = File.basename(file)
|
42
|
+
result = version_cookbook(cookbook)
|
43
|
+
if !result.nil?
|
44
|
+
results << result
|
45
|
+
end
|
36
46
|
end
|
47
|
+
cookbooks.each do |cookbook|
|
48
|
+
berks_name = File.join(cookbook_directory, File.basename(cookbook), "Berksfile")
|
49
|
+
if File.exist?(berks_name)
|
50
|
+
berksfile = Berkshelf::Berksfile.from_file(berks_name)
|
51
|
+
berksfile.install
|
52
|
+
end
|
53
|
+
end
|
54
|
+
results
|
37
55
|
end
|
38
56
|
|
39
57
|
def version_data_bag(data_bag_name)
|
40
58
|
version_json data_bag_directory, data_bag_name
|
41
59
|
end
|
42
60
|
|
61
|
+
def version_data_bags
|
62
|
+
results = []
|
63
|
+
Dir.glob(File.join(data_bag_directory, "**", "*.json")).each do |file|
|
64
|
+
data_bag = File.basename(file, File.extname(file))
|
65
|
+
result = version_data_bag(data_bag)
|
66
|
+
if !result.nil?
|
67
|
+
results << result
|
68
|
+
end
|
69
|
+
end
|
70
|
+
results
|
71
|
+
end
|
72
|
+
|
43
73
|
def version_environment(environment_name)
|
44
74
|
version_json environment_directory, environment_name do | content |
|
45
75
|
content['override_attributes']
|
46
76
|
end
|
47
77
|
end
|
48
78
|
|
79
|
+
def version_environments
|
80
|
+
results = []
|
81
|
+
Dir.glob(File.join(environment_directory, "*.json")).each do |file|
|
82
|
+
environment = File.basename(file ,File.extname(file))
|
83
|
+
result = version_environment(environment)
|
84
|
+
if !result.nil?
|
85
|
+
results << result
|
86
|
+
end
|
87
|
+
end
|
88
|
+
results
|
89
|
+
end
|
90
|
+
|
49
91
|
def cookbook_directory
|
50
92
|
File.join(@repo_root, "cookbooks")
|
51
93
|
end
|
@@ -83,6 +125,7 @@ module Promote
|
|
83
125
|
File.open(file, 'w') do |out|
|
84
126
|
out << JSON.pretty_generate(content)
|
85
127
|
end
|
128
|
+
{ :artifact => file_name, :version => version, :sha1 => sha1}
|
86
129
|
end
|
87
130
|
end
|
88
131
|
|
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.1.
|
4
|
+
version: 0.1.3
|
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-09-
|
11
|
+
date: 2014-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: knife-spork
|