clc-promote 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/promote/cookbook.rb +29 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d316a9ea6001e68fb5427d676538a9072eb3e30
4
- data.tar.gz: 0fc122ef2946c25a1d537242941afa309e0504e0
3
+ metadata.gz: ddd4e5a4f6e058ab00b7a7ffd4e825c789c13f34
4
+ data.tar.gz: dc18d819f21b0b41f8accc45ab09d247161adbe5
5
5
  SHA512:
6
- metadata.gz: 17b681a4316f945ba1411f8c7666e3e415a4fa38d37a779cbe46fcf2ef80a96b9c4b5f58d5ffadd5c8c9015a91132050ea6bcb4ad00e7565d64f81744cff388a
7
- data.tar.gz: 0a61eb79353a14b8eaecd04d4ff4a44c81264bae0c709608f4b16bca49acbf0309f644aa50cb5e0de2718c062c867d1d7ad70503b8bcf0c583e47fbed5c68c89
6
+ metadata.gz: dc2f696b503abdc2fdba35556453a0abf26f275e1e5691731d0907f6ea25f435971e8d70a9b344bb607ff5a9aa21831ee098c654c1a73ebb498a60ab6e81e0d7
7
+ data.tar.gz: 85258c220d03dc349abe15370b1295500d129bd0a5a5a1fc464305628eaa34bf29c3ce50ec6270d674c789d9998a39116d71f79e973fb77931f533d1a825628b
@@ -11,7 +11,7 @@ module Promote
11
11
  end
12
12
 
13
13
  def dependencies
14
- @dependencies ||= get_dependencies_from_lockfile
14
+ @dependencies ||= get_synced_dependencies_from_lockfile
15
15
  end
16
16
 
17
17
  def metadata_dependencies
@@ -58,7 +58,23 @@ module Promote
58
58
  return if berksfile.nil?
59
59
 
60
60
  update = false unless File.exist?("#{@berks_path}.lock")
61
- update ? berksfile.update : berksfile.install
61
+ update ? berksfile_update : berksfile.install
62
+ end
63
+
64
+ def dependencies_changed_after_update?
65
+ old_deps = dependencies
66
+ sync_berksfile(true)
67
+ new_deps = get_dependencies_from_lockfile
68
+
69
+ return true unless old_deps.count == new_deps.count
70
+
71
+ old_deps.each do |k,v|
72
+ if k != @name
73
+ return true unless new_deps[k] == v
74
+ end
75
+ end
76
+
77
+ return false
62
78
  end
63
79
 
64
80
  def sync_latest_app_cookbooks(environment_cookbook_name)
@@ -68,11 +84,10 @@ module Promote
68
84
  env_cookbook.metadata_dependencies do |key|
69
85
  latest_version = latest_server_cookbooks[key]['versions'][0]
70
86
  if dependencies.keys.include?(key) && latest_version > dependencies[key].to_s
71
- berksfile.update(key)
87
+ berksfile_update(key)
72
88
  result[key] = latest_version
73
89
  end
74
90
  end
75
- @dependencies = nil unless result.keys.empty?
76
91
  result
77
92
  end
78
93
 
@@ -96,8 +111,12 @@ module Promote
96
111
  metadata
97
112
  end
98
113
 
99
- def get_dependencies_from_lockfile
114
+ def get_synced_dependencies_from_lockfile
100
115
  berksfile.install
116
+ get_dependencies_from_lockfile
117
+ end
118
+
119
+ def get_dependencies_from_lockfile
101
120
  berks_deps = berksfile.list
102
121
  deps = {}
103
122
 
@@ -110,5 +129,10 @@ module Promote
110
129
  Berkshelf.set_format :null
111
130
  Berkshelf::Berksfile.from_file(@berks_path)
112
131
  end
132
+
133
+ def berksfile_update(cookbooks = nil)
134
+ berksfile.update(cookbooks)
135
+ @dependencies = nil
136
+ end
113
137
  end
114
138
  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.4.1
4
+ version: 0.4.2
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-12-17 00:00:00.000000000 Z
11
+ date: 2014-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clc-git