ruby_aem 1.0.0 → 1.0.2

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: d0f1ce4ed2a578ad6207b8ee2084a68fc33add63
4
- data.tar.gz: 40234461975d56d98f46114379bfdce1db25bae1
3
+ metadata.gz: 017b94ee59bf80abe0156c15ec3d70c200b122a9
4
+ data.tar.gz: 27a555764cd6460d277d1658fc7c0bf0311ee71b
5
5
  SHA512:
6
- metadata.gz: 3fe281388b41b35867c105caa54eb8904d0e77f9287c13e021ebf3437fe09e70f090aae218deea7ffc9efac332b3995f698668b02e3f472b2896c75b75480e9f
7
- data.tar.gz: e1068b423cd27d207b10be4ec13e082869c7e159dc7df892c49d3a7b47bd66fa5154aeeb251e0be668c150f4feb1435cf796703421e9cf156ed5a33baef5b79b
6
+ metadata.gz: c0f06810662d558aa580fac1939fafe6a98e5c7edba6342ac4be1e4dab9467a04ee9d08ec7601ae06403804ffa9bf72a9327e326c81598321ea06b588344ddd1
7
+ data.tar.gz: d8e300cefacd46d650a11da26cd0cca16d1e950e2efbc45e219da0fb8e31d1fe055aa186eb0a744e1157fdd31d57d04ed341e164b99d7cdfb50ea7d8499f115f
@@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  =end
16
16
 
17
+ require 'retries'
18
+
17
19
  module RubyAem
18
20
  module Resources
19
21
  # Package class contains API calls related to managing an AEM package.
@@ -68,7 +70,7 @@ module RubyAem
68
70
  @client.call(self.class, __callee__.to_s, @call_params)
69
71
  end
70
72
 
71
- # Install the package.
73
+ # Install the package without waiting until the package status states it is installed.
72
74
  #
73
75
  # @return RubyAem::Result
74
76
  def install()
@@ -92,7 +94,7 @@ module RubyAem
92
94
  @client.call(self.class, __callee__.to_s, @call_params)
93
95
  end
94
96
 
95
- # Upload the package.
97
+ # Upload the package without waiting until the package status states it is uploaded.
96
98
  #
97
99
  # @param file_path the directory where the package file to be uploaded is
98
100
  # @param force if true, then overwrite if the package already exists
@@ -185,6 +187,43 @@ module RubyAem
185
187
  result
186
188
  end
187
189
 
190
+ # Upload the package and wait until the package status states it is uploaded.
191
+ #
192
+ # @param file_path the directory where the package file to be uploaded is
193
+ # @param force if true, then overwrite if the package already exists
194
+ # @param opts optional parameters:
195
+ # - force: if false then a package file will not be uploaded when the package already exists with the same group, name, and version, default is true (will overwrite existing package file)
196
+ # @return RubyAem::Result
197
+ def upload_wait_until_ready(file_path,
198
+ opts = {
199
+ force: true
200
+ })
201
+ result = upload(file_path, opts)
202
+ with_retries(:max_tries => 30, :base_sleep_seconds => 2, :max_sleep_seconds => 2) { |retries_count|
203
+ check_result = is_uploaded()
204
+ puts 'Upload check #%d: %s - %s' % [retries_count, check_result.data, check_result.message]
205
+ if check_result.data == false
206
+ raise StandardError.new(check_result.message)
207
+ end
208
+ }
209
+ result
210
+ end
211
+
212
+ # Install the package and wait until the package status states it is installed.
213
+ #
214
+ # @return RubyAem::Result
215
+ def install_wait_until_ready()
216
+ result = install()
217
+ with_retries(:max_tries => 30, :base_sleep_seconds => 2, :max_sleep_seconds => 2) { |retries_count|
218
+ check_result = is_installed()
219
+ puts 'Install check #%d: %s - %s' % [retries_count, check_result.data, check_result.message]
220
+ if check_result.data == false
221
+ raise StandardError.new(check_result.message)
222
+ end
223
+ }
224
+ result
225
+ end
226
+
188
227
  end
189
228
  end
190
229
  end
data/lib/ruby_aem.rb CHANGED
@@ -79,14 +79,6 @@ module RubyAem
79
79
  RubyAem::Resources::Bundle.new(@client, name)
80
80
  end
81
81
 
82
- # Create a path instance.
83
- #
84
- # @param name the name of the path, e.g. /etc/designs
85
- # @return new RubyAem::Resources::Path instance
86
- def path(name)
87
- RubyAem::Resources::Path.new(@client, name)
88
- end
89
-
90
82
  # Create a config property instance.
91
83
  #
92
84
  # @param name the property's name
@@ -102,8 +94,8 @@ module RubyAem
102
94
  # @param run_mode AEM run mode: author or publish
103
95
  # @param name the flush agent's name, e.g. some-flush-agent
104
96
  # @return new RubyAem::Resources::FlushAgent instance
105
- def flush_agent(name, run_mode)
106
- RubyAem::Resources::FlushAgent.new(@client, name, run_mode)
97
+ def flush_agent(run_mode, name)
98
+ RubyAem::Resources::FlushAgent.new(@client, run_mode, name)
107
99
  end
108
100
 
109
101
  # Create a group instance.
@@ -134,13 +126,21 @@ module RubyAem
134
126
  RubyAem::Resources::Package.new(@client, group_name, package_name, package_version)
135
127
  end
136
128
 
129
+ # Create a path instance.
130
+ #
131
+ # @param name the name of the path, e.g. /etc/designs
132
+ # @return new RubyAem::Resources::Path instance
133
+ def path(name)
134
+ RubyAem::Resources::Path.new(@client, name)
135
+ end
136
+
137
137
  # Create a replication agent instance.
138
138
  #
139
139
  # @param run_mode AEM run mode: author or publish
140
140
  # @param name the replication agent's name, e.g. some-replication-agent
141
141
  # @return new RubyAem::Resources::ReplicationAgent instance
142
- def replication_agent(name, run_mode)
143
- RubyAem::Resources::ReplicationAgent.new(@client, name, run_mode)
142
+ def replication_agent(run_mode, name)
143
+ RubyAem::Resources::ReplicationAgent.new(@client, run_mode, name)
144
144
  end
145
145
 
146
146
  # Create a repository instance.
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.0
4
+ version: 1.0.2
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: 2016-11-20 00:00:00.000000000 Z
12
+ date: 2016-12-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -31,6 +31,26 @@ dependencies:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.6.8
34
+ - !ruby/object:Gem::Dependency
35
+ name: retries
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.0'
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 0.0.5
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - "~>"
49
+ - !ruby/object:Gem::Version
50
+ version: '0.0'
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 0.0.5
34
54
  - !ruby/object:Gem::Dependency
35
55
  name: swagger_aem
36
56
  requirement: !ruby/object:Gem::Requirement