wslave 0.2.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@ logfile_maxbytes=0
5
5
  pidfile=/run/supervisord.pid
6
6
 
7
7
  [program:php-fpm]
8
- command=php-fpm7.2 -F
8
+ command=php-fpm7.4 -F
9
9
  stdout_logfile=/dev/stdout
10
10
  stdout_logfile_maxbytes=0
11
11
  stderr_logfile=/dev/stderr
@@ -1,18 +1,17 @@
1
1
  <IfModule mod_rewrite.c>
2
- RewriteEngine On
3
- RewriteBase /
2
+ RewriteEngine On
3
+ RewriteBase /
4
4
 
5
- RewriteRule ^$ wordpress/index.php [L]
5
+ RewriteRule ^$ wordpress/index.php [L]
6
6
 
7
- # Skip real files and directories
8
- RewriteCond %{REQUEST_FILENAME} !-f
9
- RewriteCond %{REQUEST_FILENAME} !-d
7
+ # Skip real files and directories
8
+ RewriteCond %{REQUEST_FILENAME} !-f
9
+ RewriteCond %{REQUEST_FILENAME} !-d
10
10
 
11
- # Otherwise send it to WordPress
12
- RewriteRule .* wordpress/index.php [L]
13
-
14
- # BEGIN WordPress
15
- # END WordPress
11
+ # Otherwise send it to WordPress
12
+ RewriteRule .* wordpress/index.php [L]
13
+ # BEGIN WordPress
14
+ # END WordPress
16
15
  </IfModule>
17
16
  <FilesMatch ".+\.(blade\.php)$">
18
17
  <IfModule mod_authz_core.c>
@@ -25,3 +24,8 @@
25
24
  Deny from all
26
25
  </IfModule>
27
26
  </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
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
- desc 'version', "Prints the version of the installed WSlave"
89
- def version()
90
- require 'rubygems'
91
- spec = Gem::Specification::load("#{__dir__}/../wslave.gemspec")
92
- puts spec.version
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 'remove [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
- desc 'sage COMMAND', "Generate a theme with NAME"
96
- long_desc "Generates a theme base with sage in the themes directory with the given " \
97
- "NAME. A random name will be generated if you do not specify a NAME."
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 #{arg}"
103
- WSlaveSage.new().create(arg)
104
- when 'update'
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
- when 'dev'
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
- when 'build'
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
- when 'production'
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, volume = false)
9
+ def server(command = :start, force = false)
10
10
  case (command)
11
11
  when :start
12
- start(force, volume)
12
+ start(force)
13
13
  when :stop
14
- stop(force, volume)
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, volume = false)
29
+ def start(force = false)
26
30
  return unless _check()
27
31
  _force_down() if force
28
- `docker-compose down#{volume ? ' -v' : ''}` # Shutdown existing instances
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, volume = false)
40
+ def stop(force = false)
35
41
  return unless _check()
36
42
  _force_down() if force
37
- `docker-compose down#{volume ? ' -v' : ''}`
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
- latest = '5.4' # This is just a fallback (latest at time of update)
75
- # TODO Implementation requires this issue be resolved: https://github.com/ruby-git/ruby-git/issues/424
76
- #g = Git.open(path)
77
- #g.brances.remote.each do |branch|
78
- #end
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.2.1'
3
+ s.version = '0.3.2'
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.14.1'
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.7', '1.7.0'
28
+ s.add_dependency 'git', '~> 1.8', '1.8.1'
29
29
 
30
- s.add_dependency 'thor', '~> 1.0', '1.0.1'
31
- s.add_dependency 'haikunator', '~> 1.1', '1.1.0'
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.2.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rei Kagetsuki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-11 00:00:00.000000000 Z
11
+ date: 2021-05-05 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.14.1
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.14.1
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.7'
93
+ version: '1.8'
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 1.7.0
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.7'
103
+ version: '1.8'
104
104
  - - '='
105
105
  - !ruby/object:Gem::Version
106
- version: 1.7.0
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.0'
113
+ version: '1.1'
114
114
  - - '='
115
115
  - !ruby/object:Gem::Version
116
- version: 1.0.1
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.0'
123
+ version: '1.1'
124
124
  - - '='
125
125
  - !ruby/object:Gem::Version
126
- version: 1.0.1
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.0
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.0
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.
@@ -170,6 +170,7 @@ files:
170
170
  - base/docker/apache/Dockerfile
171
171
  - base/docker/nginx/Dockerfile
172
172
  - base/docker/nginx/nginx.vhost
173
+ - base/docker/nginx/php.ini
173
174
  - base/docker/nginx/supervisord.conf
174
175
  - base/public/.htaccess
175
176
  - base/public/wp-config.php
@@ -202,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
203
  - !ruby/object:Gem::Version
203
204
  version: '0'
204
205
  requirements: []
205
- rubygems_version: 3.1.2
206
+ rubygems_version: 3.2.15
206
207
  signing_key:
207
208
  specification_version: 4
208
209
  summary: '"Word Slave" generates and controls a WordPress installation'