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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d61b7e32270a0eda1b0651596eb6579606a3123a
4
- data.tar.gz: 58444b14e50383fae206da3d2be4f2672b375f13
3
+ metadata.gz: be0a71a3fcad72dd64f5a17a5697ac0f9e2ad9d3
4
+ data.tar.gz: 21f7a69d62f5a17ac227d84a780eb926acfa7bcb
5
5
  SHA512:
6
- metadata.gz: b1dfd786d11154b5841bfdb05f2b0f90beec3948cd6a889832bdec27dc17f46f231a3f8773348688946beeb427018b14f01987b55b964bc73d6a9b4484dd85b1
7
- data.tar.gz: 3971dcc9f4f24fe6dbb3e05b97901f934ecbdd5d7d6b52e835860f1f0a9225c394920c5c3d87aeaa6d4f74e3f9418b0cacf2ce01912c4ab8705c671e4d7037d9
6
+ metadata.gz: a0223ecfd085ddfc069f88dfb3e8655a386866b0a108b1c122db9c9698e0620027ab6b49b35eb7bee5abf27716153297b4e4480a4145ce148758d56ce64e5300
7
+ data.tar.gz: f2b82702ca79dc2f05b34b51520b64991e7f706c12c17b4db1476c9fd118031083f6943437760c30d6983cfc2593f17aba48a5bda40f914224942d8d263aa7a5
@@ -32,10 +32,8 @@ module Promote
32
32
  namespace "Promote" do
33
33
  desc "Version all cookbooks"
34
34
  task "version_cookbooks" do
35
- Dir.glob(File.join(@versioner.cookbook_directory, "*")) do |file|
36
- cookbook = File.basename(file)
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
- Dir.glob(File.join(@versioner.environment_directory, "*.json")) do |file|
58
- environment = File.basename(file ,File.extname(file))
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
- Dir.glob(File.join(@versioner.data_bag_directory, "*.json")) do |file|
80
- data_bag = File.basename(file, File.extname(file))
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
@@ -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
- berksfile = Berkshelf::Berksfile.from_file(File.join(dir, "Berksfile"))
35
- berksfile.install
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.2
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-13 00:00:00.000000000 Z
11
+ date: 2014-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: knife-spork