adobe-aem-api 0.0.1

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 ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDQ2MDAwYmEyNzk5MzJhMzAyNDk5ODhiZWNkZTYwMWI3MjhlZTI2Mg==
5
+ data.tar.gz: !binary |-
6
+ ZTJlODE3YTkzY2Y4MzM5MzIzOWQyMjA0OTM1MDBlNzE3MzkyYzMyMQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZmRlNjI2NGJhZDEzY2E4YzQ4ZTQ2ZjUwZDA3NjJjNWUzNzJlNzIyMDc4MTE3
10
+ NjMzNDgxMDRkYWIzNTUxZGYxZTQ2ZDE2ZDkyMTMzZjUwZjU4MTA1YmY3MmRj
11
+ MjEzMWMzZDIwZmRhNjhhOTM5ODMxZjNiZjY2ZTRiZWQwOGRkNTI=
12
+ data.tar.gz: !binary |-
13
+ NWQxYjQ1NDQ0NmMzZGU0ODFlZWU0MWE5YTRjZGFiMzQ2ZDg3OWNlOTEwODAy
14
+ YzQ0ZDA5MjI3MjAwNjA2NTI3OGEyZGViNTNlYTIwZmE3MzllMThkYWRiMmY3
15
+ MGQxNmQ1MWNjYjg2ZWY4MjQ4YzRiOGY2M2E2OTNjYTJmNmM0ZWU=
data/.gitignore ADDED
@@ -0,0 +1,37 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ # Gemfile.lock
30
+ # .ruby-version
31
+ # .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
35
+
36
+ # RubyMine specific
37
+ .idea
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - jruby-18mode # JRuby in 1.8 mode
5
+ - jruby-19mode # JRuby in 1.9 mode
6
+ - rbx-2.1.1
7
+ - 1.8.7
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in adobe-aem-api.gemspec
4
+ gemspec
5
+
6
+ gem 'rspec'
7
+ gem 'rspec-mocks'
data/Gemfile.lock ADDED
@@ -0,0 +1,59 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ adobe-aem-api (0.0.1)
5
+ nokogiri
6
+ recursive-open-struct
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.3.6)
12
+ crack (0.4.2)
13
+ safe_yaml (~> 1.0.0)
14
+ diff-lcs (1.2.5)
15
+ flexmock (0.9.0)
16
+ metaclass (0.0.4)
17
+ mini_portile (0.5.3)
18
+ mocha (0.13.3)
19
+ metaclass (~> 0.0.1)
20
+ nokogiri (1.6.1)
21
+ mini_portile (~> 0.5.0)
22
+ rack (1.5.2)
23
+ rack-protection (1.5.3)
24
+ rack
25
+ rake (10.0.4)
26
+ recursive-open-struct (0.5.0)
27
+ rr (1.0.5)
28
+ rspec (2.13.0)
29
+ rspec-core (~> 2.13.0)
30
+ rspec-expectations (~> 2.13.0)
31
+ rspec-mocks (~> 2.13.0)
32
+ rspec-core (2.13.1)
33
+ rspec-expectations (2.13.0)
34
+ diff-lcs (>= 1.1.3, < 2.0)
35
+ rspec-mocks (2.13.1)
36
+ safe_yaml (1.0.3)
37
+ sinatra (1.4.5)
38
+ rack (~> 1.4)
39
+ rack-protection (~> 1.4)
40
+ tilt (~> 1.3, >= 1.3.4)
41
+ tilt (1.4.1)
42
+ webmock (1.18.0)
43
+ addressable (>= 2.3.6)
44
+ crack (>= 0.3.2)
45
+
46
+ PLATFORMS
47
+ ruby
48
+
49
+ DEPENDENCIES
50
+ adobe-aem-api!
51
+ bundler (~> 1.6)
52
+ flexmock (~> 0.9.0)
53
+ mocha (~> 0.13.0)
54
+ rake
55
+ rr (~> 1.0.4)
56
+ rspec
57
+ rspec-mocks
58
+ sinatra (~> 1.4.5)
59
+ webmock (~> 1.18.0)
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Stanislaw Wozniak @ telegraph
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Adobe::Aem::Api
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'adobe-aem-api'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install adobe-aem-api
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( https://github.com/[my-github-username]/adobe-aem-api/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'adobe/aem/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'adobe-aem-api'
8
+ spec.version = Adobe::Aem::VERSION
9
+ spec.authors = ['Stanislaw Wozniak']
10
+ spec.email = ['swozniak@sponte.co.uk']
11
+ spec.summary = %q{Adobe AEM Api gem}
12
+ spec.description = %q{Provides functionality to manage Adobe AEM instances.}
13
+ spec.homepage = ''
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.6'
22
+ spec.add_development_dependency 'rake'
23
+
24
+ spec.add_development_dependency 'mocha', '~> 0.13.0'
25
+ spec.add_development_dependency 'rr', '~> 1.0.4'
26
+ spec.add_development_dependency 'flexmock', '~> 0.9.0'
27
+ spec.add_development_dependency 'sinatra', '~>1.4.5'
28
+ spec.add_development_dependency 'webmock', '~>1.18.0'
29
+ spec.add_runtime_dependency 'recursive-open-struct'
30
+ spec.add_runtime_dependency 'nokogiri'
31
+ end
@@ -0,0 +1,10 @@
1
+ require 'ostruct'
2
+ require 'net/http'
3
+ require 'json'
4
+ require 'recursive-open-struct'
5
+ require 'nokogiri'
6
+
7
+ self_dir = File.dirname(__FILE__)
8
+ Dir["#{self_dir}/**/*.rb"].each do |lib|
9
+ require File.expand_path(lib)
10
+ end
@@ -0,0 +1,21 @@
1
+ module Adobe
2
+ module Aem
3
+ class Api
4
+ attr_reader :context
5
+
6
+ def initialize(options = {})
7
+ @context = Context.new
8
+ @context.configuration = Configuration.new(options)
9
+ @context.connector = Connector.new(@context)
10
+ end
11
+
12
+ def replication
13
+ Replication.new(@context)
14
+ end
15
+
16
+ def siteadmin
17
+ SiteAdmin.new(@context)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ module Adobe
2
+ module Aem
3
+ class Configuration
4
+ def initialize(options = {})
5
+ @options = {
6
+ hostname: 'localhost',
7
+ port: 4502,
8
+ username: 'admin',
9
+ password: 'admin',
10
+ http_debug: false
11
+ }.merge(options)
12
+ end
13
+
14
+ def method_missing(name, *args)
15
+ @options[name]
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,125 @@
1
+ module Adobe
2
+ module Aem
3
+ class Connector
4
+ def initialize(context)
5
+ @context = context
6
+ end
7
+
8
+ def get(path)
9
+ get = request(path)
10
+ response = http.request(get)
11
+ verify(response)
12
+
13
+ json = parse_json(response.body)
14
+ Adobe::Aem::Jcr::Node.new(json, path.gsub(/\.\d\.json/i, ''), @context)
15
+ end
16
+
17
+ def set(path, name, value)
18
+ post = if value.is_a?(Hash)
19
+ value = {
20
+ ':content' => value.to_json,
21
+ ':contentType' => 'json',
22
+ ':operation' => 'import'
23
+ }
24
+
25
+ request("#{path}/#{name}", 'POST')
26
+ else
27
+ value = {"./#{name}" => value}
28
+ request(path, 'POST')
29
+ end
30
+
31
+ post.set_form_data(value)
32
+
33
+ response = http.request(post)
34
+ verify(response)
35
+ end
36
+
37
+ def post(path, data, headers = {})
38
+ post = request(path, 'POST')
39
+ post.form_data = data if data
40
+
41
+ response = http.request(post)
42
+ verify(response)
43
+ end
44
+
45
+ def create_page(path, title, label, template, options = {})
46
+ post = request('/bin/wcmcommand', 'POST')
47
+ post.set_form_data({
48
+ cmd: 'createPage',
49
+ parentPath: path,
50
+ title: title,
51
+ label: label,
52
+ replace: true,
53
+ replaceProperties: true,
54
+ template: template
55
+ })
56
+ response = http.request(post)
57
+ verify(response)
58
+
59
+ if options.size > 0
60
+ set path, title, options
61
+ end
62
+
63
+ doc = Nokogiri::HTML(response.body)
64
+ returned_path = doc.css('#Location').attr('href').value
65
+
66
+ get("#{returned_path}.1.json")
67
+ end
68
+
69
+ def delete_page(path)
70
+ post = request('/bin/wcmcommand', 'POST')
71
+ post.set_form_data({
72
+ cmd: 'deletePage',
73
+ force: true,
74
+ path: path
75
+ })
76
+ response = http.request(post)
77
+ verify(response)
78
+ end
79
+
80
+ private
81
+ def request(path, type='GET')
82
+ r = if type == 'GET'
83
+ Net::HTTP::Get.new(path)
84
+ else
85
+ Net::HTTP::Post.new(path)
86
+ end
87
+ r.basic_auth @context.configuration.username, @context.configuration.password
88
+ r['Accept'] = 'application/json'
89
+ r['Content-Type'] = 'application/json'
90
+ r
91
+ end
92
+
93
+ def http
94
+ return @http if @http
95
+
96
+ @http = Net::HTTP.new(@context.configuration.hostname, @context.configuration.port)
97
+ @http.set_debug_output $stderr if @context.configuration.http_debug
98
+ @http
99
+ end
100
+
101
+ def verify(response)
102
+ raise StandardError.new(response.class.to_s) unless
103
+ [Net::HTTPOK, Net::HTTPCreated].include?(response.class)
104
+ end
105
+
106
+ def parse_json(string)
107
+ json = JSON.parse(string)
108
+ json = sanitise_jcr_json(json)
109
+
110
+ json
111
+ end
112
+
113
+ def sanitise_jcr_json(json)
114
+ new_hash = {}
115
+
116
+ json.each do |key, value|
117
+ new_hash[key] = value
118
+ # new_hash[key.gsub(/[^\w]+/, '_')] = value
119
+ end
120
+
121
+ new_hash
122
+ end
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,8 @@
1
+ module Adobe
2
+ module Aem
3
+ class Context
4
+ attr_accessor :configuration
5
+ attr_accessor :connector
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,85 @@
1
+ module Adobe
2
+ module Aem
3
+ module Jcr
4
+ class Node
5
+ def initialize(hash = {}, path, context)
6
+ @context = context
7
+ @path = path
8
+ @data = hash
9
+ end
10
+
11
+ def children
12
+ @data.select do |key, value|
13
+ value.is_a? Hash
14
+ end
15
+ end
16
+
17
+ def jcr_content
18
+ self.send('jcr:content')
19
+ end
20
+
21
+ def jcr_content=(value)
22
+ self.send('jcr:content=', value)
23
+ end
24
+
25
+ def child_exists?(name)
26
+ @data.has_key?(name)
27
+ end
28
+
29
+ def create_child(title, options = {})
30
+ options = {
31
+ title: title,
32
+ label: title,
33
+ template: ''
34
+ }.merge(options)
35
+
36
+ @connector.create_page(@path, options[:title], options[:label], options[:template])
37
+ end
38
+
39
+ def method_missing(name, *args, &block)
40
+ # If we're trying to set content of a node that doesn't exist
41
+ # we should throw exception
42
+ #
43
+ # /bin/wcmcommand
44
+ # cmd:createPage
45
+ # parentPath:/etc/replication/agents.author
46
+ # title:Test
47
+ # label:Test
48
+ # template:/libs/cq/replication/templates/agent
49
+
50
+ setter = name =~ /=$/
51
+
52
+ if name.to_s =~ /^\[\]/
53
+ name = args.delete_at(0)
54
+ end
55
+
56
+ if setter
57
+ return set(name, *args)
58
+ end
59
+
60
+ unless @data[name.to_s].is_a?(Hash)
61
+ return @data[name.to_s]
62
+ end
63
+
64
+ if name.to_s =~ /=$/
65
+
66
+ else
67
+ @context.connector.get("#{@path}/#{name}.1.json")
68
+ end
69
+ end
70
+
71
+ def length
72
+ children.length
73
+ end
74
+ alias :size :length
75
+
76
+ private
77
+ def set(name, value)
78
+ field_name = name.to_s.gsub(/=$/, '')
79
+ puts "Setting #{@path} #{field_name} to #{value}"
80
+ @context.connector.set(@path, field_name, value)
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,23 @@
1
+ module Adobe
2
+ module Aem
3
+ class Replication
4
+ def initialize(context)
5
+ @context = context
6
+ end
7
+
8
+ def agents
9
+ @context.connector.get('/etc/replication.1.json')
10
+ end
11
+
12
+ # AgentyType can be empty for default replication agent, rev for reverse and static for static
13
+ def create_agent(type, name, options = {}, agentType = '')
14
+ # agent, revagent, staticagent
15
+ @context.connector.create_page("/etc/replication/#{type}", name, name, "/libs/cq/replication/templates/#{agentType}agent", options)
16
+ end
17
+
18
+ def delete_agent(type, name)
19
+ @context.connector.delete_page("/etc/replication/#{type}/#{name}")
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,13 @@
1
+ module Adobe
2
+ module Aem
3
+ class SiteAdmin
4
+ def initialize(context)
5
+ @context = context
6
+ end
7
+
8
+ def content
9
+ @context.connector.get('/content.1.json')
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ module Adobe
2
+ module Aem
3
+ module Sling
4
+ module Servlets
5
+ class Post
6
+
7
+ def initialize(context)
8
+ @context = context
9
+ end
10
+
11
+ def create(path, content)
12
+ @context.connector.post(path, {
13
+ content: content.to_json,
14
+ contentType: 'json'
15
+ })
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ module Adobe
2
+ module Aem
3
+ class TreeWalker
4
+ def initialize(context)
5
+ @context = context
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Adobe
2
+ module Aem
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
data/spec/api_spec.rb ADDED
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ module Adobe
4
+ module Aem
5
+ describe Api do
6
+ describe 'Default values' do
7
+ before(:all) do
8
+ @sinatra_app = MockAem.run
9
+ end
10
+
11
+ after(:all) do
12
+ @sinatra_app.quit!
13
+ end
14
+
15
+ subject do
16
+ Adobe::Aem::Api.new
17
+ end
18
+
19
+ it 'should set default values' do
20
+ expect(subject.context.configuration.hostname).to eq('localhost')
21
+ expect(subject.context.configuration.port).to eq(4502)
22
+ expect(subject.context.configuration.username).to eq('admin')
23
+ expect(subject.context.configuration.password).to eq('admin')
24
+ end
25
+ end
26
+
27
+ it 'should expose replication' do
28
+ expect(subject.replication).not_to be_nil
29
+ end
30
+ end
31
+
32
+ describe Replication do
33
+ subject do
34
+ @options = {}
35
+ @options[:port] = 4567
36
+
37
+ Adobe::Aem::Api.new(@options).replication
38
+ end
39
+
40
+ it 'should return list of replication agents' do
41
+ subject.should have_at_least(2).agent_types
42
+ expect(subject).to have_at_least(1).agent_types
43
+
44
+ expect(subject.agents['agents.author']['publish-1']['jcr:content']['jcr:title']).to eq('Publish 1')
45
+ end
46
+
47
+ it 'should create agent' do
48
+ subject.create_agent('agents.author', 'stan')
49
+ end
50
+ end
51
+ end
52
+ end
53
+
@@ -0,0 +1,25 @@
1
+ {
2
+ "jcr:created": "Wed Aug 13 2014 08:47:17 GMT+0000",
3
+ "sling:resourceType": "cq/replication/components/home",
4
+ "jcr:title": "Replication",
5
+ "jcr:createdBy": "admin",
6
+ "jcr:primaryType": "sling:OrderedFolder",
7
+ "treeactivation": {
8
+ "title": "Activate Tree",
9
+ "sling:resourceType": "cq/replication/components/treeactivation",
10
+ "jcr:created": "Wed Aug 13 2014 08:47:17 GMT+0000",
11
+ "jcr:title": "Activate Tree",
12
+ "jcr:primaryType": "sling:Folder",
13
+ "jcr:createdBy": "admin"
14
+ },
15
+ "agents.author": {
16
+ "jcr:created": "Wed Aug 13 2014 08:47:17 GMT+0000",
17
+ "jcr:primaryType": "cq:Page",
18
+ "jcr:createdBy": "admin"
19
+ },
20
+ "agents.publish": {
21
+ "jcr:created": "Wed Aug 13 2014 08:47:17 GMT+0000",
22
+ "jcr:primaryType": "cq:Page",
23
+ "jcr:createdBy": "admin"
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "jcr:created": "Wed Aug 13 2014 09:05:55 GMT+0000",
3
+ "jcr:primaryType": "cq:Page",
4
+ "jcr:createdBy": "admin",
5
+ "jcr:content": {
6
+ "enabled": "true",
7
+ "jcr:description": "Agent that replicates to the default publish instance.",
8
+ "sling:resourceType": "cq/replication/components/agent",
9
+ "jcr:uuid": "24b0a1ed-79a1-4fd2-84b1-c3c7ac2b6f03",
10
+ "jcr:title": "Publish 1",
11
+ "jcr:mixinTypes": ["mix:versionable"],
12
+ "jcr:baseVersion": "db950b25-0639-49b0-a812-9b7388dda1e8",
13
+ "transportUser": "admin",
14
+ "jcr:isCheckedOut": true,
15
+ "jcr:primaryType": "nt:unstructured",
16
+ "cq:template": "/libs/cq/replication/templates/agent",
17
+ "jcr:predecessors": ["db950b25-0639-49b0-a812-9b7388dda1e8"],
18
+ "retryDelay": "60000",
19
+ "jcr:versionHistory": "9816f959-099e-49a5-af3e-8801de61ab83",
20
+ "logLevel": "info",
21
+ "transportPassword": "admin",
22
+ "transportUri": "http://azaem-pub1-test1.awsdev.telegraph.co.uk:4503/bin/receive?sling:authRequestLogin=1",
23
+ "serializationType": "durbo"
24
+ }
25
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "jcr:created": "Wed Aug 13 2014 08:47:17 GMT+0000",
3
+ "jcr:primaryType": "cq:Page",
4
+ "jcr:createdBy": "admin",
5
+ "jcr:content": {
6
+ "sling:resourceType": "cq/replication/components/agents",
7
+ "jcr:title": "Agents on author",
8
+ "jcr:primaryType": "nt:unstructured",
9
+ "cq:template": "/libs/cq/replication/templates/agents"
10
+ },
11
+ "publish-1": {
12
+ "jcr:created": "Wed Aug 13 2014 09:05:55 GMT+0000",
13
+ "jcr:primaryType": "cq:Page",
14
+ "jcr:createdBy": "admin"
15
+ },
16
+ "publish-2": {
17
+ "jcr:created": "Wed Aug 13 2014 09:05:55 GMT+0000",
18
+ "jcr:primaryType": "cq:Page",
19
+ "jcr:createdBy": "admin"
20
+ },
21
+ "publish_reverse": {
22
+ "jcr:created": "Wed Aug 13 2014 08:47:17 GMT+0000",
23
+ "jcr:primaryType": "cq:Page",
24
+ "jcr:createdBy": "admin"
25
+ },
26
+ "static": {
27
+ "jcr:created": "Wed Aug 13 2014 08:47:17 GMT+0000",
28
+ "jcr:primaryType": "cq:Page",
29
+ "jcr:createdBy": "admin"
30
+ },
31
+ "test_and_target": {
32
+ "jcr:created": "Wed Aug 13 2014 08:47:17 GMT+0000",
33
+ "jcr:primaryType": "cq:Page",
34
+ "jcr:createdBy": "admin"
35
+ },
36
+ "offloading_outbox": {"jcr:primaryType": "nt:unstructured"},
37
+ "offloading_853dfded-cdea-40d3-a0cc-22555e90feca": {"jcr:primaryType": "nt:unstructured"},
38
+ "offloading_reverse_853dfded-cdea-40d3-a0cc-22555e90feca": {"jcr:primaryType": "nt:unstructured"}
39
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "jcr:created": "Wed Aug 13 2014 09:05:55 GMT+0000",
3
+ "jcr:primaryType": "cq:Page",
4
+ "jcr:createdBy": "admin",
5
+ "jcr:content": {
6
+ "enabled": "true",
7
+ "jcr:description": "Agent that replicates to the default publish instance.",
8
+ "sling:resourceType": "cq/replication/components/agent",
9
+ "jcr:uuid": "24b0a1ed-79a1-4fd2-84b1-c3c7ac2b6f03",
10
+ "jcr:title": "Publish 1",
11
+ "jcr:mixinTypes": ["mix:versionable"],
12
+ "jcr:baseVersion": "db950b25-0639-49b0-a812-9b7388dda1e8",
13
+ "transportUser": "admin",
14
+ "jcr:isCheckedOut": true,
15
+ "jcr:primaryType": "nt:unstructured",
16
+ "cq:template": "/libs/cq/replication/templates/agent",
17
+ "jcr:predecessors": ["db950b25-0639-49b0-a812-9b7388dda1e8"],
18
+ "retryDelay": "60000",
19
+ "jcr:versionHistory": "9816f959-099e-49a5-af3e-8801de61ab83",
20
+ "logLevel": "info",
21
+ "transportPassword": "admin",
22
+ "transportUri": "http://azaem-pub1-test1.awsdev.telegraph.co.uk:4503/bin/receive?sling:authRequestLogin=1",
23
+ "serializationType": "durbo"
24
+ }
25
+ }
@@ -0,0 +1,10 @@
1
+ require 'sinatra/base'
2
+
3
+ class MockAem < Sinatra::Application
4
+ use Rack::Auth::Basic, 'Restricted Area' do |username, password|
5
+ username == 'admin' and password == 'admin'
6
+ end
7
+
8
+ set :static, true
9
+ set :public_folder, File.join(File.dirname(__FILE__), '../data')
10
+ end
@@ -0,0 +1,12 @@
1
+ require 'rubygems' if RUBY_VERSION.to_f < 1.9
2
+
3
+ require 'adobe-aem-api'
4
+ require 'webmock/rspec'
5
+
6
+ require 'helpers/mock_aem'
7
+
8
+ RSpec.configure do |config|
9
+ config.before(:each) do
10
+ stub_request(:any, //).to_rack(MockAem)
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,203 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: adobe-aem-api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Stanislaw Wozniak
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: mocha
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 0.13.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.13.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rr
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.4
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 1.0.4
69
+ - !ruby/object:Gem::Dependency
70
+ name: flexmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 0.9.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 0.9.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: sinatra
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 1.4.5
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: 1.4.5
97
+ - !ruby/object:Gem::Dependency
98
+ name: webmock
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 1.18.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 1.18.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: recursive-open-struct
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: nokogiri
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ! '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: Provides functionality to manage Adobe AEM instances.
140
+ email:
141
+ - swozniak@sponte.co.uk
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - .gitignore
147
+ - .travis.yml
148
+ - Gemfile
149
+ - Gemfile.lock
150
+ - LICENSE.txt
151
+ - README.md
152
+ - Rakefile
153
+ - adobe-aem-api.gemspec
154
+ - lib/adobe-aem-api.rb
155
+ - lib/adobe/aem/api.rb
156
+ - lib/adobe/aem/configuration.rb
157
+ - lib/adobe/aem/connector.rb
158
+ - lib/adobe/aem/context.rb
159
+ - lib/adobe/aem/jcr/node.rb
160
+ - lib/adobe/aem/replication.rb
161
+ - lib/adobe/aem/site_admin.rb
162
+ - lib/adobe/aem/sling/servlets/post.rb
163
+ - lib/adobe/aem/tree_walker.rb
164
+ - lib/adobe/aem/version.rb
165
+ - spec/api_spec.rb
166
+ - spec/data/etc/replication.1.json
167
+ - spec/data/etc/replication/agent.json
168
+ - spec/data/etc/replication/agents.author.1.json
169
+ - spec/data/etc/replication/agents.author/publish-1.1.json
170
+ - spec/helpers/mock_aem.rb
171
+ - spec/spec_helper.rb
172
+ homepage: ''
173
+ licenses:
174
+ - MIT
175
+ metadata: {}
176
+ post_install_message:
177
+ rdoc_options: []
178
+ require_paths:
179
+ - lib
180
+ required_ruby_version: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - ! '>='
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
+ required_rubygems_version: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ requirements: []
191
+ rubyforge_project:
192
+ rubygems_version: 2.2.2
193
+ signing_key:
194
+ specification_version: 4
195
+ summary: Adobe AEM Api gem
196
+ test_files:
197
+ - spec/api_spec.rb
198
+ - spec/data/etc/replication.1.json
199
+ - spec/data/etc/replication/agent.json
200
+ - spec/data/etc/replication/agents.author.1.json
201
+ - spec/data/etc/replication/agents.author/publish-1.1.json
202
+ - spec/helpers/mock_aem.rb
203
+ - spec/spec_helper.rb