wslave 0.0.18 → 0.2.3
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/.gitignore +1 -0
 - data/base/config/deploy-tools/nginx.vhost.erb +40 -24
 - data/base/config/deploy.rb +1 -1
 - data/base/config/deploy/production.rb +64 -1
 - data/base/config/deploy/staging.rb +65 -2
 - data/base/docker-compose.yml +13 -2
 - data/base/{Dockerfile → docker/apache/Dockerfile} +2 -4
 - data/base/docker/nginx/Dockerfile +24 -0
 - data/base/docker/nginx/nginx.vhost +48 -0
 - data/base/docker/nginx/supervisord.conf +23 -0
 - data/base/public/.htaccess +11 -0
 - data/bin/wslave +76 -22
 - data/lib/wslave_docker.rb +34 -3
 - data/lib/wslave_new.rb +51 -9
 - data/lib/wslave_sage.rb +70 -3
 - data/lib/wslave_tools.rb +2 -1
 - data/lib/wslave_update.rb +2 -2
 - data/templates/config/definitions.yml +3 -0
 - data/wslave.gemspec +6 -4
 - metadata +35 -13
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 9ee627106f6ba97b14f1adf9d636ef8b66a9ffcf89c996b59bb077633f2f1eaa
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 1d31cf735fbeacb810f2558fd7c3b49af4fcef1a7421f27511aa89b0dbba0dee
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: ce2bce83363782e099e55132d5cf63730e4ebf16f5588446c69149a536c2d90a250eb94f07dc0748c820106513e210d31b889274c5df6bbcd52d33a4143e474c
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 53fe21ad452756017e8a4ad0c7ef93b200f08b877b531776e80898e345cdd6f6608db58ffb6d4cb3af81754a97e2abf4329f65bb8b15d5d0032adff703c34fdf
         
     | 
    
        data/base/.gitignore
    CHANGED
    
    
| 
         @@ -1,35 +1,51 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            server {                                                                       
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
      
 2 
     | 
    
         
            +
              listen 80;
         
     | 
| 
      
 3 
     | 
    
         
            +
              listen [::]:80;
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 5 
     | 
    
         
            +
              server_name <%= server[:name] %>;
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
              root <%= server[:root] %>;
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
      
 9 
     | 
    
         
            +
              access_log <%= server[:root] %>/access.log;
         
     | 
| 
      
 10 
     | 
    
         
            +
              error_log <%= server[:root] %>/error.log;
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
      
 12 
     | 
    
         
            +
              index index.php;
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
      
 14 
     | 
    
         
            +
              location / {
         
     | 
| 
      
 15 
     | 
    
         
            +
                rewrite ^/(wp-(admin|includes).*) /wordpress/$1 last;
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
      
 17 
     | 
    
         
            +
                rewrite ^/$ /wordpress/index.php last;
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                    }
         
     | 
| 
      
 19 
     | 
    
         
            +
                location ~ \.php {
         
     | 
| 
      
 20 
     | 
    
         
            +
                  if ($request_uri !~* "/wp-config.php") {
         
     | 
| 
      
 21 
     | 
    
         
            +
                    rewrite ^/wp-(.*)\.php$ /wordpress/wp-$1.php last;
         
     | 
| 
      
 22 
     | 
    
         
            +
                  }
         
     | 
| 
      
 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] %>;
         
     | 
| 
       28 
27 
     | 
    
         
             
                }
         
     | 
| 
      
 28 
     | 
    
         
            +
              }
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
      
 30 
     | 
    
         
            +
              location ~ /\. {
         
     | 
| 
      
 31 
     | 
    
         
            +
                deny all;
         
     | 
| 
      
 32 
     | 
    
         
            +
                access_log off;
         
     | 
| 
      
 33 
     | 
    
         
            +
                log_not_found off;
         
     | 
| 
      
 34 
     | 
    
         
            +
              }
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
              location ~- \.(blade\.php)$ {
         
     | 
| 
      
 37 
     | 
    
         
            +
                deny all;
         
     | 
| 
      
 38 
     | 
    
         
            +
              }
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
              location ~- composer\.(json|lock)$ {
         
     | 
| 
      
 41 
     | 
    
         
            +
                deny all;
         
     | 
| 
      
 42 
     | 
    
         
            +
              }
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
              location ~- package(-lock)?\.json$ {
         
     | 
| 
      
 45 
     | 
    
         
            +
                deny all;
         
     | 
| 
      
 46 
     | 
    
         
            +
              }
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
              location ~- yarn\.lock$ {
         
     | 
| 
      
 49 
     | 
    
         
            +
                deny all;
         
     | 
| 
      
 50 
     | 
    
         
            +
              }
         
     | 
| 
       35 
51 
     | 
    
         
             
            } 
         
     | 
    
        data/base/config/deploy.rb
    CHANGED
    
    
| 
         @@ -1,5 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'yaml'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'date'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'wslave_sage'
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
5 
     | 
    
         
             
            opts = YAML.load_file('config/definitions.yml')
         
     | 
| 
       5 
6 
     | 
    
         
             
            db_info = YAML.load_file('config/database.yml')
         
     | 
| 
         @@ -13,12 +14,16 @@ site_fqdn = opts['deployer']['fqdn']['production'] 
     | 
|
| 
       13 
14 
     | 
    
         
             
            disable_rsync = (opts.include?('options') && opts['options'].include?('rsync_enabled') && 
         
     | 
| 
       14 
15 
     | 
    
         
             
                      opts['options']['rsync_enabled'] == false)
         
     | 
| 
       15 
16 
     | 
    
         | 
| 
      
 17 
     | 
    
         
            +
            if (opts['deployer'].include?('branch') && opts['deployer']['branch'].include?('production'))
         
     | 
| 
      
 18 
     | 
    
         
            +
              set :branch, opts['deployer']['branch']['production']
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
       16 
21 
     | 
    
         
             
            role :web, "#{deploy_user}@#{host_addr}" 
         
     | 
| 
       17 
22 
     | 
    
         | 
| 
       18 
23 
     | 
    
         
             
            set :tmp_dir, "#{multisite_root}/tmp"
         
     | 
| 
       19 
24 
     | 
    
         
             
            deploy_path = "#{multisite_root}/#{site_fqdn}"
         
     | 
| 
       20 
25 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
            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}
         
     | 
| 
       22 
27 
     | 
    
         
             
            set :linked_files, %w{public/wp-config.php}
         
     | 
| 
       23 
28 
     | 
    
         | 
| 
       24 
29 
     | 
    
         
             
            set :deploy_to, deploy_path
         
     | 
| 
         @@ -77,6 +82,61 @@ namespace :deploy do 
     | 
|
| 
       77 
82 
     | 
    
         
             
                end
         
     | 
| 
       78 
83 
     | 
    
         
             
              end
         
     | 
| 
       79 
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 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
              desc 'Builds and Syncs the project Sage theme'
         
     | 
| 
      
 100 
     | 
    
         
            +
              task :sync_sage_theme do
         
     | 
| 
      
 101 
     | 
    
         
            +
                on roles(:web) do
         
     | 
| 
      
 102 
     | 
    
         
            +
                  wss = WSlaveSage.new()
         
     | 
| 
      
 103 
     | 
    
         
            +
                  sage_theme_name = wss.theme_name?
         
     | 
| 
      
 104 
     | 
    
         
            +
                  if (sage_theme_name == '')
         
     | 
| 
      
 105 
     | 
    
         
            +
                    puts "Couldn't find a Sage theme for this project."
         
     | 
| 
      
 106 
     | 
    
         
            +
                  else
         
     | 
| 
      
 107 
     | 
    
         
            +
                    wss.production()
         
     | 
| 
      
 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/`
         
     | 
| 
      
 110 
     | 
    
         
            +
                  end
         
     | 
| 
      
 111 
     | 
    
         
            +
                end
         
     | 
| 
      
 112 
     | 
    
         
            +
              end
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
              desc 'Builds and Uploads the project Sage theme'
         
     | 
| 
      
 115 
     | 
    
         
            +
              task :upload_sage_theme do
         
     | 
| 
      
 116 
     | 
    
         
            +
                on roles(:web) do
         
     | 
| 
      
 117 
     | 
    
         
            +
                  wss = WSlaveSage.new()
         
     | 
| 
      
 118 
     | 
    
         
            +
                  sage_theme_name = wss.theme_name?
         
     | 
| 
      
 119 
     | 
    
         
            +
                  if (sage_theme_name == '')
         
     | 
| 
      
 120 
     | 
    
         
            +
                    puts "Couldn't find a Sage theme for this project."
         
     | 
| 
      
 121 
     | 
    
         
            +
                  else
         
     | 
| 
      
 122 
     | 
    
         
            +
                    wss.production()
         
     | 
| 
      
 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
         
     | 
| 
      
 125 
     | 
    
         
            +
                  end
         
     | 
| 
      
 126 
     | 
    
         
            +
                end
         
     | 
| 
      
 127 
     | 
    
         
            +
              end
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
              desc 'Builds and Deploys the project Sage theme'
         
     | 
| 
      
 130 
     | 
    
         
            +
              task :sage do
         
     | 
| 
      
 131 
     | 
    
         
            +
                on roles(:web) do
         
     | 
| 
      
 132 
     | 
    
         
            +
                  if disable_rsync
         
     | 
| 
      
 133 
     | 
    
         
            +
                    invoke('deploy:upload_sage_theme')
         
     | 
| 
      
 134 
     | 
    
         
            +
                  else
         
     | 
| 
      
 135 
     | 
    
         
            +
                    invoke('deploy:sync_sage_theme')
         
     | 
| 
      
 136 
     | 
    
         
            +
                  end
         
     | 
| 
      
 137 
     | 
    
         
            +
                end
         
     | 
| 
      
 138 
     | 
    
         
            +
              end
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
       80 
140 
     | 
    
         
             
              desc 'Finds and replaces localhost:8000 and your Staging address with the Production address'
         
     | 
| 
       81 
141 
     | 
    
         
             
              task :chikan do
         
     | 
| 
       82 
142 
     | 
    
         
             
                on roles(:web) do
         
     | 
| 
         @@ -148,14 +208,17 @@ namespace :deploy do 
     | 
|
| 
       148 
208 
     | 
    
         
             
                    invoke('deploy:upload_wp')
         
     | 
| 
       149 
209 
     | 
    
         
             
                    invoke('deploy:upload_plugins')
         
     | 
| 
       150 
210 
     | 
    
         
             
                    invoke('deploy:upload_uploads')
         
     | 
| 
      
 211 
     | 
    
         
            +
                    invoke('deploy:upload_static_data')
         
     | 
| 
       151 
212 
     | 
    
         
             
                  else
         
     | 
| 
       152 
213 
     | 
    
         
             
                    invoke('deploy:sync_wp')
         
     | 
| 
       153 
214 
     | 
    
         
             
                    invoke('deploy:sync_plugins')
         
     | 
| 
       154 
215 
     | 
    
         
             
                    invoke('deploy:sync_uploads')
         
     | 
| 
      
 216 
     | 
    
         
            +
                    invoke('deploy:sync_static_data')
         
     | 
| 
       155 
217 
     | 
    
         
             
                  end
         
     | 
| 
       156 
218 
     | 
    
         
             
                  invoke('deploy')
         
     | 
| 
       157 
219 
     | 
    
         
             
                  invoke('db:seed')
         
     | 
| 
       158 
220 
     | 
    
         
             
                  invoke('deploy:chikan')
         
     | 
| 
      
 221 
     | 
    
         
            +
                  invoke('deploy:sage')
         
     | 
| 
       159 
222 
     | 
    
         
             
                  invoke('deploy:set_permissions')
         
     | 
| 
       160 
223 
     | 
    
         
             
                end
         
     | 
| 
       161 
224 
     | 
    
         
             
              end
         
     | 
| 
         @@ -1,5 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'yaml'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'date'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'wslave_sage'
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
5 
     | 
    
         
             
            opts = YAML.load_file('config/definitions.yml')
         
     | 
| 
       5 
6 
     | 
    
         
             
            db_info = YAML.load_file('config/database.yml')
         
     | 
| 
         @@ -13,21 +14,25 @@ site_fqdn = opts['deployer']['fqdn']['staging'] 
     | 
|
| 
       13 
14 
     | 
    
         
             
            disable_rsync = (opts.include?('options') && opts['options'].include?('rsync_enabled') && 
         
     | 
| 
       14 
15 
     | 
    
         
             
                      opts['options']['rsync_enabled'] == false)
         
     | 
| 
       15 
16 
     | 
    
         | 
| 
      
 17 
     | 
    
         
            +
            if (opts['deployer'].include?('branch') && opts['deployer']['branch'].include?('staging'))
         
     | 
| 
      
 18 
     | 
    
         
            +
              set :branch, opts['deployer']['branch']['staging']
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
       16 
21 
     | 
    
         
             
            role :web, "#{deploy_user}@#{host_addr}" 
         
     | 
| 
       17 
22 
     | 
    
         | 
| 
       18 
23 
     | 
    
         
             
            set :tmp_dir, "#{multisite_root}/tmp"
         
     | 
| 
       19 
24 
     | 
    
         
             
            deploy_path = "#{multisite_root}/#{site_fqdn}"
         
     | 
| 
       20 
25 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
            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}
         
     | 
| 
       22 
27 
     | 
    
         
             
            set :linked_files, %w{public/wp-config.php}
         
     | 
| 
       23 
28 
     | 
    
         | 
| 
       24 
29 
     | 
    
         
             
            set :deploy_to, deploy_path
         
     | 
| 
       25 
30 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
31 
     | 
    
         
             
            namespace :deploy do
         
     | 
| 
       28 
32 
     | 
    
         
             
              desc "Generate wp-config.php for profile"
         
     | 
| 
       29 
33 
     | 
    
         
             
              task :wp_config do
         
     | 
| 
       30 
34 
     | 
    
         
             
                on roles(:web) do
         
     | 
| 
      
 35 
     | 
    
         
            +
                  invoke 'deploy:check:make_linked_dirs'
         
     | 
| 
       31 
36 
     | 
    
         
             
                  require_relative '../deploy-tools/gen-wp-config'
         
     | 
| 
       32 
37 
     | 
    
         
             
                  FileUtils.mkdir('./tmp') unless Dir.exist?('./tmp')
         
     | 
| 
       33 
38 
     | 
    
         
             
                  GenerateWPConfig('staging', './tmp')
         
     | 
| 
         @@ -77,6 +82,61 @@ namespace :deploy do 
     | 
|
| 
       77 
82 
     | 
    
         
             
                end
         
     | 
| 
       78 
83 
     | 
    
         
             
              end
         
     | 
| 
       79 
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 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
              desc 'Builds and Syncs the project Sage theme'
         
     | 
| 
      
 100 
     | 
    
         
            +
              task :sync_sage_theme do
         
     | 
| 
      
 101 
     | 
    
         
            +
                on roles(:web) do
         
     | 
| 
      
 102 
     | 
    
         
            +
                  wss = WSlaveSage.new()
         
     | 
| 
      
 103 
     | 
    
         
            +
                  sage_theme_name = wss.theme_name?
         
     | 
| 
      
 104 
     | 
    
         
            +
                  if (sage_theme_name == '')
         
     | 
| 
      
 105 
     | 
    
         
            +
                    puts "Couldn't find a Sage theme for this project."
         
     | 
| 
      
 106 
     | 
    
         
            +
                  else
         
     | 
| 
      
 107 
     | 
    
         
            +
                    wss.production()
         
     | 
| 
      
 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/`
         
     | 
| 
      
 110 
     | 
    
         
            +
                  end
         
     | 
| 
      
 111 
     | 
    
         
            +
                end
         
     | 
| 
      
 112 
     | 
    
         
            +
              end
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
              desc 'Builds and Uploads the project Sage theme'
         
     | 
| 
      
 115 
     | 
    
         
            +
              task :upload_sage_theme do
         
     | 
| 
      
 116 
     | 
    
         
            +
                on roles(:web) do
         
     | 
| 
      
 117 
     | 
    
         
            +
                  wss = WSlaveSage.new()
         
     | 
| 
      
 118 
     | 
    
         
            +
                  sage_theme_name = wss.theme_name?
         
     | 
| 
      
 119 
     | 
    
         
            +
                  if (sage_theme_name == '')
         
     | 
| 
      
 120 
     | 
    
         
            +
                    puts "Couldn't find a Sage theme for this project."
         
     | 
| 
      
 121 
     | 
    
         
            +
                  else
         
     | 
| 
      
 122 
     | 
    
         
            +
                    wss.production()
         
     | 
| 
      
 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
         
     | 
| 
      
 125 
     | 
    
         
            +
                  end
         
     | 
| 
      
 126 
     | 
    
         
            +
                end
         
     | 
| 
      
 127 
     | 
    
         
            +
              end
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
              desc 'Builds and Deploys the project Sage theme'
         
     | 
| 
      
 130 
     | 
    
         
            +
              task :sage do
         
     | 
| 
      
 131 
     | 
    
         
            +
                on roles(:web) do
         
     | 
| 
      
 132 
     | 
    
         
            +
                  if disable_rsync
         
     | 
| 
      
 133 
     | 
    
         
            +
                    invoke('deploy:upload_sage_theme')
         
     | 
| 
      
 134 
     | 
    
         
            +
                  else
         
     | 
| 
      
 135 
     | 
    
         
            +
                    invoke('deploy:sync_sage_theme')
         
     | 
| 
      
 136 
     | 
    
         
            +
                  end
         
     | 
| 
      
 137 
     | 
    
         
            +
                end
         
     | 
| 
      
 138 
     | 
    
         
            +
              end
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
       80 
140 
     | 
    
         
             
              desc 'Finds and replaces localhost:8000 and your Production address with the Staging address'
         
     | 
| 
       81 
141 
     | 
    
         
             
              task :chikan do
         
     | 
| 
       82 
142 
     | 
    
         
             
                on roles(:web) do
         
     | 
| 
         @@ -148,14 +208,17 @@ namespace :deploy do 
     | 
|
| 
       148 
208 
     | 
    
         
             
                    invoke('deploy:upload_wp')
         
     | 
| 
       149 
209 
     | 
    
         
             
                    invoke('deploy:upload_plugins')
         
     | 
| 
       150 
210 
     | 
    
         
             
                    invoke('deploy:upload_uploads')
         
     | 
| 
      
 211 
     | 
    
         
            +
                    invoke('deploy:upload_static_data')
         
     | 
| 
       151 
212 
     | 
    
         
             
                  else
         
     | 
| 
       152 
213 
     | 
    
         
             
                    invoke('deploy:sync_wp')
         
     | 
| 
       153 
214 
     | 
    
         
             
                    invoke('deploy:sync_plugins')
         
     | 
| 
       154 
215 
     | 
    
         
             
                    invoke('deploy:sync_uploads')
         
     | 
| 
      
 216 
     | 
    
         
            +
                    invoke('deploy:sync_static_data')
         
     | 
| 
       155 
217 
     | 
    
         
             
                  end
         
     | 
| 
       156 
218 
     | 
    
         
             
                  invoke('deploy')
         
     | 
| 
       157 
219 
     | 
    
         
             
                  invoke('db:seed')
         
     | 
| 
       158 
220 
     | 
    
         
             
                  invoke('deploy:chikan')
         
     | 
| 
      
 221 
     | 
    
         
            +
                  invoke('deploy:sage')
         
     | 
| 
       159 
222 
     | 
    
         
             
                  invoke('deploy:set_permissions')
         
     | 
| 
       160 
223 
     | 
    
         
             
                end
         
     | 
| 
       161 
224 
     | 
    
         
             
              end
         
     | 
    
        data/base/docker-compose.yml
    CHANGED
    
    | 
         @@ -2,7 +2,7 @@ version: '3' 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            services:
         
     | 
| 
       4 
4 
     | 
    
         
             
              db:
         
     | 
| 
       5 
     | 
    
         
            -
                image:  
     | 
| 
      
 5 
     | 
    
         
            +
                image: mariadb:10.5.4-focal
         
     | 
| 
       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. 
     | 
| 
      
 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  
     | 
| 
       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,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            FROM ubuntu:20.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 ln -sf /dev/stdout /var/log/nginx/access.log \
         
     | 
| 
      
 18 
     | 
    
         
            +
                && ln -sf /dev/stderr /var/log/nginx/error.log
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            EXPOSE 80
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            STOPSIGNAL SIGTERM
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
         
     | 
| 
         @@ -0,0 +1,48 @@ 
     | 
|
| 
      
 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 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            	location ~- \.(blade\.php)$ {
         
     | 
| 
      
 34 
     | 
    
         
            +
            		deny all;
         
     | 
| 
      
 35 
     | 
    
         
            +
            	}
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            	location ~- composer\.(json|lock)$ {
         
     | 
| 
      
 38 
     | 
    
         
            +
            		deny all;
         
     | 
| 
      
 39 
     | 
    
         
            +
            	}
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            	location ~- package(-lock)?\.json$ {
         
     | 
| 
      
 42 
     | 
    
         
            +
            		deny all;
         
     | 
| 
      
 43 
     | 
    
         
            +
            	}
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
            	location ~- yarn\.lock$ {
         
     | 
| 
      
 46 
     | 
    
         
            +
            		deny all;
         
     | 
| 
      
 47 
     | 
    
         
            +
            	}
         
     | 
| 
      
 48 
     | 
    
         
            +
            } 
         
     | 
| 
         @@ -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/base/public/.htaccess
    CHANGED
    
    | 
         @@ -14,3 +14,14 @@ 
     | 
|
| 
       14 
14 
     | 
    
         
             
              # BEGIN WordPress
         
     | 
| 
       15 
15 
     | 
    
         
             
              # END WordPress
         
     | 
| 
       16 
16 
     | 
    
         
             
            </IfModule>
         
     | 
| 
      
 17 
     | 
    
         
            +
            <FilesMatch ".+\.(blade\.php)$">
         
     | 
| 
      
 18 
     | 
    
         
            +
                <IfModule mod_authz_core.c>
         
     | 
| 
      
 19 
     | 
    
         
            +
                    # Apache 2.4
         
     | 
| 
      
 20 
     | 
    
         
            +
                    Require all denied
         
     | 
| 
      
 21 
     | 
    
         
            +
                </IfModule>
         
     | 
| 
      
 22 
     | 
    
         
            +
                <IfModule !mod_authz_core.c>
         
     | 
| 
      
 23 
     | 
    
         
            +
                    # Apache 2.2
         
     | 
| 
      
 24 
     | 
    
         
            +
                    Order deny,allow
         
     | 
| 
      
 25 
     | 
    
         
            +
                    Deny from all
         
     | 
| 
      
 26 
     | 
    
         
            +
                </IfModule>
         
     | 
| 
      
 27 
     | 
    
         
            +
            </FilesMatch>
         
     | 
    
        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 
     | 
    
         
            -
               
     | 
| 
      
 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"
         
     | 
| 
         @@ -20,35 +27,55 @@ class WSlaveCLI < Thor 
     | 
|
| 
       20 
27 
     | 
    
         
             
                WSlaveUpdate.new()
         
     | 
| 
       21 
28 
     | 
    
         
             
              end
         
     | 
| 
       22 
29 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
              desc ' 
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
                 
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
                 
     | 
| 
       32 
     | 
    
         
            -
                 
     | 
| 
       33 
     | 
    
         
            -
                 
     | 
| 
       34 
     | 
    
         
            -
                 
     | 
| 
      
 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'])
         
     | 
| 
       35 
61 
     | 
    
         
             
              end
         
     | 
| 
       36 
62 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
              desc ' 
     | 
| 
       38 
     | 
    
         
            -
              method_option : 
     | 
| 
       39 
     | 
    
         
            -
               
     | 
| 
      
 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()
         
     | 
| 
       40 
67 
     | 
    
         
             
                puts 'Starting server...'
         
     | 
| 
       41 
68 
     | 
    
         
             
                require_relative '../lib/wslave_docker'
         
     | 
| 
       42 
     | 
    
         
            -
                WSlaveDocker.new().server(options['f'])
         
     | 
| 
      
 69 
     | 
    
         
            +
                WSlaveDocker.new().server(:start, options['f'], options['v'])
         
     | 
| 
       43 
70 
     | 
    
         
             
              end
         
     | 
| 
       44 
71 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
              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'
         
     | 
| 
      
 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'
         
     | 
| 
       48 
75 
     | 
    
         
             
              def stop()
         
     | 
| 
       49 
76 
     | 
    
         
             
                puts 'Stopping server...'
         
     | 
| 
       50 
77 
     | 
    
         
             
                require_relative '../lib/wslave_docker'
         
     | 
| 
       51 
     | 
    
         
            -
                WSlaveDocker.new().stop 
     | 
| 
      
 78 
     | 
    
         
            +
                WSlaveDocker.new().server(:stop, options['f'], options['v'])
         
     | 
| 
       52 
79 
     | 
    
         
             
              end
         
     | 
| 
       53 
80 
     | 
    
         | 
| 
       54 
81 
     | 
    
         
             
              desc 'sync', "Synchronizes submodules and file permissions"
         
     | 
| 
         @@ -64,6 +91,33 @@ class WSlaveCLI < Thor 
     | 
|
| 
       64 
91 
     | 
    
         
             
                spec = Gem::Specification::load("#{__dir__}/../wslave.gemspec")
         
     | 
| 
       65 
92 
     | 
    
         
             
                puts spec.version
         
     | 
| 
       66 
93 
     | 
    
         
             
              end
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 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'
         
     | 
| 
      
 101 
     | 
    
         
            +
                  require_relative '../lib/wslave_sage'
         
     | 
| 
      
 102 
     | 
    
         
            +
                  puts "Generating sage theme base for #{arg}"
         
     | 
| 
      
 103 
     | 
    
         
            +
                  WSlaveSage.new().create(arg)
         
     | 
| 
      
 104 
     | 
    
         
            +
                when 'update'
         
     | 
| 
      
 105 
     | 
    
         
            +
                  require_relative '../lib/wslave_sage'
         
     | 
| 
      
 106 
     | 
    
         
            +
                  WSlaveSage.new().update()
         
     | 
| 
      
 107 
     | 
    
         
            +
                when 'dev'
         
     | 
| 
      
 108 
     | 
    
         
            +
                  require_relative '../lib/wslave_sage'
         
     | 
| 
      
 109 
     | 
    
         
            +
                  WSlaveSage.new().dev()
         
     | 
| 
      
 110 
     | 
    
         
            +
                when 'build'
         
     | 
| 
      
 111 
     | 
    
         
            +
                  require_relative '../lib/wslave_sage'
         
     | 
| 
      
 112 
     | 
    
         
            +
                  WSlaveSage.new().build()
         
     | 
| 
      
 113 
     | 
    
         
            +
                when 'production'
         
     | 
| 
      
 114 
     | 
    
         
            +
                  require_relative '../lib/wslave_sage'
         
     | 
| 
      
 115 
     | 
    
         
            +
                  WSlaveSage.new().production()
         
     | 
| 
      
 116 
     | 
    
         
            +
                else
         
     | 
| 
      
 117 
     | 
    
         
            +
                  puts "sage command \"#{command}\" not found."
         
     | 
| 
      
 118 
     | 
    
         
            +
                  puts "sage commands available: create update dev build production"
         
     | 
| 
      
 119 
     | 
    
         
            +
                end
         
     | 
| 
      
 120 
     | 
    
         
            +
              end
         
     | 
| 
       67 
121 
     | 
    
         
             
            end
         
     | 
| 
       68 
122 
     | 
    
         | 
| 
       69 
123 
     | 
    
         
             
            WSlaveCLI.start(ARGV)
         
     | 
    
        data/lib/wslave_docker.rb
    CHANGED
    
    | 
         @@ -6,23 +6,54 @@ class WSlaveDocker 
     | 
|
| 
       6 
6 
     | 
    
         
             
                puts 'Initializing WSlave Docker Control'
         
     | 
| 
       7 
7 
     | 
    
         
             
              end
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
              def server(force)
         
     | 
| 
      
 9 
     | 
    
         
            +
              def server(command = :start, force = false, volume = false)
         
     | 
| 
      
 10 
     | 
    
         
            +
                case (command)
         
     | 
| 
      
 11 
     | 
    
         
            +
                when :start
         
     | 
| 
      
 12 
     | 
    
         
            +
                  start(force, volume)
         
     | 
| 
      
 13 
     | 
    
         
            +
                when :stop
         
     | 
| 
      
 14 
     | 
    
         
            +
                  stop(force, volume)
         
     | 
| 
      
 15 
     | 
    
         
            +
                when :log
         
     | 
| 
      
 16 
     | 
    
         
            +
                  log()
         
     | 
| 
      
 17 
     | 
    
         
            +
                when :console
         
     | 
| 
      
 18 
     | 
    
         
            +
                  console()
         
     | 
| 
      
 19 
     | 
    
         
            +
                else
         
     | 
| 
      
 20 
     | 
    
         
            +
                  puts "server subcommand \"#{command.to_s}\" not found."
         
     | 
| 
      
 21 
     | 
    
         
            +
                  puts "Available commands: start stop log console"
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              def start(force = false, volume = false)
         
     | 
| 
       10 
26 
     | 
    
         
             
                return unless _check()
         
     | 
| 
       11 
27 
     | 
    
         
             
                _force_down() if force
         
     | 
| 
      
 28 
     | 
    
         
            +
                `docker-compose down#{volume ? ' -v' : ''}` # Shutdown existing instances
         
     | 
| 
       12 
29 
     | 
    
         
             
                _unfuck_dot_htaccess()
         
     | 
| 
       13 
30 
     | 
    
         
             
                WSlaveTools.set_dev_perms
         
     | 
| 
       14 
31 
     | 
    
         
             
                `docker-compose up -d`
         
     | 
| 
       15 
32 
     | 
    
         
             
              end
         
     | 
| 
       16 
33 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
              def stop(force, volume)
         
     | 
| 
      
 34 
     | 
    
         
            +
              def stop(force = false, volume = false)
         
     | 
| 
       18 
35 
     | 
    
         
             
                return unless _check()
         
     | 
| 
       19 
36 
     | 
    
         
             
                _force_down() if force
         
     | 
| 
       20 
37 
     | 
    
         
             
                `docker-compose down#{volume ? ' -v' : ''}`
         
     | 
| 
       21 
38 
     | 
    
         
             
              end
         
     | 
| 
       22 
39 
     | 
    
         | 
| 
      
 40 
     | 
    
         
            +
              def log()
         
     | 
| 
      
 41 
     | 
    
         
            +
                return unless _check()
         
     | 
| 
      
 42 
     | 
    
         
            +
                begin
         
     | 
| 
      
 43 
     | 
    
         
            +
                  system("docker-compose logs -f")
         
     | 
| 
      
 44 
     | 
    
         
            +
                rescue Exception => e
         
     | 
| 
      
 45 
     | 
    
         
            +
                  puts "\n\nEnding log trace. NOTE: Server containers are still running!\n\n"
         
     | 
| 
      
 46 
     | 
    
         
            +
                  return
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
              def console()
         
     | 
| 
      
 51 
     | 
    
         
            +
                return unless _check()
         
     | 
| 
      
 52 
     | 
    
         
            +
                system("docker-compose exec web /bin/bash")
         
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
       23 
55 
     | 
    
         
             
              def _check()
         
     | 
| 
       24 
56 
     | 
    
         
             
                return true if (File.exist?("./config/.wslave") &&
         
     | 
| 
       25 
     | 
    
         
            -
                                File.exist?("Dockerfile") &&
         
     | 
| 
       26 
57 
     | 
    
         
             
                                File.exist?("docker-compose.yml"))
         
     | 
| 
       27 
58 
     | 
    
         
             
                puts "This does not appear to be the root of a WSlave managed app."
         
     | 
| 
       28 
59 
     | 
    
         
             
                false
         
     | 
    
        data/lib/wslave_new.rb
    CHANGED
    
    | 
         @@ -1,43 +1,85 @@ 
     | 
|
| 
       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 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
      
 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("#{ 
     | 
| 
      
 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 != ''
         
     | 
| 
       27 
43 
     | 
    
         
             
                `cd #{path} && git submodule update --init --recursive public/wordpress`
         
     | 
| 
      
 44 
     | 
    
         
            +
                if (version == 'edge' || version == 'master')
         
     | 
| 
      
 45 
     | 
    
         
            +
                  `cd #{path}/public/wordpress && git checkout master`
         
     | 
| 
      
 46 
     | 
    
         
            +
                elsif version != ''
         
     | 
| 
      
 47 
     | 
    
         
            +
                  `cd #{path}/public/wordpress && git checkout #{version}`
         
     | 
| 
      
 48 
     | 
    
         
            +
                else
         
     | 
| 
      
 49 
     | 
    
         
            +
                  `cd #{path}/public/wordpress && git checkout #{get_stable_branch_version("#{path}/public/wordpress")}-branch`
         
     | 
| 
      
 50 
     | 
    
         
            +
                end
         
     | 
| 
       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 
     | 
    
         | 
| 
      
 60 
     | 
    
         
            +
                puts "  > Preparing statid data directory"
         
     | 
| 
      
 61 
     | 
    
         
            +
                FileUtils.mkdir("#{path}/public/data") unless Dir.exist?("#{path}/public/data")
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
       37 
63 
     | 
    
         
             
                puts "  > Setting permissions"
         
     | 
| 
       38 
64 
     | 
    
         
             
                WSlaveTools.set_dev_perms
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
       40 
66 
     | 
    
         
             
                `cd #{path} && git add --all && git commit -am "Add and initialize WordPress#{version}"`
         
     | 
| 
       41 
67 
     | 
    
         
             
                puts "  > Done!"
         
     | 
| 
       42 
68 
     | 
    
         
             
              end
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
              def add_path_to_Gemspec(wspath, path)
         
     | 
| 
      
 71 
     | 
    
         
            +
                gemtext = File.read("#{path}/Gemfile")
         
     | 
| 
      
 72 
     | 
    
         
            +
                gemtext.gsub!("gem 'wslave'", "gem 'wslave', path: '#{wspath}'")
         
     | 
| 
      
 73 
     | 
    
         
            +
                File.open("#{path}/Gemfile", "w") {|gemfile| gemfile.puts gemtext}
         
     | 
| 
      
 74 
     | 
    
         
            +
              end
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
              def get_stable_branch_version(path)
         
     | 
| 
      
 77 
     | 
    
         
            +
                latest = '5.4' # This is just a fallback (latest at time of update)
         
     | 
| 
      
 78 
     | 
    
         
            +
                # TODO Implementation requires this issue be resolved: https://github.com/ruby-git/ruby-git/issues/424
         
     | 
| 
      
 79 
     | 
    
         
            +
                #g = Git.open(path)
         
     | 
| 
      
 80 
     | 
    
         
            +
                #g.brances.remote.each do |branch|
         
     | 
| 
      
 81 
     | 
    
         
            +
                #end
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                latest
         
     | 
| 
      
 84 
     | 
    
         
            +
              end
         
     | 
| 
       43 
85 
     | 
    
         
             
            end
         
     | 
    
        data/lib/wslave_sage.rb
    CHANGED
    
    | 
         @@ -1,9 +1,76 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'yaml'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       1 
3 
     | 
    
         
             
            class WSlaveSage
         
     | 
| 
       2 
     | 
    
         
            -
               
     | 
| 
      
 4 
     | 
    
         
            +
              attr_reader :theme_name
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              def initialize()
         
     | 
| 
      
 7 
     | 
    
         
            +
                @theme_name = ''
         
     | 
| 
      
 8 
     | 
    
         
            +
              end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              def create(name)
         
     | 
| 
       3 
11 
     | 
    
         
             
                unless File.exist?("./config/.wslave")
         
     | 
| 
       4 
12 
     | 
    
         
             
                  puts "This command must be run in the root of a WSlave setup"
         
     | 
| 
       5 
13 
     | 
    
         
             
                end
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                 
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                name = 'wslave-sage-theme' if name.empty?
         
     | 
| 
      
 16 
     | 
    
         
            +
                project_root = Dir.pwd
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 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`
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                Dir.chdir project_root
         
     | 
| 
      
 22 
     | 
    
         
            +
                _write_wslave_sage_config(name)
         
     | 
| 
      
 23 
     | 
    
         
            +
                _overwrite_sage_webpack_browsersync_config
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              def update()
         
     | 
| 
      
 27 
     | 
    
         
            +
                return unless _check()
         
     | 
| 
      
 28 
     | 
    
         
            +
                system("cd public/wp-content/themes/#{@theme_name} && yarn && yarn build")
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
              def dev()
         
     | 
| 
      
 32 
     | 
    
         
            +
                return unless _check()
         
     | 
| 
      
 33 
     | 
    
         
            +
                system("cd public/wp-content/themes/#{@theme_name} && yarn start")
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
              def build()
         
     | 
| 
      
 37 
     | 
    
         
            +
                return unless _check()
         
     | 
| 
      
 38 
     | 
    
         
            +
                system("cd public/wp-content/themes/#{@theme_name} && yarn build")
         
     | 
| 
      
 39 
     | 
    
         
            +
              end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
              def production()
         
     | 
| 
      
 42 
     | 
    
         
            +
                return unless _check()
         
     | 
| 
      
 43 
     | 
    
         
            +
                system("cd public/wp-content/themes/#{@theme_name} && yarn build:production")
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
              def theme_name?()
         
     | 
| 
      
 47 
     | 
    
         
            +
                return '' unless _check()
         
     | 
| 
      
 48 
     | 
    
         
            +
                @theme_name
         
     | 
| 
      
 49 
     | 
    
         
            +
              end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
              def _write_wslave_sage_config(name)
         
     | 
| 
      
 52 
     | 
    
         
            +
                File.open("./config/sage.yml", 'w') {|f| YAML.dump({theme: name}, f)}
         
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
              def _overwrite_sage_webpack_browsersync_config
         
     | 
| 
      
 56 
     | 
    
         
            +
                return unless _check()
         
     | 
| 
      
 57 
     | 
    
         
            +
                theme_info = YAML.load_file("./config/sage.yml")
         
     | 
| 
      
 58 
     | 
    
         
            +
                Dir.chdir "#{Dir.pwd}/public/wp-content/themes/#{theme_info[:theme]}"
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                webpack_config_path = './webpack.mix.js'
         
     | 
| 
      
 61 
     | 
    
         
            +
                new_webpack_config = File.read(webpack_config_path).gsub(
         
     | 
| 
      
 62 
     | 
    
         
            +
                  /browserSync\('sage.test'\)/, "browserSync('localhost:8000')"
         
     | 
| 
      
 63 
     | 
    
         
            +
                )
         
     | 
| 
      
 64 
     | 
    
         
            +
                File.open(webpack_config_path, 'w') { |f| f.puts new_webpack_config }
         
     | 
| 
      
 65 
     | 
    
         
            +
              end
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
              def _check()
         
     | 
| 
      
 68 
     | 
    
         
            +
                if (File.exist?("./config/.wslave") && File.exist?("./config/sage.yml"))
         
     | 
| 
      
 69 
     | 
    
         
            +
                  theme_info = YAML.load_file("./config/sage.yml")
         
     | 
| 
      
 70 
     | 
    
         
            +
                  @theme_name = theme_info[:theme]
         
     | 
| 
      
 71 
     | 
    
         
            +
                  return true
         
     | 
| 
      
 72 
     | 
    
         
            +
                end
         
     | 
| 
      
 73 
     | 
    
         
            +
                puts "This does not appear to be the root of a WSlave managed app with a Sage theme."
         
     | 
| 
      
 74 
     | 
    
         
            +
                false
         
     | 
| 
       8 
75 
     | 
    
         
             
              end
         
     | 
| 
       9 
76 
     | 
    
         
             
            end
         
     | 
    
        data/lib/wslave_tools.rb
    CHANGED
    
    | 
         @@ -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."
         
     | 
| 
         @@ -24,6 +23,8 @@ class WSlaveTools 
     | 
|
| 
       24 
23 
     | 
    
         
             
                  FileUtils.chmod(0775, "#{path}/public/wp-content/plugins")
         
     | 
| 
       25 
24 
     | 
    
         
             
                  FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/upgrade")
         
     | 
| 
       26 
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")
         
     | 
| 
       27 
28 
     | 
    
         | 
| 
       28 
29 
     | 
    
         
             
                  unless Dir.exist?("#{path}/db")
         
     | 
| 
       29 
30 
     | 
    
         
             
                    FileUtils.mkdir("#{path}/db")
         
     | 
    
        data/lib/wslave_update.rb
    CHANGED
    
    | 
         @@ -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 
     | 
    
         
            -
             
     | 
| 
      
 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. 
     | 
| 
      
 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 
27 
     | 
    
         
             
                FileUtils.cp_r(Dir.glob("#{base_path}/config/*"), "#{path}/config")
         
     | 
    
        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.2.3'
         
     | 
| 
       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. 
     | 
| 
       24 
     | 
    
         
            -
              s.add_dependency 'capistrano-git-with-submodules', '~> 2.0', '2.0. 
     | 
| 
      
 23 
     | 
    
         
            +
              s.add_dependency 'capistrano', '= 3.14.1'
         
     | 
| 
      
 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 ' 
     | 
| 
      
 28 
     | 
    
         
            +
              s.add_dependency 'git', '~> 1.7', '1.7.0'
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
              s.add_dependency 'thor', '~> 1.0', '1.0.1'
         
     | 
| 
       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. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.2.3
         
     | 
| 
       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: 2020-11-19 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.14.1
         
     | 
| 
       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.14.1
         
     | 
| 
       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. 
     | 
| 
      
 36 
     | 
    
         
            +
                    version: 2.0.4
         
     | 
| 
       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. 
     | 
| 
      
 46 
     | 
    
         
            +
                    version: 2.0.4
         
     | 
| 
       47 
47 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       48 
48 
     | 
    
         
             
              name: capistrano-scm-copy
         
     | 
| 
       49 
49 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -84,26 +84,46 @@ dependencies: 
     | 
|
| 
       84 
84 
     | 
    
         
             
                - - '='
         
     | 
| 
       85 
85 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       86 
86 
     | 
    
         
             
                    version: 1.0.0
         
     | 
| 
      
 87 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 88 
     | 
    
         
            +
              name: git
         
     | 
| 
      
 89 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 90 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 91 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 92 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 93 
     | 
    
         
            +
                    version: '1.7'
         
     | 
| 
      
 94 
     | 
    
         
            +
                - - '='
         
     | 
| 
      
 95 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 96 
     | 
    
         
            +
                    version: 1.7.0
         
     | 
| 
      
 97 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 98 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 99 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 100 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 101 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 102 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 103 
     | 
    
         
            +
                    version: '1.7'
         
     | 
| 
      
 104 
     | 
    
         
            +
                - - '='
         
     | 
| 
      
 105 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 106 
     | 
    
         
            +
                    version: 1.7.0
         
     | 
| 
       87 
107 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       88 
108 
     | 
    
         
             
              name: thor
         
     | 
| 
       89 
109 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       90 
110 
     | 
    
         
             
                requirements:
         
     | 
| 
       91 
111 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       92 
112 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       93 
     | 
    
         
            -
                    version: '0 
     | 
| 
      
 113 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
       94 
114 
     | 
    
         
             
                - - '='
         
     | 
| 
       95 
115 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       96 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 116 
     | 
    
         
            +
                    version: 1.0.1
         
     | 
| 
       97 
117 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       98 
118 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       99 
119 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       100 
120 
     | 
    
         
             
                requirements:
         
     | 
| 
       101 
121 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       102 
122 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       103 
     | 
    
         
            -
                    version: '0 
     | 
| 
      
 123 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
       104 
124 
     | 
    
         
             
                - - '='
         
     | 
| 
       105 
125 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       106 
     | 
    
         
            -
                    version: 0. 
     | 
| 
      
 126 
     | 
    
         
            +
                    version: 1.0.1
         
     | 
| 
       107 
127 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       108 
128 
     | 
    
         
             
              name: haikunator
         
     | 
| 
       109 
129 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -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 
     | 
    
         
            -
             
     | 
| 
       183 
     | 
    
         
            -
            rubygems_version: 2.7.7
         
     | 
| 
      
 205 
     | 
    
         
            +
            rubygems_version: 3.1.2
         
     | 
| 
       184 
206 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       185 
207 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       186 
208 
     | 
    
         
             
            summary: '"Word Slave" generates and controls a WordPress installation'
         
     |