ruby_aem 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/conf/spec.yaml +581 -0
- data/lib/ruby_aem/bundle.rb +48 -0
- data/lib/ruby_aem/client.rb +131 -0
- data/lib/ruby_aem/config_property.rb +53 -0
- data/lib/ruby_aem/flush_agent.rb +65 -0
- data/lib/ruby_aem/group.rb +101 -0
- data/lib/ruby_aem/handlers/file.rb +42 -0
- data/lib/ruby_aem/handlers/html.rb +46 -0
- data/lib/ruby_aem/handlers/json.rb +96 -0
- data/lib/ruby_aem/handlers/simple.rb +41 -0
- data/lib/ruby_aem/handlers/xml.rb +50 -0
- data/lib/ruby_aem/node.rb +63 -0
- data/lib/ruby_aem/package.rb +187 -0
- data/lib/ruby_aem/path.rb +46 -0
- data/lib/ruby_aem/replication_agent.rb +65 -0
- data/lib/ruby_aem/repository.rb +45 -0
- data/lib/ruby_aem/result.rb +66 -0
- data/lib/ruby_aem/swagger.rb +51 -0
- data/lib/ruby_aem/user.rb +110 -0
- data/lib/ruby_aem.rb +163 -0
- metadata +147 -0
data/lib/ruby_aem.rb
ADDED
@@ -0,0 +1,163 @@
|
|
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 'ruby_aem/bundle'
|
18
|
+
require 'ruby_aem/client'
|
19
|
+
require 'ruby_aem/config_property'
|
20
|
+
require 'ruby_aem/flush_agent'
|
21
|
+
require 'ruby_aem/group'
|
22
|
+
require 'ruby_aem/node'
|
23
|
+
require 'ruby_aem/package'
|
24
|
+
require 'ruby_aem/path'
|
25
|
+
require 'ruby_aem/replication_agent'
|
26
|
+
require 'ruby_aem/repository'
|
27
|
+
require 'ruby_aem/user'
|
28
|
+
require 'swagger_aem'
|
29
|
+
require 'yaml'
|
30
|
+
|
31
|
+
module RubyAem
|
32
|
+
# Aem class represents an AEM client instance.
|
33
|
+
class Aem
|
34
|
+
|
35
|
+
# Initialise a Ruby AEM instance.
|
36
|
+
#
|
37
|
+
# @param conf configuration hash of the following configuration values:
|
38
|
+
# - username: username used to authenticate to AEM instance
|
39
|
+
# - password: password used to authenticate to AEM instance
|
40
|
+
# - protocol: AEM instance protocol (http or https)
|
41
|
+
# - host: AEM instance host name
|
42
|
+
# - port: AEM instance port
|
43
|
+
# - debug: if true, then additional debug messages will be included
|
44
|
+
# @return new RubyAem::Aem instance
|
45
|
+
def initialize(conf = {})
|
46
|
+
|
47
|
+
conf[:username] ||= 'admin'
|
48
|
+
conf[:password] ||= 'admin'
|
49
|
+
conf[:protocol] ||= 'http'
|
50
|
+
conf[:host] ||= 'localhost'
|
51
|
+
conf[:port] ||= 4502
|
52
|
+
conf[:debug] ||= false
|
53
|
+
|
54
|
+
SwaggerAemClient.configure { |swagger_conf| [
|
55
|
+
swagger_conf.host = "#{conf[:protocol]}://#{conf[:host]}:#{conf[:port]}",
|
56
|
+
swagger_conf.username = conf[:username],
|
57
|
+
swagger_conf.password = conf[:password],
|
58
|
+
swagger_conf.debugging = conf[:debug],
|
59
|
+
swagger_conf.params_encoding = :multi
|
60
|
+
]}
|
61
|
+
|
62
|
+
apis = {
|
63
|
+
:console => SwaggerAemClient::ConsoleApi.new,
|
64
|
+
:cq => SwaggerAemClient::CqApi.new,
|
65
|
+
:crx => SwaggerAemClient::CrxApi.new,
|
66
|
+
:sling => SwaggerAemClient::SlingApi.new
|
67
|
+
}
|
68
|
+
|
69
|
+
spec = YAML.load_file(File.expand_path('../../conf/spec.yaml', __FILE__))
|
70
|
+
|
71
|
+
@client = RubyAem::Client.new(apis, spec)
|
72
|
+
end
|
73
|
+
|
74
|
+
# Create a bundle instance.
|
75
|
+
#
|
76
|
+
# @param name the bundle's name, e.g. com.adobe.cq.social.cq-social-forum
|
77
|
+
# @return new RubyAem::Bundle instance
|
78
|
+
def bundle(name)
|
79
|
+
RubyAem::Bundle.new(@client, name)
|
80
|
+
end
|
81
|
+
|
82
|
+
# Create a path instance.
|
83
|
+
#
|
84
|
+
# @param name the name of the path, e.g. /etc/designs
|
85
|
+
# @return new RubyAem::Path instance
|
86
|
+
def path(name)
|
87
|
+
RubyAem::Path.new(@client, name)
|
88
|
+
end
|
89
|
+
|
90
|
+
# Create a config property instance.
|
91
|
+
#
|
92
|
+
# @param name the property's name
|
93
|
+
# @param type the property's type, e.g. Boolean
|
94
|
+
# @param value the property's value, e.g. true
|
95
|
+
# @return new RubyAem::ConfigProperty instance
|
96
|
+
def config_property(name, type, value)
|
97
|
+
RubyAem::ConfigProperty.new(@client, name, type, value)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Create a flush agent instance.
|
101
|
+
#
|
102
|
+
# @param run_mode AEM run mode: author or publish
|
103
|
+
# @param name the flush agent's name, e.g. some-flush-agent
|
104
|
+
# @return new RubyAem::FlushAgent instance
|
105
|
+
def flush_agent(name, run_mode)
|
106
|
+
RubyAem::FlushAgent.new(@client, name, run_mode)
|
107
|
+
end
|
108
|
+
|
109
|
+
# Create a group instance.
|
110
|
+
#
|
111
|
+
# @param path the path to group node, e.g. /home/groups/s/
|
112
|
+
# @param name the name of the AEM group, e.g. somegroup
|
113
|
+
# @return new RubyAem::Group instance
|
114
|
+
def group(path, name)
|
115
|
+
RubyAem::Group.new(@client, path, name)
|
116
|
+
end
|
117
|
+
|
118
|
+
# Create a node instance.
|
119
|
+
#
|
120
|
+
# @param path the path to the node, e.g. /apps/system/
|
121
|
+
# @param name the node name, e.g. somenode
|
122
|
+
# @return new RubyAem::Node instance
|
123
|
+
def node(path, name)
|
124
|
+
RubyAem::Node.new(@client, path, name)
|
125
|
+
end
|
126
|
+
|
127
|
+
# Create a package instance.
|
128
|
+
#
|
129
|
+
# @param group_name the group name of the package, e.g. somepackagegroup
|
130
|
+
# @param package_name the name of the package, e.g. somepackage
|
131
|
+
# @param package_version the version of the package, e.g. 1.2.3
|
132
|
+
# @return new RubyAem::Package instance
|
133
|
+
def package(group_name, package_name, package_version)
|
134
|
+
RubyAem::Package.new(@client, group_name, package_name, package_version)
|
135
|
+
end
|
136
|
+
|
137
|
+
# Create a replication agent instance.
|
138
|
+
#
|
139
|
+
# @param run_mode AEM run mode: author or publish
|
140
|
+
# @param name the replication agent's name, e.g. some-replication-agent
|
141
|
+
# @return new RubyAem::ReplicationAgent instance
|
142
|
+
def replication_agent(name, run_mode)
|
143
|
+
RubyAem::ReplicationAgent.new(@client, name, run_mode)
|
144
|
+
end
|
145
|
+
|
146
|
+
# Create a repository instance.
|
147
|
+
#
|
148
|
+
# @return new RubyAem::Repository instance
|
149
|
+
def repository
|
150
|
+
RubyAem::Repository.new(@client)
|
151
|
+
end
|
152
|
+
|
153
|
+
# Create a user instance.
|
154
|
+
#
|
155
|
+
# @param path the path to user node, e.g. /home/users/s/
|
156
|
+
# @param name the username of the AEM user, e.g. someuser, admin, johncitizen
|
157
|
+
# @return new RubyAem::User instance
|
158
|
+
def user(path, name)
|
159
|
+
RubyAem::User.new(@client, path, name)
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
163
|
+
end
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby_aem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shine Solutions
|
8
|
+
- Cliffano Subagio
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2016-09-12 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: nokogiri
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.6'
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.6.8
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
requirements:
|
28
|
+
- - "~>"
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '1.6'
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.6.8
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: swagger_aem
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.9'
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.9.1
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - "~>"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0.9'
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.9.1
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: rspec
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '3.4'
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 3.4.0
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '3.4'
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: 3.4.0
|
74
|
+
- !ruby/object:Gem::Dependency
|
75
|
+
name: yard
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0.9'
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 0.9.5
|
84
|
+
type: :development
|
85
|
+
prerelease: false
|
86
|
+
version_requirements: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0.9'
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.9.5
|
94
|
+
description: ruby_aem is a Ruby client for Adobe Experience Manager (AEM) API, written
|
95
|
+
on top of swagger_aem
|
96
|
+
email:
|
97
|
+
- opensource@shinesolutions.com
|
98
|
+
- cliffano@gmail.com
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files: []
|
102
|
+
files:
|
103
|
+
- conf/spec.yaml
|
104
|
+
- lib/ruby_aem.rb
|
105
|
+
- lib/ruby_aem/bundle.rb
|
106
|
+
- lib/ruby_aem/client.rb
|
107
|
+
- lib/ruby_aem/config_property.rb
|
108
|
+
- lib/ruby_aem/flush_agent.rb
|
109
|
+
- lib/ruby_aem/group.rb
|
110
|
+
- lib/ruby_aem/handlers/file.rb
|
111
|
+
- lib/ruby_aem/handlers/html.rb
|
112
|
+
- lib/ruby_aem/handlers/json.rb
|
113
|
+
- lib/ruby_aem/handlers/simple.rb
|
114
|
+
- lib/ruby_aem/handlers/xml.rb
|
115
|
+
- lib/ruby_aem/node.rb
|
116
|
+
- lib/ruby_aem/package.rb
|
117
|
+
- lib/ruby_aem/path.rb
|
118
|
+
- lib/ruby_aem/replication_agent.rb
|
119
|
+
- lib/ruby_aem/repository.rb
|
120
|
+
- lib/ruby_aem/result.rb
|
121
|
+
- lib/ruby_aem/swagger.rb
|
122
|
+
- lib/ruby_aem/user.rb
|
123
|
+
homepage: https://github.com/shinesolutions/ruby_aem
|
124
|
+
licenses:
|
125
|
+
- Apache 2.0
|
126
|
+
metadata: {}
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options: []
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '1.9'
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
requirements: []
|
142
|
+
rubyforge_project:
|
143
|
+
rubygems_version: 2.2.2
|
144
|
+
signing_key:
|
145
|
+
specification_version: 4
|
146
|
+
summary: AEM API Ruby client
|
147
|
+
test_files: []
|