aem-deploy 0.1.0 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/Gemfile +1 -1
- data/aem-deploy.gemspec +1 -1
- data/lib/.DS_Store +0 -0
- data/lib/aem-deploy.rb +13 -0
- data/lib/aem/.DS_Store +0 -0
- data/lib/aem/deploy.rb +1 -11
- data/lib/aem/deploy/session.rb +28 -26
- data/lib/aem/deploy/version.rb +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ab22c76d3236da230581e43fe0a2ffd5a0fa6b3
|
4
|
+
data.tar.gz: 70ca68c9afb7889ccc9d65e5a78b1b7957621fee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d102bdce92580b57ba324ef46a06e2d9c4ed95a051669f583d5f1f71b6f59526d4ad19d2de46af907eeb1b1d41d88750fe1b268a0c6e41009a08dee1661cd782
|
7
|
+
data.tar.gz: ddcd24ee30d71e6a47c2d4450474004c39fb2459d9ce01d6af97a883acfb95768c026d6ad35f14750e454ae6bd2da89ecc7fa26fe4ea80318208c595b6f9d7e7
|
data/.DS_Store
ADDED
Binary file
|
data/Gemfile
CHANGED
data/aem-deploy.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
# delete this section to allow pushing this gem to any host.
|
19
19
|
|
20
20
|
|
21
|
-
spec.files =
|
21
|
+
spec.files = ["lib/aem-deploy.rb",`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }]
|
22
22
|
spec.bindir = "exe"
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ["lib"]
|
data/lib/.DS_Store
ADDED
Binary file
|
data/lib/aem-deploy.rb
ADDED
data/lib/aem/.DS_Store
ADDED
Binary file
|
data/lib/aem/deploy.rb
CHANGED
data/lib/aem/deploy/session.rb
CHANGED
@@ -2,62 +2,64 @@ require 'rest_client'
|
|
2
2
|
require 'open-uri'
|
3
3
|
require 'uri'
|
4
4
|
require 'cgi'
|
5
|
-
require 'yaml'
|
6
|
-
require 'rake'
|
7
|
-
require 'erb'
|
8
5
|
require 'json'
|
9
|
-
|
6
|
+
require 'pry'
|
10
7
|
module Aem::Deploy
|
11
8
|
|
12
|
-
|
13
9
|
class Session
|
14
10
|
attr_reader :host, :user, :pass, :retry
|
15
11
|
|
16
|
-
def initialize(
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
def initialize(options)
|
13
|
+
if [:host, :user, :pass].all? {|k| options.key?(k)}
|
14
|
+
@host = options.fetch(:host)
|
15
|
+
@user = options.fetch(:user)
|
16
|
+
@pass = CGI.escape(options.fetch(:pass))
|
17
|
+
@retry = options.fetch(:retry) unless options[:retry].nil?
|
18
|
+
else
|
19
|
+
raise 'Hostname, User and Password are required'
|
20
|
+
end
|
21
21
|
end
|
22
22
|
|
23
23
|
# Install latest package to CMS
|
24
24
|
def install_package(package_path)
|
25
|
-
|
26
|
-
upload = RestClient.post("http://#{@user}:#{@pass}@#{@host}/crx/packmgr/service/.json", :cmd => 'upload', :package => File.new(package_path, 'rb'), :timeout => 300)
|
25
|
+
upload = RestClient.post("http://#{@user}:#{@pass}@#{@host}/crx/packmgr/service/.json", :cmd => 'upload', :package => File.new(package_path, 'rb'), :force => true, :timeout => 300)
|
27
26
|
parse_response(upload)
|
28
|
-
upload_path = JSON.parse(upload)["path"]
|
27
|
+
upload_path = URI.encode(JSON.parse(upload)["path"])
|
29
28
|
install = RestClient.post("http://#{user}:#{pass}@#{host}/crx/packmgr/service/.json#{upload_path}", :cmd => 'install', :timeout => 300)
|
30
29
|
parse_response(install)
|
31
30
|
rescue RestClient::RequestTimeout => error
|
32
|
-
|
33
|
-
|
31
|
+
{msg: error.to_s}.to_json
|
32
|
+
if @retry
|
33
|
+
puts 'retrying installation as there was a problem'
|
34
|
+
retry unless (@retry -= 1).zero?
|
34
35
|
end
|
35
|
-
return {msg: error.to_s}.to_json
|
36
36
|
end
|
37
37
|
|
38
38
|
# Recompiles JSPs on CMS
|
39
|
-
def recompile_jsps
|
39
|
+
def recompile_jsps
|
40
40
|
begin
|
41
|
-
RestClient.post "http://#{user}:#{
|
41
|
+
RestClient.post "http://#{@user}:#{@pass}@#{@host}/system/console/slingjsp", :cmd => 'recompile', :timeout => 120
|
42
42
|
rescue RestClient::Found => error
|
43
|
-
return {msg:
|
43
|
+
return {msg: 'JSPs recompiled'}.to_json
|
44
44
|
rescue RestClient::RequestTimeout => error
|
45
|
-
|
46
|
-
retry
|
47
|
-
|
45
|
+
{msg: error.to_s}.to_json
|
46
|
+
if @retry
|
47
|
+
puts 'retrying installation as there was a problem'
|
48
|
+
retry unless (@retry -= 1).zero?
|
49
|
+
end
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|
51
53
|
# Checks response of any request to CMS. Breaks script if unexpected response.
|
52
54
|
def parse_response(message)
|
53
55
|
if JSON.parse(message)['success'] == true
|
54
|
-
|
56
|
+
return " #{message}"
|
55
57
|
elsif JSON.parse(message)['msg'].include?("Package already exists")
|
56
|
-
|
58
|
+
return " #{message}"
|
57
59
|
elsif message.include? ("302 Found")
|
58
|
-
|
60
|
+
return ' JSPs Recompiled'
|
59
61
|
else
|
60
|
-
|
62
|
+
raise " It looks there was a problem uploading/installing the package #{JSON.parse(message)}"
|
61
63
|
end
|
62
64
|
end
|
63
65
|
end
|
data/lib/aem/deploy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aem-deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mitch Eaton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -45,6 +45,7 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
+
- ".DS_Store"
|
48
49
|
- ".gitignore"
|
49
50
|
- Gemfile
|
50
51
|
- LICENSE.txt
|
@@ -53,6 +54,9 @@ files:
|
|
53
54
|
- aem-deploy.gemspec
|
54
55
|
- bin/console
|
55
56
|
- bin/setup
|
57
|
+
- lib/.DS_Store
|
58
|
+
- lib/aem-deploy.rb
|
59
|
+
- lib/aem/.DS_Store
|
56
60
|
- lib/aem/deploy.rb
|
57
61
|
- lib/aem/deploy/session.rb
|
58
62
|
- lib/aem/deploy/version.rb
|
@@ -76,9 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
80
|
version: '0'
|
77
81
|
requirements: []
|
78
82
|
rubyforge_project:
|
79
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.5.1
|
80
84
|
signing_key:
|
81
85
|
specification_version: 4
|
82
86
|
summary: A gem to wrap deployments to Adobe Experience Manager
|
83
87
|
test_files: []
|
84
|
-
has_rdoc:
|