ruby_aem 1.4.2 → 1.4.3

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: db17bd379da3f56cab010d2bd3616f83d3919154
4
- data.tar.gz: e704e3e0f154f4b05b3dc4c7925b85568f223c8f
3
+ metadata.gz: ec1f486b8608c93169df3761902f6a78d8b32294
4
+ data.tar.gz: 3efe5f1035113b3d5275ddb038775a87c24ad892
5
5
  SHA512:
6
- metadata.gz: 4a21e7768885f40c4560919b2e902cce0a01f290297833d391c54f57e34c17b9a8410add7f1f0dcfff8168b187bdfff43b809d85bf97dca6e801144ef9613121
7
- data.tar.gz: 33614eb491d78330eb0173d295f4a02d060031c2e6d7fd41e8beeef99991716f61437b2c70af522b8b69297612b121b39cf6ff606418396e81c41eadfcda8bc7
6
+ metadata.gz: 8d510b3d2618a1a04142b9917b25024f36ca6530dabcf8bf3ba30c8a36693b2f38b217afd817a39f0059bbb2aa69eb8126866bc24426fab3a4207e5b2e698ad1
7
+ data.tar.gz: 7e0478248e3a339aabcfc1d113fd8649a45629ebde886477b285752953e9ded3eff2d12f2f1e1a91e59153dd582c75d7a57d25d6121a2aa89ae8d8f6dbfbcf92
data/conf/spec.yaml CHANGED
@@ -52,6 +52,16 @@ aem:
52
52
  404:
53
53
  handler: simple_false
54
54
  message: 'CRXDE is disabled'
55
+ get_packages:
56
+ api: crx
57
+ operation: postPackageService
58
+ params:
59
+ required:
60
+ cmd: ls
61
+ responses:
62
+ 200:
63
+ handler: xml_package_list
64
+ message: 'All packages list retrieved successfully'
55
65
  bundle:
56
66
  responses:
57
67
  404:
@@ -89,9 +89,7 @@ module RubyAem
89
89
  # if there is no value in optional param spec,
90
90
  # then only add optional param that is set in call parameters
91
91
  if !value
92
- if call_params.key? key.to_sym
93
- params[-1][key.to_sym] = call_params[key.to_sym]
94
- end
92
+ params[-1][key.to_sym] = call_params[key.to_sym] if call_params.key? key.to_sym
95
93
  # if value is provided in optional param spec,
96
94
  # then apply variable interpolation the same way as required param
97
95
  elsif value.class == String
@@ -104,9 +104,7 @@ module RubyAem
104
104
 
105
105
  agent_names = []
106
106
  json.each_key do |key|
107
- if (!key.start_with? 'jcr:') && (!key.start_with? 'rep:')
108
- agent_names.push(key)
109
- end
107
+ agent_names.push(key) if (!key.start_with? 'jcr:') && (!key.start_with? 'rep:')
110
108
  end
111
109
 
112
110
  message = response_spec['message'] % call_params
@@ -12,10 +12,12 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ require 'nori'
15
16
  require 'retries'
16
17
  require 'ruby_aem/error'
17
18
 
18
19
  module RubyAem
20
+ # AEM resources
19
21
  module Resources
20
22
  # AEM class contains API calls related to managing the AEM instance itself.
21
23
  class Aem
@@ -85,13 +87,13 @@ module RubyAem
85
87
  begin
86
88
  result = get_login_page
87
89
  if result.response.body !~ /QUICKSTART_HOMEPAGE/
88
- puts format('Retrieve login page attempt #%d: %s but not ready yet', retries_count, result.message)
90
+ puts format('Retrieve login page attempt #%<retries_count>d: %<message>s but not ready yet', retries_count: retries_count, message: result.message)
89
91
  raise StandardError.new(result.message)
90
92
  else
91
- puts format('Retrieve login page attempt #%d: %s and ready', retries_count, result.message)
93
+ puts format('Retrieve login page attempt #%<retries_count>d: %<message>s and ready', retries_count: retries_count, message: result.message)
92
94
  end
93
95
  rescue RubyAem::Error => err
94
- puts format('Retrieve login page attempt #%d: %s', retries_count, err.message)
96
+ puts format('Retrieve login page attempt #%<retries_count>d: %<message>s', retries_count: retries_count, message: err.message)
95
97
  raise StandardError.new(err.message)
96
98
  end
97
99
  }
@@ -134,13 +136,13 @@ module RubyAem
134
136
  end
135
137
  }
136
138
  if is_ok == false
137
- puts format('Retrieve AEM Health Check attempt #%d: %s but not ok yet', retries_count, result.message)
139
+ puts format('Retrieve AEM Health Check attempt #%<retries_count>d: %<message>s but not ok yet', retries_count: retries_count, message: result.message)
138
140
  raise StandardError.new(result.message)
139
141
  else
140
- puts format('Retrieve AEM Health Check attempt #%d: %s and ok', retries_count, result.message)
142
+ puts format('Retrieve AEM Health Check attempt #%<retries_count>d: %<message>s and ok', retries_count: retries_count, message: result.message)
141
143
  end
142
144
  rescue RubyAem::Error => err
143
- puts format('Retrieve AEM Health Check attempt #%d: %s', retries_count, err.message)
145
+ puts format('Retrieve AEM Health Check attempt #%<retries_count>d: %<message>s', retries_count: retries_count, message: err.message)
144
146
  raise StandardError.new(err.message)
145
147
  end
146
148
  }
@@ -193,18 +195,44 @@ module RubyAem
193
195
  result = get_install_status
194
196
  item_count = result.response.body.status.item_count
195
197
  if result.response.body.status.finished == true && item_count.zero?
196
- puts format('Retrieve AEM install status attempt #%d: %s and finished', retries_count, result.message)
198
+ puts format('Retrieve AEM install status attempt #%<retries_count>d: %<message>s and finished', retries_count: retries_count, message: result.message)
197
199
  else
198
- puts format('Retrieve AEM install status attempt #%d: %s but not finished yet, still installing %d package(s)', retries_count, result.message, item_count)
200
+ puts format('Retrieve AEM install status attempt #%<retries_count>d: %<message>s but not finished yet, still installing %<item_count>d package(s)', retries_count: retries_count, message: result.message, item_count: item_count)
199
201
  raise StandardError.new(result.message)
200
202
  end
201
203
  rescue RubyAem::Error => err
202
- puts format('Retrieve AEM install status attempt #%d: %s', retries_count, err.message)
204
+ puts format('Retrieve AEM install status attempt #%<retries_count>d: %<message>s', retries_count: retries_count, message: err.message)
203
205
  raise StandardError.new(err.message)
204
206
  end
205
207
  }
206
208
  result
207
209
  end
210
+
211
+ # Get a list of all packages available on AEM instance.
212
+ # The list of packages are returned as result data.
213
+ # Example:
214
+ # {
215
+ # "group" => "shinesolutions",
216
+ # "name" => "aem-password-reset-content",
217
+ # "version" => "1.0.1",
218
+ # "downloadName" => "aem-password-reset-content-1.0.1.zip",
219
+ # "size" => "23579",
220
+ # "created" => "Tue, 4 Apr 2017 13:38:35 +1000",
221
+ # "createdBy" => "root",
222
+ # "lastModified" => nil,
223
+ # "lastModifiedBy" => "null",
224
+ # "lastUnpacked" => "Wed, 18 Apr 2018 22:57:01 +1000",
225
+ # "lastUnpackedBy" => "admin"
226
+ # }
227
+ #
228
+ # @return RubyAem::Result
229
+ def get_packages
230
+ result = @client.call(self.class, __callee__.to_s, @call_params)
231
+ packages = Nori.new.parse(result.data.to_s)['packages']['package']
232
+ result_copy = RubyAem::Result.new(result.message, result.response)
233
+ result_copy.data = packages
234
+ result_copy
235
+ end
208
236
  end
209
237
  end
210
238
  end
@@ -315,10 +315,8 @@ module RubyAem
315
315
  result = upload(file_path, opts)
316
316
  with_retries(max_tries: opts[:_retries][:max_tries], base_sleep_seconds: opts[:_retries][:base_sleep_seconds], max_sleep_seconds: opts[:_retries][:max_sleep_seconds]) { |retries_count|
317
317
  check_result = is_uploaded
318
- puts format('Upload check #%d: %s - %s', retries_count, check_result.data, check_result.message)
319
- if check_result.data == false
320
- raise StandardError.new(check_result.message)
321
- end
318
+ puts format('Upload check #%<retries_count>d: %<check_result_data>s - %<check_result_message>s', retries_count: retries_count, check_result_data: check_result.data, check_result_message: check_result.message)
319
+ raise StandardError.new(check_result.message) if check_result.data == false
322
320
  }
323
321
  result
324
322
  end
@@ -350,10 +348,8 @@ module RubyAem
350
348
  result = install
351
349
  with_retries(max_tries: opts[:_retries][:max_tries], base_sleep_seconds: opts[:_retries][:base_sleep_seconds], max_sleep_seconds: opts[:_retries][:max_sleep_seconds]) { |retries_count|
352
350
  check_result = is_installed
353
- puts format('Install check #%d: %s - %s', retries_count, check_result.data, check_result.message)
354
- if check_result.data == false
355
- raise StandardError.new(check_result.message)
356
- end
351
+ puts format('Install check #%<retries_count>d: %<check_result_data>s - %<check_result_message>s', retries_count: retries_count, check_result_data: check_result.data, check_result_message: check_result.message)
352
+ raise StandardError.new(check_result.message) if check_result.data == false
357
353
  }
358
354
  result
359
355
  end
@@ -385,10 +381,8 @@ module RubyAem
385
381
  result = delete
386
382
  with_retries(max_tries: opts[:_retries][:max_tries], base_sleep_seconds: opts[:_retries][:base_sleep_seconds], max_sleep_seconds: opts[:_retries][:max_sleep_seconds]) { |retries_count|
387
383
  check_result = is_uploaded
388
- puts format('Delete check #%d: %s - %s', retries_count, !check_result.data, check_result.message)
389
- if check_result.data == true
390
- raise StandardError.new(check_result.message)
391
- end
384
+ puts format('Delete check #%<retries_count>d: %<check_result_data>s - %<check_result_message>s', retries_count: retries_count, check_result_data: !check_result.data, check_result_message: check_result.message)
385
+ raise StandardError.new(check_result.message) if check_result.data == true
392
386
  }
393
387
  result
394
388
  end
@@ -420,10 +414,8 @@ module RubyAem
420
414
  result = build
421
415
  with_retries(max_tries: opts[:_retries][:max_tries], base_sleep_seconds: opts[:_retries][:base_sleep_seconds], max_sleep_seconds: opts[:_retries][:max_sleep_seconds]) { |retries_count|
422
416
  check_result = is_built
423
- puts format('Build check #%d: %s - %s', retries_count, check_result.data, check_result.message)
424
- if check_result.data == false
425
- raise StandardError.new(check_result.message)
426
- end
417
+ puts format('Build check #%<retries_count>d: %<check_result_data>s - %<check_result_message>s', retries_count: retries_count, check_result_data: check_result.data, check_result_message: check_result.message)
418
+ raise StandardError.new(check_result.message) if check_result.data == false
427
419
  }
428
420
  result
429
421
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_aem
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shine Solutions
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-03-19 00:00:00.000000000 Z
12
+ date: 2018-04-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -25,6 +25,20 @@ dependencies:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: 1.8.1
28
+ - !ruby/object:Gem::Dependency
29
+ name: nori
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 2.6.0
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 2.6.0
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: retries
30
44
  requirement: !ruby/object:Gem::Requirement