aemninja 0.0.2
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 +7 -0
- data/.gitignore +2 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +62 -0
- data/LICENSE.txt +21 -0
- data/README.md +9 -0
- data/Rakefile +8 -0
- data/aemninja.gemspec +40 -0
- data/bin/aemninja +24 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/aemninja.rb +173 -0
- data/lib/aemninja/aem.rb +102 -0
- data/lib/aemninja/errors.rb +19 -0
- data/lib/aemninja/helpers.rb +30 -0
- data/lib/aemninja/usage.rb +35 -0
- data/lib/aemninja/version.rb +3 -0
- metadata +159 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 623162e0339d1cb1b5f229f9d958b58389e75cb9
|
4
|
+
data.tar.gz: a483f61a00d5c92fe62707a90f8da172686fafc8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: db1658ae63880003c4397d2582995cf29d582b660e2cac5c1991294f7fdb0780ab22d31ab68cb667f5b7568e5cbe01bd6bc4baaa871069b25714b8c048e26ab5
|
7
|
+
data.tar.gz: 1ddc05831fdbb370da7efc80b209434378f0f6fdbf0ecb43d3cb55eefcbd2d1cab514292fa0b1d152f66b1e53bf3624a620e4db6e52726b08da1e0c9a8af64eb
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
aemninja (0.0.1)
|
5
|
+
activesupport (~> 4.2)
|
6
|
+
rest-client (~> 2.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activesupport (4.2.9)
|
12
|
+
i18n (~> 0.7)
|
13
|
+
minitest (~> 5.1)
|
14
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
15
|
+
tzinfo (~> 1.1)
|
16
|
+
addressable (2.5.2)
|
17
|
+
public_suffix (>= 2.0.2, < 4.0)
|
18
|
+
crack (0.4.3)
|
19
|
+
safe_yaml (~> 1.0.0)
|
20
|
+
domain_name (0.5.20170404)
|
21
|
+
unf (>= 0.0.5, < 1.0.0)
|
22
|
+
hashdiff (0.3.6)
|
23
|
+
http-cookie (1.0.3)
|
24
|
+
domain_name (~> 0.5)
|
25
|
+
i18n (0.8.6)
|
26
|
+
mime-types (3.1)
|
27
|
+
mime-types-data (~> 3.2015)
|
28
|
+
mime-types-data (3.2016.0521)
|
29
|
+
minitest (5.10.3)
|
30
|
+
netrc (0.11.0)
|
31
|
+
public_suffix (3.0.0)
|
32
|
+
rake (10.4.2)
|
33
|
+
rest-client (2.0.2)
|
34
|
+
http-cookie (>= 1.0.2, < 2.0)
|
35
|
+
mime-types (>= 1.16, < 4.0)
|
36
|
+
netrc (~> 0.8)
|
37
|
+
safe_yaml (1.0.4)
|
38
|
+
thread_safe (0.3.6)
|
39
|
+
tzinfo (1.2.3)
|
40
|
+
thread_safe (~> 0.1)
|
41
|
+
unf (0.1.4)
|
42
|
+
unf_ext
|
43
|
+
unf_ext (0.0.7.4)
|
44
|
+
vcr (3.0.3)
|
45
|
+
webmock (3.0.1)
|
46
|
+
addressable (>= 2.3.6)
|
47
|
+
crack (>= 0.3.2)
|
48
|
+
hashdiff
|
49
|
+
|
50
|
+
PLATFORMS
|
51
|
+
ruby
|
52
|
+
|
53
|
+
DEPENDENCIES
|
54
|
+
aemninja!
|
55
|
+
bundler (~> 1.13)
|
56
|
+
minitest (~> 5.8)
|
57
|
+
rake (~> 10.0)
|
58
|
+
vcr (~> 3.0)
|
59
|
+
webmock (~> 3.0)
|
60
|
+
|
61
|
+
BUNDLED WITH
|
62
|
+
1.15.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Samuel Fawaz
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
data/aemninja.gemspec
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'aemninja/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "aemninja"
|
8
|
+
spec.version = Aemninja::VERSION
|
9
|
+
spec.authors = ["AEMNinja"]
|
10
|
+
spec.email = ["info@aemninja.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{AEM scripting Gem}
|
13
|
+
spec.description = %q{Reduces complexity of AEM deployments.}
|
14
|
+
spec.homepage = "http://www.github.com/aemninja"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
#if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
# else
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
# "public gem pushes."
|
24
|
+
# end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "bin"
|
30
|
+
spec.executables = ["aemninja"]
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_runtime_dependency "activesupport", "~> 4.2"
|
34
|
+
spec.add_runtime_dependency "rest-client", "~> 2.0"
|
35
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
36
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
37
|
+
spec.add_development_dependency "minitest", "~> 5.8"
|
38
|
+
spec.add_development_dependency "vcr", "~> 3.0"
|
39
|
+
spec.add_development_dependency "webmock", "~> 3.0"
|
40
|
+
end
|
data/bin/aemninja
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'aemninja'
|
4
|
+
|
5
|
+
ARGV << '--help' if ARGV.empty?
|
6
|
+
|
7
|
+
command = ARGV.shift
|
8
|
+
|
9
|
+
aemninja = Aemninja::Application::new
|
10
|
+
|
11
|
+
|
12
|
+
if command == "deploy" then
|
13
|
+
pkg = ARGV.shift || Aemninja::Usage.deploy
|
14
|
+
environment = ARGV.shift || 'local'
|
15
|
+
aemninja.deploy!(pkg, environment)
|
16
|
+
|
17
|
+
elsif command == "init" then
|
18
|
+
aemninja.init!
|
19
|
+
|
20
|
+
else
|
21
|
+
aemninja.no_valid_command
|
22
|
+
end
|
23
|
+
|
24
|
+
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "aemninja"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/aemninja.rb
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
require "aemninja/version"
|
2
|
+
require "aemninja/errors"
|
3
|
+
require "aemninja/helpers"
|
4
|
+
require "aemninja/usage"
|
5
|
+
require "aemninja/aem"
|
6
|
+
require 'fileutils'
|
7
|
+
|
8
|
+
module Aemninja
|
9
|
+
class Configuration
|
10
|
+
attr_accessor :instances
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@instances = nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class << self
|
18
|
+
attr_accessor :configuration
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.configuration
|
22
|
+
@configuration ||= Configuration.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.reset
|
26
|
+
@configuration = Configuration.new
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.configure
|
30
|
+
yield(configuration)
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
class Application
|
35
|
+
|
36
|
+
ROOT_PATH=".aemninja"
|
37
|
+
CONFIG_PATH = File.join(ROOT_PATH, "config")
|
38
|
+
ENVIRONMENTS_PATH = File.join(CONFIG_PATH, "environments")
|
39
|
+
ENVIRONMENT_CONFIG_FILE_LOCAL = File.join(ENVIRONMENTS_PATH, "local.rb")
|
40
|
+
ENVIRONMENT_CONFIG_FILE_STAGING = File.join(ENVIRONMENTS_PATH, "staging.rb")
|
41
|
+
ENVIRONMENT_CONFIG_FILE_PRODUCTION = File.join(ENVIRONMENTS_PATH, "production.rb")
|
42
|
+
|
43
|
+
def init!
|
44
|
+
if File.directory? ROOT_PATH
|
45
|
+
Aemninja::Errors::already_initialized(ROOT_PATH)
|
46
|
+
end
|
47
|
+
|
48
|
+
Aemninja::Helpers::create_directory ROOT_PATH
|
49
|
+
Aemninja::Helpers::create_directory CONFIG_PATH
|
50
|
+
Aemninja::Helpers::create_directory ENVIRONMENTS_PATH
|
51
|
+
|
52
|
+
Aemninja::Helpers::create_file ENVIRONMENT_CONFIG_FILE_LOCAL
|
53
|
+
open(ENVIRONMENT_CONFIG_FILE_LOCAL, 'w') do |f|
|
54
|
+
f.puts 'Aemninja.configure do |config|'
|
55
|
+
f.puts ' config.instances = {'
|
56
|
+
f.puts ' author: { host: "localhost:4502", user: "admin", password: "admin"},'
|
57
|
+
f.puts ' publish: { host: "localhost:4503", user: "admin", password: "admin"}'
|
58
|
+
f.puts ' }'
|
59
|
+
f.puts 'end'
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
Aemninja::Helpers::create_file ENVIRONMENT_CONFIG_FILE_STAGING
|
64
|
+
open(ENVIRONMENT_CONFIG_FILE_STAGING, 'w') do |f|
|
65
|
+
f.puts 'Aemninja.configure do |config|'
|
66
|
+
f.puts ' config.instances = {'
|
67
|
+
f.puts ' author: { host: "localhost:4502", user: "admin", password: "admin"},'
|
68
|
+
f.puts ' publish: { host: "localhost:4503", user: "admin", password: "admin"}'
|
69
|
+
f.puts ' }'
|
70
|
+
f.puts 'end'
|
71
|
+
end
|
72
|
+
|
73
|
+
Aemninja::Helpers::create_file ENVIRONMENT_CONFIG_FILE_PRODUCTION
|
74
|
+
open(ENVIRONMENT_CONFIG_FILE_PRODUCTION, 'w') do |f|
|
75
|
+
f.puts 'Aemninja.configure do |config|'
|
76
|
+
f.puts ' config.instances = {'
|
77
|
+
f.puts ' author: { host: "localhost:4502", user: "admin", password: "admin"},'
|
78
|
+
f.puts ' publish: { host: "localhost:4503", user: "admin", password: "admin"}'
|
79
|
+
f.puts ' }'
|
80
|
+
f.puts 'end'
|
81
|
+
end
|
82
|
+
|
83
|
+
exit 0
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
def deploy!(package, environment='local')
|
88
|
+
|
89
|
+
# Read Environment from Config File
|
90
|
+
#host = "localhost:4503"
|
91
|
+
#user = "admin"
|
92
|
+
#password = "admin"
|
93
|
+
|
94
|
+
|
95
|
+
# Do It
|
96
|
+
if File.exists?(package)
|
97
|
+
if File.file?(package)
|
98
|
+
#puts 'deploy package ' + package + ' to ' + environment
|
99
|
+
|
100
|
+
package_without_path = Aemninja::Helpers::remove_path_from package
|
101
|
+
stripped_pkg = Aemninja::Helpers::remove_path_and_version_from package
|
102
|
+
|
103
|
+
puts "--------------------------------------------------------"
|
104
|
+
puts "Deployment to \'#{environment}\' environment"
|
105
|
+
puts "--------------------------------------------------------"
|
106
|
+
puts
|
107
|
+
puts "Configuration: .aemninja/config/environments/#{environment}.rb"
|
108
|
+
puts
|
109
|
+
|
110
|
+
require "./.aemninja/config/environments/#{environment}.rb"
|
111
|
+
|
112
|
+
Aemninja.configuration.instances.each do |key, array|
|
113
|
+
host = array[:host]
|
114
|
+
user = array[:user]
|
115
|
+
password = array[:password]
|
116
|
+
|
117
|
+
puts
|
118
|
+
puts key.to_s + " [" + host + "]"
|
119
|
+
|
120
|
+
# puts "host: " + host
|
121
|
+
# puts "user: " + user
|
122
|
+
# puts "password: " + password
|
123
|
+
|
124
|
+
installed_package_name = Aem::is_package_installed? host, user, password, stripped_pkg
|
125
|
+
|
126
|
+
if installed_package_name != nil
|
127
|
+
print " uninstall " + installed_package_name + " from " + host
|
128
|
+
rc = Aem::uninstall host, user, password, installed_package_name
|
129
|
+
if rc == true
|
130
|
+
puts " OK"
|
131
|
+
else
|
132
|
+
puts " FAILED"
|
133
|
+
end
|
134
|
+
|
135
|
+
print " delete " + installed_package_name + " from " + host
|
136
|
+
rc = Aem::delete host, user, password, installed_package_name
|
137
|
+
if rc == true
|
138
|
+
puts " OK"
|
139
|
+
else
|
140
|
+
puts " FAILED"
|
141
|
+
end
|
142
|
+
|
143
|
+
else
|
144
|
+
puts " Package " + package_without_path + " not found on " + host + ". Skipping uninstall."
|
145
|
+
end
|
146
|
+
|
147
|
+
print " install " + package + " to " + host
|
148
|
+
rc = Aem::install host, user, password, package
|
149
|
+
if rc == true
|
150
|
+
puts " OK"
|
151
|
+
else
|
152
|
+
puts " FAILED"
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
else
|
159
|
+
Aemninja::Errors::not_a_file(package)
|
160
|
+
end
|
161
|
+
else
|
162
|
+
Aemninja::Errors::does_not_exist(package)
|
163
|
+
end
|
164
|
+
|
165
|
+
exit 0
|
166
|
+
end
|
167
|
+
|
168
|
+
def no_valid_command
|
169
|
+
Aemninja::Usage.commands
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
173
|
+
end
|
data/lib/aemninja/aem.rb
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'RestClient'
|
3
|
+
require 'active_support/core_ext/hash'
|
4
|
+
|
5
|
+
module Aem
|
6
|
+
# is_package_installed?
|
7
|
+
# RestClient.get 'admin:admin@localhost:4502/crx/packmgr/service.jsp', {params: {cmd: 'ls'}}
|
8
|
+
|
9
|
+
# group>adobe/aem6/sample</group>\n
|
10
|
+
# <downloadName>cq-geometrixx-outdoors-ugc-pkg-5.8.18.zip</downloadName>\n
|
11
|
+
|
12
|
+
|
13
|
+
# <crx version="1.4.1" user="admin" workspace="crx.default">
|
14
|
+
# <request>
|
15
|
+
# <param name="cmd" value="ls"/>
|
16
|
+
# </request>
|
17
|
+
# <response>
|
18
|
+
# <data>
|
19
|
+
# <packages>
|
20
|
+
# <package>
|
21
|
+
# <group>Adobe/granite</group>
|
22
|
+
# <name>com.adobe.granite.httpcache.content</name>
|
23
|
+
# <version>1.0.2</version>
|
24
|
+
# <downloadName>com.adobe.granite.httpcache.content-1.0.2.zip</downloadName>
|
25
|
+
# <size>13323</size>
|
26
|
+
# <created>Tue, 25 Feb 2014 11:40:56 +0100</created>
|
27
|
+
# <createdBy>Adobe</createdBy>
|
28
|
+
# <lastModified></lastModified>
|
29
|
+
# <lastModifiedBy>null</lastModifiedBy>
|
30
|
+
# <lastUnpacked>Thu, 10 Aug 2017 13:42:23 +0200</lastUnpacked>
|
31
|
+
# <lastUnpackedBy>admin</lastUnpackedBy>
|
32
|
+
# </package>
|
33
|
+
#
|
34
|
+
# returns adobe/aem6/sample/we.retail.download-1.0.8.zip
|
35
|
+
#
|
36
|
+
def self.is_package_installed? host="localhost:4502", user="admin", password="admin", package
|
37
|
+
response_xml = RestClient.get "#{user}:#{password}@#{host}/crx/packmgr/service.jsp", {params: {cmd: 'ls'}}
|
38
|
+
|
39
|
+
response_hash = Hash.from_xml(response_xml.body)
|
40
|
+
|
41
|
+
installed_packages = response_hash["crx"]["response"]["data"]["packages"]["package"]
|
42
|
+
|
43
|
+
if ary = installed_packages.find { |h| h['downloadName'].include? package }
|
44
|
+
result = ary['group'] + "/" + ary['downloadName']
|
45
|
+
else
|
46
|
+
result = nil
|
47
|
+
end
|
48
|
+
|
49
|
+
result
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.uninstall host="localhost:4502", user="admin", password="admin", package
|
53
|
+
request = RestClient::Request.new(
|
54
|
+
:method => :post,
|
55
|
+
:url => "#{user}:#{password}@#{host}/crx/packmgr/service/.json/etc/packages/#{package}",
|
56
|
+
:payload => {
|
57
|
+
:cmd => 'uninstall'
|
58
|
+
})
|
59
|
+
response = request.execute
|
60
|
+
|
61
|
+
JSON.parse(response)["success"]
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.delete host="localhost:4502", user="admin", password="admin", package
|
65
|
+
request = RestClient::Request.new(
|
66
|
+
:method => :post,
|
67
|
+
:url => "#{user}:#{password}@#{host}/crx/packmgr/service/.json/etc/packages/#{package}",
|
68
|
+
:payload => {
|
69
|
+
:cmd => 'delete'
|
70
|
+
})
|
71
|
+
response = request.execute
|
72
|
+
|
73
|
+
JSON.parse(response)["success"]
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
def self.install host="localhost:4502", user="admin", password="admin", package
|
79
|
+
stripped_pkg = Aemninja::Helpers::remove_path_and_version_from package
|
80
|
+
request = RestClient::Request.new(
|
81
|
+
|
82
|
+
:method => :post,
|
83
|
+
:url => "#{user}:#{password}@#{host}/crx/packmgr/service.jsp",
|
84
|
+
:payload => {
|
85
|
+
:multipart => true,
|
86
|
+
:file => File.new(package, 'rb'),
|
87
|
+
:name => stripped_pkg,
|
88
|
+
:force => true,
|
89
|
+
:install => true
|
90
|
+
})
|
91
|
+
response_xml = request.execute
|
92
|
+
|
93
|
+
#response_hash = Hash.from_xml(response_xml.body)
|
94
|
+
|
95
|
+
if Hash.from_xml(response_xml.body)["crx"]["response"]["status"] == 'ok'
|
96
|
+
return true
|
97
|
+
else
|
98
|
+
return false
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Aemninja
|
2
|
+
module Errors
|
3
|
+
|
4
|
+
def self.not_a_file(path)
|
5
|
+
puts 'ERROR: ' + path + ' is not a file!'
|
6
|
+
exit 1
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.already_initialized(path)
|
10
|
+
puts 'It seems like aemninja has already been initialized in this directory. "' + path + '" folder already exists!'
|
11
|
+
exit 2
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.does_not_exist(path)
|
15
|
+
puts 'ERROR: ' + path + ' does not exist!'
|
16
|
+
exit 3
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module Aemninja
|
4
|
+
module Helpers
|
5
|
+
|
6
|
+
def self.create_directory(name)
|
7
|
+
puts 'create ' + name
|
8
|
+
FileUtils.mkdir_p name
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.create_file(name)
|
12
|
+
puts 'create ' + name
|
13
|
+
FileUtils.touch name
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.remove_path_from package
|
17
|
+
URI(package).path.split('/').last
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.remove_version_from package
|
21
|
+
package.split(/[0-9]/)[0]
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.remove_path_and_version_from package
|
25
|
+
package_without_path = remove_path_from package
|
26
|
+
remove_version_from package_without_path
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Aemninja
|
2
|
+
module Usage
|
3
|
+
|
4
|
+
def self.commands
|
5
|
+
puts
|
6
|
+
puts 'Usage:'
|
7
|
+
puts ' aemninja COMMAND [ARGS]'
|
8
|
+
puts
|
9
|
+
puts 'Available COMMANDs:'
|
10
|
+
puts ' init # creates ".aemninja" base directory'
|
11
|
+
puts ' deploy # deploys package to local or remote AEM instances'
|
12
|
+
puts
|
13
|
+
puts
|
14
|
+
puts
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.deploy
|
18
|
+
puts
|
19
|
+
puts
|
20
|
+
puts 'Usage'
|
21
|
+
puts ' aemninja deploy PATH_TO_PACKAGE [ENVIRONMENT]'
|
22
|
+
puts
|
23
|
+
puts 'Available ARGS are'
|
24
|
+
puts ' aemninja deploy [local] # default, deploys to the AEM instances configured in .aemninja/config/environments/local.rb'
|
25
|
+
puts ' aemninja deploy staging # deploys to the AEM instances configured in .aemninja/config/environments/staging.rb'
|
26
|
+
puts ' aemninja deploy production # deploys to the AEM instances configured in .aemninja/config/environments/production.rb'
|
27
|
+
puts
|
28
|
+
puts
|
29
|
+
puts
|
30
|
+
|
31
|
+
exit 1
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aemninja
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- AEMNinja
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-08-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.13'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.13'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '5.8'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '5.8'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: vcr
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webmock
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.0'
|
111
|
+
description: Reduces complexity of AEM deployments.
|
112
|
+
email:
|
113
|
+
- info@aemninja.com
|
114
|
+
executables:
|
115
|
+
- aemninja
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".gitignore"
|
120
|
+
- Gemfile
|
121
|
+
- Gemfile.lock
|
122
|
+
- LICENSE.txt
|
123
|
+
- README.md
|
124
|
+
- Rakefile
|
125
|
+
- aemninja.gemspec
|
126
|
+
- bin/aemninja
|
127
|
+
- bin/console
|
128
|
+
- bin/setup
|
129
|
+
- lib/aemninja.rb
|
130
|
+
- lib/aemninja/aem.rb
|
131
|
+
- lib/aemninja/errors.rb
|
132
|
+
- lib/aemninja/helpers.rb
|
133
|
+
- lib/aemninja/usage.rb
|
134
|
+
- lib/aemninja/version.rb
|
135
|
+
homepage: http://www.github.com/aemninja
|
136
|
+
licenses:
|
137
|
+
- MIT
|
138
|
+
metadata: {}
|
139
|
+
post_install_message:
|
140
|
+
rdoc_options: []
|
141
|
+
require_paths:
|
142
|
+
- lib
|
143
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
requirements: []
|
154
|
+
rubyforge_project:
|
155
|
+
rubygems_version: 2.6.13
|
156
|
+
signing_key:
|
157
|
+
specification_version: 4
|
158
|
+
summary: AEM scripting Gem
|
159
|
+
test_files: []
|