cloudwalk 0.1.0 → 0.1.1

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: a76eb0a4e3788de1be11141163b5f42589b64565
4
- data.tar.gz: 492470763d237efd68559c1ffb025269d51ccba4
3
+ metadata.gz: f6d76b3afb06d902fc1235c9285a78d73c657b30
4
+ data.tar.gz: 6b50e42b1c3deac0e189e8517c6f13292fb39bd8
5
5
  SHA512:
6
- metadata.gz: 5ae5747d259dea477e657ece603a9de7be247e034aadb2caeca36246e306e86425c691b82c08d57ae1405436f43aa0355c0c4c4e1aac4e2dc597c35852a4bf2f
7
- data.tar.gz: da09203da62f05e97b224b0c9cf7663125bffad6a31b5cf52ff6332403d6d4d6f2e22c34e080a2ae7cf8a0dbc2667dcda0fa8ea619b9f0ca0c78e248895e30b3
6
+ metadata.gz: 6b4cddbfb08578ceaf1cd7eefec439d696565777c360956409ccf96fb4d1d107c434d7664e057325a1952881eb439df094e0eb6d0001df7443e80ce890197d9c
7
+ data.tar.gz: 7e5e9c969f4512dfa1d1de9886091ae173292f52d137733a34277f224d8e3298b3c60b2f1322bb88f009f1cd0a11ecc9fbbf78dde58ba5a9536d5ad538faefed
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -86,14 +86,7 @@ module Cloudwalk
86
86
  true
87
87
  elsif CwFileJson.exists_lock?
88
88
  if self.lock = load_cwfile_lock
89
- difference = self.compare
90
- if difference.empty?
91
- true
92
- else
93
- puts "Warning Cwfile.json and Cwfile.json.lock are different, follow differences:"
94
- puts difference
95
- false
96
- end
89
+ self.compare
97
90
  end
98
91
  else
99
92
  persist_lock!
@@ -171,6 +164,11 @@ module Cloudwalk
171
164
  end
172
165
  end
173
166
 
167
+ unless app_lock
168
+ # TODO Improve!
169
+ raise Exception.new("application or module #{path} not found in Manager, please create it")
170
+ end
171
+
174
172
  Cloudwalk::PosxmlVersion.update(
175
173
  app_lock["id"], app_lock["version_id"], File.read(path)
176
174
  )
@@ -196,23 +194,34 @@ module Cloudwalk
196
194
  # TODO future!
197
195
 
198
196
  def self.compare
199
- cwfile_list = self.cwfile["apps"].inject({}) do |hash, app|
200
- hash[app["name"]] = app["modules"].inject({}) do |hash_m, app_module|
201
- hash_m[app_module[0]] = app_module[1]
202
- hash_m
197
+ cwfile_list = []
198
+ self.cwfile["apps"].each do |app|
199
+ cwfile_list << [app["name"], app["version"]]
200
+ app["modules"].each do |app_module|
201
+ cwfile_list << [app_module[0], app_module[1]]
203
202
  end
204
- hash
205
203
  end
206
204
 
207
- lock_list = self.lock.inject({}) do |hash, app|
208
- hash[posxml2xml(app["name"])] = app["modules"].inject({}) do |hash_m, app_module|
209
- hash_m[posxml2xml(app_module["name"])] = app_module["version"]
210
- hash_m
205
+ lock_list = []
206
+ self.lock.each do |app|
207
+ lock_list << [posxml2xml(app["name"]), app["version"]]
208
+ app["modules"].each do |app_module|
209
+ lock_list << [posxml2xml(app_module["name"]), posxml2xml(app_module["version"])]
211
210
  end
212
- hash
213
211
  end
214
212
 
215
- cwfile_list.to_a - lock_list.to_a
213
+ cwdiff = cwfile_list - lock_list
214
+ lockdiff = lock_list - cwfile_list
215
+ unless cwdiff.empty? && lockdiff.empty?
216
+ puts "Warning Cwfile.json and Cwfile.json.lock are different, follow differences:"
217
+ puts "Cwfile.json"
218
+ puts cwdiff.inspect
219
+ puts "Cwfile.json.lock"
220
+ puts lockdiff.inspect
221
+ false
222
+ else
223
+ true
224
+ end
216
225
  end
217
226
 
218
227
  def compare_modules(local_app, module_ids)
@@ -64,7 +64,7 @@ module Cloudwalk
64
64
  Cloudwalk::CwFileJson.deploy([Cloudwalk::CwFileJson.xml2posxml(out)])
65
65
  else
66
66
  posxmls = self.outs.collect do |xml|
67
- Cloudwalk::CwFileJson.xml2posxml(out)
67
+ Cloudwalk::CwFileJson.xml2posxml(xml)
68
68
  end
69
69
  Cloudwalk::CwFileJson.deploy(posxmls)
70
70
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudwalk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thiago Scalone
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-18 00:00:00.000000000 Z
11
+ date: 2017-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake