wslave 0.0.18 → 0.1.0

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: c8df8f2d9fb3ddae0dfbc1d47fdf8107b20c455e3d4eadb15538e1d9483cfcb8
4
- data.tar.gz: ab496e09948a4edf41cc828c01a34487cb7a29633c203356b231e967f582d4a9
3
+ metadata.gz: d5f66ec5135ab82042cc857c9f6f5b47e0ea95d5f52a995d43eed1c2d7319d86
4
+ data.tar.gz: 981881f07224bc43bf887f58a7561cc970dd6cad9dc8915206844bff08a4322b
5
5
  SHA512:
6
- metadata.gz: c97f9515d2229be7bfee1b2e1df26347be54f178e47382bf67390651dba0aa10ec1158574e5aedd3e233ec610be25ae9a42afd03f4e27c427ea148780dad21aa
7
- data.tar.gz: 9622367e6bd226bc525146f6792fb598220397528055946e393dbc1f1952215b1ade9b90a010420d30748944875105e545f68fa15896a9caddce594c4c3e1ee8
6
+ metadata.gz: d922fd571f7c599417333a3d462c30049e1448fdea965e0f8891f2a256d9179c9c5b670ac5f7f0710bcff5c921665a9e73f7fbf752543489944c21214bbecf3d
7
+ data.tar.gz: b6937ce57fa47c62393d771f02da7367a7f8c52329478f099d40306812fd614bb8f3feee114daf3e4d97b42f27a39bcce31d450e9168e8a29cb9fe66580a16d5
@@ -1,8 +1,8 @@
1
1
  server {
2
2
  listen 80;
3
- listen [::]:80;
3
+ listen [::]:80;
4
4
 
5
- server_name <%= server[:name] %>;
5
+ server_name <%= server[:name] %>;
6
6
 
7
7
  root <%= server[:root] %>;
8
8
 
@@ -1,5 +1,5 @@
1
1
  # config valid only for current version of Capistrano
2
- lock "3.11.0"
2
+ lock "3.11.2"
3
3
 
4
4
  require 'yaml'
5
5
  opts = YAML.load_file('config/definitions.yml')
@@ -2,7 +2,7 @@ version: '3'
2
2
 
3
3
  services:
4
4
  db:
5
- image: mysql:5.7
5
+ image: mariadb:10.5.1-bionic
6
6
  volumes:
7
7
  - "./db/dev:/db"
8
8
  - "./db/active:/docker-entrypoint-initdb.d"
@@ -12,7 +12,7 @@ services:
12
12
  web:
13
13
  depends_on:
14
14
  - db
15
- build: .
15
+ build: ./docker/apache/
16
16
  volumes:
17
17
  - "./public:/var/www/html"
18
18
  ports:
@@ -20,3 +20,14 @@ services:
20
20
  environment:
21
21
  WORDPRESS_DB_HOST: db:3306
22
22
  WORDPRESS_DB_PASSWORD: wordpress
23
+ nweb:
24
+ depends_on:
25
+ - db
26
+ build: ./docker/nginx/
27
+ volumes:
28
+ - "./public:/var/www/html"
29
+ ports:
30
+ - "8001:80"
31
+ environment:
32
+ WORDPRESS_DB_HOST: db:3306
33
+ WORDPRESS_DB_PASSWORD: wordpress
@@ -1,13 +1,11 @@
1
- FROM php:7.2.6-apache
1
+ FROM php:7.4-apache
2
2
 
3
3
  RUN a2enmod rewrite
4
4
  RUN service apache2 restart
5
5
  RUN apt-get update \
6
- && apt-get install -y libpng-dev libjpeg-dev mysql-client mysql-common \
7
- && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
6
+ && apt-get install -y libpng-dev libjpeg-dev mariadb-client mariadb-common libonig-dev \
8
7
  && docker-php-ext-install gd \
9
8
  && docker-php-ext-install mbstring \
10
- # && docker-php-ext-install mysql \
11
9
  && docker-php-ext-install mysqli \
12
10
  && docker-php-ext-install pdo \
13
11
  && docker-php-ext-install pdo_mysql \
@@ -0,0 +1,26 @@
1
+ FROM ubuntu:18.04
2
+
3
+ COPY nginx.vhost /etc/nginx/sites-enabled/default
4
+ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
5
+
6
+ RUN apt-get update
7
+ RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata
8
+ RUN apt-get install -y nginx php-fpm php-mysql \
9
+ libpng-dev libjpeg-dev \
10
+ mariadb-client mariadb-common \
11
+ supervisor curl
12
+ RUN apt-get clean
13
+ RUN adduser www-data root
14
+ RUN mkdir /db \
15
+ && chmod 777 /db
16
+
17
+ RUN mkdir /run/php
18
+
19
+ RUN ln -sf /dev/stdout /var/log/nginx/access.log \
20
+ && ln -sf /dev/stderr /var/log/nginx/error.log
21
+
22
+ EXPOSE 80
23
+
24
+ STOPSIGNAL SIGTERM
25
+
26
+ CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
@@ -0,0 +1,32 @@
1
+ server {
2
+ listen 80;
3
+ listen [::]:80;
4
+
5
+ server_name testing;
6
+
7
+ root /var/www/html;
8
+
9
+ index index.php;
10
+
11
+ location / {
12
+ rewrite ^/(wp-(admin|includes).*) /wordpress/$1 last;
13
+
14
+ rewrite ^/$ /wordpress/index.php last;
15
+
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.2-fpm.sock;
24
+ }
25
+ }
26
+
27
+ location ~ /\. {
28
+ deny all;
29
+ access_log off;
30
+ log_not_found off;
31
+ }
32
+ }
@@ -0,0 +1,23 @@
1
+ [supervisord]
2
+ nodaemon=true
3
+ logfile=/dev/null
4
+ logfile_maxbytes=0
5
+ pidfile=/run/supervisord.pid
6
+
7
+ [program:php-fpm]
8
+ command=php-fpm7.2 -F
9
+ stdout_logfile=/dev/stdout
10
+ stdout_logfile_maxbytes=0
11
+ stderr_logfile=/dev/stderr
12
+ stderr_logfile_maxbytes=0
13
+ autorestart=false
14
+ startretries=0
15
+
16
+ [program:nginx]
17
+ command=nginx -g 'daemon off;'
18
+ stdout_logfile=/dev/stdout
19
+ stdout_logfile_maxbytes=0
20
+ stderr_logfile=/dev/stderr
21
+ stderr_logfile_maxbytes=0
22
+ autorestart=false
23
+ startretries=0
data/bin/wslave CHANGED
@@ -4,13 +4,20 @@ require 'fileutils'
4
4
 
5
5
  class WSlaveCLI < Thor
6
6
 
7
+ def self.exit_on_failure?
8
+ true
9
+ end
10
+
7
11
  desc 'new [APP_PATH]', "Generate a new app at APP_PATH"
8
12
  long_desc "Creates a new application in the current directory or in the specificed path."
9
- method_option :version, default: ''
13
+ option :version, default: '',
14
+ desc: 'Specify the version, EG: "--version 5.3". To specify edge/development master use "--version edge".'
15
+ option :wspath, default: '',
16
+ desc: 'specify the path to the wslave distribution, EG: "--wspath ../wslave".'
10
17
  def new(path = './')
11
18
  require_relative '../lib/wslave_new'
12
19
  real_path = File.expand_path(path)
13
- WSlaveNew.new(real_path, options['version'])
20
+ WSlaveNew.new(real_path, options['version'], options['wspath'])
14
21
  end
15
22
 
16
23
  desc 'update', "Updates toolchain"
@@ -35,7 +42,7 @@ class WSlaveCLI < Thor
35
42
  end
36
43
 
37
44
  desc 'server', "Starts the development server"
38
- method_option :f, default: false, description: 'force close other servers first'
45
+ method_option :f, type: :boolean, default: false, description: 'force close other servers first'
39
46
  def server()
40
47
  puts 'Starting server...'
41
48
  require_relative '../lib/wslave_docker'
@@ -43,8 +50,8 @@ class WSlaveCLI < Thor
43
50
  end
44
51
 
45
52
  desc 'stop [options]', "Stops the development server"
46
- method_option :v, default: false, description: 'remove volume data'
47
- method_option :f, default: false, description: 'force close other servers first'
53
+ method_option :v, type: :boolean, default: false, description: 'remove volume data'
54
+ method_option :f, type: :boolean, default: false, description: 'force close other servers first'
48
55
  def stop()
49
56
  puts 'Stopping server...'
50
57
  require_relative '../lib/wslave_docker'
@@ -22,7 +22,6 @@ class WSlaveDocker
22
22
 
23
23
  def _check()
24
24
  return true if (File.exist?("./config/.wslave") &&
25
- File.exist?("Dockerfile") &&
26
25
  File.exist?("docker-compose.yml"))
27
26
  puts "This does not appear to be the root of a WSlave managed app."
28
27
  false
@@ -1,43 +1,82 @@
1
1
  require 'fileutils'
2
2
  require 'rubygems'
3
+ require 'pathname'
4
+ require 'git'
5
+
3
6
  require_relative 'wslave_tools'
4
7
 
5
8
  class WSlaveNew
6
- def initialize(path, version)
9
+ def initialize(path, version = '', wspath = '')
7
10
  puts '⚙ Initializing Toolchain・・・'
8
11
 
9
- base_path = File.expand_path "#{__dir__}/../base/"
10
- template_path = File.expand_path "#{__dir__}/../templates/"
12
+ if (wspath != '')
13
+ manual_path = true
14
+ if ((Pathname.new(wspath)).absolute?)
15
+ base_path = File.expand_path "#{wspath}/base/"
16
+ template_path = File.expand_path "#{wspath}/templates/"
17
+ else
18
+ base_path = File.expand_path "#{path}/#{wspath}/base/"
19
+ template_path = File.expand_path "#{path}/#{wspath}/templates/"
20
+ end
21
+ else
22
+ manual_path = false
23
+ wspath = "#{__dir__}/.."
24
+ base_path = File.expand_path "#{wspath}/base/"
25
+ template_path = File.expand_path "#{wspath}/templates/"
26
+ end
11
27
 
12
28
  FileUtils.mkdir_p path
13
29
 
14
30
  Dir.chdir path
15
-
31
+
16
32
  puts " > Setting up WordPress WSlave setup in: #{path}"
17
33
  FileUtils.cp_r Dir.glob("#{base_path}/*"), path
18
34
  FileUtils.cp_r Dir.glob("#{template_path}/*"), path
35
+ add_path_to_Gemspec(wspath, path) if manual_path
19
36
 
20
- spec = Gem::Specification::load("#{__dir__}/../wslave.gemspec")
37
+ spec = Gem::Specification::load("#{wspath}/wslave.gemspec")
21
38
  File.open("#{path}/config/.wslave", 'w') {|f| f.write(spec.version)}
22
39
 
23
40
  `cd #{path} && git init && git add --all && git commit -am "initial commit by wslave"`
24
41
 
25
42
  `cd #{path} && git submodule add git://github.com/WordPress/WordPress.git public/wordpress`
26
- `cd #{path}/public/wordpress && git checkout #{version}-branch` if version != ''
43
+ if (version == 'edge' || version == 'master')
44
+ `cd #{path}/public/wordpress && git checkout master`
45
+ elsif version != ''
46
+ `cd #{path}/public/wordpress && git checkout #{version}-branch`
47
+ else
48
+ `cd #{path}/public/wordpress && git checkout #{get_stable_branch_version("#{path}/public/wordpress")}-branch`
49
+ end
27
50
  `cd #{path} && git submodule update --init --recursive public/wordpress`
28
51
 
29
52
  puts " > Preparing detached content directory"
30
53
  FileUtils.cp_r("#{path}/public/wordpress/wp-content", "#{path}/public/wp-content")
31
- FileUtils.mkdir("#{path}/public/wp-content/uploads")
54
+ FileUtils.mkdir("#{path}/public/wp-content/uploads") unless Dir.exist?("#{path}/public/wp-content/uploads")
32
55
  FileUtils.touch("#{path}/public/wp-content/uploads/.gitkeep")
33
- FileUtils.mkdir("#{path}/public/wp-content/upgrade")
56
+ FileUtils.mkdir("#{path}/public/wp-content/upgrade") unless Dir.exist?("#{path}/public/wp-content/upgrade")
34
57
  FileUtils.touch("#{path}/public/wp-content/upgrade/.gitkeep")
35
58
  Dir.chdir path
36
59
 
37
60
  puts " > Setting permissions"
38
61
  WSlaveTools.set_dev_perms
39
-
62
+
40
63
  `cd #{path} && git add --all && git commit -am "Add and initialize WordPress#{version}"`
41
64
  puts " > Done!"
42
65
  end
66
+
67
+ def add_path_to_Gemspec(wspath, path)
68
+ gemtext = File.read("#{path}/Gemfile")
69
+ gemtext.gsub!("gem 'wslave'", "gem 'wslave', path: '#{wspath}'")
70
+ File.open("#{path}/Gemfile", "w") {|gemfile| gemfile.puts gemtext}
71
+ end
72
+
73
+ def get_stable_branch_version(path)
74
+ latest = '5.3' # 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
79
+
80
+ latest
81
+ end
43
82
  end
@@ -3,7 +3,6 @@ require 'fileutils'
3
3
  class WSlaveTools
4
4
  def self.wslave_root?()
5
5
  return true if (File.exist?("./config/.wslave") &&
6
- File.exist?("Dockerfile") &&
7
6
  File.exist?("docker-compose.yml"))
8
7
  puts "This does not appear to be the root of a WSlave managed app."
9
8
  puts "Run command again from the root directory of a WSlave app."
@@ -9,7 +9,7 @@ class WSlaveUpdate
9
9
  path = Dir.pwd
10
10
  if !File.exist?("#{path}/config/.wslave")
11
11
  puts "!!!This command must be run in a WSlave generated project!!!"
12
- return
12
+ return
13
13
  end
14
14
 
15
15
  base_path = File.expand_path "#{__dir__}/../base/"
@@ -21,7 +21,7 @@ class WSlaveUpdate
21
21
  FileUtils.cp("#{base_path}/Capfile", "#{path}/Capfile")
22
22
  # FileUtils.cp("#{base_path}/Gemfile", "#{path}/Gemfile")
23
23
  FileUtils.cp("#{base_path}/Rakefile", "#{path}/Rakefile")
24
- FileUtils.cp("#{base_path}/Dockerfile", "#{path}/Dockerfile")
24
+ FileUtils.cp_r("#{base_path}/docker", "#{path}/docker")
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
27
  FileUtils.cp_r(Dir.glob("#{base_path}/config/*"), "#{path}/config")
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'wslave'
3
- s.version = '0.0.18'
3
+ s.version = '0.1.0'
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,11 +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.11.0'
23
+ s.add_dependency 'capistrano', '= 3.11.2'
24
24
  s.add_dependency 'capistrano-git-with-submodules', '~> 2.0', '2.0.3'
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 'thor', '~> 0.20', '0.20.0'
28
+ s.add_dependency 'git', '~> 1.5', '1.5.0'
29
+
30
+ s.add_dependency 'thor', '~> 0.20', '0.20.3'
29
31
  s.add_dependency 'haikunator', '~> 1.1', '1.1.0'
30
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.0.18
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rei Kagetsuki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-27 00:00:00.000000000 Z
11
+ date: 2020-03-03 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.11.0
19
+ version: 3.11.2
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.11.0
26
+ version: 3.11.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: capistrano-git-with-submodules
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -48,42 +48,62 @@ dependencies:
48
48
  name: capistrano-scm-copy
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '0.7'
54
51
  - - '='
55
52
  - !ruby/object:Gem::Version
56
53
  version: 0.7.0
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '0.7'
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - "~>"
62
- - !ruby/object:Gem::Version
63
- version: '0.7'
64
61
  - - '='
65
62
  - !ruby/object:Gem::Version
66
63
  version: 0.7.0
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '0.7'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: capistrano-file-permissions
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - "~>"
72
- - !ruby/object:Gem::Version
73
- version: '1.0'
74
71
  - - '='
75
72
  - !ruby/object:Gem::Version
76
73
  version: 1.0.0
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '1.0'
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
+ - - '='
82
+ - !ruby/object:Gem::Version
83
+ version: 1.0.0
81
84
  - - "~>"
82
85
  - !ruby/object:Gem::Version
83
86
  version: '1.0'
87
+ - !ruby/object:Gem::Dependency
88
+ name: git
89
+ requirement: !ruby/object:Gem::Requirement
90
+ requirements:
84
91
  - - '='
85
92
  - !ruby/object:Gem::Version
86
- version: 1.0.0
93
+ version: 1.5.0
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.5'
97
+ type: :runtime
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 1.5.0
104
+ - - "~>"
105
+ - !ruby/object:Gem::Version
106
+ version: '1.5'
87
107
  - !ruby/object:Gem::Dependency
88
108
  name: thor
89
109
  requirement: !ruby/object:Gem::Requirement
@@ -93,7 +113,7 @@ dependencies:
93
113
  version: '0.20'
94
114
  - - '='
95
115
  - !ruby/object:Gem::Version
96
- version: 0.20.0
116
+ version: 0.20.3
97
117
  type: :runtime
98
118
  prerelease: false
99
119
  version_requirements: !ruby/object:Gem::Requirement
@@ -103,27 +123,27 @@ dependencies:
103
123
  version: '0.20'
104
124
  - - '='
105
125
  - !ruby/object:Gem::Version
106
- version: 0.20.0
126
+ version: 0.20.3
107
127
  - !ruby/object:Gem::Dependency
108
128
  name: haikunator
109
129
  requirement: !ruby/object:Gem::Requirement
110
130
  requirements:
111
- - - "~>"
112
- - !ruby/object:Gem::Version
113
- version: '1.1'
114
131
  - - '='
115
132
  - !ruby/object:Gem::Version
116
133
  version: 1.1.0
134
+ - - "~>"
135
+ - !ruby/object:Gem::Version
136
+ version: '1.1'
117
137
  type: :runtime
118
138
  prerelease: false
119
139
  version_requirements: !ruby/object:Gem::Requirement
120
140
  requirements:
121
- - - "~>"
122
- - !ruby/object:Gem::Version
123
- version: '1.1'
124
141
  - - '='
125
142
  - !ruby/object:Gem::Version
126
143
  version: 1.1.0
144
+ - - "~>"
145
+ - !ruby/object:Gem::Version
146
+ version: '1.1'
127
147
  description: Word Slave includes the wslave command and a control library to generate
128
148
  a "best practice" WordPress installation and includes a pre-rolled Docker setup
129
149
  for running a development server and a Capistrano setup for deployment.
@@ -135,7 +155,6 @@ extra_rdoc_files: []
135
155
  files:
136
156
  - base/.gitignore
137
157
  - base/Capfile
138
- - base/Dockerfile
139
158
  - base/Gemfile
140
159
  - base/Rakefile
141
160
  - base/config/deploy-tools/gen-nginx-vhost.rb
@@ -148,6 +167,10 @@ files:
148
167
  - base/config/deploy/production.rb
149
168
  - base/config/deploy/staging.rb
150
169
  - base/docker-compose.yml
170
+ - base/docker/apache/Dockerfile
171
+ - base/docker/nginx/Dockerfile
172
+ - base/docker/nginx/nginx.vhost
173
+ - base/docker/nginx/supervisord.conf
151
174
  - base/public/.htaccess
152
175
  - base/public/wp-config.php
153
176
  - bin/wslave
@@ -179,8 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
202
  - !ruby/object:Gem::Version
180
203
  version: '0'
181
204
  requirements: []
182
- rubyforge_project:
183
- rubygems_version: 2.7.7
205
+ rubygems_version: 3.0.6
184
206
  signing_key:
185
207
  specification_version: 4
186
208
  summary: '"Word Slave" generates and controls a WordPress installation'