wslave 0.2.0 → 0.3.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 +4 -4
- data/base/Rakefile +5 -0
- data/base/config/deploy-tools/nginx.vhost.erb +4 -4
- data/base/config/deploy.rb +1 -1
- data/base/config/deploy/.production.rb.swp +0 -0
- data/base/config/deploy/.staging.rb.swp +0 -0
- data/base/config/deploy/production.rb +25 -7
- data/base/config/deploy/staging.rb +26 -7
- data/base/docker-compose.yml +2 -2
- data/base/docker/apache/Dockerfile +1 -1
- data/base/docker/nginx/Dockerfile +7 -2
- data/base/docker/nginx/nginx.vhost +26 -26
- data/base/docker/nginx/supervisord.conf +1 -1
- data/bin/wslave +64 -71
- data/lib/wslave_docker.rb +27 -7
- data/lib/wslave_new.rb +24 -5
- data/lib/wslave_tools.rb +2 -0
- data/wslave.gemspec +5 -5
- metadata +17 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9097b3fe47c8f112323d69a91628033a8fd1fe6f1d79cadd3070b49d1b66f23
|
4
|
+
data.tar.gz: 5286c213c8943c4abe5fe891c48bb52bc6221a0bd3e06421a1726765b7e468d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 575e6219da5b439cf6f3079f2e4adb7b54c841f705285620e7ae3dec884dd6e5360e8c20b086046fcdcc5304a42245b59f03c0334de389cc352d6f34bacb1fcd
|
7
|
+
data.tar.gz: 47d48b9b1f032b04c4965f13212e20cfb47b846622db763932472904d4e2015c52f591cbb954203fcac82524cff9516f59069033d010ee9172a25a60901f1418
|
data/base/Rakefile
CHANGED
@@ -3,6 +3,11 @@ require 'yaml'
|
|
3
3
|
|
4
4
|
@opts = YAML.load_file('config/definitions.yml')
|
5
5
|
|
6
|
+
desc "Print simple instructions."
|
7
|
+
task :default do
|
8
|
+
puts 'Please call rake with a taks name, such as "db:dev", or list tasks with "rake -T".'
|
9
|
+
end
|
10
|
+
|
6
11
|
def rm_dbfile(profile)
|
7
12
|
puts "Deleting db/#{profile}/wordpress.sql"
|
8
13
|
FileUtils.rm("db/#{profile}/wordpress.sql") if File.exist?("db/#{profile}/wordpress.sql")
|
@@ -33,19 +33,19 @@ server {
|
|
33
33
|
log_not_found off;
|
34
34
|
}
|
35
35
|
|
36
|
-
location
|
36
|
+
location ~* \.(blade\.php)$ {
|
37
37
|
deny all;
|
38
38
|
}
|
39
39
|
|
40
|
-
location
|
40
|
+
location ~* composer\.(json|lock)$ {
|
41
41
|
deny all;
|
42
42
|
}
|
43
43
|
|
44
|
-
location
|
44
|
+
location ~* package(-lock)?\.json$ {
|
45
45
|
deny all;
|
46
46
|
}
|
47
47
|
|
48
|
-
location
|
48
|
+
location ~* yarn\.lock$ {
|
49
49
|
deny all;
|
50
50
|
}
|
51
51
|
}
|
data/base/config/deploy.rb
CHANGED
Binary file
|
Binary file
|
@@ -14,14 +14,16 @@ site_fqdn = opts['deployer']['fqdn']['production']
|
|
14
14
|
disable_rsync = (opts.include?('options') && opts['options'].include?('rsync_enabled') &&
|
15
15
|
opts['options']['rsync_enabled'] == false)
|
16
16
|
|
17
|
-
|
17
|
+
if (opts['deployer'].include?('branch') && opts['deployer']['branch'].include?('production'))
|
18
|
+
set :branch, opts['deployer']['branch']['production']
|
19
|
+
end
|
18
20
|
|
19
21
|
role :web, "#{deploy_user}@#{host_addr}"
|
20
22
|
|
21
23
|
set :tmp_dir, "#{multisite_root}/tmp"
|
22
24
|
deploy_path = "#{multisite_root}/#{site_fqdn}"
|
23
25
|
|
24
|
-
set :linked_dirs, %w{public/wp-content/uploads public/wordpress public/wp-content/upgrade public/wp-content/plugins tmp}
|
26
|
+
set :linked_dirs, %w{public/wp-content/uploads public/wordpress public/wp-content/upgrade public/wp-content/plugins public/data tmp}
|
25
27
|
set :linked_files, %w{public/wp-config.php}
|
26
28
|
|
27
29
|
set :deploy_to, deploy_path
|
@@ -80,6 +82,20 @@ namespace :deploy do
|
|
80
82
|
end
|
81
83
|
end
|
82
84
|
|
85
|
+
desc 'Syncs the static data directory with rsync'
|
86
|
+
task :sync_static_data do
|
87
|
+
on roles(:web) do
|
88
|
+
`rsync -avzPhu --delete ./public/data/ #{deploy_user}@#{host_addr}:#{deploy_path}/shared/public/data/`
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
desc 'Uploads the static data directory'
|
93
|
+
task :upload_static_data do
|
94
|
+
on roles(:web) do
|
95
|
+
upload! './public/data', "#{deploy_path}/shared/public/data/", recursive: true
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
83
99
|
desc 'Builds and Syncs the project Sage theme'
|
84
100
|
task :sync_sage_theme do
|
85
101
|
on roles(:web) do
|
@@ -89,8 +105,8 @@ namespace :deploy do
|
|
89
105
|
puts "Couldn't find a Sage theme for this project."
|
90
106
|
else
|
91
107
|
wss.production()
|
92
|
-
`rsync -avzPhu --delete ./public/wp-content/themes/#{sage_theme_name}/vendor #{deploy_user}@#{host_addr}:#{deploy_path}/current/public/wp-content/themes/#{sage_theme_name}/vendor
|
93
|
-
`rsync -avzPhu --delete ./public/wp-content/themes/#{sage_theme_name}/dist #{deploy_user}@#{host_addr}:#{deploy_path}/current/public/wp-content/themes/#{sage_theme_name}/dist
|
108
|
+
`rsync -avzPhu --delete ./public/wp-content/themes/#{sage_theme_name}/vendor/ #{deploy_user}@#{host_addr}:#{deploy_path}/current/public/wp-content/themes/#{sage_theme_name}/vendor/`
|
109
|
+
`rsync -avzPhu --delete ./public/wp-content/themes/#{sage_theme_name}/dist/ #{deploy_user}@#{host_addr}:#{deploy_path}/current/public/wp-content/themes/#{sage_theme_name}/dist/`
|
94
110
|
end
|
95
111
|
end
|
96
112
|
end
|
@@ -104,8 +120,8 @@ namespace :deploy do
|
|
104
120
|
puts "Couldn't find a Sage theme for this project."
|
105
121
|
else
|
106
122
|
wss.production()
|
107
|
-
upload! "./public/wp-content/themes/#{sage_theme_name}/vendor", "#{deploy_path}/current/public/wp-content/themes/#{sage_theme_name}/", recursive: true
|
108
|
-
upload! "./public/wp-content/themes/#{sage_theme_name}/dist", "#{deploy_path}/current/public/wp-content/themes/#{sage_theme_name}/", recursive: true
|
123
|
+
upload! "./public/wp-content/themes/#{sage_theme_name}/vendor/", "#{deploy_path}/current/public/wp-content/themes/#{sage_theme_name}/", recursive: true
|
124
|
+
upload! "./public/wp-content/themes/#{sage_theme_name}/dist/", "#{deploy_path}/current/public/wp-content/themes/#{sage_theme_name}/", recursive: true
|
109
125
|
end
|
110
126
|
end
|
111
127
|
end
|
@@ -192,15 +208,17 @@ namespace :deploy do
|
|
192
208
|
invoke('deploy:upload_wp')
|
193
209
|
invoke('deploy:upload_plugins')
|
194
210
|
invoke('deploy:upload_uploads')
|
211
|
+
invoke('deploy:upload_static_data')
|
195
212
|
else
|
196
213
|
invoke('deploy:sync_wp')
|
197
214
|
invoke('deploy:sync_plugins')
|
198
215
|
invoke('deploy:sync_uploads')
|
216
|
+
invoke('deploy:sync_static_data')
|
199
217
|
end
|
200
218
|
invoke('deploy')
|
201
|
-
invoke('sage')
|
202
219
|
invoke('db:seed')
|
203
220
|
invoke('deploy:chikan')
|
221
|
+
invoke('deploy:sage')
|
204
222
|
invoke('deploy:set_permissions')
|
205
223
|
end
|
206
224
|
end
|
@@ -14,14 +14,16 @@ site_fqdn = opts['deployer']['fqdn']['staging']
|
|
14
14
|
disable_rsync = (opts.include?('options') && opts['options'].include?('rsync_enabled') &&
|
15
15
|
opts['options']['rsync_enabled'] == false)
|
16
16
|
|
17
|
-
|
17
|
+
if (opts['deployer'].include?('branch') && opts['deployer']['branch'].include?('staging'))
|
18
|
+
set :branch, opts['deployer']['branch']['staging']
|
19
|
+
end
|
18
20
|
|
19
21
|
role :web, "#{deploy_user}@#{host_addr}"
|
20
22
|
|
21
23
|
set :tmp_dir, "#{multisite_root}/tmp"
|
22
24
|
deploy_path = "#{multisite_root}/#{site_fqdn}"
|
23
25
|
|
24
|
-
set :linked_dirs, %w{public/wp-content/uploads public/wordpress public/wp-content/upgrade public/wp-content/plugins tmp}
|
26
|
+
set :linked_dirs, %w{public/wp-content/uploads public/wordpress public/wp-content/upgrade public/wp-content/plugins public/data tmp}
|
25
27
|
set :linked_files, %w{public/wp-config.php}
|
26
28
|
|
27
29
|
set :deploy_to, deploy_path
|
@@ -30,6 +32,7 @@ namespace :deploy do
|
|
30
32
|
desc "Generate wp-config.php for profile"
|
31
33
|
task :wp_config do
|
32
34
|
on roles(:web) do
|
35
|
+
invoke 'deploy:check:make_linked_dirs'
|
33
36
|
require_relative '../deploy-tools/gen-wp-config'
|
34
37
|
FileUtils.mkdir('./tmp') unless Dir.exist?('./tmp')
|
35
38
|
GenerateWPConfig('staging', './tmp')
|
@@ -79,6 +82,20 @@ namespace :deploy do
|
|
79
82
|
end
|
80
83
|
end
|
81
84
|
|
85
|
+
desc 'Syncs the static data directory with rsync'
|
86
|
+
task :sync_static_data do
|
87
|
+
on roles(:web) do
|
88
|
+
`rsync -avzPhu --delete ./public/data/ #{deploy_user}@#{host_addr}:#{deploy_path}/shared/public/data/`
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
desc 'Uploads the static data directory'
|
93
|
+
task :upload_static_data do
|
94
|
+
on roles(:web) do
|
95
|
+
upload! './public/data', "#{deploy_path}/shared/public/data/", recursive: true
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
82
99
|
desc 'Builds and Syncs the project Sage theme'
|
83
100
|
task :sync_sage_theme do
|
84
101
|
on roles(:web) do
|
@@ -88,8 +105,8 @@ namespace :deploy do
|
|
88
105
|
puts "Couldn't find a Sage theme for this project."
|
89
106
|
else
|
90
107
|
wss.production()
|
91
|
-
`rsync -avzPhu --delete ./public/wp-content/themes/#{sage_theme_name}/vendor #{deploy_user}@#{host_addr}:#{deploy_path}/current/public/wp-content/themes/#{sage_theme_name}/vendor
|
92
|
-
`rsync -avzPhu --delete ./public/wp-content/themes/#{sage_theme_name}/dist #{deploy_user}@#{host_addr}:#{deploy_path}/current/public/wp-content/themes/#{sage_theme_name}/dist
|
108
|
+
`rsync -avzPhu --delete ./public/wp-content/themes/#{sage_theme_name}/vendor/ #{deploy_user}@#{host_addr}:#{deploy_path}/current/public/wp-content/themes/#{sage_theme_name}/vendor/`
|
109
|
+
`rsync -avzPhu --delete ./public/wp-content/themes/#{sage_theme_name}/dist/ #{deploy_user}@#{host_addr}:#{deploy_path}/current/public/wp-content/themes/#{sage_theme_name}/dist/`
|
93
110
|
end
|
94
111
|
end
|
95
112
|
end
|
@@ -103,8 +120,8 @@ namespace :deploy do
|
|
103
120
|
puts "Couldn't find a Sage theme for this project."
|
104
121
|
else
|
105
122
|
wss.production()
|
106
|
-
upload! "./public/wp-content/themes/#{sage_theme_name}/vendor", "#{deploy_path}/current/public/wp-content/themes/#{sage_theme_name}/", recursive: true
|
107
|
-
upload! "./public/wp-content/themes/#{sage_theme_name}/dist", "#{deploy_path}/current/public/wp-content/themes/#{sage_theme_name}/", recursive: true
|
123
|
+
upload! "./public/wp-content/themes/#{sage_theme_name}/vendor/", "#{deploy_path}/current/public/wp-content/themes/#{sage_theme_name}/", recursive: true
|
124
|
+
upload! "./public/wp-content/themes/#{sage_theme_name}/dist/", "#{deploy_path}/current/public/wp-content/themes/#{sage_theme_name}/", recursive: true
|
108
125
|
end
|
109
126
|
end
|
110
127
|
end
|
@@ -191,15 +208,17 @@ namespace :deploy do
|
|
191
208
|
invoke('deploy:upload_wp')
|
192
209
|
invoke('deploy:upload_plugins')
|
193
210
|
invoke('deploy:upload_uploads')
|
211
|
+
invoke('deploy:upload_static_data')
|
194
212
|
else
|
195
213
|
invoke('deploy:sync_wp')
|
196
214
|
invoke('deploy:sync_plugins')
|
197
215
|
invoke('deploy:sync_uploads')
|
216
|
+
invoke('deploy:sync_static_data')
|
198
217
|
end
|
199
218
|
invoke('deploy')
|
200
|
-
invoke('sage')
|
201
219
|
invoke('db:seed')
|
202
220
|
invoke('deploy:chikan')
|
221
|
+
invoke('deploy:sage')
|
203
222
|
invoke('deploy:set_permissions')
|
204
223
|
end
|
205
224
|
end
|
data/base/docker-compose.yml
CHANGED
@@ -3,9 +3,14 @@ FROM ubuntu:20.04
|
|
3
3
|
COPY nginx.vhost /etc/nginx/sites-enabled/default
|
4
4
|
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
5
5
|
|
6
|
-
RUN apt-get update
|
6
|
+
RUN apt-get update && apt-get dist-upgrade -y
|
7
7
|
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata
|
8
|
-
|
8
|
+
# NOTE: When the PHP FPM version changes, you MUST update the
|
9
|
+
# version named in base/docker/nginx/supervisord.conf and
|
10
|
+
# in base/docker/nginx/nginx.vhost, then rebuild the nweb image!
|
11
|
+
RUN apt-get install -y nginx php7.4-fpm php-mysql \
|
12
|
+
php7.4-mbstring php7.4-curl php7.4-dom php7.4-exif php7.4-fileinfo \
|
13
|
+
php7.4-json php7.4-imagick php7.4-xml php7.4-zip php7.4-iconv \
|
9
14
|
libpng-dev libjpeg-dev \
|
10
15
|
mariadb-client mariadb-common \
|
11
16
|
supervisor curl
|
@@ -1,48 +1,48 @@
|
|
1
1
|
server {
|
2
|
-
|
3
|
-
|
2
|
+
listen 80;
|
3
|
+
listen [::]:80;
|
4
4
|
|
5
|
-
|
5
|
+
server_name testing;
|
6
6
|
|
7
|
-
|
7
|
+
root /var/www/html;
|
8
8
|
|
9
|
-
|
9
|
+
index index.php;
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
location / {
|
12
|
+
rewrite ^/(wp-(admin|includes).*) /wordpress/$1 last;
|
13
13
|
|
14
|
-
|
14
|
+
rewrite ^/$ /wordpress/index.php last;
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
}
|
16
|
+
location ~ \.php {
|
17
|
+
if ($request_uri !~* "/wp-config.php") {
|
18
|
+
rewrite ^/wp-(.*)\.php$ /wordpress/wp-$1.php last;
|
19
|
+
}
|
20
|
+
rewrite ^/index\.php$ /wordpress/index.php last;
|
21
|
+
rewrite ^/wp-login\.php$ /hello.php last;
|
22
|
+
include snippets/fastcgi-php.conf;
|
23
|
+
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
|
25
24
|
}
|
25
|
+
}
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
location ~ /\. {
|
28
|
+
deny all;
|
29
|
+
access_log off;
|
30
|
+
log_not_found off;
|
31
|
+
}
|
32
32
|
|
33
|
-
location
|
33
|
+
location ~* \.(blade\.php)$ {
|
34
34
|
deny all;
|
35
35
|
}
|
36
36
|
|
37
|
-
location
|
37
|
+
location ~* composer\.(json|lock)$ {
|
38
38
|
deny all;
|
39
39
|
}
|
40
40
|
|
41
|
-
location
|
41
|
+
location ~* package(-lock)?\.json$ {
|
42
42
|
deny all;
|
43
43
|
}
|
44
44
|
|
45
|
-
location
|
45
|
+
location ~* yarn\.lock$ {
|
46
46
|
deny all;
|
47
47
|
}
|
48
48
|
}
|
data/bin/wslave
CHANGED
@@ -8,6 +8,13 @@ class WSlaveCLI < Thor
|
|
8
8
|
true
|
9
9
|
end
|
10
10
|
|
11
|
+
desc 'version', "Prints the version of the installed WSlave"
|
12
|
+
def version()
|
13
|
+
require 'rubygems'
|
14
|
+
spec = Gem::Specification::load("#{__dir__}/../wslave.gemspec")
|
15
|
+
puts spec.version
|
16
|
+
end
|
17
|
+
|
11
18
|
desc 'new [APP_PATH]', "Generate a new app at APP_PATH"
|
12
19
|
long_desc "Creates a new application in the current directory or in the specificed path."
|
13
20
|
option :version, default: '',
|
@@ -27,57 +34,6 @@ class WSlaveCLI < Thor
|
|
27
34
|
WSlaveUpdate.new()
|
28
35
|
end
|
29
36
|
|
30
|
-
desc 'server COMMAND [options]', "Control the development server container. " \
|
31
|
-
"Commands include: start stop log console"
|
32
|
-
long_desc <<-LONGDESC
|
33
|
-
Start, stop, view logs for, or connect to a console in a development server container.
|
34
|
-
\x5
|
35
|
-
\x5 COMMANDs:
|
36
|
-
\x5 start Starts a development server container. *Will restart the container if already running.
|
37
|
-
\x5 stop Stops a running development container.
|
38
|
-
\x5 log Connects to the container logs and follows them.
|
39
|
-
\x5 console Gives a terminal connection to a bash console on the web container.
|
40
|
-
\x5\x5
|
41
|
-
Examples:
|
42
|
-
\x5 Start dev container servers
|
43
|
-
\x5 > wslave server start
|
44
|
-
\x5 Start or restart dev container servers after resetting all volumes (reinit)
|
45
|
-
\x5 > wslave server start -v
|
46
|
-
\x5 Force stop all dev container servers
|
47
|
-
\x5 > wslave server stop -f
|
48
|
-
\x5 Show logs
|
49
|
-
\x5 > wslave server logs
|
50
|
-
|
51
|
-
|
52
|
-
\x5 * If you do not specify a COMMAND the default is to start a server.
|
53
|
-
\x5 * If a server is alredy running this command will restart the server.
|
54
|
-
LONGDESC
|
55
|
-
method_option :v, type: :boolean, default: false, description: 'remove volume data'
|
56
|
-
method_option :f, type: :boolean, default: false, description: 'force close other servers first'
|
57
|
-
def server(command = 'start')
|
58
|
-
puts 'Starting server...'
|
59
|
-
require_relative '../lib/wslave_docker'
|
60
|
-
WSlaveDocker.new().server(command.to_sym, options['f'], options['v'])
|
61
|
-
end
|
62
|
-
|
63
|
-
desc 'start [options]', "Starts the development server (short for 'server start')"
|
64
|
-
method_option :v, type: :boolean, default: false, description: 'remove volume data'
|
65
|
-
method_option :f, type: :boolean, default: false, description: 'force close other servers first'
|
66
|
-
def start()
|
67
|
-
puts 'Starting server...'
|
68
|
-
require_relative '../lib/wslave_docker'
|
69
|
-
WSlaveDocker.new().server(:start, options['f'], options['v'])
|
70
|
-
end
|
71
|
-
|
72
|
-
desc 'stop [options]', "Stops the development server (short for 'server stop')"
|
73
|
-
method_option :v, type: :boolean, default: false, description: 'remove volume data'
|
74
|
-
method_option :f, type: :boolean, default: false, description: 'force close other servers first'
|
75
|
-
def stop()
|
76
|
-
puts 'Stopping server...'
|
77
|
-
require_relative '../lib/wslave_docker'
|
78
|
-
WSlaveDocker.new().server(:stop, options['f'], options['v'])
|
79
|
-
end
|
80
|
-
|
81
37
|
desc 'sync', "Synchronizes submodules and file permissions"
|
82
38
|
def sync()
|
83
39
|
require_relative '../lib/wslave_tools'
|
@@ -85,39 +41,76 @@ class WSlaveCLI < Thor
|
|
85
41
|
WSlaveTools.sync()
|
86
42
|
end
|
87
43
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
44
|
+
class Server < Thor
|
45
|
+
desc 'start [options]', "Starts the development server"
|
46
|
+
method_option :f, type: :boolean, default: false, description: 'force close other servers first'
|
47
|
+
def start()
|
48
|
+
puts 'Starting server...'
|
49
|
+
require_relative '../lib/wslave_docker'
|
50
|
+
WSlaveDocker.new().server(:start, options['f'])
|
51
|
+
end
|
52
|
+
|
53
|
+
desc 'stop [options]', "Stops the development server"
|
54
|
+
method_option :f, type: :boolean, default: false, description: 'force close other servers first'
|
55
|
+
def stop()
|
56
|
+
puts 'Stopping server...'
|
57
|
+
require_relative '../lib/wslave_docker'
|
58
|
+
WSlaveDocker.new().server(:stop, options['f'])
|
59
|
+
end
|
60
|
+
|
61
|
+
desc 'reset [options]', "Deletes all container data and volumes, then rebuilds and restarts the containers"
|
62
|
+
method_option :f, type: :boolean, default: false, description: 'force close other servers first'
|
63
|
+
def reset()
|
64
|
+
puts 'Stopping server...'
|
65
|
+
require_relative '../lib/wslave_docker'
|
66
|
+
WSlaveDocker.new().server(:reset, options['f'])
|
67
|
+
end
|
68
|
+
|
69
|
+
desc 'reset [options]', "Shuts down containers and deletes all container data and volumes"
|
70
|
+
method_option :f, type: :boolean, default: false, description: 'force close other servers first'
|
71
|
+
def remove()
|
72
|
+
puts 'Stopping server...'
|
73
|
+
require_relative '../lib/wslave_docker'
|
74
|
+
WSlaveDocker.new().server(:remove, options['f'])
|
75
|
+
end
|
93
76
|
end
|
77
|
+
desc 'server COMMAND [options]', "Control the development server container"
|
78
|
+
subcommand 'server', Server
|
94
79
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
def sage(command = '', arg = '')
|
99
|
-
case command
|
100
|
-
when 'create'
|
80
|
+
class Sage < Thor
|
81
|
+
desc 'create THEME_NAME', "Creates a theme with the specified name using Sage"
|
82
|
+
def create(theme_name = "wslave_sage_theme")
|
101
83
|
require_relative '../lib/wslave_sage'
|
102
|
-
puts "Generating sage theme base for #{
|
103
|
-
WSlaveSage.new().create(
|
104
|
-
|
84
|
+
puts "Generating sage theme base for #{theme_name}"
|
85
|
+
WSlaveSage.new().create(theme_name)
|
86
|
+
end
|
87
|
+
|
88
|
+
desc 'update', "Updates theme generator components"
|
89
|
+
def update
|
105
90
|
require_relative '../lib/wslave_sage'
|
106
91
|
WSlaveSage.new().update()
|
107
|
-
|
92
|
+
end
|
93
|
+
|
94
|
+
desc 'dev', "Starts a development server which dynamically compiles the theme"
|
95
|
+
def dev
|
108
96
|
require_relative '../lib/wslave_sage'
|
109
97
|
WSlaveSage.new().dev()
|
110
|
-
|
98
|
+
end
|
99
|
+
|
100
|
+
desc 'build', "Builds the theme (generates development grade static assets)"
|
101
|
+
def build
|
111
102
|
require_relative '../lib/wslave_sage'
|
112
103
|
WSlaveSage.new().build()
|
113
|
-
|
104
|
+
end
|
105
|
+
|
106
|
+
desc 'production', "Builds the theme (generates production grade static assets)"
|
107
|
+
def production
|
114
108
|
require_relative '../lib/wslave_sage'
|
115
109
|
WSlaveSage.new().production()
|
116
|
-
else
|
117
|
-
puts "sage command \"#{command}\" not found."
|
118
|
-
puts "sage commands available: create update dev build production"
|
119
110
|
end
|
120
111
|
end
|
112
|
+
desc 'sage COMMAND', "Generates and manages a Sage theme"
|
113
|
+
subcommand 'sage', Sage
|
121
114
|
end
|
122
115
|
|
123
116
|
WSlaveCLI.start(ARGV)
|
data/lib/wslave_docker.rb
CHANGED
@@ -6,12 +6,16 @@ class WSlaveDocker
|
|
6
6
|
puts 'Initializing WSlave Docker Control'
|
7
7
|
end
|
8
8
|
|
9
|
-
def server(command = :start, force = false
|
9
|
+
def server(command = :start, force = false)
|
10
10
|
case (command)
|
11
11
|
when :start
|
12
|
-
start(force
|
12
|
+
start(force)
|
13
13
|
when :stop
|
14
|
-
stop(force
|
14
|
+
stop(force)
|
15
|
+
when :reset
|
16
|
+
reset(force)
|
17
|
+
when :remove
|
18
|
+
remove(force)
|
15
19
|
when :log
|
16
20
|
log()
|
17
21
|
when :console
|
@@ -22,19 +26,35 @@ class WSlaveDocker
|
|
22
26
|
end
|
23
27
|
end
|
24
28
|
|
25
|
-
def start(force = false
|
29
|
+
def start(force = false)
|
26
30
|
return unless _check()
|
27
31
|
_force_down() if force
|
28
|
-
`docker-compose
|
32
|
+
`docker-compose stop` # Shutdown existing instances
|
29
33
|
_unfuck_dot_htaccess()
|
30
34
|
WSlaveTools.set_dev_perms
|
35
|
+
`docker-compose build`
|
36
|
+
`docker-compose start -d`
|
31
37
|
`docker-compose up -d`
|
32
38
|
end
|
33
39
|
|
34
|
-
def stop(force = false
|
40
|
+
def stop(force = false)
|
35
41
|
return unless _check()
|
36
42
|
_force_down() if force
|
37
|
-
`docker-compose
|
43
|
+
`docker-compose stop`
|
44
|
+
end
|
45
|
+
|
46
|
+
def reset(force = false)
|
47
|
+
return unless _check()
|
48
|
+
_force_down() if force
|
49
|
+
`docker-compose down -v`
|
50
|
+
`docker-compose build`
|
51
|
+
`docker-compose up -d`
|
52
|
+
end
|
53
|
+
|
54
|
+
def remove(force = false)
|
55
|
+
return unless _check()
|
56
|
+
_force_down() if force
|
57
|
+
`docker-compose down -v`
|
38
58
|
end
|
39
59
|
|
40
60
|
def log()
|
data/lib/wslave_new.rb
CHANGED
@@ -57,6 +57,9 @@ class WSlaveNew
|
|
57
57
|
FileUtils.touch("#{path}/public/wp-content/upgrade/.gitkeep")
|
58
58
|
Dir.chdir path
|
59
59
|
|
60
|
+
puts " > Preparing static data directory"
|
61
|
+
FileUtils.mkdir("#{path}/public/data") unless Dir.exist?("#{path}/public/data")
|
62
|
+
|
60
63
|
puts " > Setting permissions"
|
61
64
|
WSlaveTools.set_dev_perms
|
62
65
|
|
@@ -71,12 +74,28 @@ class WSlaveNew
|
|
71
74
|
end
|
72
75
|
|
73
76
|
def get_stable_branch_version(path)
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
#
|
77
|
+
latest_major = 5
|
78
|
+
latest_minor = 7
|
79
|
+
|
80
|
+
reg = /^(\d*)\.(\d)-branch$/
|
81
|
+
puts "> Checking for WordPress versions in: #{path}"
|
82
|
+
cdir = Dir.pwd()
|
83
|
+
Dir.chdir(path)
|
84
|
+
g = Git.open("./")
|
85
|
+
g.branches.remote.each do |branch|
|
86
|
+
ver = reg.match(branch.name)
|
87
|
+
if (ver) # If the branch matched the x.y-branch pattern
|
88
|
+
if ((ver[1].to_i >= latest_major) && (ver[2].to_i > latest_minor))
|
89
|
+
latest_major = ver[1].to_i
|
90
|
+
latest_minor = ver[2].to_i
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
Dir.chdir(cdir)
|
79
96
|
|
97
|
+
latest = "#{latest_major}.#{latest_minor}"
|
98
|
+
puts "> Detected latest WordPress version as: #{latest}"
|
80
99
|
latest
|
81
100
|
end
|
82
101
|
end
|
data/lib/wslave_tools.rb
CHANGED
@@ -23,6 +23,8 @@ class WSlaveTools
|
|
23
23
|
FileUtils.chmod(0775, "#{path}/public/wp-content/plugins")
|
24
24
|
FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/upgrade")
|
25
25
|
FileUtils.chmod(0775, "#{path}/public/wp-content/upgrade")
|
26
|
+
FileUtils.chown(nil, 'www-data', "#{path}/public/data")
|
27
|
+
FileUtils.chmod(0775, "#{path}/public/data")
|
26
28
|
|
27
29
|
unless Dir.exist?("#{path}/db")
|
28
30
|
FileUtils.mkdir("#{path}/db")
|
data/wslave.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'wslave'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '0.3.1'
|
4
4
|
s.licenses = ['GPL-3.0', 'AGPL-3.0']
|
5
5
|
s.summary = '"Word Slave" generates and controls a WordPress installation'
|
6
6
|
s.description = 'Word Slave includes the wslave command and a control library to generate a ' \
|
@@ -20,13 +20,13 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.bindir = 'bin'
|
21
21
|
s.executables << 'wslave'
|
22
22
|
|
23
|
-
s.add_dependency 'capistrano', '= 3.
|
23
|
+
s.add_dependency 'capistrano', '= 3.16.0'
|
24
24
|
s.add_dependency 'capistrano-git-with-submodules', '~> 2.0', '2.0.4'
|
25
25
|
s.add_dependency 'capistrano-scm-copy', '~> 0.7', '0.7.0'
|
26
26
|
s.add_dependency 'capistrano-file-permissions', '~> 1.0', '1.0.0'
|
27
27
|
|
28
|
-
s.add_dependency 'git', '~> 1.
|
28
|
+
s.add_dependency 'git', '~> 1.8', '1.8.1'
|
29
29
|
|
30
|
-
s.add_dependency 'thor', '~> 1.
|
31
|
-
s.add_dependency 'haikunator', '~> 1.1', '1.1.
|
30
|
+
s.add_dependency 'thor', '~> 1.1', '1.1.0'
|
31
|
+
s.add_dependency 'haikunator', '~> 1.1', '1.1.1'
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wslave
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rei Kagetsuki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.
|
19
|
+
version: 3.16.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.
|
26
|
+
version: 3.16.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: capistrano-git-with-submodules
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,40 +90,40 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - "~>"
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: '1.
|
93
|
+
version: '1.8'
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
96
|
+
version: 1.8.1
|
97
97
|
type: :runtime
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '1.
|
103
|
+
version: '1.8'
|
104
104
|
- - '='
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version: 1.
|
106
|
+
version: 1.8.1
|
107
107
|
- !ruby/object:Gem::Dependency
|
108
108
|
name: thor
|
109
109
|
requirement: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
111
|
- - "~>"
|
112
112
|
- !ruby/object:Gem::Version
|
113
|
-
version: '1.
|
113
|
+
version: '1.1'
|
114
114
|
- - '='
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: 1.0
|
116
|
+
version: 1.1.0
|
117
117
|
type: :runtime
|
118
118
|
prerelease: false
|
119
119
|
version_requirements: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
121
|
- - "~>"
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: '1.
|
123
|
+
version: '1.1'
|
124
124
|
- - '='
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version: 1.0
|
126
|
+
version: 1.1.0
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
128
|
name: haikunator
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
@@ -133,7 +133,7 @@ dependencies:
|
|
133
133
|
version: '1.1'
|
134
134
|
- - '='
|
135
135
|
- !ruby/object:Gem::Version
|
136
|
-
version: 1.1.
|
136
|
+
version: 1.1.1
|
137
137
|
type: :runtime
|
138
138
|
prerelease: false
|
139
139
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -143,7 +143,7 @@ dependencies:
|
|
143
143
|
version: '1.1'
|
144
144
|
- - '='
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
version: 1.1.
|
146
|
+
version: 1.1.1
|
147
147
|
description: Word Slave includes the wslave command and a control library to generate
|
148
148
|
a "best practice" WordPress installation and includes a pre-rolled Docker setup
|
149
149
|
for running a development server and a Capistrano setup for deployment.
|
@@ -164,6 +164,8 @@ files:
|
|
164
164
|
- base/config/deploy-tools/wp-config.php.erb
|
165
165
|
- base/config/deploy-tools/wp-config.php.local
|
166
166
|
- base/config/deploy.rb
|
167
|
+
- base/config/deploy/.production.rb.swp
|
168
|
+
- base/config/deploy/.staging.rb.swp
|
167
169
|
- base/config/deploy/production.rb
|
168
170
|
- base/config/deploy/staging.rb
|
169
171
|
- base/docker-compose.yml
|
@@ -202,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
204
|
- !ruby/object:Gem::Version
|
203
205
|
version: '0'
|
204
206
|
requirements: []
|
205
|
-
rubygems_version: 3.
|
207
|
+
rubygems_version: 3.2.15
|
206
208
|
signing_key:
|
207
209
|
specification_version: 4
|
208
210
|
summary: '"Word Slave" generates and controls a WordPress installation'
|