wslave 0.3.3 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b847c2beb1bdaa632427b26f939ffe8246a46e144d314fa68360c10ac9f77622
4
- data.tar.gz: b43e7df9d2b1dc863a3c4c977068199fd19b13bb65b6df5b0b9bec684445dfcf
3
+ metadata.gz: 8daaa212535c1ecfa77f8e58081ee01f28c89d95c782dda2e6e31a608c17364f
4
+ data.tar.gz: f8661cfe1d3a1a190a99a5fca0f50c5be41e081637fcf81866a798e1ab56488c
5
5
  SHA512:
6
- metadata.gz: aa8655e9bc041985642319f6fd2fea482d79e93237a60dbd240dea3cf7fd08ead01165ef6a74985879c885c9bc5f053ba0b8d8c051ec82d85019e4f4eab283e5
7
- data.tar.gz: b4926ab55b8ff77199b74bdfc18397a87fef8d344ff73c252d4ff3428b375b20d1be70a566278554796bdd3dcaf48ed5768b894b182f9160639f8e93f8b254a4
6
+ metadata.gz: 2ede25542d1264752be2659c8098c847dd53b65bb696fe1a6c24be291020bc0465555262b026059c249046967f32b5cf762919b3cc55cf9c77e332ee19cead1f
7
+ data.tar.gz: fdaa5e5762f5edb5f09c4264ae45a3f61594272f954e198d4bbfdca8b7743bd0f83ec33d041e46370c97238dbe71997f5dd1f0a769d4043bc3e4f6c5e3b05f1b
data/base/.gitignore CHANGED
@@ -1,5 +1,5 @@
1
1
  log
2
- .swp
3
- .swo
2
+ *.swp
3
+ *.swo
4
4
  db/tmp/*
5
5
  .vscode
Binary file
@@ -12,7 +12,10 @@ server {
12
12
  index index.php;
13
13
 
14
14
  location / {
15
- rewrite ^/(wp-(admin|includes).*) /wordpress/$1 last;
15
+ rewrite ^/wp-admin$ /wordpress/wp-admin/ redirect;
16
+ rewrite ^/wp-admin/(.*) /wordpress/wp-admin/$1 redirect;
17
+
18
+ rewrite ^/wp-includes/(.*) /wordpress/wp-includes/$1 last;
16
19
 
17
20
  rewrite ^/$ /wordpress/index.php last;
18
21
 
@@ -20,11 +23,12 @@ server {
20
23
  if ($request_uri !~* "/wp-config.php") {
21
24
  rewrite ^/wp-(.*)\.php$ /wordpress/wp-$1.php last;
22
25
  }
23
- rewrite ^/index\.php$ /wordpress/index.php last;
24
- rewrite ^/wp-login\.php$ /hello.php last;
25
- include snippets/fastcgi-php.conf;
26
- fastcgi_pass unix:<%= server[:php_sock_path] %>;
27
- }
26
+ rewrite ^/index\.php$ /wordpress/index.php last;
27
+ include snippets/fastcgi-php.conf;
28
+ fastcgi_pass unix:<%= server[:php_sock_path] %>;
29
+ }
30
+
31
+ try_files $uri $uri/ /index.php?$args;
28
32
  }
29
33
 
30
34
  location ~ /\. {
@@ -33,9 +37,14 @@ server {
33
37
  log_not_found off;
34
38
  }
35
39
 
40
+ # Don't allow PHP to be run from the uploads folder (common attack vector)
41
+ location ~* /(?:uploads|files|wp-content\/uploads|wp-content\/files)/.*\.php$ {
42
+ deny all;
43
+ }
44
+
36
45
  location /wp-json/ { # Resolves WP Gutenberg 404 issue
37
46
  try_files $uri $uri/ /index.php;
38
- }
47
+ }
39
48
 
40
49
  location ~* \.(blade\.php)$ {
41
50
  deny all;
@@ -54,4 +63,4 @@ server {
54
63
  }
55
64
 
56
65
  client_max_body_size 4096M;
57
- }
66
+ }
@@ -1,5 +1,5 @@
1
1
  # config valid only for current version of Capistrano
2
- lock "3.16.0"
2
+ lock "3.17.0"
3
3
 
4
4
  require 'yaml'
5
5
  opts = YAML.load_file('config/definitions.yml')
@@ -1,4 +1,4 @@
1
- FROM php:8.0-apache
1
+ FROM php:7.4-apache
2
2
 
3
3
  RUN a2enmod rewrite
4
4
  RUN service apache2 restart
@@ -1,15 +1,25 @@
1
- server {
2
- listen 80;
3
- listen [::]:80;
1
+ server {
2
+ listen 8001 default_server;
3
+ listen [::]:8001;
4
4
 
5
- server_name testing;
5
+ server_name _;
6
+
7
+ port_in_redirect on; # Keeps the 8001 in redirects for better local development
6
8
 
7
9
  root /var/www/html;
8
10
 
9
11
  index index.php;
10
12
 
13
+ rewrite ^http://$host/.* http://$host:$server_port$request_uri;
14
+ rewrite ^http://$host:$server_port/wp-admin$ http://$host:$server_port/wordpress/wp-admin/;
15
+
16
+ proxy_set_header Host $host:$server_port;
17
+
11
18
  location / {
12
- rewrite ^/(wp-(admin|includes).*) /wordpress/$1 last;
19
+ rewrite ^/wp-admin$ /wordpress/wp-admin/ redirect;
20
+ rewrite ^/wp-admin/(.*) /wordpress/wp-admin/$1 redirect;
21
+
22
+ rewrite ^/wp-includes/(.*) /wordpress/wp-includes/$1;
13
23
 
14
24
  rewrite ^/$ /wordpress/index.php last;
15
25
 
@@ -17,11 +27,13 @@ server {
17
27
  if ($request_uri !~* "/wp-config.php") {
18
28
  rewrite ^/wp-(.*)\.php$ /wordpress/wp-$1.php last;
19
29
  }
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;
30
+
31
+ rewrite ^/index\.php$ /wordpress/index.php last;
32
+ include snippets/fastcgi-php.conf;
33
+ fastcgi_pass unix:/run/php/php7.4-fpm.sock;
24
34
  }
35
+
36
+ try_files $uri $uri/ /index.php?$args;
25
37
  }
26
38
 
27
39
  location ~ /\. {
@@ -30,9 +42,13 @@ server {
30
42
  log_not_found off;
31
43
  }
32
44
 
45
+ location ~* /(?:uploads|files|wp-content\/uploads|wp-content\/files)/.*\.php$ {
46
+ deny all;
47
+ }
48
+
33
49
  location /wp-json/ { # Resolves WP Gutenberg 404 issue
34
50
  try_files $uri $uri/ /index.php;
35
- }
51
+ }
36
52
 
37
53
  location ~* \.(blade\.php)$ {
38
54
  deny all;
@@ -50,5 +66,5 @@ server {
50
66
  deny all;
51
67
  }
52
68
 
53
- client_max_body_size 4096M;
54
- }
69
+ client_max_body_size 0;
70
+ }
@@ -1,8 +1,8 @@
1
- version: '3.7'
1
+ version: '3.8'
2
2
 
3
3
  services:
4
4
  db:
5
- image: mariadb:10.5-focal
5
+ image: mariadb:10.7-focal
6
6
  volumes:
7
7
  - "./db/dev:/db"
8
8
  - "./db/active:/docker-entrypoint-initdb.d"
@@ -27,7 +27,7 @@ services:
27
27
  volumes:
28
28
  - "./public:/var/www/html"
29
29
  ports:
30
- - "8001:80"
30
+ - "8001:8001"
31
31
  environment:
32
32
  WORDPRESS_DB_HOST: db:3306
33
33
  WORDPRESS_DB_PASSWORD: wordpress
@@ -2,17 +2,24 @@
2
2
  RewriteEngine On
3
3
  RewriteBase /
4
4
 
5
+ # Open the subfoldered index when accessing the apex
5
6
  RewriteRule ^$ wordpress/index.php [L]
6
7
 
8
+ # Special forwarding to wp-admin
9
+ RewriteRule ^wp-admin$ wp-admin/
10
+ RewriteRule ^wp-admin/(.*) wordpress/wp-admin/$1 [R=301,L]
11
+
7
12
  # Skip real files and directories
8
13
  RewriteCond %{REQUEST_FILENAME} !-f
9
14
  RewriteCond %{REQUEST_FILENAME} !-d
10
15
 
11
16
  # Otherwise send it to WordPress
12
17
  RewriteRule .* wordpress/index.php [L]
18
+
13
19
  # BEGIN WordPress
14
20
  # END WordPress
15
21
  </IfModule>
22
+
16
23
  <FilesMatch ".+\.(blade\.php)$">
17
24
  <IfModule mod_authz_core.c>
18
25
  # Apache 2.4
@@ -24,8 +31,6 @@
24
31
  Deny from all
25
32
  </IfModule>
26
33
  </FilesMatch>
27
- php_value upload_max_filesize 4096M
28
- php_value post_max_size 4096M
29
- php_value memory_limit 512M
30
- php_value max_execution_time 1200
31
- php_value max_input_time 2400
34
+
35
+ php_value upload_max_filesize 0
36
+ php_value post_max_size 0
@@ -92,5 +92,10 @@ define('WP_CONTENT_URL', WP_HOME . '/wp-content');
92
92
  //define('WP_TEMP_DIR', realpath(ABSPATH . '../../tmp/'));
93
93
  define('FS_METHOD', 'direct');
94
94
 
95
+ define('FORCE_SSL_ADMIN', false);
96
+ define('FORCE_SSL_LOGIN', false);
97
+
98
+ define('WP_CACHE', false);
99
+
95
100
  /** Sets up WordPress vars and included files. */
96
101
  require_once(ABSPATH . 'wp-settings.php');
data/bin/wslave CHANGED
@@ -20,11 +20,18 @@ class WSlaveCLI < Thor
20
20
  option :version, default: '',
21
21
  desc: 'Specify the version, EG: "--version 5.3". To specify edge/development master use "--version edge".'
22
22
  option :wspath, default: '',
23
- desc: 'specify the path to the wslave distribution, EG: "--wspath ../wslave".'
23
+ desc: 'specify the path to the wslave distribution, EG: "--wspath ../wslave".
24
+ NOTE: This is relative to the new app path.'
25
+ option :wppath, default: '',
26
+ desc: 'specify the path to a cloned git wordpress distribution, EG: "--wppath /shared/wordpress".
27
+ NOTE: This is relative to the new app path.
28
+ NOTE: If no data is found in this directory, wslave will clone the official WordPress repository here and
29
+ copy it. Also, if there is data here that does not match the format of the official WordPress repository,
30
+ most wslave functionality will probably be broken.'
24
31
  def new(path = './')
25
32
  require_relative '../lib/wslave_new'
26
33
  real_path = File.expand_path(path)
27
- WSlaveNew.new(real_path, options['version'], options['wspath'])
34
+ WSlaveNew.new(real_path, options['version'], options['wspath'], options['wppath'])
28
35
  end
29
36
 
30
37
  desc 'update', "Updates toolchain"
data/lib/wslave_new.rb CHANGED
@@ -6,7 +6,7 @@ require 'git'
6
6
  require_relative 'wslave_tools'
7
7
 
8
8
  class WSlaveNew
9
- def initialize(path, version = '', wspath = '')
9
+ def initialize(path, version = '', wspath = '', wppath = '')
10
10
  puts '⚙ Initializing Toolchain・・・'
11
11
 
12
12
  if (wspath != '')
@@ -39,7 +39,21 @@ class WSlaveNew
39
39
 
40
40
  `cd #{path} && git init && git add --all && git commit -am "initial commit by wslave"`
41
41
 
42
- `cd #{path} && git submodule add git://github.com/WordPress/WordPress.git public/wordpress`
42
+ if (wppath != '')
43
+ wppath = File.expand_path(wppath)
44
+ puts " >> Checking wppath (#{wppath}) ..."
45
+ if (File.directory? wppath)
46
+ puts " >> wppath is a folder. Copying..."
47
+ Dir.chdir path
48
+ FileUtils.cp_r wppath, "public/wordpress"
49
+ Dir.chdir "public/wordpress"
50
+ `git clean -fdx; git stash`
51
+ `git checkout master`
52
+ `git pull`
53
+ end
54
+ end
55
+
56
+ `cd #{path} && git submodule add https://github.com/WordPress/WordPress.git public/wordpress`
43
57
  `cd #{path} && git submodule update --init --recursive public/wordpress`
44
58
  if (version == 'edge' || version == 'master')
45
59
  `cd #{path}/public/wordpress && git checkout master`
data/lib/wslave_sage.rb CHANGED
@@ -16,11 +16,14 @@ class WSlaveSage
16
16
  project_root = Dir.pwd
17
17
 
18
18
  puts "Creating Sage theme at public/wp-content/themes/#{name}"
19
- `cd public/wp-content/themes && composer create-project roots/sage #{name} dev-master`
19
+ Dir.chdir "public/wp-content/themes"
20
+ `composer create-project roots/sage #{name}`
21
+ Dir.chdir name
22
+ `composer require roots/acorn`
20
23
 
21
24
  Dir.chdir project_root
22
25
  _write_wslave_sage_config(name)
23
- _overwrite_sage_webpack_browsersync_config
26
+ # _overwrite_sage_webpack_browsersync_config # TODO: sageの更新でwebpack.mix.jsが出力されなくなっている様子
24
27
  end
25
28
 
26
29
  def update()
data/lib/wslave_tools.rb CHANGED
@@ -11,20 +11,28 @@ class WSlaveTools
11
11
 
12
12
  def self.set_dev_perms(path = '.')
13
13
  begin
14
- unless Dir.exist?("#{path}/public/wp-content/upgrade")
15
- FileUtils.mkdir("#{path}/public/wp-content/upgrade")
16
- FileUtils.touch("#{path}/public/wp-content/upgrade/.gitkeep")
14
+ unless Dir.exist?("#{path}/public/data")
15
+ FileUtils.mkdir("#{path}/public/data")
16
+ FileUtils.touch("#{path}/public/data/.gitkeep")
17
17
  end
18
+ FileUtils.chown(nil, 'www-data', "#{path}/public/data")
19
+ FileUtils.chmod(0775, "#{path}/public/data")
20
+
18
21
  FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/themes")
19
22
  FileUtils.chmod(0775, "#{path}/public/wp-content/themes")
23
+
20
24
  FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/uploads")
21
25
  FileUtils.chmod(0775, "#{path}/public/wp-content/uploads")
26
+
22
27
  FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/plugins")
23
28
  FileUtils.chmod(0775, "#{path}/public/wp-content/plugins")
29
+
30
+ unless Dir.exist?("#{path}/public/wp-content/upgrade")
31
+ FileUtils.mkdir("#{path}/public/wp-content/upgrade")
32
+ FileUtils.touch("#{path}/public/wp-content/upgrade/.gitkeep")
33
+ end
24
34
  FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/upgrade")
25
35
  FileUtils.chmod(0775, "#{path}/public/wp-content/upgrade")
26
- FileUtils.chown(nil, 'www-data', "#{path}/public/data")
27
- FileUtils.chmod(0775, "#{path}/public/data")
28
36
 
29
37
  unless Dir.exist?("#{path}/db")
30
38
  FileUtils.mkdir("#{path}/db")
@@ -59,6 +67,7 @@ class WSlaveTools
59
67
  end
60
68
  FileUtils.chown(nil, 'www-data', "#{path}/db/production")
61
69
  FileUtils.chmod(0775, "#{path}/db/production")
70
+
62
71
  rescue Errno::EPERM
63
72
  puts "!!!WARNING!!! Your user does not belong to the www-data group!\n" \
64
73
  " >>> Unable to make folders writable for devlopment. <<<\n" \
data/lib/wslave_update.rb CHANGED
@@ -24,6 +24,7 @@ class WSlaveUpdate
24
24
  FileUtils.cp_r("#{base_path}/docker", "#{path}/")
25
25
  FileUtils.cp("#{base_path}/docker-compose.yml", "#{path}/docker-compose.yml")
26
26
  FileUtils.cp("#{base_path}/public/.htaccess", "#{path}/public/.htaccess")
27
+ FileUtils.cp("#{base_path}/public/wp-config.php", "#{path}/public/wp-config.php")
27
28
  FileUtils.cp_r(Dir.glob("#{base_path}/config/*"), "#{path}/config")
28
29
  FileUtils.cp("#{template_path}/config/database.yml", "#{path}/config/database.yml") unless File.exist? "#{path}/config/database.yml"
29
30
  FileUtils.cp("#{template_path}/config/definitions.yml", "#{path}/config/definitions.yml") unless File.exist? "#{path}/config/definitions.yml"
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.3'
3
+ s.version = '0.3.6'
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.16.0'
24
- s.add_dependency 'capistrano-git-with-submodules', '~> 2.0', '2.0.4'
23
+ s.add_dependency 'capistrano', '= 3.17.0'
24
+ s.add_dependency 'capistrano-git-with-submodules', '~> 2.0', '2.0.6'
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.8', '1.8.1'
28
+ s.add_dependency 'git', '~> 1.10', '1.10.2'
29
29
 
30
- s.add_dependency 'thor', '~> 1.1', '1.1.0'
30
+ s.add_dependency 'thor', '~> 1.2', '1.2.1'
31
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.3.3
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rei Kagetsuki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-06 00:00:00.000000000 Z
11
+ date: 2022-04-14 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.16.0
19
+ version: 3.17.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.16.0
26
+ version: 3.17.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: capistrano-git-with-submodules
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '2.0'
34
34
  - - '='
35
35
  - !ruby/object:Gem::Version
36
- version: 2.0.4
36
+ version: 2.0.6
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '2.0'
44
44
  - - '='
45
45
  - !ruby/object:Gem::Version
46
- version: 2.0.4
46
+ version: 2.0.6
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: capistrano-scm-copy
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -90,40 +90,40 @@ dependencies:
90
90
  requirements:
91
91
  - - "~>"
92
92
  - !ruby/object:Gem::Version
93
- version: '1.8'
93
+ version: '1.10'
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 1.8.1
96
+ version: 1.10.2
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.8'
103
+ version: '1.10'
104
104
  - - '='
105
105
  - !ruby/object:Gem::Version
106
- version: 1.8.1
106
+ version: 1.10.2
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.1'
113
+ version: '1.2'
114
114
  - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: 1.1.0
116
+ version: 1.2.1
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.1'
123
+ version: '1.2'
124
124
  - - '='
125
125
  - !ruby/object:Gem::Version
126
- version: 1.1.0
126
+ version: 1.2.1
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: haikunator
129
129
  requirement: !ruby/object:Gem::Requirement
@@ -164,6 +164,7 @@ 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/.staging.rb.swp
167
168
  - base/config/deploy/production.rb
168
169
  - base/config/deploy/staging.rb
169
170
  - base/docker-compose.yml
@@ -203,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
203
204
  - !ruby/object:Gem::Version
204
205
  version: '0'
205
206
  requirements: []
206
- rubygems_version: 3.2.15
207
+ rubygems_version: 3.3.7
207
208
  signing_key:
208
209
  specification_version: 4
209
210
  summary: '"Word Slave" generates and controls a WordPress installation'