alcapon 0.4.5 → 0.4.6
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.
- data/bin/capezit +24 -6
- data/lib/capez.rb +19 -18
- data/lib/db.rb +1 -1
- data/lib/ezpublish4.rb +6 -6
- data/lib/ezpublish5.rb +9 -55
- data/lib/ezpublish5/deploy.rb +0 -0
- data/lib/ezpublish5/ezpublish.rb +49 -0
- metadata +5 -3
data/bin/capezit
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
require 'optparse'
|
|
4
4
|
require 'fileutils'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
ezpublish_version = nil
|
|
7
|
+
alcapon_version = "0.4.6"
|
|
8
8
|
|
|
9
9
|
OptionParser.new do |opts|
|
|
10
10
|
opts.banner = "Usage: #{File.basename($0)} [path]"
|
|
@@ -14,6 +14,11 @@ OptionParser.new do |opts|
|
|
|
14
14
|
exit 0
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
opts.on("-v", "--version", "") do
|
|
18
|
+
puts "alcapon v#{alcapon_version}"
|
|
19
|
+
exit 0
|
|
20
|
+
end
|
|
21
|
+
|
|
17
22
|
begin
|
|
18
23
|
opts.parse!(ARGV)
|
|
19
24
|
rescue OptionParser::ParseError => e
|
|
@@ -38,10 +43,21 @@ def unindent(string)
|
|
|
38
43
|
string.strip.gsub(/^#{indentation}/, "")
|
|
39
44
|
end
|
|
40
45
|
|
|
46
|
+
base = ARGV.shift
|
|
47
|
+
ezpublish_version = ezpublish_version || ((File.directory? File.join(base, 'ezpublish')) ? 5 : 4)
|
|
48
|
+
|
|
49
|
+
if ezpublish_version == 5
|
|
50
|
+
alcapon_path = 'ezpublish_legacy/extension/alcapon'
|
|
51
|
+
else
|
|
52
|
+
alcapon_path = 'extension/alcapon'
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
FileUtils.mkdir_p(File.join(alcapon_path,'config/deploy'))
|
|
56
|
+
|
|
41
57
|
files = {
|
|
42
58
|
"Capfile" => unindent(<<-FILE),
|
|
43
59
|
set :alcapon_path, \"#{alcapon_path}\"
|
|
44
|
-
set :ezpublish_version,
|
|
60
|
+
set :ezpublish_version, #{ezpublish_version}
|
|
45
61
|
|
|
46
62
|
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
|
|
47
63
|
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
|
|
@@ -94,6 +110,7 @@ files = {
|
|
|
94
110
|
# Prevents you from cloning the whole rep. each deploy but your remote servers
|
|
95
111
|
# must be able to get connected to your scm server
|
|
96
112
|
set :deploy_via, :remote_cache
|
|
113
|
+
set :copy_exclude, [ '.git' ]
|
|
97
114
|
|
|
98
115
|
# Your Primary HTTP server
|
|
99
116
|
# (Use config/deploy/*.rb files instead if you need a multisage setup)
|
|
@@ -170,7 +187,7 @@ files = {
|
|
|
170
187
|
|
|
171
188
|
# Check-list (used by cap setup:check)
|
|
172
189
|
depend :remote, :command, "php"
|
|
173
|
-
depend :remote, :match, "php -r \\"echo(version_compare(PHP_VERSION,'5.
|
|
190
|
+
depend :remote, :match, "php -r \\"echo(version_compare(PHP_VERSION,'5.3.3')?'ok':'ko');\\"", "ok"
|
|
174
191
|
depend :remote, :match, "php -m | grep curl", "curl"
|
|
175
192
|
|
|
176
193
|
# TODO
|
|
@@ -183,6 +200,9 @@ files = {
|
|
|
183
200
|
"#{alcapon_path}/config/deploy/devel.rb" => unindent(<<-FILE),
|
|
184
201
|
# There you can override default settings for this specific environment
|
|
185
202
|
|
|
203
|
+
# Triggers local modification, based on the vcs used (only git supported)
|
|
204
|
+
set :enable_local_check, true
|
|
205
|
+
|
|
186
206
|
set :branch, "dev"
|
|
187
207
|
#role :web, "myapp.devserv", :primary => true # Your Primary HTTP server
|
|
188
208
|
|
|
@@ -219,8 +239,6 @@ files = {
|
|
|
219
239
|
FILE
|
|
220
240
|
}
|
|
221
241
|
|
|
222
|
-
base = ARGV.shift
|
|
223
|
-
|
|
224
242
|
files.each do |file, content|
|
|
225
243
|
file = File.join(base, file)
|
|
226
244
|
if File.exists?(file)
|
data/lib/capez.rb
CHANGED
|
@@ -37,7 +37,7 @@ after "deploy:setup", :roles => :web do
|
|
|
37
37
|
print_dotted( "--> Fixing permissions on deployment directory" )
|
|
38
38
|
try_sudo( "chown -R #{user} #{deploy_to}" ) # if not code checkout cannot be done :/
|
|
39
39
|
capez_puts_done
|
|
40
|
-
|
|
40
|
+
ezpublish.var.init_shared
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
before "deploy:update_code" do
|
|
@@ -63,7 +63,9 @@ before "deploy:finalize_update" do
|
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
before "deploy", :roles => :web do
|
|
66
|
-
|
|
66
|
+
if fetch( :enable_local_check, false )
|
|
67
|
+
ezpublish.dev.local_check
|
|
68
|
+
end
|
|
67
69
|
deploy.web.disable
|
|
68
70
|
end
|
|
69
71
|
|
|
@@ -84,8 +86,7 @@ namespace :deploy do
|
|
|
84
86
|
|
|
85
87
|
namespace :web do
|
|
86
88
|
desc <<-DESC
|
|
87
|
-
Puts a html file somewhere in the documentroot
|
|
88
|
-
This file is displayed by a RewriteRule if it exists
|
|
89
|
+
Puts a html file somewhere in the documentroot. This file is displayed by a RewriteRule if it exists
|
|
89
90
|
DESC
|
|
90
91
|
task :disable do
|
|
91
92
|
end
|
|
@@ -109,7 +110,7 @@ namespace :deploy do
|
|
|
109
110
|
end
|
|
110
111
|
|
|
111
112
|
|
|
112
|
-
namespace :
|
|
113
|
+
namespace :ezpublish do
|
|
113
114
|
namespace :settings do
|
|
114
115
|
|
|
115
116
|
def make_file_changes( options={} )
|
|
@@ -242,7 +243,7 @@ namespace :capez do
|
|
|
242
243
|
capez_puts_done
|
|
243
244
|
}
|
|
244
245
|
run( "chmod -R g+w #{shared_path}/var")
|
|
245
|
-
|
|
246
|
+
try_sudo( "chown -R #{fetch(:webserver_group,user)} #{shared_path}/var")
|
|
246
247
|
end
|
|
247
248
|
|
|
248
249
|
|
|
@@ -258,7 +259,7 @@ namespace :capez do
|
|
|
258
259
|
folders_path.each{ |fp|
|
|
259
260
|
print_dotted( "#{fp}" )
|
|
260
261
|
run( "mkdir -p #{latest_release}/#{fp}")
|
|
261
|
-
|
|
262
|
+
try_sudo( "chown -R #{fetch(:webserver_user,user)}:#{fetch(:webserver_group,user)} #{latest_release}/#{fp}" )
|
|
262
263
|
run( "chmod -R g+wx #{latest_release}/#{fp}" )
|
|
263
264
|
capez_puts_done
|
|
264
265
|
}
|
|
@@ -273,7 +274,7 @@ namespace :capez do
|
|
|
273
274
|
|
|
274
275
|
# makes sure the webserver can write into var/
|
|
275
276
|
run( "chmod -R g+w #{latest_release}/" + ezp_legacy_path( "var" ) )
|
|
276
|
-
|
|
277
|
+
try_sudo( "chown -R #{fetch(:webserver_user,user)}:#{fetch(:webserver_group,user)} #{latest_release}/" + ezp_legacy_path( "var" ) )
|
|
277
278
|
|
|
278
279
|
# needed even if we just want to run 'bin/php/ezpgenerateautoloads.php' with --extension
|
|
279
280
|
# autoload seems to be mandatory for "old" version such as 4.0, 4.1, ...
|
|
@@ -281,7 +282,7 @@ namespace :capez do
|
|
|
281
282
|
autoload_path = File.join( latest_release, ezp_legacy_path( 'autoload' ) )
|
|
282
283
|
run( "if [ ! -d #{autoload_path} ]; then mkdir -p #{autoload_path}; fi;" )
|
|
283
284
|
capez_puts_done
|
|
284
|
-
|
|
285
|
+
try_sudo( "chown -R #{fetch(:webserver_user,user)}:#{fetch(:webserver_group,user)} #{autoload_path}" )
|
|
285
286
|
end
|
|
286
287
|
|
|
287
288
|
desc <<-DESC
|
|
@@ -291,18 +292,18 @@ namespace :capez do
|
|
|
291
292
|
puts( "\n--> Symlinks" )
|
|
292
293
|
|
|
293
294
|
print_dotted( "var/storage" )
|
|
294
|
-
|
|
295
|
+
try_sudo( "ln -s #{shared_path}/var/storage #{latest_release}/" + ezp_legacy_path( "var/storage" ) )
|
|
295
296
|
capez_puts_done
|
|
296
297
|
|
|
297
298
|
storage_directories.each{ |sd|
|
|
298
299
|
print_dotted( "var/#{sd}/storage" )
|
|
299
|
-
|
|
300
|
+
try_sudo( "ln -s #{shared_path}/var/#{sd}/storage #{latest_release}/" + ezp_legacy_path( "var/#{sd}/storage" ), :as => webserver_user )
|
|
300
301
|
#run( "chmod -h g+w #{latest_release}/var/#{sd}/storage")
|
|
301
302
|
capez_puts_done
|
|
302
303
|
}
|
|
303
304
|
|
|
304
|
-
|
|
305
|
-
|
|
305
|
+
try_sudo( "chmod -R g+w #{latest_release}/" + ezp_legacy_path( "var" ) )
|
|
306
|
+
try_sudo( "chown -R #{fetch(:webserver_user,user)}:#{fetch(:webserver_group,user)} #{shared_path}/var")
|
|
306
307
|
end
|
|
307
308
|
|
|
308
309
|
desc <<-DESC
|
|
@@ -349,7 +350,7 @@ namespace :capez do
|
|
|
349
350
|
end
|
|
350
351
|
|
|
351
352
|
end
|
|
352
|
-
# End of namespace :
|
|
353
|
+
# End of namespace ezpublish:var
|
|
353
354
|
|
|
354
355
|
# TODO : cache management must be aware of cluster setup namespace :autoloads do
|
|
355
356
|
namespace :autoloads do
|
|
@@ -370,14 +371,14 @@ namespace :capez do
|
|
|
370
371
|
end
|
|
371
372
|
end
|
|
372
373
|
end
|
|
373
|
-
# End of namespace :
|
|
374
|
+
# End of namespace ezpublish:autoloads
|
|
374
375
|
|
|
375
376
|
# Should be transformed in a simple function (not aimed to be called as a Cap task...)
|
|
377
|
+
# Considers that your main git repo is at the top of your eZ Publish install
|
|
378
|
+
# If changes are detected, then ask the user to continue or not
|
|
376
379
|
namespace :dev do
|
|
377
380
|
desc <<-DESC
|
|
378
|
-
|
|
379
|
-
Considers that your main git repo is at the top of your eZ Publish install
|
|
380
|
-
If changes are detected, then ask the user to continue or not
|
|
381
|
+
Check if there are any changes on your local installation based on what your scm knows
|
|
381
382
|
DESC
|
|
382
383
|
task :local_check do
|
|
383
384
|
if "#{scm}" != "git" then
|
data/lib/db.rb
CHANGED
data/lib/ezpublish4.rb
CHANGED
|
@@ -6,14 +6,14 @@ after "deploy:finalize_update" do
|
|
|
6
6
|
if fetch( :shared_children_group, false )
|
|
7
7
|
shared_children.map { |d| run( "chgrp -R #{shared_children_group} #{shared_path}/#{d.split('/').last}") }
|
|
8
8
|
end
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
#
|
|
9
|
+
ezpublish.var.init_release
|
|
10
|
+
ezpublish.var.link
|
|
11
|
+
ezpublish.settings.deploy
|
|
12
|
+
ezpublish.autoloads.generate
|
|
13
|
+
#ezpublish.cache.clear
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
namespace :
|
|
16
|
+
namespace :ezpublish do
|
|
17
17
|
|
|
18
18
|
namespace :cache do
|
|
19
19
|
desc <<-DESC
|
data/lib/ezpublish5.rb
CHANGED
|
@@ -3,66 +3,20 @@ puts "Running AlCapON for eZ Publish 5"
|
|
|
3
3
|
set :ezp_legacy, "ezpublish_legacy"
|
|
4
4
|
set :ezp_app, "ezpublish"
|
|
5
5
|
|
|
6
|
+
load 'ezpublish5/deploy'
|
|
7
|
+
load 'ezpublish5/ezpublish'
|
|
8
|
+
|
|
6
9
|
after "deploy:finalize_update" do
|
|
7
10
|
if fetch( :shared_children_group, false )
|
|
8
11
|
shared_children.map { |d| run( "chgrp -R #{shared_children_group} #{shared_path}/#{d.split('/').last}") }
|
|
9
12
|
end
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
ezpublish.var.init_release
|
|
14
|
+
ezpublish.var.link
|
|
15
|
+
ezpublish.autoloads.generate
|
|
16
|
+
ezpublish.settings.deploy
|
|
14
17
|
if ( fetch( :ezp5_regenerate_config, false ) )
|
|
15
|
-
|
|
18
|
+
ezpublish.settings.configure
|
|
16
19
|
end
|
|
17
|
-
|
|
20
|
+
ezpublish.assets.install
|
|
18
21
|
end
|
|
19
22
|
|
|
20
|
-
namespace :capez do
|
|
21
|
-
|
|
22
|
-
namespace :cache do
|
|
23
|
-
desc <<-DESC
|
|
24
|
-
Clear caches the way it is configured in ezpublish.rb
|
|
25
|
-
DESC
|
|
26
|
-
# Caches are just cleared for the primary server
|
|
27
|
-
# Multiple server platform are supposed to use a cluster configuration (eZDFS/eZDBFS)
|
|
28
|
-
# and cache management is done via expiry.php which is managed by the cluster API
|
|
29
|
-
# TODO : make it ezp5 aware
|
|
30
|
-
task :clear, :roles => :web, :only => { :primary => true } do
|
|
31
|
-
puts( "\n--> Clearing caches #{'with --purge'.red if cache_purge}" )
|
|
32
|
-
cache_list.each { |cache_tag|
|
|
33
|
-
print_dotted( "#{cache_tag}" )
|
|
34
|
-
capture "cd #{current_path}/#{ezp_legacy_path} && sudo -u #{webserver_user} php bin/php/ezcache.php --clear-tag=#{cache_tag}#{' --purge' if cache_purge}"
|
|
35
|
-
capez_puts_done
|
|
36
|
-
}
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
namespace :assets do
|
|
41
|
-
desc <<-DESC
|
|
42
|
-
Install assets (ezp5 only)
|
|
43
|
-
DESC
|
|
44
|
-
task :install do
|
|
45
|
-
print_dotted( "\n--> Generating web assets in #{fetch('ezp5_assets_path','web')}" )
|
|
46
|
-
capture( "cd #{latest_release} && sudo -u #{webserver_user} php ezpublish/console assets:install --symlink #{fetch('ezp5_assets_path','web')}" )
|
|
47
|
-
capture( "cd #{latest_release} && sudo -u #{webserver_user} php ezpublish/console ezpublish:legacy:assets_install --symlink #{fetch('ezp5_assets_path','web')}" )
|
|
48
|
-
capez_puts_done
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
namespace :settings do
|
|
53
|
-
desc <<-DESC
|
|
54
|
-
Generate yml (ezp5) based on ini (ezp4)
|
|
55
|
-
DESC
|
|
56
|
-
task :configure do
|
|
57
|
-
print_dotted( "\n--> Generating ezp5 configuration files from ezp4 ones" )
|
|
58
|
-
if( fetch('ezp5_siteaccess_groupname',false) != false && fetch('ezp5_admin_siteaccess',false) != false )
|
|
59
|
-
capture( "cd #{latest_release} && sudo -u #{webserver_user} php ezpublish/console ezpublish:configure --env=#{fetch('ezp5_env','prod')} #{ezp5_siteaccess_groupname} #{ezp5_admin_siteaccess}" )
|
|
60
|
-
else
|
|
61
|
-
abort( "Since version 0.4.3, you need to set ezp5_siteaccess_groupname & ezp5_admin_siteaccess".red )
|
|
62
|
-
end
|
|
63
|
-
capez_puts_done
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
end
|
|
File without changes
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
namespace :ezpublish do
|
|
2
|
+
|
|
3
|
+
namespace :cache do
|
|
4
|
+
desc <<-DESC
|
|
5
|
+
Clear caches the way it is configured in ezpublish.rb
|
|
6
|
+
DESC
|
|
7
|
+
# Caches are just cleared for the primary server
|
|
8
|
+
# Multiple server platform are supposed to use a cluster configuration (eZDFS/eZDBFS)
|
|
9
|
+
# and cache management is done via expiry.php which is managed by the cluster API
|
|
10
|
+
# TODO : make it ezp5 aware
|
|
11
|
+
task :clear, :roles => :web, :only => { :primary => true } do
|
|
12
|
+
puts( "\n--> Clearing caches #{'with --purge'.red if cache_purge}" )
|
|
13
|
+
cache_list.each { |cache_tag|
|
|
14
|
+
print_dotted( "#{cache_tag}" )
|
|
15
|
+
capture "cd #{current_path}/#{ezp_legacy_path} && sudo -u #{webserver_user} php bin/php/ezcache.php --clear-tag=#{cache_tag}#{' --purge' if cache_purge}"
|
|
16
|
+
capez_puts_done
|
|
17
|
+
}
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
namespace :assets do
|
|
22
|
+
desc <<-DESC
|
|
23
|
+
Install assets (ezp5 only)
|
|
24
|
+
DESC
|
|
25
|
+
task :install do
|
|
26
|
+
print_dotted( "\n--> Generating web assets in #{fetch('ezp5_assets_path','web')}" )
|
|
27
|
+
capture( "cd #{latest_release} && sudo -u #{webserver_user} php ezpublish/console assets:install --symlink #{fetch('ezp5_assets_path','web')}" )
|
|
28
|
+
capture( "cd #{latest_release} && sudo -u #{webserver_user} php ezpublish/console ezpublish:legacy:assets_install --symlink #{fetch('ezp5_assets_path','web')}" )
|
|
29
|
+
capez_puts_done
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
namespace :settings do
|
|
34
|
+
desc <<-DESC
|
|
35
|
+
Generate yml (ezp5) based on ini (ezp4)
|
|
36
|
+
DESC
|
|
37
|
+
task :configure do
|
|
38
|
+
print_dotted( "\n--> Generating ezp5 configuration files from ezp4 ones" )
|
|
39
|
+
if( fetch('ezp5_siteaccess_groupname',false) != false && fetch('ezp5_admin_siteaccess',false) != false )
|
|
40
|
+
capture( "cd #{latest_release} && sudo -u #{webserver_user} php ezpublish/console ezpublish:configure --env=#{fetch('ezp5_env','prod')} #{ezp5_siteaccess_groupname} #{ezp5_admin_siteaccess}" )
|
|
41
|
+
else
|
|
42
|
+
abort( "Since version 0.4.3, you need to set ezp5_siteaccess_groupname & ezp5_admin_siteaccess".red )
|
|
43
|
+
end
|
|
44
|
+
capez_puts_done
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
metadata
CHANGED
|
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
|
5
5
|
segments:
|
|
6
6
|
- 0
|
|
7
7
|
- 4
|
|
8
|
-
-
|
|
9
|
-
version: 0.4.
|
|
8
|
+
- 6
|
|
9
|
+
version: 0.4.6
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- Arnaud Lafon
|
|
@@ -14,7 +14,7 @@ autorequire:
|
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
16
|
|
|
17
|
-
date:
|
|
17
|
+
date: 2013-03-12 00:00:00 +01:00
|
|
18
18
|
default_executable:
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
|
@@ -58,6 +58,8 @@ files:
|
|
|
58
58
|
- lib/db.rb
|
|
59
59
|
- lib/ext/spinner.rb
|
|
60
60
|
- lib/ezpublish4.rb
|
|
61
|
+
- lib/ezpublish5/deploy.rb
|
|
62
|
+
- lib/ezpublish5/ezpublish.rb
|
|
61
63
|
- lib/ezpublish5.rb
|
|
62
64
|
- lib/utils.rb
|
|
63
65
|
- README.md
|