knife-verschart 2.7.4 → 2.7.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/chef/knife/Verschart.rb +27 -14
- metadata +2 -2
data/lib/chef/knife/Verschart.rb
CHANGED
@@ -3,10 +3,11 @@ require 'chef/knife'
|
|
3
3
|
require 'chef/search/query'
|
4
4
|
|
5
5
|
class String
|
6
|
-
def red;
|
7
|
-
def purple;
|
8
|
-
def teal;
|
9
|
-
def bold;
|
6
|
+
def red; "\033[31m\033[1m#{self}\033[0m" end
|
7
|
+
def purple; "\033[35m#{self}\033[0m" end
|
8
|
+
def teal; "\033[36m#{self}\033[0m" end
|
9
|
+
def bold; "\033[44m\033[1m#{self}\033[0m" end # Bold & blue back-ground
|
10
|
+
def yellow; "\033[30m\033[43m#{self}\033[0m" end
|
10
11
|
end
|
11
12
|
|
12
13
|
module Verschart
|
@@ -44,7 +45,8 @@ module Verschart
|
|
44
45
|
ui.info('')
|
45
46
|
ui.info("Version numbers in the Latest column in " + "teal".teal + " are frozen")
|
46
47
|
ui.info("Version numbers in the " + "primary".purple + " Environment(s) which are NOT frozen will be " + "red".red ) unless primary.empty?
|
47
|
-
ui.info("Version numbers which
|
48
|
+
ui.info("Version numbers which do not exist on the server will be in " + "yellow".yellow)
|
49
|
+
ui.info("Version numbers which are different from the Latest (but do exist), will be in " + "blue".bold)
|
48
50
|
ui.info("Requested environment order is #{envorder}") unless envorder.empty?
|
49
51
|
ui.info('')
|
50
52
|
|
@@ -78,6 +80,8 @@ module Verschart
|
|
78
80
|
cblen = 10
|
79
81
|
|
80
82
|
charthash = Hash.new # The hash for all chart data
|
83
|
+
# store list of availible cookbook versions for comparison to constraint
|
84
|
+
vers_store = Chef::CookbookVersion.list_all_versions
|
81
85
|
|
82
86
|
# Load list of latest cookbook versions
|
83
87
|
charthash['Latest'] = Hash.new
|
@@ -119,20 +123,25 @@ module Verschart
|
|
119
123
|
charthash[enviro.name]['col'] = 10
|
120
124
|
end
|
121
125
|
enviro.cookbook_versions.each do | cb, v|
|
122
|
-
charthash[enviro.name][cb] = Hash.new(0)
|
123
|
-
charthash[enviro.name][cb]['vs'] = v.to_s
|
124
|
-
vn = v.to_s.split(' ')[1]
|
125
|
-
charthash[enviro.name][cb]['red'] = false
|
126
|
-
charthash[enviro.name][cb]['teal'] = false
|
127
126
|
if charthash['Latest'].has_key?(cb)
|
128
|
-
|
127
|
+
charthash[enviro.name][cb] = Hash.new(0)
|
128
|
+
charthash[enviro.name][cb]['vs'] = v.to_s
|
129
|
+
vn = v.to_s.split(' ')[1]
|
130
|
+
charthash[enviro.name][cb]['red'] = false
|
131
|
+
charthash[enviro.name][cb]['teal'] = false
|
132
|
+
charthash[enviro.name][cb]['yellow'] = true
|
133
|
+
charthash[enviro.name][cb]['bold'] = false
|
134
|
+
vers_store[cb]['versions'].each do | vss |
|
135
|
+
if vss['version'] == vn
|
136
|
+
charthash[enviro.name][cb]['yellow'] = false
|
137
|
+
end
|
138
|
+
end
|
139
|
+
if !primary.empty? && primary.include?(enviro.name) && !charthash[enviro.name][cb]['yellow']
|
129
140
|
fm = Chef::CookbookVersion.load(cb, version = "#{vn}")
|
130
141
|
charthash[enviro.name][cb]['red'] = true unless fm.frozen_version?
|
131
142
|
end
|
132
|
-
if vn != charthash['Latest'][cb]['vs']
|
143
|
+
if vn != charthash['Latest'][cb]['vs'] && !charthash[enviro.name][cb]['yellow']
|
133
144
|
charthash[enviro.name][cb]['bold'] = true
|
134
|
-
else
|
135
|
-
charthash[enviro.name][cb]['bold'] = false
|
136
145
|
end
|
137
146
|
end
|
138
147
|
end
|
@@ -166,12 +175,16 @@ module Verschart
|
|
166
175
|
if charthash[hdr][cbk]['bold']
|
167
176
|
if charthash[hdr][cbk]['red']
|
168
177
|
print charthash[hdr][cbk]['vs'].ljust(charthash[hdr]['col']).red.bold
|
178
|
+
elsif charthash[hdr][cbk]['yellow']
|
179
|
+
print charthash[hdr][cbk]['vs'].ljust(charthash[hdr]['col']).yellow.bold
|
169
180
|
else
|
170
181
|
print charthash[hdr][cbk]['vs'].ljust(charthash[hdr]['col']).bold
|
171
182
|
end
|
172
183
|
else
|
173
184
|
if charthash[hdr][cbk]['red']
|
174
185
|
print charthash[hdr][cbk]['vs'].ljust(charthash[hdr]['col']).red
|
186
|
+
elsif charthash[hdr][cbk]['yellow']
|
187
|
+
print charthash[hdr][cbk]['vs'].ljust(charthash[hdr]['col']).yellow
|
175
188
|
else
|
176
189
|
print charthash[hdr][cbk]['vs'].ljust(charthash[hdr]['col'])
|
177
190
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-verschart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-09
|
12
|
+
date: 2014-10-09 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email: chazzly@gmail.com
|