cloudwalk 1.9.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 134d80f06616cb142ed8509d543acc4f570c3af0
4
- data.tar.gz: 53a837570b408606370218e2a84eae156b45eced
3
+ metadata.gz: 184f76c269f8fe57ace73fc0032c02ab5f656c5f
4
+ data.tar.gz: 337ce866b3863dcc950b0455057cde2853154611
5
5
  SHA512:
6
- metadata.gz: ef059b73a31e2f0f3aacd5233bfa4a1a2ebf9b10bc4af35db5ea4529f32b47961e7fd6c39f3e6f23cfc193c73aa849f60bac07931bf8fdf86d68509974b64b20
7
- data.tar.gz: cde72278e686a97c01259724e6115c176db8336075759f3f72826c6592d637f58e076f03b21824fd263b81b95f8674731355a8f43417ee784b891864230d5ed0
6
+ metadata.gz: 83e3ca52737c2a673216d8a907a647a0f65ded070adcd285892cd32f5f1611225570b4dcec47e7b2a9a5da9744d1de8b5efaed94982bb89014d5f33d57e924ef
7
+ data.tar.gz: e1a1380dc8873b3c4c020e5e05529b37398a920107cef4615801ee51d9ebfce7127d21a0bed51fdcd9291dc3c2a202360e0babf4c58a0643a78502d7d72fcb2d
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -222,6 +222,58 @@ module Cloudwalk
222
222
  true
223
223
  end
224
224
  end
225
+
226
+ def compare_modules(local_app, module_ids)
227
+ local_module_app_ids = local_app["modules"].inject([]) do |mods, app|
228
+ mods << app["id"]
229
+ end
230
+
231
+ module_app_ids = module_ids.inject([]) do |mods, app|
232
+ mods << app["app_id"]
233
+ end
234
+
235
+ local_creation = local_module_app_ids - module_app_ids
236
+ remote_creation = module_app_ids - local_module_app_ids
237
+
238
+ if local_creation.nil?
239
+ raise ApplicationConfigError.new("Application #{local_app["name"]}: Local modules are missing #{local_creation}")
240
+ end
241
+
242
+ if remote_creation.nil?
243
+ raise ApplicationConfigError.new("Application #{local_app["name"]}: Remote modules are missing #{local_creation}")
244
+ end
245
+ end
246
+
247
+ # curl -X GET "https://api-staging.cloudwalk.io/v1/apps/posxml?access_token=TOKEN"
248
+ # curl -X GET "https://manager.cloudwalk.io/v1/apps/posxml/3082/versions?access_token=TOKEN"
249
+ def update_apps(list, apps, config)
250
+ all = Cloudwalk::Posxml::PosxmlApplication.all
251
+ list.each do |app, version|
252
+ local_app = apps.find { |json| json["name"] == app }
253
+
254
+ if app[-4..-1] == ".xml" # Check if is posxml application
255
+ remote_app = all.find { |app_json| app_json["posxml_app"]["name"] == xml2posxml(app) }
256
+
257
+ if remote_app
258
+ remote_posxml_app = remote_app["posxml_app"]
259
+ remote_versions = Cloudwalk::Posxml::PosxmlVersion.all(remote_posxml_app["id"])
260
+ remote_version_json = remote_versions.find { |json| json["app_version"]["number"] == version }
261
+
262
+ if remote_version_json && (remote_version = remote_version_json["app_version"])
263
+ remote_version_detail = Cloudwalk::Posxml::PosxmlVersion.get(remote_posxml_app["id"], remote_version["id"])
264
+ # TODO: Check if application exists locally
265
+ build_application(local_app, config, remote_posxml_app, remote_version, remote_version_detail["app_version"]["module_ids"])
266
+ else
267
+ # TODO versions not found, what to do?
268
+ end
269
+ else
270
+ # TODO app not found, what to do?
271
+ end
272
+ else
273
+ # Ruby flow
274
+ end
275
+ end
276
+ end
225
277
  end
226
278
  end
227
279
 
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: 1.9.0
4
+ version: 1.9.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: 2018-03-02 00:00:00.000000000 Z
11
+ date: 2018-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake