capistrano-contao 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/capistrano-contao.gemspec +3 -1
- data/lib/capistrano/ext/contao.rb +13 -25
- data/lib/capistrano/ext/contao_assets.rb +8 -6
- data/lib/capistrano/ext/deploy.rb +2 -1
- data/lib/capistrano/ext/item.rb +39 -0
- metadata +35 -4
data/capistrano-contao.gemspec
CHANGED
@@ -13,12 +13,14 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
14
|
gem.name = 'capistrano-contao'
|
15
15
|
gem.require_paths = ['lib']
|
16
|
-
gem.version = '0.0.
|
16
|
+
gem.version = '0.0.3'
|
17
17
|
|
18
18
|
# Runtime dependencies
|
19
19
|
gem.add_dependency 'rake'
|
20
20
|
gem.add_dependency 'activesupport'
|
21
|
+
gem.add_dependency 'capistrano', '>= 2.12.0'
|
21
22
|
gem.add_dependency 'capistrano-database'
|
22
23
|
gem.add_dependency 'capistrano-utils'
|
23
24
|
gem.add_dependency 'capistrano-server'
|
25
|
+
gem.add_dependency 'capistrano-content'
|
24
26
|
end
|
@@ -8,12 +8,16 @@ require 'capistrano/ext/contao_assets'
|
|
8
8
|
require 'capistrano/ext/database'
|
9
9
|
require 'capistrano/ext/server'
|
10
10
|
require 'capistrano/ext/deploy'
|
11
|
+
require 'capistrano/ext/item'
|
12
|
+
require 'capistrano/ext/content'
|
11
13
|
|
12
14
|
unless Capistrano::Configuration.respond_to?(:instance)
|
13
15
|
abort 'capistrano/ext/contao requires capistrano 2'
|
14
16
|
end
|
15
17
|
|
16
18
|
Capistrano::Configuration.instance(:must_exist).load do
|
19
|
+
Rails.env = 'production'
|
20
|
+
|
17
21
|
namespace :contao do
|
18
22
|
desc '[internal] Setup contao'
|
19
23
|
task :setup, :roles => :app, :except => { :no_release => true } do
|
@@ -37,7 +41,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
37
41
|
|
38
42
|
desc '[internal] Setup contao localconfig'
|
39
43
|
task :setup_localconfig, :roles => :app, :except => { :no_release => true } do
|
40
|
-
localconfig_php_config_path = "#{fetch :shared_path}/config
|
44
|
+
localconfig_php_config_path = "#{fetch :shared_path}/items/public,system,config,localconfig.php"
|
41
45
|
on_rollback { run "rm -f #{localconfig_php_config_path}" }
|
42
46
|
db_credentials = fetch :db_credentials
|
43
47
|
|
@@ -71,32 +75,16 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
71
75
|
end
|
72
76
|
|
73
77
|
desc '[internal] Link files from contao to inside public folder'
|
74
|
-
task :
|
75
|
-
|
76
|
-
|
77
|
-
"#{try_sudo} ln -nsf #{list[0]} #{list[1]}"
|
78
|
-
end
|
79
|
-
|
80
|
-
begin
|
81
|
-
run commands.join(';')
|
82
|
-
rescue Capistrano::CommandError
|
83
|
-
abort 'Unable to create to link contao files'
|
84
|
-
end
|
78
|
+
task :link_files, :roles => :app, :except => { :no_release => true } do
|
79
|
+
deep_link "#{fetch :latest_release}/contao",
|
80
|
+
"#{fetch :latest_release}/public"
|
85
81
|
end
|
86
82
|
|
87
83
|
desc '[internal] Fix contao symlinks to the shared path'
|
88
84
|
task :fix_links, :roles => :app, :except => { :no_release => true } do
|
89
|
-
latest_release = fetch :latest_release
|
90
|
-
shared_path = fetch :shared_path
|
91
|
-
|
92
|
-
# Remove files
|
93
|
-
run <<-CMD
|
94
|
-
#{try_sudo} rm -rf #{latest_release}/public/system/logs
|
95
|
-
CMD
|
96
|
-
|
97
|
-
# Create symlinks
|
98
85
|
run <<-CMD
|
99
|
-
#{try_sudo}
|
86
|
+
#{try_sudo} rm -rf #{fetch :latest_release}/public/system/logs;
|
87
|
+
#{try_sudo} ln -nsf #{fetch :shared_path}/logs #{fetch :latest_release}/public/system/logs
|
100
88
|
CMD
|
101
89
|
end
|
102
90
|
end
|
@@ -105,11 +93,11 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
105
93
|
after 'deploy:setup', 'contao:setup'
|
106
94
|
after 'contao:setup', 'contao:setup_shared_folder'
|
107
95
|
after 'contao:setup', 'contao:setup_localconfig'
|
108
|
-
after 'deploy:finalize_update', 'contao:
|
109
|
-
after 'contao:
|
96
|
+
after 'deploy:finalize_update', 'contao:link_files'
|
97
|
+
after 'contao:link_files', 'contao:fix_links'
|
110
98
|
|
111
99
|
# Assets
|
112
|
-
|
100
|
+
before 'deploy:finalize_update', 'contao:assets'
|
113
101
|
|
114
102
|
# Database credentions
|
115
103
|
before 'contao:setup_localconfig', 'db:credentials'
|
@@ -6,13 +6,18 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
6
6
|
namespace :contao do
|
7
7
|
namespace :assets do
|
8
8
|
desc '[internal] Upload contao assets'
|
9
|
-
task :
|
10
|
-
|
11
|
-
|
9
|
+
task :default, :roles => :app, :except => { :no_release => true } do
|
10
|
+
transaction do
|
11
|
+
precompile
|
12
|
+
path = File.join 'public', Rails.application.config.assets.prefix
|
13
|
+
upload(path, "#{fetch :latest_release}/#{path}", :via => :scp, :recursive => true)
|
14
|
+
clean
|
15
|
+
end
|
12
16
|
end
|
13
17
|
|
14
18
|
desc '[internal] Generate assets'
|
15
19
|
task :precompile, :roles => :app, :except => { :no_release => true } do
|
20
|
+
on_rollback { find_and_execute_task 'contao:assets:clean' }
|
16
21
|
run_locally 'bundle exec rake assets:precompile'
|
17
22
|
end
|
18
23
|
|
@@ -22,7 +27,4 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
22
27
|
end
|
23
28
|
end
|
24
29
|
end
|
25
|
-
|
26
|
-
before 'contao:assets:deploy', 'contao:assets:precompile'
|
27
|
-
after 'contao:assets:deploy', 'contao:assets:clean'
|
28
30
|
end
|
@@ -35,7 +35,8 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
35
35
|
#{try_sudo} mkdir -p \
|
36
36
|
#{fetch :deploy_to} \
|
37
37
|
#{backup_path} \
|
38
|
-
#{fetch :shared_path}/
|
38
|
+
#{fetch :shared_path}/items \
|
39
|
+
#{fetch :shared_path}/__system__ \
|
39
40
|
#{fetch :logs_path, ''}
|
40
41
|
CMD
|
41
42
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
unless Capistrano::Configuration.respond_to?(:instance)
|
2
|
+
abort 'capistrano/ext/item requires capistrano 2'
|
3
|
+
end
|
4
|
+
|
5
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
6
|
+
set :shared_item_path, -> { "#{fetch :shared_path}/items" }
|
7
|
+
|
8
|
+
namespace :item do
|
9
|
+
desc '[internal] Symlink all items'
|
10
|
+
task :link, :roles => :app do
|
11
|
+
link_items fetch(:shared_item_path),
|
12
|
+
fetch(:latest_release)
|
13
|
+
end
|
14
|
+
|
15
|
+
desc '[internal] Setup shared items'
|
16
|
+
task :setup, :roles => :app do
|
17
|
+
fetch(:shared_items, []).each do |item|
|
18
|
+
item_shared_path = "#{fetch :shared_item_path}/#{item.gsub /\//, ','}"
|
19
|
+
item_public_path = "#{fetch :latest_release}/#{item}"
|
20
|
+
|
21
|
+
unless remote_file_exists? item_shared_path
|
22
|
+
if remote_file_exists? "#{item_public_path}.default"
|
23
|
+
run "#{try_sudo} cp #{item_public_path}.default #{item_shared_path}"
|
24
|
+
logger.important "#{item_public_path}.default copied to #{item_shared_path}"
|
25
|
+
else
|
26
|
+
write '', item_shared_path
|
27
|
+
logger.important "#{item_shared_path} has been initialized with an empty file"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Internal Dependencies
|
35
|
+
before 'item:link', 'item:setup'
|
36
|
+
|
37
|
+
# External Dependencies
|
38
|
+
before 'deploy:restart', 'item:link'
|
39
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-contao
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: capistrano
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 2.12.0
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.12.0
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: capistrano-database
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -91,6 +107,22 @@ dependencies:
|
|
91
107
|
- - ! '>='
|
92
108
|
- !ruby/object:Gem::Version
|
93
109
|
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: capistrano-content
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
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
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
94
126
|
description: Capistrano recipes for Contao deployment
|
95
127
|
email:
|
96
128
|
- wael.nasreddine@gmail.com
|
@@ -109,6 +141,7 @@ files:
|
|
109
141
|
- lib/capistrano/ext/custom_colors.rb
|
110
142
|
- lib/capistrano/ext/decouple_from_rails.rb
|
111
143
|
- lib/capistrano/ext/deploy.rb
|
144
|
+
- lib/capistrano/ext/item.rb
|
112
145
|
- lib/capistrano/monkey_patches/fix_capture_conflict.rb
|
113
146
|
homepage: http://technogate.github.com/contao
|
114
147
|
licenses: []
|
@@ -128,9 +161,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
161
|
- - ! '>='
|
129
162
|
- !ruby/object:Gem::Version
|
130
163
|
version: '0'
|
131
|
-
segments:
|
132
|
-
- 0
|
133
|
-
hash: 3411963624336550606
|
134
164
|
requirements: []
|
135
165
|
rubyforge_project:
|
136
166
|
rubygems_version: 1.8.23
|
@@ -138,3 +168,4 @@ signing_key:
|
|
138
168
|
specification_version: 3
|
139
169
|
summary: ''
|
140
170
|
test_files: []
|
171
|
+
has_rdoc:
|