aem-deploy 0.1.5 → 0.1.6
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 +4 -4
- data/README.md +20 -8
- data/lib/aem-deploy.rb +2 -2
- data/lib/aem/deploy/session.rb +33 -16
- data/lib/aem/deploy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e24cbb0c947811740e490fef9b1ca92239570334
|
4
|
+
data.tar.gz: 90095fbf276da04e461674c3e54fae59d0080739
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 974ca1105f51a9fe3c098bf15e62b3c8627f40867875f334cf7641be732f3ab7e65d914667132585479d3c9a3f82569cdf950714b735d037f158904241bf2319
|
7
|
+
data.tar.gz: 6fd62c8b6478fe5942316248a23b0f6c050bc0547236c655dc5045404d7c14db277d02dc492e57fca43054f1c662427dc204816180cd433e18a8b482aaff1a4b
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# Aem::Deploy
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Simple Ruby wrapper for the docker compose cli
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
7
|
+
You need to have the docker compose cli installed.
|
8
|
+
|
9
9
|
Add this line to your application's Gemfile:
|
10
10
|
|
11
11
|
```ruby
|
@@ -22,17 +22,29 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
Intialize the object (crx host, user, and pass are required )
|
26
26
|
|
27
|
-
|
27
|
+
$ client = Aem::Deploy.new({host: '192.168.0.1', user: 'admin', pass: 'admin'})
|
28
|
+
|
29
|
+
Easy Install to CRX (uploads and installs).
|
30
|
+
|
31
|
+
$ client.install_package('/Users/meaton/Desktop/centre.zip')
|
28
32
|
|
29
|
-
|
33
|
+
Upload a package to CRX.
|
30
34
|
|
31
|
-
|
35
|
+
$ client.upload_package('/Users/meaton/Desktop/centre.zip')
|
36
|
+
|
37
|
+
Recompile JSP's
|
38
|
+
|
39
|
+
$ client.recompile_jsps
|
40
|
+
|
41
|
+
|
42
|
+
## Development
|
32
43
|
|
44
|
+
This project is brand new. I plan to incorporate many other methods here.
|
33
45
|
## Contributing
|
34
46
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/
|
47
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/docker_compose_ruby.
|
36
48
|
|
37
49
|
|
38
50
|
## License
|
data/lib/aem-deploy.rb
CHANGED
data/lib/aem/deploy/session.rb
CHANGED
@@ -7,28 +7,47 @@ require 'pry'
|
|
7
7
|
module Aem::Deploy
|
8
8
|
|
9
9
|
class Session
|
10
|
-
attr_reader :host, :user, :pass, :retry
|
10
|
+
attr_reader :host, :user, :pass, :retry, :upload_path
|
11
11
|
|
12
|
-
def initialize(
|
13
|
-
if [:host, :user, :pass].all? {|k|
|
14
|
-
@host =
|
15
|
-
@user =
|
16
|
-
@pass = CGI.escape(
|
17
|
-
@retry =
|
12
|
+
def initialize(params)
|
13
|
+
if [:host, :user, :pass].all? {|k| params.key?(k)}
|
14
|
+
@host = params.fetch(:host)
|
15
|
+
@user = params.fetch(:user)
|
16
|
+
@pass = CGI.escape(params.fetch(:pass))
|
17
|
+
@retry = params.fetch(:retry) unless params[:retry].nil?
|
18
18
|
else
|
19
19
|
raise 'Hostname, User and Password are required'
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
#
|
24
|
-
def
|
23
|
+
#upload and install package
|
24
|
+
def easy_install(package_path)
|
25
|
+
upload_package(package_path)
|
26
|
+
install_package
|
27
|
+
end
|
28
|
+
|
29
|
+
# upload package
|
30
|
+
def upload_package(package_path)
|
25
31
|
upload = RestClient.post("http://#{@user}:#{@pass}@#{@host}/crx/packmgr/service/.json", :cmd => 'upload', :package => File.new(package_path, 'rb'), :force => true, :timeout => 300)
|
26
32
|
parse_response(upload)
|
27
|
-
upload_path = URI.encode(JSON.parse(upload)["path"])
|
28
|
-
|
33
|
+
@upload_path = URI.encode(JSON.parse(upload)["path"])
|
34
|
+
rescue RestClient::RequestTimeout => error
|
35
|
+
{error: error.to_s}.to_json
|
36
|
+
if @retry
|
37
|
+
puts 'retrying installation as there was a problem'
|
38
|
+
retry unless (@retry -= 1).zero?
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Install package
|
43
|
+
def install_package(options = {})
|
44
|
+
if options[:path]
|
45
|
+
@upload_path = options[:path]
|
46
|
+
end
|
47
|
+
install = RestClient.post("http://#{user}:#{pass}@#{host}/crx/packmgr/service/.json#{@upload_path}", :cmd => 'install', :timeout => 300)
|
29
48
|
parse_response(install)
|
30
49
|
rescue RestClient::RequestTimeout => error
|
31
|
-
{
|
50
|
+
{error: error.to_s}.to_json
|
32
51
|
if @retry
|
33
52
|
puts 'retrying installation as there was a problem'
|
34
53
|
retry unless (@retry -= 1).zero?
|
@@ -42,7 +61,7 @@ module Aem::Deploy
|
|
42
61
|
rescue RestClient::Found => error
|
43
62
|
return {msg: 'JSPs recompiled'}.to_json
|
44
63
|
rescue RestClient::RequestTimeout => error
|
45
|
-
{
|
64
|
+
{error: error.to_s}.to_json
|
46
65
|
if @retry
|
47
66
|
puts 'retrying installation as there was a problem'
|
48
67
|
retry unless (@retry -= 1).zero?
|
@@ -54,12 +73,10 @@ module Aem::Deploy
|
|
54
73
|
def parse_response(message)
|
55
74
|
if JSON.parse(message)['success'] == true
|
56
75
|
return " #{message}"
|
57
|
-
elsif JSON.parse(message)['msg'].include?("Package already exists")
|
58
|
-
return " #{message}"
|
59
76
|
elsif message.include? ("302 Found")
|
60
77
|
return ' JSPs Recompiled'
|
61
78
|
else
|
62
|
-
raise "
|
79
|
+
raise " #{JSON.parse(message)}"
|
63
80
|
end
|
64
81
|
end
|
65
82
|
end
|
data/lib/aem/deploy/version.rb
CHANGED