ruby_aem 1.0.2 → 1.0.6

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: 017b94ee59bf80abe0156c15ec3d70c200b122a9
4
- data.tar.gz: 27a555764cd6460d277d1658fc7c0bf0311ee71b
3
+ metadata.gz: bd2ed673ae15b68e95ab826d68fcbe626be9d311
4
+ data.tar.gz: 05a5ce3cbb7b71bd803e0e84ea3bde75c8f5cfe9
5
5
  SHA512:
6
- metadata.gz: c0f06810662d558aa580fac1939fafe6a98e5c7edba6342ac4be1e4dab9467a04ee9d08ec7601ae06403804ffa9bf72a9327e326c81598321ea06b588344ddd1
7
- data.tar.gz: d8e300cefacd46d650a11da26cd0cca16d1e950e2efbc45e219da0fb8e31d1fe055aa186eb0a744e1157fdd31d57d04ed341e164b99d7cdfb50ea7d8499f115f
6
+ metadata.gz: a9575353f79e67a36b1ff72c710ab178e8589459e07a415fd4597809b9e95911cd1f55f2cf54e7fd15708adab7094d5a433bb3a718617f08e169fef485d9754e
7
+ data.tar.gz: d031a4e54a02d5fd02313e91ae108ba01495dd892b1b69e8b1c5d0736840ac369778846648784ead03a45af3296044568f563ee8110e6c0df18bb873277cd52e
data/conf/spec.yaml CHANGED
@@ -1,3 +1,14 @@
1
+ aem:
2
+ actions:
3
+ get_login_page:
4
+ api: cq
5
+ operation: getLoginPage
6
+ params:
7
+ required:
8
+ responses:
9
+ 200:
10
+ handler: simple
11
+ message: 'Login page retrieved'
1
12
  bundle:
2
13
  responses:
3
14
  404:
@@ -358,11 +369,11 @@ configproperty:
358
369
  actions:
359
370
  create:
360
371
  api: sling
361
- operation: postPath
372
+ operation: postConfig
362
373
  params:
363
374
  required:
364
375
  runmode: '%{run_mode}'
365
- name: '%{name}'
376
+ name: '%{node_name}'
366
377
  optional:
367
378
  - org_apache_felix_https_nio
368
379
  - org_apache_felix_https_nio_type_hint
@@ -387,10 +398,10 @@ configproperty:
387
398
  responses:
388
399
  200:
389
400
  handler: simple
390
- message: 'Set %{run_mode} config %{type} property %{name}=%{value}'
401
+ message: 'Set %{run_mode} %{node_name} config %{type} property %{name}=%{value}'
391
402
  201:
392
403
  handler: simple
393
- message: 'Set %{run_mode} config %{type} property %{name}=%{value}'
404
+ message: 'Set %{run_mode} %{node_name} config %{type} property %{name}=%{value}'
394
405
  replicationagent:
395
406
  responses:
396
407
  404:
@@ -0,0 +1,67 @@
1
+ =begin
2
+ Copyright 2016 Shine Solutions
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ =end
16
+
17
+ require 'retries'
18
+ require 'ruby_aem/error'
19
+
20
+ module RubyAem
21
+ module Resources
22
+ # AEM class contains API calls related to managing the AEM instance itself.
23
+ class Aem
24
+
25
+ # Initialise an AEM instance.
26
+ #
27
+ # @param client RubyAem::Client
28
+ # @return new RubyAem::Resources::Aem instance
29
+ def initialize(client)
30
+ @client = client
31
+ @call_params = {
32
+ }
33
+ end
34
+
35
+ # Retrieve AEM login page.
36
+ #
37
+ # @return RubyAem::Result
38
+ def get_login_page()
39
+ @client.call(self.class, __callee__.to_s, @call_params)
40
+ end
41
+
42
+ # Retrieve AEM login page with retries until it is successful.
43
+ # This is handy for waiting for AEM to start or restart Jetty.
44
+ #
45
+ # @return RubyAem::Result
46
+ def get_login_page_wait_until_ready()
47
+ result = nil
48
+ with_retries(:max_tries => 30, :base_sleep_seconds => 2, :max_sleep_seconds => 2) { |retries_count|
49
+ begin
50
+ result = get_login_page()
51
+ if result.response.body !~ /QUICKSTART_HOMEPAGE/
52
+ puts 'Retrieve login page attempt #%d: %s but not ready yet' % [retries_count, result.message]
53
+ raise StandardError.new(result.message)
54
+ else
55
+ puts 'Retrieve login page attempt #%d: %s and ready' % [retries_count, result.message]
56
+ end
57
+ rescue RubyAem::Error => err
58
+ puts 'Retrieve login page attempt #%d: %s' % [retries_count, err.message]
59
+ raise StandardError.new(err.message)
60
+ end
61
+ }
62
+ result
63
+ end
64
+
65
+ end
66
+ end
67
+ end
@@ -38,11 +38,13 @@ module RubyAem
38
38
  # Create a new config property.
39
39
  #
40
40
  # @param run_mode AEM run mode: author or publish
41
+ # @param node_name the node name under /apps/system/config.{run_mode}/ where the property will be part of
41
42
  # @return RubyAem::Result
42
- def create(run_mode)
43
+ def create(run_mode, node_name)
43
44
 
44
45
  name = RubyAem::Swagger.property_to_parameter(@call_params[:name])
45
46
 
47
+ @call_params[:node_name] = node_name
46
48
  @call_params[:run_mode] = run_mode
47
49
  @call_params["#{name}".to_sym] = @call_params[:value]
48
50
  @call_params["#{name}_type_hint".to_sym] = @call_params[:type]
@@ -174,7 +174,7 @@ module RubyAem
174
174
  package = packages.xpath("//packages/package[group=\"#{@call_params[:group_name]}\" and name=\"#{@call_params[:package_name]}\" and version=\"#{@call_params[:package_version]}\"]")
175
175
  last_unpacked_by = package.xpath('lastUnpackedBy')
176
176
 
177
- if not ['<lastUnpackedBy/>', '<lastUnpackedBy>null</lastUnpackedBy>'].include? last_unpacked_by.to_s
177
+ if not ['', '<lastUnpackedBy/>', '<lastUnpackedBy>null</lastUnpackedBy>'].include? last_unpacked_by.to_s
178
178
  message = "Package #{@call_params[:group_name]}/#{@call_params[:package_name]}-#{@call_params[:package_version]} is installed"
179
179
  is_installed = true
180
180
  else
@@ -40,7 +40,7 @@ module RubyAem
40
40
  # @param dest_base_url base URL of the agent target destination, e.g. https://somepublisher:4503
41
41
  # @param opts optional parameters:
42
42
  # - transport_user: username for transport user, default is admin
43
- # - transport_password: username for transport user, default is admin
43
+ # - transport_password: password for transport user, default is admin
44
44
  # - log_level: error, info, debug, default is error
45
45
  # - retry_delay: in milliseconds, default is 30000
46
46
  # @return RubyAem::Result
data/lib/ruby_aem.rb CHANGED
@@ -15,6 +15,7 @@ limitations under the License.
15
15
  =end
16
16
 
17
17
  require 'ruby_aem/client'
18
+ require 'ruby_aem/resources/aem'
18
19
  require 'ruby_aem/resources/bundle'
19
20
  require 'ruby_aem/resources/config_property'
20
21
  require 'ruby_aem/resources/flush_agent'
@@ -71,6 +72,13 @@ module RubyAem
71
72
  @client = RubyAem::Client.new(apis, spec)
72
73
  end
73
74
 
75
+ # Create an AEM instance.
76
+ #
77
+ # @return new RubyAem::Resources::Aem instance
78
+ def aem()
79
+ RubyAem::Resources::Aem.new(@client)
80
+ end
81
+
74
82
  # Create a bundle instance.
75
83
  #
76
84
  # @param name the bundle's name, e.g. com.adobe.cq.social.cq-social-forum
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.0.2
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shine Solutions
@@ -9,106 +9,76 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-12-20 00:00:00.000000000 Z
12
+ date: 2017-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.6'
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.6.8
24
21
  type: :runtime
25
22
  prerelease: false
26
23
  version_requirements: !ruby/object:Gem::Requirement
27
24
  requirements:
28
- - - "~>"
25
+ - - ~>
29
26
  - !ruby/object:Gem::Version
30
27
  version: '1.6'
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.6.8
34
28
  - !ruby/object:Gem::Dependency
35
29
  name: retries
36
30
  requirement: !ruby/object:Gem::Requirement
37
31
  requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '0.0'
41
- - - ">="
32
+ - - ~>
42
33
  - !ruby/object:Gem::Version
43
34
  version: 0.0.5
44
35
  type: :runtime
45
36
  prerelease: false
46
37
  version_requirements: !ruby/object:Gem::Requirement
47
38
  requirements:
48
- - - "~>"
49
- - !ruby/object:Gem::Version
50
- version: '0.0'
51
- - - ">="
39
+ - - ~>
52
40
  - !ruby/object:Gem::Version
53
41
  version: 0.0.5
54
42
  - !ruby/object:Gem::Dependency
55
43
  name: swagger_aem
56
44
  requirement: !ruby/object:Gem::Requirement
57
45
  requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '0.9'
61
- - - ">="
46
+ - - ~>
62
47
  - !ruby/object:Gem::Version
63
- version: 0.9.2
48
+ version: 0.9.4
64
49
  type: :runtime
65
50
  prerelease: false
66
51
  version_requirements: !ruby/object:Gem::Requirement
67
52
  requirements:
68
- - - "~>"
53
+ - - ~>
69
54
  - !ruby/object:Gem::Version
70
- version: '0.9'
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- version: 0.9.2
55
+ version: 0.9.4
74
56
  - !ruby/object:Gem::Dependency
75
57
  name: rspec
76
58
  requirement: !ruby/object:Gem::Requirement
77
59
  requirements:
78
- - - "~>"
60
+ - - ~>
79
61
  - !ruby/object:Gem::Version
80
62
  version: '3.4'
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: 3.4.0
84
63
  type: :development
85
64
  prerelease: false
86
65
  version_requirements: !ruby/object:Gem::Requirement
87
66
  requirements:
88
- - - "~>"
67
+ - - ~>
89
68
  - !ruby/object:Gem::Version
90
69
  version: '3.4'
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- version: 3.4.0
94
70
  - !ruby/object:Gem::Dependency
95
71
  name: yard
96
72
  requirement: !ruby/object:Gem::Requirement
97
73
  requirements:
98
- - - "~>"
99
- - !ruby/object:Gem::Version
100
- version: '0.9'
101
- - - ">="
74
+ - - ~>
102
75
  - !ruby/object:Gem::Version
103
76
  version: 0.9.5
104
77
  type: :development
105
78
  prerelease: false
106
79
  version_requirements: !ruby/object:Gem::Requirement
107
80
  requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '0.9'
111
- - - ">="
81
+ - - ~>
112
82
  - !ruby/object:Gem::Version
113
83
  version: 0.9.5
114
84
  description: ruby_aem is a Ruby client for Adobe Experience Manager (AEM) API, written
@@ -129,6 +99,7 @@ files:
129
99
  - lib/ruby_aem/handlers/json.rb
130
100
  - lib/ruby_aem/handlers/simple.rb
131
101
  - lib/ruby_aem/handlers/xml.rb
102
+ - lib/ruby_aem/resources/aem.rb
132
103
  - lib/ruby_aem/resources/bundle.rb
133
104
  - lib/ruby_aem/resources/config_property.rb
134
105
  - lib/ruby_aem/resources/flush_agent.rb
@@ -152,12 +123,12 @@ require_paths:
152
123
  - lib
153
124
  required_ruby_version: !ruby/object:Gem::Requirement
154
125
  requirements:
155
- - - ">="
126
+ - - '>='
156
127
  - !ruby/object:Gem::Version
157
128
  version: '1.9'
158
129
  required_rubygems_version: !ruby/object:Gem::Requirement
159
130
  requirements:
160
- - - ">="
131
+ - - '>='
161
132
  - !ruby/object:Gem::Version
162
133
  version: '0'
163
134
  requirements: []