knife-env-diff 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/chef/knife/env-diff.rb +16 -11
- data/lib/knife-env-diff/version.rb +1 -1
- metadata +8 -7
data/lib/chef/knife/env-diff.rb
CHANGED
@@ -43,35 +43,40 @@ module GoulahKnifePlugins
|
|
43
43
|
|
44
44
|
from_env.each_value do |from_cookbooks|
|
45
45
|
from_cookbooks.each do |from_cookbook, from_data|
|
46
|
-
from_version = from_data["versions"].first['version']
|
47
|
-
|
48
46
|
diff_versions = {}
|
49
47
|
|
50
|
-
|
51
|
-
|
48
|
+
from_version = get_cookbook_version(from_data)
|
49
|
+
|
50
|
+
to_env.each do |env, to_cookbooks|
|
51
|
+
to_version = get_cookbook_version(to_cookbooks[from_cookbook])
|
52
52
|
|
53
|
-
if from_version != to_version
|
54
|
-
diff_versions[
|
53
|
+
if from_version != to_version || from_version.nil?
|
54
|
+
diff_versions[env] = to_version
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
unless diff_versions.empty?
|
59
59
|
ui.msg "cookbook: "+ from_cookbook
|
60
|
-
ui.msg " #{firstenv} version: "
|
60
|
+
ui.msg " #{firstenv} version: #{from_version}"
|
61
61
|
diff_versions.each do |env, version|
|
62
62
|
ui.msg " #{env} version: "+ version
|
63
63
|
end
|
64
64
|
ui.msg "\n"
|
65
65
|
end
|
66
|
-
|
67
66
|
end
|
68
67
|
end
|
69
|
-
|
70
68
|
end
|
71
69
|
|
72
|
-
|
70
|
+
def get_env_cookbooks(env)
|
73
71
|
rest.get_rest("environments/#{env}/cookbooks")
|
74
|
-
|
72
|
+
end
|
75
73
|
|
74
|
+
def get_cookbook_version(data)
|
75
|
+
if data['versions'].empty?
|
76
|
+
'none'
|
77
|
+
else
|
78
|
+
data['versions'].first['version']
|
79
|
+
end
|
80
|
+
end
|
76
81
|
end
|
77
82
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-env-diff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- John Goulah
|
@@ -14,8 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2012-01-02 00:00:00
|
18
|
-
default_executable:
|
18
|
+
date: 2012-01-02 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: A plugin for Chef::Knife which displays the roles that are included recursively within a role and optionally displays all the roles that include it.
|
@@ -32,7 +32,6 @@ files:
|
|
32
32
|
- knife-env-diff.gemspec
|
33
33
|
- lib/chef/knife/env-diff.rb
|
34
34
|
- lib/knife-env-diff/version.rb
|
35
|
-
has_rdoc: true
|
36
35
|
homepage: https://github.com/jgoulah/knife-env-diff
|
37
36
|
licenses: []
|
38
37
|
|
@@ -46,6 +45,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
46
45
|
requirements:
|
47
46
|
- - ">="
|
48
47
|
- !ruby/object:Gem::Version
|
48
|
+
hash: 3
|
49
49
|
segments:
|
50
50
|
- 0
|
51
51
|
version: "0"
|
@@ -54,13 +54,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
54
|
requirements:
|
55
55
|
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
57
58
|
segments:
|
58
59
|
- 0
|
59
60
|
version: "0"
|
60
61
|
requirements: []
|
61
62
|
|
62
63
|
rubyforge_project:
|
63
|
-
rubygems_version: 1.
|
64
|
+
rubygems_version: 1.8.24
|
64
65
|
signing_key:
|
65
66
|
specification_version: 3
|
66
67
|
summary: A plugin for Chef::Knife which displays the roles that are included recursively within a role and optionally displays all the roles that include it.
|