clc-promote 0.3.15 → 0.3.16

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: 0a793b7138b94ab2d704cd1f2137b620e93aee42
4
- data.tar.gz: 7279804825c4e04c9eabccaebe70546ecb6ad6e3
3
+ metadata.gz: 9154527d572479db900219e14b964145fd8ca281
4
+ data.tar.gz: 81e513887c826b6fdd14b03b1df886282e7e0ab3
5
5
  SHA512:
6
- metadata.gz: 5ad19f5b5798327867db5586b6ec9c134e49c9abfc92e5faa4fe540017de2b0be57b25cca3026dd83d449d1477fc03a8e37806ab2ab50f5e8a47edd3f29b1742
7
- data.tar.gz: fdc0ffa1660e9cc119bdf6966fb7c8b40f822e33cb97708fb7f196a6dfa9f7f235a3d9caab0832fcc5ab3f258a8bbc652816cbceeb9e7e2ff21cb9f84956445d
6
+ metadata.gz: 68513c9814d177a27e9aa98ae265c1aa12ecc9b289226225295625cc992487f07cf1d1407418e153058ab8f0d8496b3c0d1557dd135c66c0ef1a7e466c6fe67f
7
+ data.tar.gz: 7156ac310dc558ac99e084ffe2cd94ac08a9e893d5414feb05f9e488082b95eb9dc6e0327f3b5b4400df47b725c3a34b357c8e4655224c9995a92df87cfb6614
data/README.md CHANGED
@@ -36,7 +36,7 @@ Promote::RakeTasks.new(config)
36
36
  ```
37
37
 
38
38
  The `Config` class can receive the following settings:
39
- Setting |
39
+ Setting |
40
40
  :repo_root | **mandatory**
41
41
  :cookbook_directory | Defaults to `#{root}/cookbooks`
42
42
  :environment_directory | Defaults to `#{root}/environments`
@@ -51,7 +51,7 @@ Setting |
51
51
  **Note:** See the [below section on versioning](/gems/clc-promote#How are version numbers generated) for details on how versin numbers are generated.
52
52
 
53
53
  ### Promote:version_cookbook
54
- Bumps the version of an individual cookbook.
54
+ Bumps the version of an individual cookbook.
55
55
 
56
56
  ### Promote:version_cookbooks
57
57
  Same as `Promote:version_cookbook` but iterates all cookbooks.
@@ -64,9 +64,11 @@ Same as `Promote:version_environment` but iterates all environment files.
64
64
 
65
65
  ### Promote:version_data_bag
66
66
  Bumps the version of an individual databag entry.
67
+ DEPRECATED (breaks encrypted data bags and vaults).
67
68
 
68
69
  ### Promote:version_data_bags
69
70
  Bumps the versions of all databag entries.
71
+ DEPRECATED (breaks encrypted data bags and vaults).
70
72
 
71
73
  ### Promote:sync_berksfiles
72
74
  Performs a berks install on all cookbooks in the chef repo.
@@ -16,8 +16,6 @@ module Promote
16
16
  define_version_cookbooks
17
17
  define_version_environment
18
18
  define_version_environments
19
- define_version_data_bag
20
- define_version_data_bags
21
19
  define_sync_berksfiles
22
20
  define_upload_cookbooks
23
21
  define_upload_environment
@@ -103,27 +101,6 @@ module Promote
103
101
  end
104
102
  end
105
103
 
106
- def define_version_data_bag
107
- namespace "Promote" do
108
- desc "Version a data_bag"
109
- task "version_data_bag", :data_bag do |task, args|
110
- @versioner.version_data_bag(args.data_bag)
111
- end
112
- end
113
- end
114
-
115
- def define_version_data_bags
116
- namespace "Promote" do
117
- desc "Version all data_bags"
118
- task "version_data_bags" do
119
- puts "Version stamping changed data_bags..."
120
- @versioner.version_data_bags.each do |result|
121
- puts "Versioned data_bag: #{result[:artifact]} v#{result[:version]}"
122
- end
123
- end
124
- end
125
- end
126
-
127
104
  def define_upload_cookbooks
128
105
  namespace "Promote" do
129
106
  desc "Upload all cookbooks in an environment to the chef server"
@@ -144,15 +121,15 @@ module Promote
144
121
  end
145
122
  end
146
123
 
147
- def define_upload_data_bags
148
- namespace "Promote" do
149
- desc "Upload data_bags to the chef server"
150
- task "upload_data_bags" do
151
- file_uploaded = @uploader.upload_data_bags
152
- puts "Uploading #{file_uploaded} to #{@uploader.config.chef_server_url} as #{@uploader.config.node_name} using #{@uploader.config.client_key}"
153
- end
154
- end
155
- end
124
+ def define_upload_data_bags
125
+ namespace "Promote" do
126
+ desc "Upload data_bags to the chef server"
127
+ task "upload_data_bags" do
128
+ file_uploaded = @uploader.upload_data_bags
129
+ puts "Uploading #{file_uploaded} to #{@uploader.config.chef_server_url} as #{@uploader.config.node_name} using #{@uploader.config.client_key}"
130
+ end
131
+ end
132
+ end
156
133
 
157
134
  end
158
135
  end
@@ -5,21 +5,17 @@ module Promote
5
5
  class Versioner
6
6
  def initialize(config = Config.new)
7
7
  @config = config
8
- @git = git_chef(config)
9
- version_tags = @git.tags.select { |t| t.name[/^[0-9\.]+/] }
10
- @current_tag = version_tags[-1]
11
- @sha1 = @git.log(10000).between(current_tag.sha).first.sha
12
8
  end
13
9
 
14
10
  def version_cookbook(cookbook_name)
15
11
  dir = File.join(config.cookbook_directory, cookbook_name)
16
12
  cookbook_name = File.basename(dir)
17
- version = version_number(current_tag, dir)
13
+ ct = current_tag
14
+ version = version_number(ct, dir)
18
15
  metadata_file = File.join(dir, "metadata.rb")
19
16
  metadata_content = File.read(metadata_file)
20
17
  version_line = metadata_content[/^\s*version\s.*$/]
21
18
  current_version = version_line[/('|").*("|')/].gsub(/('|")/,"")
22
-
23
19
  if current_version != version
24
20
  metadata_content = metadata_content.gsub(current_version, version)
25
21
  outdata = metadata_content.gsub(/#sha1.*$/, "#sha1 '#{sha1}'")
@@ -49,23 +45,8 @@ module Promote
49
45
  Utils.sync_berksfiles(config.cookbook_directory)
50
46
  end
51
47
 
52
- def version_data_bag(data_bag_path)
53
- version_json File.dirname(data_bag_path), File.basename(data_bag_path, File.extname(data_bag_path))
54
- end
55
-
56
- def version_data_bags
57
- results = []
58
- Dir.glob(File.join(config.data_bag_directory, "**", "*.json")).each do |file|
59
- result = version_data_bag(file)
60
- if !result.nil?
61
- results << result
62
- end
63
- end
64
- results
65
- end
66
-
67
48
  def version_environment(environment_name)
68
- version_json config.environment_directory, environment_name do | content |
49
+ version_json config.environment_directory, environment_name do | content |
69
50
  content['override_attributes']
70
51
  end
71
52
  end
@@ -144,9 +125,17 @@ module Promote
144
125
  end
145
126
  end
146
127
 
147
- attr_accessor :git
148
- attr_accessor :current_tag
149
- attr_accessor :sha1
128
+ def git
129
+ @git ||= git_chef(config)
130
+ end
131
+
132
+ def current_tag
133
+ @current_tag ||= git.tags.select { |t| t.name[/^[0-9\.]+/] }[-1]
134
+ end
135
+
136
+ def sha1
137
+ @sha1 ||= git.log(10000).between(current_tag.sha).first.sha
138
+ end
150
139
 
151
140
  def version_number(current_tag, ref)
152
141
  all_commit_count = git.log(10000).object(ref).between(current_tag.sha).size
@@ -157,4 +146,4 @@ module Promote
157
146
 
158
147
  include Promote::GitHelper
159
148
  end
160
- end
149
+ end
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.3.15
4
+ version: 0.3.16
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-11-04 00:00:00.000000000 Z
11
+ date: 2014-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef