capistrano-olympus 0.0.6 → 0.0.7
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 +4 -4
- data/capistrano-olympus.gemspec +2 -6
- data/lib/capistrano/olympus.rb +6 -9
- data/lib/capistrano/tasks/capistrano-deploy.rake +74 -24
- data/lib/capistrano/tasks/database.rake +24 -112
- data/lib/capistrano/tasks/directories.rake +16 -18
- data/lib/capistrano/tasks/files.rake +60 -8
- data/lib/capistrano/vars/defaults.rb +15 -12
- metadata +4 -21
- data/lib/capistrano/tasks/composer.rake +0 -14
- data/lib/capistrano/tasks/htaccess.rake +0 -35
- data/lib/capistrano/tasks/robots.rake +0 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52be08cd696c54e3994b29010f39cda0c1b21345
|
4
|
+
data.tar.gz: 77376b0a802a5ef89819d2401c36c22af271024d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0bf9ee13d133aaef373cadb3813d8b01f9e1298c9b69c002d7596faf30fd23b4bc034881b6ca4cb44f6b269ca1fe061e6edb65e1fcaed39a953e275d6d6a1c3
|
7
|
+
data.tar.gz: 15d5f2e4345f477d11d55558f020f69623e18f186ce0eb81e473624e2fb5a449b0ce0f445de9a47f0ead12f292ac72c3e141a813a91065eda380b6fc8210ed17
|
data/capistrano-olympus.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = 'capistrano-olympus'
|
7
|
-
gem.version = '0.0.
|
7
|
+
gem.version = '0.0.7'
|
8
8
|
gem.date = Time.now.strftime("%Y-%m-%d")
|
9
9
|
gem.authors = ['Achraf Chouk']
|
10
10
|
gem.email = ['achrafchouk@gmail.com']
|
@@ -21,15 +21,12 @@ Gem::Specification.new do |gem|
|
|
21
21
|
'lib/capistrano-olympus.rb',
|
22
22
|
'lib/capistrano/olympus.rb',
|
23
23
|
'lib/capistrano/tasks/capistrano-deploy.rake',
|
24
|
-
'lib/capistrano/tasks/composer.rake',
|
25
24
|
'lib/capistrano/tasks/database.rake',
|
26
25
|
'lib/capistrano/tasks/directories.rake',
|
27
26
|
'lib/capistrano/tasks/files.rake',
|
28
|
-
'lib/capistrano/tasks/htaccess.rake',
|
29
27
|
'lib/capistrano/tasks/pagespeed.rake',
|
30
28
|
'lib/capistrano/tasks/php.rake',
|
31
29
|
'lib/capistrano/tasks/redis.rake',
|
32
|
-
'lib/capistrano/tasks/robots.rake',
|
33
30
|
'lib/capistrano/tasks/server.rake',
|
34
31
|
'lib/capistrano/tasks/varnish.rake',
|
35
32
|
'lib/capistrano/vars/defaults.rb',
|
@@ -42,7 +39,6 @@ Gem::Specification.new do |gem|
|
|
42
39
|
gem.require_paths = ['lib']
|
43
40
|
|
44
41
|
gem.add_dependency 'capistrano', '~> 3.4'
|
45
|
-
gem.add_dependency 'capistrano-composer', '~> 0.0.
|
42
|
+
gem.add_dependency 'capistrano-composer', '~> 0.0.3'
|
46
43
|
gem.add_dependency 'colorize', '~> 0.7.7'
|
47
|
-
gem.add_dependency 'sshkit-sudo', '~> 0.1.0'
|
48
44
|
end
|
data/lib/capistrano/olympus.rb
CHANGED
@@ -1,19 +1,16 @@
|
|
1
|
+
require "capistrano/composer"
|
1
2
|
require 'colorize'
|
2
|
-
require 'sshkit/sudo'
|
3
3
|
|
4
4
|
# Core tasks for deploying Olympus framework with WordPress and composer
|
5
5
|
load File.expand_path("../tasks/capistrano-deploy.rake", __FILE__)
|
6
|
-
load File.expand_path("../tasks/composer.rake", __FILE__)
|
7
6
|
load File.expand_path("../tasks/database.rake", __FILE__)
|
8
7
|
load File.expand_path("../tasks/directories.rake", __FILE__)
|
9
8
|
load File.expand_path("../tasks/files.rake", __FILE__)
|
10
|
-
load File.expand_path("../tasks/
|
11
|
-
load File.expand_path("../tasks/
|
12
|
-
load File.expand_path("../tasks/
|
13
|
-
load File.expand_path("../tasks/
|
14
|
-
load File.expand_path("../tasks/
|
15
|
-
load File.expand_path("../tasks/server.rake", __FILE__)
|
16
|
-
load File.expand_path("../tasks/varnish.rake", __FILE__)
|
9
|
+
#load File.expand_path("../tasks/pagespeed.rake", __FILE__)
|
10
|
+
#load File.expand_path("../tasks/php.rake", __FILE__)
|
11
|
+
#load File.expand_path("../tasks/redis.rake", __FILE__)
|
12
|
+
#load File.expand_path("../tasks/server.rake", __FILE__)
|
13
|
+
#load File.expand_path("../tasks/varnish.rake", __FILE__)
|
17
14
|
|
18
15
|
# Load defaults variables
|
19
16
|
namespace :load do
|
@@ -6,53 +6,103 @@ end
|
|
6
6
|
# Deploy
|
7
7
|
namespace :deploy do
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
task :message_start do
|
10
|
+
puts " "
|
11
|
+
puts " Start deploy ".colorize(:color => :black, :background => :green)
|
12
|
+
puts " "
|
13
|
+
end
|
14
|
+
task :message_finish do
|
15
|
+
puts " "
|
16
|
+
puts " Finish deploy ".colorize(:color => :black, :background => :green)
|
17
|
+
puts " "
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "Initialize folders"
|
21
|
+
task :init_folders do
|
11
22
|
on release_roles(:all) do
|
12
23
|
|
24
|
+
puts " "
|
25
|
+
puts "Running deploy:init_folders task".colorize(:color => :light_green, :mode => :bold, :mode => :underline)
|
26
|
+
puts " "
|
27
|
+
|
28
|
+
# Linked dirs
|
13
29
|
# Check the very last action made: it means all setup processes are done!
|
14
30
|
if test "[ ! -f \"#{shared_path}/web/robots.txt\" ]"
|
15
|
-
puts "Create directories".colorize(:light_blue)
|
16
31
|
invoke "directories:do_actions"
|
32
|
+
end
|
17
33
|
|
18
|
-
|
19
|
-
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
desc "Initialize files and database"
|
38
|
+
task :init_files do
|
39
|
+
on release_roles(:all) do
|
40
|
+
|
41
|
+
puts " "
|
42
|
+
puts "Running deploy:init_files task".colorize(:color => :light_green, :mode => :bold)
|
43
|
+
puts " "
|
44
|
+
|
45
|
+
# Linked files
|
46
|
+
# Check the very last action made: it means all setup processes are done!
|
47
|
+
if test "[ ! -f \"#{shared_path}/web/robots.txt\" ]"
|
48
|
+
invoke "files:before_action"
|
20
49
|
end
|
21
50
|
|
22
51
|
end
|
23
52
|
end
|
24
53
|
|
25
|
-
desc "
|
26
|
-
task :
|
27
|
-
|
54
|
+
desc "Initialize files, database, composer, and all"
|
55
|
+
task :init_all do
|
56
|
+
on release_roles(:all) do
|
57
|
+
|
58
|
+
puts " "
|
59
|
+
puts "Running deploy:init_all task".colorize(:color => :light_green, :mode => :bold)
|
60
|
+
puts " "
|
61
|
+
|
62
|
+
# Check the very last action made: it means all setup processes are done!
|
63
|
+
if test "[ -f \"#{shared_path}/.tmp\" -o ! -f \"#{shared_path}/web/robots.txt\" ]"
|
64
|
+
# Composer install
|
65
|
+
invoke "composer:install"
|
66
|
+
|
67
|
+
# Linked files
|
68
|
+
invoke "files:after_action"
|
69
|
+
|
70
|
+
# Create database
|
71
|
+
invoke "database:do_actions"
|
72
|
+
|
73
|
+
# Install WP
|
74
|
+
invoke "database:wp_cli"
|
75
|
+
else
|
76
|
+
# Composer install
|
77
|
+
invoke "composer:install"
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
28
81
|
end
|
29
82
|
|
30
83
|
desc "Restart services and clear caches"
|
31
|
-
task :
|
84
|
+
task :clear_caches do
|
32
85
|
on release_roles(:all) do
|
33
86
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
#invoke "server:stop"
|
38
|
-
#invoke "php:restart"
|
39
|
-
#invoke "server:start"
|
87
|
+
puts " "
|
88
|
+
puts "Running deploy:clear_caches task".colorize(:color => :light_green, :mode => :bold)
|
89
|
+
puts " "
|
40
90
|
|
41
|
-
#
|
42
|
-
#invoke "redis:flushall"
|
43
|
-
#invoke "pagespeed:flushall"
|
44
|
-
#invoke "varnish:restart"
|
91
|
+
#Do nothing for now...
|
45
92
|
|
46
93
|
end
|
47
94
|
end
|
48
95
|
|
49
|
-
#
|
50
|
-
before :starting, 'deploy:
|
96
|
+
# Messages
|
97
|
+
before 'deploy:starting', 'deploy:message_start'
|
98
|
+
after 'deploy:finished', 'deploy:message_finish'
|
51
99
|
|
52
|
-
# Initialize
|
53
|
-
|
100
|
+
# Initialize
|
101
|
+
before 'deploy:starting', 'deploy:init_folders'
|
102
|
+
before 'deploy:check', 'deploy:init_files'
|
103
|
+
after 'deploy:updating', 'deploy:init_all'
|
54
104
|
|
55
105
|
# Restart services and clear caches
|
56
|
-
after :publishing, 'deploy:
|
106
|
+
after 'deploy:publishing', 'deploy:clear_caches'
|
57
107
|
|
58
108
|
end
|
@@ -1,135 +1,47 @@
|
|
1
1
|
# Database
|
2
2
|
namespace :database do
|
3
3
|
|
4
|
-
desc "Creates
|
4
|
+
desc "Creates database"
|
5
5
|
task :do_actions do
|
6
6
|
on release_roles(:all) do
|
7
7
|
|
8
|
-
#
|
9
|
-
|
10
|
-
|
11
|
-
set :database_user, ask("Enter the database user:".colorize(:magenta), 'username_here')
|
12
|
-
set :database_pass, ask("Enter the database password:".colorize(:magenta), 'password_here', echo: false)
|
8
|
+
# Create database
|
9
|
+
puts " "
|
10
|
+
puts "> Create database.sql file".colorize(:light_blue)
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
set :wordpress_pass, ask("Enter the admin password:".colorize(:magenta), 'password', echo: false)
|
12
|
+
io = StringIO.new("CREATE DATABASE IF NOT EXISTS `#{fetch(:database_name)}`;")
|
13
|
+
upload! io, File.join(shared_path, "database.sql")
|
17
14
|
|
15
|
+
execute :chmod, "644 #{shared_path}/database.sql"
|
16
|
+
execute :mysql, "-u #{fetch(:database_user)} -p#{fetch(:database_pass)} -h #{fetch(:database_host)} < #{shared_path}/database.sql"
|
17
|
+
execute :rm, "#{shared_path}/database.sql"
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
upload! StringIO.new(File.read("#{release_path}/tmp/database.sql")), "#{shared_path}/tmp/database.sql"
|
22
|
-
else
|
23
|
-
puts "Create database.sql file".colorize(:light_blue)
|
24
|
-
io = StringIO.new("CREATE DATABASE IF NOT EXISTS `#{fetch(:database_name)}`;")
|
25
|
-
upload! io, File.join(shared_path, "database.sql")
|
26
|
-
execute :chmod, "644 #{shared_path}/database.sql"
|
19
|
+
puts "end :database:do_actions".colorize(:light_blue)
|
20
|
+
puts " "
|
27
21
|
|
28
|
-
|
29
|
-
|
30
|
-
execute :rm, "#{shared_path}/database.sql"
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
if File.exists?("#{release_path}/app/config/env.php")
|
35
|
-
puts "Copy env.php file".colorize(:light_blue)
|
36
|
-
upload! StringIO.new(File.read("#{release_path}/app/config/env.php")), "#{shared_path}/app/config/env.php"
|
37
|
-
else
|
38
|
-
puts "Create env.php file".colorize(:light_blue)
|
39
|
-
|
40
|
-
if fetch(:stage) == :production then
|
41
|
-
set :use_cache, true
|
42
|
-
set :use_wpcron, false
|
43
|
-
set :debug, "false"
|
44
|
-
else
|
45
|
-
set :use_cache, false
|
46
|
-
set :use_wpcron, true
|
47
|
-
set :debug, "['savequeries' => true, 'script_debug' => true, 'wp_debug_display' => true, 'wp_debug' => true]"
|
48
|
-
end
|
49
|
-
|
50
|
-
io = StringIO.new("<?php
|
51
|
-
|
52
|
-
/**
|
53
|
-
* File auto-generated while first deploy.
|
54
|
-
*/
|
55
|
-
return [
|
56
|
-
// Database
|
57
|
-
'database' => [
|
58
|
-
'host' => '#{fetch(:database_host)}',
|
59
|
-
'name' => '#{fetch(:database_name)}',
|
60
|
-
'user' => '#{fetch(:database_user)}',
|
61
|
-
'pass' => '#{fetch(:database_pass)}',
|
62
|
-
'charset' => 'utf8',
|
63
|
-
'collate' => '',
|
64
|
-
'prefix' => 'wp_',
|
65
|
-
],
|
66
|
-
|
67
|
-
// WordPress configurations
|
68
|
-
'wordpress' => [
|
69
|
-
'home' => '#{fetch(:localurl)}',
|
70
|
-
'siteurl' => '#{fetch(:localurl)}/cms',
|
71
|
-
'revisions' => 3
|
72
|
-
],
|
73
|
-
|
74
|
-
// Secure?
|
75
|
-
'https' => false,
|
76
|
-
|
77
|
-
// Default WordPress cron?
|
78
|
-
'cron' => #{fetch(:use_wpcron)},
|
79
|
-
|
80
|
-
// Security
|
81
|
-
'file_edit' => false,
|
82
|
-
|
83
|
-
// Cache
|
84
|
-
'cache' => #{fetch(:use_cache)},
|
85
|
-
|
86
|
-
// Debug
|
87
|
-
'debug' => #{fetch(:debug)},
|
88
|
-
];
|
89
|
-
|
90
|
-
")
|
91
|
-
upload! io, File.join(shared_path, "env.php")
|
92
|
-
execute :chmod, "644 #{shared_path}/env.php"
|
93
|
-
execute :mv, "#{shared_path}/env.php", "#{shared_path}/app/config/"
|
94
|
-
end
|
95
|
-
|
96
|
-
|
97
|
-
if File.exists?("#{release_path}/app/config/salt.php")
|
98
|
-
puts "Copy salt.php file".colorize(:light_blue)
|
99
|
-
upload! StringIO.new(File.read("#{release_path}/app/config/salt.php")), "#{shared_path}/app/config/salt.php"
|
100
|
-
else
|
101
|
-
puts "Create salt.php file".colorize(:light_blue)
|
102
|
-
set :secret_keys, capture("curl -s -k https://api.wordpress.org/secret-key/1.1/salt")
|
103
|
-
|
104
|
-
io = StringIO.new("<?php
|
105
|
-
|
106
|
-
/**
|
107
|
-
* File auto-generated while first deploy.
|
108
|
-
* @link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service
|
109
|
-
*/
|
110
|
-
#{fetch(:secret_keys)}
|
22
|
+
end
|
23
|
+
end
|
111
24
|
|
112
|
-
"
|
113
|
-
|
114
|
-
|
115
|
-
execute :mv, "#{shared_path}/salt.php", "#{shared_path}/app/config/"
|
116
|
-
end
|
25
|
+
desc "Install WP"
|
26
|
+
task :wp_cli do
|
27
|
+
on release_roles(:all) do
|
117
28
|
|
29
|
+
# Execute WordPress SQL requests
|
30
|
+
puts " "
|
31
|
+
puts "> Execute wp-cli commands to install WordPress SQL requests".colorize(:light_blue)
|
118
32
|
|
119
|
-
puts "Execute wp-cli commands to create database".colorize(:light_blue)
|
120
33
|
execute :mkdir, '-p', "#{shared_path}/tmp/wpcli"
|
121
34
|
execute "wp core download --path=#{shared_path}/tmp/wpcli --force"
|
122
35
|
|
123
|
-
|
124
|
-
|
125
|
-
execute "wp core config --path=#{shared_path}/tmp/wpcli --dbname=#{fetch(:database_name)} --dbuser=#{fetch(:database_user)} --dbpass=#{fetch(:database_pass)}"
|
126
|
-
end
|
36
|
+
puts "Execute wp-cli command to generate wp-config.php file".colorize(:light_blue)
|
37
|
+
execute "wp core config --path=#{shared_path}/tmp/wpcli --dbname=#{fetch(:database_name)} --dbuser=#{fetch(:database_user)} --dbpass=#{fetch(:database_pass)}"
|
127
38
|
|
128
|
-
puts "Execute wp-cli command to install WordPress in the database".colorize(:light_blue)
|
129
39
|
execute "wp core install --path=#{shared_path}/tmp/wpcli --url=#{fetch(:localurl)} --title=#{fetch(:application)} --admin_user=#{fetch(:wordpress_name)} --admin_password=#{fetch(:wordpress_pass)} --admin_email=#{fetch(:wordpress_mail)}"
|
130
|
-
|
131
40
|
execute :rm, '-rf', "#{shared_path}/tmp"
|
132
41
|
|
42
|
+
puts "end :database:wp_cli".colorize(:light_blue)
|
43
|
+
puts " "
|
44
|
+
|
133
45
|
end
|
134
46
|
end
|
135
47
|
|
@@ -5,30 +5,28 @@ namespace :directories do
|
|
5
5
|
task :do_actions do
|
6
6
|
on release_roles(:all) do
|
7
7
|
|
8
|
+
# Create app/config folder
|
8
9
|
if test "[ ! -d \"#{shared_path}/app/config\" ]"
|
9
|
-
puts "
|
10
|
+
puts " "
|
11
|
+
puts "> Create app/config folder".colorize(:light_blue)
|
10
12
|
execute :mkdir, '-p', "#{shared_path}/app/config"
|
11
13
|
end
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
15
|
+
# Create all linked dirs
|
16
|
+
fetch(:linked_dirs).each do |folder|
|
17
|
+
if test "[ ! -d \"#{shared_path}/#{folder}\" ]"
|
18
|
+
puts " "
|
19
|
+
puts "> Create #{folder} folder".colorize(:light_blue)
|
20
|
+
execute :mkdir, '-p', "#{shared_path}/#{folder}"
|
21
|
+
|
22
|
+
if test "[ -d \"#{release_path}/#{folder}\" ]"
|
23
|
+
execute :rm, '-rf', "#{release_path}/#{folder}"
|
24
|
+
end
|
25
|
+
end
|
16
26
|
end
|
17
27
|
|
18
|
-
|
19
|
-
|
20
|
-
execute :mkdir, '-p', "#{shared_path}/web/statics/languages"
|
21
|
-
end
|
22
|
-
|
23
|
-
if test "[ ! -d \"#{shared_path}/web/statics/plugins\" ]"
|
24
|
-
puts "Create web/statics/plugins folder".colorize(:light_blue)
|
25
|
-
execute :mkdir, '-p', "#{shared_path}/web/statics/plugins"
|
26
|
-
end
|
27
|
-
|
28
|
-
if test "[ ! -d \"#{shared_path}/web/statics/uploads\" ]"
|
29
|
-
puts "Create web/statics/uploads folder".colorize(:light_blue)
|
30
|
-
execute :mkdir, '-p', "#{shared_path}/web/statics/uploads"
|
31
|
-
end
|
28
|
+
puts "end :directories".colorize(:light_blue)
|
29
|
+
puts " "
|
32
30
|
|
33
31
|
end
|
34
32
|
end
|
@@ -1,18 +1,70 @@
|
|
1
1
|
# Files
|
2
2
|
namespace :files do
|
3
3
|
|
4
|
-
desc "
|
5
|
-
task :
|
4
|
+
desc "Create shared files"
|
5
|
+
task :before_action do
|
6
6
|
on release_roles(:all) do
|
7
7
|
|
8
|
-
# Create
|
9
|
-
|
8
|
+
# Create temporary (fake) files for symlinks
|
9
|
+
fetch(:linked_files).each do |file|
|
10
|
+
puts " "
|
11
|
+
puts "> Create #{file} temporary file".colorize(:light_black)
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
+
execute :touch, "#{shared_path}/#{file}"
|
14
|
+
execute :chmod, "644 #{shared_path}/#{file}"
|
15
|
+
end
|
13
16
|
|
14
|
-
#
|
15
|
-
|
17
|
+
# Special case
|
18
|
+
puts " "
|
19
|
+
puts "> Create .tmp temporary file".colorize(:light_black)
|
20
|
+
|
21
|
+
execute :touch, "#{shared_path}/.tmp"
|
22
|
+
execute :chmod, "644 #{shared_path}/.tmp"
|
23
|
+
|
24
|
+
puts "end :files:before_action".colorize(:light_blue)
|
25
|
+
puts " "
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "Create useful files"
|
31
|
+
task :after_action do
|
32
|
+
on release_roles(:all) do
|
33
|
+
|
34
|
+
# Special case
|
35
|
+
if test "[ -f \"#{shared_path}/.tmp\" ]"
|
36
|
+
puts " "
|
37
|
+
puts "> Remove .tmp temporary file".colorize(:light_black)
|
38
|
+
|
39
|
+
execute :rm, "#{shared_path}/.tmp"
|
40
|
+
end
|
41
|
+
|
42
|
+
# Create .htaccess file
|
43
|
+
puts " "
|
44
|
+
puts "> Copy .htaccess file".colorize(:light_blue)
|
45
|
+
|
46
|
+
execute :cp, "#{release_path}/web/.htaccess.dist", "#{release_path}/web/.htaccess"
|
47
|
+
execute :chmod, "644 #{release_path}/web/.htaccess"
|
48
|
+
|
49
|
+
# Create robots.txt file
|
50
|
+
if fetch(:stage) == :staging then
|
51
|
+
puts " "
|
52
|
+
puts "> Copy robots.txt file for production environment with '#{fetch(:stage_url)}' url".colorize(:light_blue)
|
53
|
+
|
54
|
+
execute :cp, "#{release_path}/web/robots.txt.dist", "#{release_path}/web/robots.txt"
|
55
|
+
execute :chmod, "644 #{release_path}/web/robots.txt"
|
56
|
+
execute :sed, "-i 's|http://www.domain.tld|#{fetch(:stage_url)}|g' #{release_path}/web/robots.txt"
|
57
|
+
else
|
58
|
+
puts " "
|
59
|
+
puts "> Create robots.txt file for staging environment".colorize(:light_blue)
|
60
|
+
|
61
|
+
execute :cp, "#{release_path}/web/robots.txt.dist", "#{release_path}/web/robots.txt"
|
62
|
+
execute "echo \"User-agent: *\\nDisallow: /\\n\" > #{release_path}/web/robots.txt"
|
63
|
+
execute :chmod, "644 #{release_path}/web/robots.txt"
|
64
|
+
end
|
65
|
+
|
66
|
+
puts "end :files:after_action".colorize(:light_blue)
|
67
|
+
puts " "
|
16
68
|
|
17
69
|
end
|
18
70
|
end
|
@@ -1,16 +1,5 @@
|
|
1
|
-
# config valid only for current version of Capistrano
|
2
|
-
lock '3.4.0'
|
3
|
-
|
4
1
|
# ~~~~
|
5
2
|
|
6
|
-
# Setup Capistrano
|
7
|
-
set :log_level, fetch(:log_level, :debug)
|
8
|
-
set :keep_releases, fetch(:keep_releases, 3)
|
9
|
-
|
10
|
-
# Setup Project
|
11
|
-
set :application, fetch(:application, 'olympus-capified')
|
12
|
-
set :localurl, fetch(:localurl, 'http://www.domain.tld')
|
13
|
-
|
14
3
|
# Setup Git
|
15
4
|
set :repo_url, 'git@github.com:crewstyle/Olympus.git'
|
16
5
|
set :scm, :git
|
@@ -26,10 +15,24 @@ set :ssh_options, {
|
|
26
15
|
# ~~~~
|
27
16
|
|
28
17
|
# Setup Composer
|
29
|
-
|
18
|
+
set :composer_flags, '--no-dev --prefer-dist --optimize-autoloader'
|
19
|
+
set :composer_install_flags, fetch(:composer_flags)
|
30
20
|
|
31
21
|
# ~~~~
|
32
22
|
|
33
23
|
# Setup Symlinks
|
34
24
|
set :linked_files, ["app/config/env.php", "app/config/salt.php", "web/.htaccess", "web/robots.txt"]
|
35
25
|
set :linked_dirs, ["web/statics/languages", "web/statics/plugins", "web/statics/uploads"]
|
26
|
+
|
27
|
+
# ~~~~
|
28
|
+
|
29
|
+
# Setup Database
|
30
|
+
set :database_host, ask("Enter the database hostname:".colorize(:magenta), 'localhost')
|
31
|
+
set :database_name, ask("Enter the database name:".colorize(:magenta), 'database_name_here')
|
32
|
+
set :database_user, ask("Enter the database user:".colorize(:magenta), 'username_here')
|
33
|
+
set :database_pass, ask("Enter the database password:".colorize(:magenta), 'password_here', echo: false)
|
34
|
+
|
35
|
+
# Setup WordPress
|
36
|
+
set :wordpress_name, ask("Enter the admin username:".colorize(:magenta), 'admin')
|
37
|
+
set :wordpress_mail, ask("Enter the admin email address:".colorize(:magenta), 'admin@domain.tld')
|
38
|
+
set :wordpress_pass, ask("Enter the admin password:".colorize(:magenta), 'password', echo: false)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-olympus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Achraf Chouk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.0.
|
33
|
+
version: 0.0.3
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.0.
|
40
|
+
version: 0.0.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: colorize
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.7.7
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: sshkit-sudo
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.1.0
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.1.0
|
69
55
|
description: Capistrano 3.x deployment processes for WordPress and Olympus framework
|
70
56
|
email:
|
71
57
|
- achrafchouk@gmail.com
|
@@ -80,15 +66,12 @@ files:
|
|
80
66
|
- lib/capistrano-olympus.rb
|
81
67
|
- lib/capistrano/olympus.rb
|
82
68
|
- lib/capistrano/tasks/capistrano-deploy.rake
|
83
|
-
- lib/capistrano/tasks/composer.rake
|
84
69
|
- lib/capistrano/tasks/database.rake
|
85
70
|
- lib/capistrano/tasks/directories.rake
|
86
71
|
- lib/capistrano/tasks/files.rake
|
87
|
-
- lib/capistrano/tasks/htaccess.rake
|
88
72
|
- lib/capistrano/tasks/pagespeed.rake
|
89
73
|
- lib/capistrano/tasks/php.rake
|
90
74
|
- lib/capistrano/tasks/redis.rake
|
91
|
-
- lib/capistrano/tasks/robots.rake
|
92
75
|
- lib/capistrano/tasks/server.rake
|
93
76
|
- lib/capistrano/tasks/varnish.rake
|
94
77
|
- lib/capistrano/vars/defaults.rb
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# Composer
|
2
|
-
namespace :composer do
|
3
|
-
|
4
|
-
desc "Composer run install"
|
5
|
-
task :install do
|
6
|
-
on release_roles(:all) do
|
7
|
-
|
8
|
-
puts "Install composer vendors in #{release_path}".colorize(:light_blue)
|
9
|
-
execute "cd #{release_path} && composer install --quiet"
|
10
|
-
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# Htaccess
|
2
|
-
namespace :htaccess do
|
3
|
-
|
4
|
-
desc "Creates files"
|
5
|
-
task :do_actions do
|
6
|
-
on release_roles(:all) do
|
7
|
-
|
8
|
-
if File.exists?("#{release_path}/web/.htaccess")
|
9
|
-
puts "Copy .htaccess file".colorize(:light_blue)
|
10
|
-
upload! StringIO.new(File.read("#{release_path}/web/.htaccess")), "#{shared_path}/web/.htaccess"
|
11
|
-
else
|
12
|
-
puts "Create .htaccess file".colorize(:light_blue)
|
13
|
-
io = StringIO.new("
|
14
|
-
# BEGIN WordPress
|
15
|
-
|
16
|
-
<IfModule mod_rewrite.c>
|
17
|
-
RewriteEngine On
|
18
|
-
RewriteBase /
|
19
|
-
RewriteRule ^index\.php$ - [L]
|
20
|
-
RewriteCond %{REQUEST_FILENAME} !-f
|
21
|
-
RewriteCond %{REQUEST_FILENAME} !-d
|
22
|
-
RewriteRule . /index.php [L]
|
23
|
-
</IfModule>
|
24
|
-
|
25
|
-
# END WordPress
|
26
|
-
")
|
27
|
-
upload! io, File.join(shared_path, ".htaccess")
|
28
|
-
execute :chmod, "644 #{shared_path}/.htaccess"
|
29
|
-
execute :mv, "#{shared_path}/.htaccess", "#{shared_path}/web/"
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
# Robots
|
2
|
-
namespace :robots do
|
3
|
-
|
4
|
-
desc "Creates files"
|
5
|
-
task :do_actions do
|
6
|
-
on release_roles(:all) do
|
7
|
-
|
8
|
-
if File.exists?("#{release_path}/web/robots.txt")
|
9
|
-
puts "Copy robots.txt file".colorize(:light_blue)
|
10
|
-
upload! StringIO.new(File.read("#{release_path}/web/robots.txt")), "#{shared_path}/web/robots.txt"
|
11
|
-
else
|
12
|
-
puts "Create robots.txt file".colorize(:light_blue)
|
13
|
-
if fetch(:stage) == :production then
|
14
|
-
io = StringIO.new("Sitemap: #{fetch(:localurl)}/sitemap.xml
|
15
|
-
|
16
|
-
User-agent: *
|
17
|
-
Disallow: /*?
|
18
|
-
|
19
|
-
User-agent: Googlebot
|
20
|
-
User-agent: Googlebot-News
|
21
|
-
User-agent: Googlebot-Image
|
22
|
-
User-agent: Googlebot-Video
|
23
|
-
User-agent: Googlebot-Mobile
|
24
|
-
User-agent: Mediapartners-Google
|
25
|
-
User-agent: Mediapartners
|
26
|
-
User-agent: AdsBot-Google
|
27
|
-
User-agent: Bingbot
|
28
|
-
User-agent: Twitterbot
|
29
|
-
Crawl-delay: 5
|
30
|
-
|
31
|
-
User-agent: CCBot
|
32
|
-
Crawl-delay: 10
|
33
|
-
|
34
|
-
User-agent: Yandex
|
35
|
-
Crawl-delay: 10
|
36
|
-
|
37
|
-
User-agent: Applebot
|
38
|
-
Crawl-delay: 10
|
39
|
-
|
40
|
-
User-agent: archive.org_bot
|
41
|
-
Crawl-delay: 10
|
42
|
-
|
43
|
-
User-agent: ia_archiver
|
44
|
-
Crawl-delay: 10
|
45
|
-
")
|
46
|
-
else
|
47
|
-
io = StringIO.new("User-agent: *
|
48
|
-
Disallow: /
|
49
|
-
")
|
50
|
-
end
|
51
|
-
|
52
|
-
upload! io, File.join(shared_path, "robots.txt")
|
53
|
-
execute :chmod, "644 #{shared_path}/robots.txt"
|
54
|
-
execute :mv, "#{shared_path}/robots.txt", "#{shared_path}/web/robots.txt"
|
55
|
-
end
|
56
|
-
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|