eclix 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +121 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +26 -0
- data/Rakefile +6 -0
- data/bin/eclix +62 -0
- data/eclix.gemspec +35 -0
- data/lib/eclix.rb +4 -0
- data/lib/eclix/domain.rb +18 -0
- data/lib/eclix/publication_creator.rb +140 -0
- data/lib/eclix/sync.rb +79 -0
- data/lib/eclix/version.rb +3 -0
- data/spec/domain_spec.rb +22 -0
- data/spec/publication_creator_spec.rb +37 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/sync_spec.rb +43 -0
- metadata +249 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 259e884960bd89b4d471fc53bc212818796fcd7c
|
4
|
+
data.tar.gz: e5d805e610e2fb85f732087e9c09da077328de6e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: df5b138e8dc9fe0a12d33c91138980ebe950551a8130e75258490a1c86f80ae879a6d2dd77f87605f3b20e70293626992e999c65a1ce6f6a893ef63bfd6d084b
|
7
|
+
data.tar.gz: b70af3cf7805715f0f2d5eefbade1c9b3d143f0fb7fee5ef5d1f2963ac2a6d05f0bd67a5c8a3f8a28b49443d09bc4a777d551f85760bffa91db97311ef18b557
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
# Created by https://www.gitignore.io
|
2
|
+
|
3
|
+
### Ruby ###
|
4
|
+
*.gem
|
5
|
+
*.rbc
|
6
|
+
/.config
|
7
|
+
/coverage/
|
8
|
+
/InstalledFiles
|
9
|
+
/pkg/
|
10
|
+
/spec/reports/
|
11
|
+
/test/tmp/
|
12
|
+
/test/version_tmp/
|
13
|
+
/tmp/
|
14
|
+
Gemfile.lock
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
|
21
|
+
## Documentation cache and generated files:
|
22
|
+
/.yardoc/
|
23
|
+
/_yardoc/
|
24
|
+
/doc/
|
25
|
+
/rdoc/
|
26
|
+
|
27
|
+
## Environment normalisation:
|
28
|
+
/.bundle/
|
29
|
+
/lib/bundler/man/
|
30
|
+
|
31
|
+
# for a library or gem, you might want to ignore these files since the code is
|
32
|
+
# intended to run in multiple environments; otherwise, check them in:
|
33
|
+
# Gemfile.lock
|
34
|
+
# .ruby-version
|
35
|
+
# .ruby-gemset
|
36
|
+
|
37
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
38
|
+
.rvmrc
|
39
|
+
|
40
|
+
|
41
|
+
### Intellij ###
|
42
|
+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
|
43
|
+
|
44
|
+
*.iml
|
45
|
+
|
46
|
+
## Directory-based project format:
|
47
|
+
.idea/
|
48
|
+
# if you remove the above rule, at least ignore the following:
|
49
|
+
|
50
|
+
# User-specific stuff:
|
51
|
+
# .idea/workspace.xml
|
52
|
+
# .idea/tasks.xml
|
53
|
+
# .idea/dictionaries
|
54
|
+
|
55
|
+
# Sensitive or high-churn files:
|
56
|
+
# .idea/dataSources.ids
|
57
|
+
# .idea/dataSources.xml
|
58
|
+
# .idea/sqlDataSources.xml
|
59
|
+
# .idea/dynamic.xml
|
60
|
+
# .idea/uiDesigner.xml
|
61
|
+
|
62
|
+
# Gradle:
|
63
|
+
# .idea/gradle.xml
|
64
|
+
# .idea/libraries
|
65
|
+
|
66
|
+
# Mongo Explorer plugin:
|
67
|
+
# .idea/mongoSettings.xml
|
68
|
+
|
69
|
+
## File-based project format:
|
70
|
+
*.ipr
|
71
|
+
*.iws
|
72
|
+
|
73
|
+
## Plugin-specific files:
|
74
|
+
|
75
|
+
# IntelliJ
|
76
|
+
out/
|
77
|
+
|
78
|
+
# mpeltonen/sbt-idea plugin
|
79
|
+
.idea_modules/
|
80
|
+
|
81
|
+
# JIRA plugin
|
82
|
+
atlassian-ide-plugin.xml
|
83
|
+
|
84
|
+
# Crashlytics plugin (for Android Studio and IntelliJ)
|
85
|
+
com_crashlytics_export_strings.xml
|
86
|
+
crashlytics.properties
|
87
|
+
crashlytics-build.properties
|
88
|
+
|
89
|
+
|
90
|
+
### OSX ###
|
91
|
+
.DS_Store
|
92
|
+
.AppleDouble
|
93
|
+
.LSOverride
|
94
|
+
|
95
|
+
# Icon must end with two \r
|
96
|
+
Icon
|
97
|
+
|
98
|
+
|
99
|
+
# Thumbnails
|
100
|
+
._*
|
101
|
+
|
102
|
+
# Files that might appear on external disk
|
103
|
+
.Spotlight-V100
|
104
|
+
.Trashes
|
105
|
+
|
106
|
+
# Directories potentially created on remote AFP share
|
107
|
+
.AppleDB
|
108
|
+
.AppleDesktop
|
109
|
+
Network Trash Folder
|
110
|
+
Temporary Items
|
111
|
+
.apdisk
|
112
|
+
|
113
|
+
|
114
|
+
### Vim ###
|
115
|
+
[._]*.s[a-w][a-z]
|
116
|
+
[._]s[a-w][a-z]
|
117
|
+
*.un~
|
118
|
+
Session.vim
|
119
|
+
.netrwhist
|
120
|
+
*~
|
121
|
+
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Piotr Limanowski
|
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,26 @@
|
|
1
|
+
ECLIx
|
2
|
+
===========
|
3
|
+
|
4
|
+
## Escenic CLI not mouseclix
|
5
|
+
|
6
|
+
The gem is a CLI interface for Escenic CMS. For now it provides basic functionalities like adding publications, bacis syncing static content.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Execute following command:
|
11
|
+
|
12
|
+
$ gem install eclix
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
|
16
|
+
To see detailed documentation execute:
|
17
|
+
|
18
|
+
$ eclix -h
|
19
|
+
|
20
|
+
## Contributing
|
21
|
+
|
22
|
+
1. Fork it ( https://github.com/[my-github-username]/eclix/fork )
|
23
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
24
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
25
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
26
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/eclix
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'commander/import'
|
4
|
+
require 'Eclix'
|
5
|
+
|
6
|
+
program :name, 'ECLIx'
|
7
|
+
program :version, '0.1.0'
|
8
|
+
program :description, 'Escenic CLI mode'
|
9
|
+
|
10
|
+
command :mkpub do |c|
|
11
|
+
c.syntax = 'eclix mkpub'
|
12
|
+
c.description = 'Creates a new publication'
|
13
|
+
c.option '--host STRING', String, 'Hostname on which Escenic server is running'
|
14
|
+
c.option '--port PORT_NUMBER', Integer, 'Port on which Escenic server is running'
|
15
|
+
c.option '--war STRING', String, 'Name of the WAR containing content definitions'
|
16
|
+
c.option '--publication STRING', String, 'Name of the publication to create'
|
17
|
+
c.action do |args, options|
|
18
|
+
options.default \
|
19
|
+
:host => 'localhost',
|
20
|
+
:port => 8080,
|
21
|
+
:war => 'shared-war.war',
|
22
|
+
:publication_name => 'demo'
|
23
|
+
|
24
|
+
resources = Resources.new(file=options.war)
|
25
|
+
publication = Publication.new(options.publication_name)
|
26
|
+
server = Server.new(options.port, options.host)
|
27
|
+
escenic = Escenic.new(options.server)
|
28
|
+
creator = Publication_Creator.new(options.escenic)
|
29
|
+
creator.new_publication(options.resources, options.publication)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
command :static do |c|
|
34
|
+
c.syntax = 'eclix static'
|
35
|
+
c.description = 'Performs operations on static content'
|
36
|
+
c.option '--local_dir STRING', String, 'Manually sets local dir to publication'
|
37
|
+
c.option '--host STRING', String, 'Hostname on which Escenic server is listening'
|
38
|
+
c.option '--port PORT_NUM', Integer, 'Port on which *SSH* server is listening'
|
39
|
+
c.option '--user STRING', String, 'Username for *SSH* user to remote server'
|
40
|
+
c.option '--pass STRING', String, 'Password for *SSH* connection'
|
41
|
+
c.option '--publications STRING STRING', Array, 'List of publications to sync'
|
42
|
+
c.option '--remote_name STRING', String, 'Name of the remote Escenic instance to sync with'
|
43
|
+
c.action do |args, options|
|
44
|
+
options.default \
|
45
|
+
:name => 'engine1',
|
46
|
+
:host => 'localhost',
|
47
|
+
:port => 2222,
|
48
|
+
:user => 'escenic',
|
49
|
+
:pass => '',
|
50
|
+
:local_dir => "#{Dir.pwd}/app",
|
51
|
+
:publication_names => ['demo']
|
52
|
+
|
53
|
+
credentials = Eclix::Credentials.new(options.user, options.pass)
|
54
|
+
|
55
|
+
local = Eclix::Local.new(options.local_dir)
|
56
|
+
remote = Eclix::Remote.new(options.name, options.host, options.port, credentials)
|
57
|
+
env = Eclix::Environment.new(remote, local, options.publication_names)
|
58
|
+
|
59
|
+
uploader = Eclix::Uploader.new
|
60
|
+
uploader.upload(env)
|
61
|
+
end
|
62
|
+
end
|
data/eclix.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'eclix/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "eclix"
|
8
|
+
spec.version = Eclix::VERSION
|
9
|
+
spec.authors = ["Piotr Limanowski"]
|
10
|
+
spec.email = ["piotr.limanowski@schibsted.pl"]
|
11
|
+
spec.summary = "A CLI interface to Escenic CMS"
|
12
|
+
spec.description = "A CLI interface to Escenic CMS"
|
13
|
+
spec.homepage = "https://github.com/peel/eclix"
|
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.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_development_dependency "rspec-nc"
|
25
|
+
spec.add_development_dependency "guard"
|
26
|
+
spec.add_development_dependency "guard-rspec"
|
27
|
+
spec.add_development_dependency "pry"
|
28
|
+
spec.add_development_dependency "pry-remote"
|
29
|
+
spec.add_development_dependency "pry-nav"
|
30
|
+
spec.add_development_dependency "coveralls"
|
31
|
+
|
32
|
+
spec.add_runtime_dependency "rest-client"
|
33
|
+
spec.add_runtime_dependency "commander"
|
34
|
+
spec.add_runtime_dependency "net-scp"
|
35
|
+
end
|
data/lib/eclix.rb
ADDED
data/lib/eclix/domain.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Eclix
|
2
|
+
class Publication
|
3
|
+
attr_reader :name, :publisher, :password, :context
|
4
|
+
def initialize(name,publisher='Escenic',password='admin',context=name)
|
5
|
+
@name = name
|
6
|
+
@publisher=publisher
|
7
|
+
@password=password
|
8
|
+
@context=context
|
9
|
+
@context||=name
|
10
|
+
end
|
11
|
+
def template(path)
|
12
|
+
path+"template"
|
13
|
+
end
|
14
|
+
def static(path)
|
15
|
+
path+"static"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
|
3
|
+
module Eclix
|
4
|
+
class Publication_Creator
|
5
|
+
attr_reader :escenic
|
6
|
+
|
7
|
+
def initialize(escenic=default_env)
|
8
|
+
@escenic = escenic
|
9
|
+
end
|
10
|
+
|
11
|
+
def new_publication(resources, publication)
|
12
|
+
if publication_exists(publication)
|
13
|
+
puts "Publication already exists, proceeding..."
|
14
|
+
else
|
15
|
+
@cookies = get_session_id
|
16
|
+
puts "Uploading resources..."
|
17
|
+
deploy_resources(resources, @cookies)
|
18
|
+
puts "Adding publication config..."
|
19
|
+
create_publication(publication, @cookies)
|
20
|
+
puts "Done."
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_session_id
|
25
|
+
response = RestClient.get(escenic.admin_url.absolute)
|
26
|
+
response.cookies
|
27
|
+
end
|
28
|
+
|
29
|
+
def deploy_resources(resources, cookies)
|
30
|
+
RestClient.post(escenic.resource_url.absolute,
|
31
|
+
{
|
32
|
+
:type => resources.type,
|
33
|
+
:resourceFile => File.new(resources.file, 'rb'),
|
34
|
+
:multipart => true
|
35
|
+
},
|
36
|
+
{:cookies => cookies},
|
37
|
+
) { |response, request, result|
|
38
|
+
case response.code
|
39
|
+
when 200
|
40
|
+
response
|
41
|
+
else
|
42
|
+
raise ResourceUploadException
|
43
|
+
end
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
def create_publication(publication, cookies)
|
48
|
+
RestClient.post(escenic.publish_url.absolute,
|
49
|
+
{
|
50
|
+
:name => publication.name,
|
51
|
+
:publisherName => publication.publisher,
|
52
|
+
:allowEmptyPassword => false,
|
53
|
+
:adminPassword => publication.password,
|
54
|
+
:adminPasswordConfirm => publication.password
|
55
|
+
},
|
56
|
+
{
|
57
|
+
:cookies => cookies
|
58
|
+
}
|
59
|
+
) { |response, request, result|
|
60
|
+
case response.code
|
61
|
+
when 200
|
62
|
+
response
|
63
|
+
else
|
64
|
+
raise PublicationDefinitionException
|
65
|
+
end
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
def publication_exists(publication)
|
70
|
+
url = escenic.publication_url(publication).absolute
|
71
|
+
RestClient.get(url) { |response, request, result|
|
72
|
+
case response.code
|
73
|
+
when 200
|
74
|
+
true
|
75
|
+
else
|
76
|
+
false
|
77
|
+
end
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
def default_env
|
82
|
+
Escenic.new(Server.new)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
class ResourceUploadException < Exception
|
86
|
+
end
|
87
|
+
class PublicationDefinitionException < Exception
|
88
|
+
end
|
89
|
+
class Url
|
90
|
+
attr_reader :path, :base
|
91
|
+
def initialize(server, path)
|
92
|
+
@server=server
|
93
|
+
@path=path
|
94
|
+
@base=base_url(server)
|
95
|
+
end
|
96
|
+
|
97
|
+
def absolute
|
98
|
+
"#{base}/#{path}"
|
99
|
+
end
|
100
|
+
|
101
|
+
def base_url(server)
|
102
|
+
"http://#{server.host}:#{server.port}"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
class Server
|
106
|
+
attr_reader :host, :port
|
107
|
+
def initialize(port=8080, host='localhost')
|
108
|
+
@host=host
|
109
|
+
@port=port
|
110
|
+
end
|
111
|
+
end
|
112
|
+
class Escenic
|
113
|
+
attr_reader :server
|
114
|
+
def initialize(server=Server.new)
|
115
|
+
@server=server
|
116
|
+
end
|
117
|
+
def resource_url
|
118
|
+
Url.new(server, 'escenic-admin/do/publication/resource')
|
119
|
+
end
|
120
|
+
|
121
|
+
def publish_url
|
122
|
+
Url.new(server, 'escenic-admin/do/publication/insert')
|
123
|
+
end
|
124
|
+
|
125
|
+
def admin_url
|
126
|
+
Url.new(server, 'escenic-admin')
|
127
|
+
end
|
128
|
+
|
129
|
+
def publication_url(publication)
|
130
|
+
Url.new(server, "#{publication.context}/")
|
131
|
+
end
|
132
|
+
end
|
133
|
+
class Resources
|
134
|
+
attr_reader :type, :file
|
135
|
+
def initialize(type='webapp', file)
|
136
|
+
@type=type
|
137
|
+
@file=file
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
data/lib/eclix/sync.rb
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'net/scp'
|
2
|
+
|
3
|
+
module Eclix
|
4
|
+
class Credentials
|
5
|
+
attr_reader :user, :password
|
6
|
+
def initialize(user, password)
|
7
|
+
@user = user
|
8
|
+
@password = password
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class Remote
|
13
|
+
attr_reader :name, :host, :port, :credentials
|
14
|
+
def initialize(name, host, port, credentials)
|
15
|
+
@name = name
|
16
|
+
@host = host
|
17
|
+
@port = port
|
18
|
+
@credentials = credentials
|
19
|
+
end
|
20
|
+
|
21
|
+
def password
|
22
|
+
credentials.password
|
23
|
+
end
|
24
|
+
|
25
|
+
def user
|
26
|
+
credentials.user
|
27
|
+
end
|
28
|
+
|
29
|
+
def publication_dir(publication_name)
|
30
|
+
"/opt/tomcat-#{name}/webapps-#{publication_name}/#{publication_name}/"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class Local
|
35
|
+
attr_reader :project_home
|
36
|
+
def initialize(project_home)
|
37
|
+
@project_home = project_home
|
38
|
+
end
|
39
|
+
def publication_dir(publication_name)
|
40
|
+
"#{project_home}/publications/#{publication_name}/src/main/webapp/"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
class Environment
|
45
|
+
attr_reader :publications, :local, :remote
|
46
|
+
def initialize(remote, local, publication_names)
|
47
|
+
@publications = publication_names.map{|n| Publication.new(n)}
|
48
|
+
@local = local
|
49
|
+
@remote = remote
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class Uploader
|
54
|
+
def upload_template(environment)
|
55
|
+
environment.publications.each do |pub|
|
56
|
+
p 'Syncing templates...'
|
57
|
+
p pub.template(environment.local.publication_dir(pub.name)) => environment.remote.publication_dir(pub.name)
|
58
|
+
Net::SCP.upload!(environment.remote.host, environment.remote.user, pub.template(environment.local.publication_dir(pub.name)), environment.remote.publication_dir(pub.name), :ssh => {:port => environment.remote.port}, :recursive => true)
|
59
|
+
p pub.template(environment.local.publication_dir("shared-war")) => environment.remote.publication_dir(pub.name)
|
60
|
+
Net::SCP.upload!(environment.remote.host, environment.remote.user, pub.template(environment.local.publication_dir("shared-war")), environment.remote.publication_dir(pub.name), :ssh => {:port => environment.remote.port}, :recursive => true)
|
61
|
+
p 'Templates synced.'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
def upload_static(environment)
|
65
|
+
environment.publications.each do |pub|
|
66
|
+
p 'Syncing statics...'
|
67
|
+
p pub.static(environment.local.publication_dir(pub.name)) => pub.static(environment.remote.publication_dir(pub.name))
|
68
|
+
Net::SCP.upload!(environment.remote.host, environment.remote.user, pub.static(environment.local.publication_dir(pub.name)), environment.remote.publication_dir(pub.name), :ssh => {:port => environment.remote.port}, :recursive => true)
|
69
|
+
p pub.static(environment.local.publication_dir("shared-war")) => pub.static(environment.remote.publication_dir(pub.name))
|
70
|
+
Net::SCP.upload!(environment.remote.host, environment.remote.user, pub.static(environment.local.publication_dir("shared-war")), environment.remote.publication_dir(pub.name), :ssh => {:port => environment.remote.port}, :recursive => true)
|
71
|
+
p 'Statics synced.'
|
72
|
+
end
|
73
|
+
end
|
74
|
+
def upload(environment)
|
75
|
+
upload_template(environment)
|
76
|
+
upload_static(environment)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
data/spec/domain_spec.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
pub_name = "test"
|
4
|
+
pub = Eclix::Publication.new(pub_name)
|
5
|
+
path = '/home/escenic/pub/'
|
6
|
+
|
7
|
+
describe Eclix::Publication do
|
8
|
+
|
9
|
+
describe '#template' do
|
10
|
+
it "creates a path to templates" do
|
11
|
+
expect(pub.template(path)).to eq "#{path}template"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#static' do
|
16
|
+
it "creates a path to static directory" do
|
17
|
+
expect(pub.static(path)).to eq "#{path}static"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Eclix::Url do
|
4
|
+
|
5
|
+
describe '#base' do
|
6
|
+
it 'returns a base url (http://{host}:{port}) for a given url' do
|
7
|
+
expect(Eclix::Url.new(Eclix::Server.new,'abc').base).to eq('http://localhost:8080')
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '#absolute' do
|
12
|
+
it 'returns an absolute url for a given url path' do
|
13
|
+
expect(Eclix::Url.new(Eclix::Server.new,'abc').absolute).to eq('http://localhost:8080/abc')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe Eclix::Escenic do
|
19
|
+
|
20
|
+
describe '#admin_url' do
|
21
|
+
it 'returns absolute escenic admin url' do
|
22
|
+
expect(Eclix::Escenic.new.admin_url.absolute).to eq('http://localhost:8080/escenic-admin')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#resource_url' do
|
27
|
+
it 'returns absolute escenic resource submission url' do
|
28
|
+
expect(Eclix::Escenic.new.resource_url.absolute).to eq('http://localhost:8080/escenic-admin/do/publication/resource')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#publish_url' do
|
33
|
+
it 'returns absolute escenic publication submission url' do
|
34
|
+
expect(Eclix::Escenic.new.publish_url.absolute).to eq('http://localhost:8080/escenic-admin/do/publication/insert')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/spec/spec_helper.rb
ADDED
data/spec/sync_spec.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
pub_name = "test"
|
4
|
+
path = '/home/escenic/pub/'
|
5
|
+
|
6
|
+
describe Eclix::Remote do
|
7
|
+
server_name = "test"
|
8
|
+
host = "host"
|
9
|
+
port = 22
|
10
|
+
user = "user"
|
11
|
+
pass = "pass"
|
12
|
+
credentials = Eclix::Credentials.new(user,pass)
|
13
|
+
remote = Eclix::Remote.new(server_name, host, port, credentials)
|
14
|
+
|
15
|
+
describe '#publication_dir' do
|
16
|
+
it 'creates a publication absolute dir on remote server' do
|
17
|
+
expect(remote.publication_dir(pub_name)).to eq "/opt/tomcat-#{server_name}/webapps-#{pub_name}/#{pub_name}/"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#user' do
|
22
|
+
it 'returns ussername on remote server' do
|
23
|
+
expect(remote.user).to eq user
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#password' do
|
28
|
+
it 'returns ussername on remote server' do
|
29
|
+
expect(remote.password).to eq pass
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe Eclix::Local do
|
35
|
+
local = Eclix::Local.new(path)
|
36
|
+
describe '#publication_dir' do
|
37
|
+
it 'creates a publication absolute dir on remote server' do
|
38
|
+
expect(local.publication_dir(pub_name)).to eq "#{path}/publications/#{pub_name}/src/main/webapp/"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
#TODO: Add tests for upload
|
metadata
ADDED
@@ -0,0 +1,249 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: eclix
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Piotr Limanowski
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-14 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.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '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'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-nc
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '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'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry-remote
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
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: pry-nav
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: coveralls
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rest-client
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: commander
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: net-scp
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
195
|
+
description: A CLI interface to Escenic CMS
|
196
|
+
email:
|
197
|
+
- piotr.limanowski@schibsted.pl
|
198
|
+
executables:
|
199
|
+
- eclix
|
200
|
+
extensions: []
|
201
|
+
extra_rdoc_files: []
|
202
|
+
files:
|
203
|
+
- ".coveralls.yml"
|
204
|
+
- ".gitignore"
|
205
|
+
- ".rspec"
|
206
|
+
- Gemfile
|
207
|
+
- LICENSE.txt
|
208
|
+
- README.md
|
209
|
+
- Rakefile
|
210
|
+
- bin/eclix
|
211
|
+
- eclix.gemspec
|
212
|
+
- lib/eclix.rb
|
213
|
+
- lib/eclix/domain.rb
|
214
|
+
- lib/eclix/publication_creator.rb
|
215
|
+
- lib/eclix/sync.rb
|
216
|
+
- lib/eclix/version.rb
|
217
|
+
- spec/domain_spec.rb
|
218
|
+
- spec/publication_creator_spec.rb
|
219
|
+
- spec/spec_helper.rb
|
220
|
+
- spec/sync_spec.rb
|
221
|
+
homepage: https://github.com/peel/eclix
|
222
|
+
licenses:
|
223
|
+
- MIT
|
224
|
+
metadata: {}
|
225
|
+
post_install_message:
|
226
|
+
rdoc_options: []
|
227
|
+
require_paths:
|
228
|
+
- lib
|
229
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
230
|
+
requirements:
|
231
|
+
- - ">="
|
232
|
+
- !ruby/object:Gem::Version
|
233
|
+
version: '0'
|
234
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
235
|
+
requirements:
|
236
|
+
- - ">="
|
237
|
+
- !ruby/object:Gem::Version
|
238
|
+
version: '0'
|
239
|
+
requirements: []
|
240
|
+
rubyforge_project:
|
241
|
+
rubygems_version: 2.2.2
|
242
|
+
signing_key:
|
243
|
+
specification_version: 4
|
244
|
+
summary: A CLI interface to Escenic CMS
|
245
|
+
test_files:
|
246
|
+
- spec/domain_spec.rb
|
247
|
+
- spec/publication_creator_spec.rb
|
248
|
+
- spec/spec_helper.rb
|
249
|
+
- spec/sync_spec.rb
|