├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── README_CONFIG.md ├── Vagrantfile └── wpdistillery ├── config.yml ├── provision.sh └── wpdistillery.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_STORE 2 | .vagrant 3 | config_custom.yml 4 | npm-debug.log 5 | public -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | # CHANGELOG 3 | 4 | ## HEAD | 2.3.6 | 05.11.2018 5 | * Add WP-CLI environment variables to fix permission errors when creating the WPCLI cache folder (thanks to [@tgroff](https://github.com/tgroff)) 6 | * Clean up the readme (thanks to [@mohnjatthews](https://github.com/mohnjatthews) 7 | * fix a bug regarding the Themes mapping name in the provisioning (thanks to [@bzmr](https://github.com/bzmr)) 8 | * add WinNFSd support (thanks to [@thursby](https://github.com/thursby)) 9 | * fix license-link in documentation (thanks to [@mikaeljorhult](https://github.com/mikaeljorhult)) 10 | * update default plugin list 11 | * fix a bug where the `public` dir was not created on setup (thanks to [@donaldCull](https://github.com/donaldCull)) 12 | * remove custom root dir because path to the docroot is in the Apache config using `public` (thanks to [@XedinUnknown](https://github.com/XedinUnknown)) 13 | 14 | Contributors: 15 | * [@tgroff](https://github.com/tgroff) 16 | * [@mohnjatthews](https://github.com/mohnjatthews) 17 | 18 | ## 2.3.0 | 24.01.2018 19 | * re-organize the theme-cleanup (now located at `themes`, removed from `cleanup`) 20 | * fix a bug caused by using a default theme with theme-cleanup activated 21 | * silence curl command for downloading the current version of WP CLI to reduce cli-bloating 22 | * change default local-domain to `.vm` (for "virtual machine") as `.local` has conflicts when using browsersync 23 | * add note about the WP-Multisite feature to the readme (thanks to [@pjohanneson](https://github.com/pjohanneson)) 24 | 25 | ## 2.2.0 | 31.10.2017 26 | * change default local-domain to `.local` as `.dev` is an official gTLD now 27 | * add ssh credentials to `Vagrantfile` 28 | * add `--hard` to rewrite flush to make sure .htaccess file is generated (thanks to [@XedinUnknown](https://github.com/XedinUnknown)) 29 | * Fix Typo 30 | 31 | ## 2.1.0 | 21.06.2017 32 | * update setup for Scotch Box 3.0 (re-install WP-CLI for php7) 33 | * update default plugin list: remove yoast, add the-seo-framework (see https://roots.io/weve-migrated-from-yoast-seo/) 34 | * remove max-filesize option on provisioning 35 | * add license note 36 | * fix yaml syntax errors (thanks to [@XedinUnknown](https://github.com/XedinUnknown)) 37 | * fix front_page_name variable in setup 38 | 39 | ## 2.0.0 | 15.01.2017 40 | * simplified setup process to `vagrant up` 41 | * restructured file and folder structure (moved all files into a wpdistillery folder) 42 | * added custom Vagrantfile 43 | * added auto-update for WP-CLI 44 | * added auto-update option for WordPress Core and Plugins 45 | * fixed a few minor bugs 46 | * added Windows Support 47 | 48 | Special thanks to [@ShaneShipston](https://github.com/ShaneShipston) for his feature-suggestions and everyone involved in beta testing ([@MarcWieland95](https://github.com/marcwieland95), Anthony Chapman) 49 | 50 | Contributors: [@FlurinDuerst](https://github.com/flurinduerst), [@ShaneShipston](https://github.com/ShaneShipston) 51 | 52 | ## 1.8.0 | 20.12.2016 53 | * fixed a bug that occurred when sending the admin email after core installation 54 | * fixed a bug that occurred on installing a theme from Github using the current version of WP-CLI (0.25.0) 55 | * added an option to define WordPress Version 56 | * documentation updates 57 | * added rewrite flush to make sure permalinks are working correctly 58 | * added firstname/lastname to default user 59 | * removed google-sitemap-generator from default plugins (Yoast covers this aswell) 60 | * added note about wpdistillery.org 61 | 62 | Contributors: [@flurinduerst](https://github.com/flurinduerst), [@ShaneShipston](https://github.com/ShaneShipston), [@drawcard](https://github.com/drawcard) 63 | 64 | ## 1.7.1 | 02.08.2016 65 | * fixed a bug that caused an error if a theme was installed that doesn't end with `master.zip` 66 | * add additional options 67 | * custom page to be used as front_page 68 | * timezone 69 | * description 70 | * default image sizes 71 | * add settings setup task 72 | * small bugfixes 73 | * cleanup/renaming 74 | 75 | ## 1.6.1 | 07.07.2016 76 | * bugfix (now correctly checking `theme_rename`) 77 | * add error handler that asks the user to continue if an error occured 78 | * add google-sitemap-generator to preset plugins 79 | * remove dublicated plugin entry 80 | * remove WPDistillery Version from config/setup - remain at README 81 | 82 | ## 1.5.1 | 21.06.2016 83 | * Rename to WP Distillery 84 | * Bugfixes / Typo / Documentation 85 | 86 | ## 1.4.0 | 17.06.2016 87 | * Add support for custom WP root folder 88 | * Add option to rename theme after installation 89 | * Add file versions to config.yml and setup.sh 90 | * Fix Typo in setup procedure 91 | 92 | 93 | ## 1.3.0 | 16.06.2016 94 | * Add modular setup task options 95 | 96 | ## 1.2.0 | 17.06.2016 97 | * Public Release 98 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | ========================================================================================================= 3 | All code in this repository, unless otherwise specified, is hereby licensed under the MIT Public License: 4 | ========================================================================================================= 5 | 6 | Copyright © 2016-2017 Flurin Dürst (https://flurinduerst.ch) 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | ========================================================================================================= 27 | License Addition 28 | ========================================================================================================= 29 | 30 | The author notice shall not be removed in any file. You may add your own name 31 | to it if you applied some changes. The "About" section in README.md shall not 32 | be edited or deleted without permission. 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WPDistillery 2 | 3 | ![WPDistillery Logo](http://files.flurinduerst.ch/wpdistillery/wpdistillery_logo.png) 4 | 5 | Version 2.3.6 (05.11.2018) 6 | 7 | Created by [wpdistillery.org](https://wpdistillery.org) 8 | 9 | I’m putting a lot of time into maintaining WPDistillery. So if you like it, please consider supporting it: 10 | 11 | [![BMC](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/flurinduerst) 12 | [![Patreon](https://files.flurinduerst.ch/patreon.jpg)](https://www.patreon.com/bePatron?u=10089926) 13 | 14 | ## What is WPDistillery 15 | 16 | WP Distillery does all the work for you when setting up a new WordPress project with [Scotch Box](https://box.scotch.io/). Simply add your preferred theme, plugins, and options into `config.yml` and you're good to go! With WPDistillery it won't take longer than 5 minutes until you can start working on your new WordPress project. 17 | 18 | One simple command will: 19 | 20 | - Install Scotch Box 21 | - Install and update requirements on the local webserver 22 | - Download, install, and configure WordPress 23 | - Set WordPress options 24 | - Install and activate your favorite WordPress theme (default: [WPSeed](https://wpseed.org)) 25 | - Remove default themes 26 | - Install and activate the plugins defined in the config files 27 | - Clean the contents, plugins, unused files, and other Wordpress defaults 28 | 29 | You're able to adjust which of the above tasks will be executed. Simply set the desired tasks to `true` or `false` in the **Setup Options** section at the bottom of `config.yml`. All you need to do after customizing your config file is `vagrant up`. That's it! With that one single command WPDistillery will: 30 | 31 | 1. SSH to the VM 32 | 1. Update WP-CLI 33 | 1. Install and configure everything 34 | 35 | It also comes with an optional auto-update function and integrated support for Windows. Check out the [Changelog](CHANGELOG.md) for a complete list of changes. 36 | 37 | WPDistillery is fully compatible with [Scotchbox 3.0](https://box.scotch.io/) 38 | 39 | ## Demo 40 | 41 | [![WPDistillery Setup Video](http://files.flurinduerst.ch/wpdistillery/demovideo_thumb2.png)](https://youtu.be/y1GtIiODsxM) 42 | 43 | ## Dependencies 44 | 45 | - [ScotchBox](https://box.scotch.io) (using [Vagrant](https://vagrantup.com) & [Virtualbox](https://virtualbox.org)) 46 | - [Vagrant Hostsupdater](https://github.com/cogitatio/vagrant-hostsupdater) (`vagrant plugin install vagrant-hostsupdater`) 47 | 48 | ## Setup 49 | 50 | To setup a new project running Scotch Box and WordPress, simply follow these steps: 51 | 52 | 1. In a terminal, run: `git clone https://github.com/flurinduerst/WPDistillery.git my-project` 53 | 2. Customize `wpdistillery/config.yml` to suit your needs. See [configuration file documentation](README_CONFIG.md). 54 | 3. Inside the `Vagrantfile` add your local URL at `config.vm.hostname`. This should be the same as `wpsettings:url:` in `config.yml`. 55 | 4. Run `vagrant up` from where your `Vagrantfile` is. 56 | 57 | Done! You can now access your project at the local URL (for example `yoursite.vm`) defined in **Step 3**. (or at http://192.168.33.10/) 58 | 59 | **Note:** Currently there's an [issue](https://github.com/scotch-io/scotch-box/issues/296) related to [ScotchBox](https://github.com/scotch-io/scotch-box) that hinders Vagrant from mounting VirtualBox Shared folders. The solution is to install [vagrant-vbguest](https://github.com/dotless-de/vagrant-vbguest) before running vagrant. This will install the correct vbguest package into the box: 60 | 61 | ``` 62 | vagrant plugin install vagrant-vbguest 63 | vagrant vbguest 64 | ``` 65 | 66 | ### Windows Users 67 | 68 | Windows users may wish to `vagrant plugin install vagrant-winnfsd` before `vagrant up` for a moderate speed increase on sites with a lot of files. WPDistillery will detect **WinNFSd** support if needed. See [Vagrant WinNFSd](https://github.com/winnfsd/vagrant-winnfsd) for more information. 69 | 70 | ## Additional Information 71 | 72 | ### WPDistillery with WP-Multisite 73 | 74 | Using this [Pull Request](https://github.com/flurinduerst/WPDistillery/pull/45) you can add multisite capability for your project. We [decided](https://github.com/flurinduerst/WPDistillery/issues/59) to not merge the PR to keep WPDistillery as clean as it is. 75 | 76 | ### Auto Update WordPress and Plugins 77 | 78 | If you want to automatically update WordPress and all Plugins on every `vagrant up` you can remove the comment character at line 26 inside the Vagrantfile. 79 | 80 | ### Windows Support 81 | 82 | Using Windows? No Problem! WPDistillery will detect if you're using Windows and if so, automatically convert all files using dos2unix. 83 | 84 | ### Basic Vagrant Commands 85 | 86 | - `vagrant up` will start the machine. The first ever `vagrant up` in your project will also install Scotch Box and execute provisioning. 87 | - `vagrant provision` will execute provisioning. This is where WPDistillery runs its core function which is installing and configuring WordPress according to `config.yml`. Before that, it will also update WP-CLI and set the upload size to 64MB. Normally `vagrant provision` should not be executed manually but can be used to re-run the WPDistillery setup in case you want to re-install WordPress. 88 | - `vagrant reload` will restart Vagrant. This is required for changes made in the `Vagrantfile` to take effect. 89 | - `vagrant halt` will shut down the virtual machine. 90 | - `vagrant destroy` will destroy all the resources related to the current virtual machine. This action is not reversable. 91 | 92 | More informations can be found at [vagrantup.com](https://vagrantup.com). 93 | 94 | ## Troubleshooting 95 | 96 | Something went wrong within the WPDistillery setup. I'd like to restart the setup: 97 | 98 | - Fix your setting (probably in `wpdistillery/config.yml` or `Vagrantfile`) 99 | - Remove all tables from the `scotchbox` database 100 | - Remove the `public` folder 101 | - Run `vagrant reload --provision` 102 | 103 | ## About 104 | 105 | - Author: [Flurin Dürst](https://github.com/flurinduerst) | [Twitter](https://twitter.com/flurinduerst) 106 | - Contributors: 107 | - [@ShaneShipston](https://github.com/ShaneShipston) 108 | - [@drawcard](https://github.com/drawcard) 109 | - [@thursby](https://github.com/thursby) 110 | - [@tgroff](https://github.com/tgroff) 111 | - [@mohnjatthews](https://github.com/mohnjatthews) 112 | 113 | ### Contribute 114 | 115 | - Fork it 116 | - Create your feature branch 117 | - Commit your changes 118 | - Push to the branch 119 | - Create new a Pull Request 120 | 121 | Feel free to contact me if you have questions or need any advice. 122 | 123 | ### License 124 | 125 | WPDistillery is released under the MIT Public License. 126 | 127 | Note: The "About" section in `README.md` and the author (`@author`) notice in the file-headers shall not be edited or deleted without permission. For details, please see [License](LICENSE). 128 | -------------------------------------------------------------------------------- /README_CONFIG.md: -------------------------------------------------------------------------------- 1 | 2 | # The configuration file in detail 3 | 4 | In this section, we will go through the `config.yml` step by step as I will explain the options available. 5 | 6 | The configuration file is split into five sections: 7 | 8 | * Installation 9 | * Wordpress 10 | * Themes 11 | * Plugins 12 | * WPDistillery Setup 13 | 14 | ## Installation 15 | * In **`wpversion`** you can define what WordPress version to install. 16 | * With **`wplocale`** you can select what language to download and install WordPress. Use language Codes like `en_US` or `en_GB`. 17 | * Add your timezone as string to **`timezone`**. See [List of Supported Timezones](http://php.net/manual/en/timezones.php). 18 | * **`admin`** defines the default admin user. Set your preferred username, password and email. 19 | * **`db`** contains the access data to connect WordPress to the database on the Virtual Machine. By default (when using ScotchBox) no changes are needed here. 20 | 21 | ```yaml 22 | # INSTALLATION 23 | ################################################################# 24 | 25 | # WordPress version 26 | wpversion: latest 27 | 28 | # language/timezone 29 | wplocale: en_US 30 | timezone: America/New_York 31 | 32 | # admin user settings 33 | admin: 34 | user: admin 35 | password: admin 36 | email: mail@domain.tld 37 | 38 | # scotch box db access 39 | db: 40 | name: scotchbox 41 | user: root 42 | pass: root 43 | prefix: wp_ 44 | ``` 45 | 46 | ## Settings 47 | * In **`wpsettings`** you can define WP-Options like url, title, description, the permalink_structure or edit the default image sizes. 48 | * Set **`page_on_front`** to true to set **`frontpage_name`** as default front page. 49 | * If you set **`convert_smilies`** false, smilies wont be converted to image-smilies automatically. 50 | * Note: To edit the url you use to access the website within your browser edit `config.vm.hostname` in the Vagrantfile from Scotch Box. 51 | 52 | ```yaml 53 | # SETTINGS 54 | ################################################################# 55 | 56 | wpsettings: 57 | url: wpdistillery.vm 58 | title: Example 59 | description: Example Description 60 | permalink_structure: /%postname%/ 61 | # default image sizes 62 | thumbnail_width: 150 63 | thumbnail_height: 150 64 | medium_width: 300 65 | medium_height: 300 66 | large_width: 1024 67 | large_height: 1024 68 | # use page as frontpage 69 | page_on_front: true 70 | frontpage_name: Example Front Page 71 | # automatic converttion of smilies 72 | convert_smilies: false 73 | ``` 74 | 75 | ## Themes 76 | Now you can install a (starter-) theme if you want. Simply add the name and download-url of the theme. WP Distillery will then download, unzip and install the theme. If you do not leave **`rename`** empty, it will also rename the installed theme folder. By default, WPDistillery will also delete the delete the default WordPress themes defined at **`remove`**. If you don't want this, just leave it empty: `remove: ""`. 77 | 78 | ```yaml 79 | # THEMES 80 | ################################################################# 81 | 82 | # install a custom theme via url, rename it and remove default themes 83 | themes: 84 | name: WPSeed 85 | url: "https://github.com/flurinduerst/WPSeed/archive/master.zip" 86 | rename: "" 87 | remove: 88 | - twentyfifteen 89 | - twentysixteen 90 | - twentyseventeen 91 | ``` 92 | 93 | ## Plugins 94 | You can select what plugins you want WP Distillery to install for you. Split into two sections you can define which plugins to download and install, and which to also activate. By default this section contains a few recommendations. The plugin identifier must be the same as it's slug on the WordPress plugin catalog (ex: disable-comments = https://wordpress.org/plugins/disable-comments/) 95 | 96 | ```yaml 97 | # PLUGINS 98 | ################################################################# 99 | 100 | # plugins to install & activate 101 | plugins_active: 102 | - disable-comments 103 | - duplicate-post 104 | - enable-media-replace 105 | - favicon-by-realfavicongenerator 106 | - regenerate-thumbnails 107 | - simple-page-ordering 108 | - user-switching 109 | - google-sitemap-generator 110 | 111 | # plugins to install 112 | plugins_inactive: 113 | #development 114 | - custom-post-type-ui 115 | - search-and-replace 116 | - capability-manager-enhanced 117 | #administration 118 | - adminimize 119 | - admin-menu-editor 120 | - admin-menu-reorder 121 | - wordpress-seo 122 | #security/backup 123 | - wp-security-audit-log 124 | - backwpup 125 | ``` 126 | 127 | If you want to install custom or premium plugins you can simply write down the download-url instead of the name. Make sure to add quotes: 128 | 129 | ```yaml 130 | plugins_active: 131 | - "https://example.com/plugins/awesome_plugin.zip&key=31071988" 132 | ``` 133 | 134 | ## WPDistillery Setup 135 | Maybe you don't want WP Distillery to install a theme? Or you prefer keeping the default posts and files it comes with? Within the setup options at the bottom of the file you can tell WP Distillery which tasks to perform. Simply set those you wan't to skip to `false`. 136 | 137 | * **`wp`**: install WordPress core 138 | * **`settings`**: set custom WordPress settings (Note: the value defined **`timezone`** is also considered a setting) 139 | * **`themes`**: install and activate the theme defined above and delete defined default themes 140 | * **`plugins`**: install the plugins listed 141 | * **`cleanup`**: delete WordPress defaults as followed 142 | * **`comment`**: the default comment 143 | * **`posts`**: the default post 144 | * **`files`**: `readme.html`, `license.txt` 145 | 146 | 147 | ```yaml 148 | # WPDISTILLERY SETUP 149 | #################################################################### 150 | # if you don't want the setup to run all tasks set them to false 151 | 152 | setup: 153 | wp: true 154 | settings: true 155 | themes: true 156 | plugins: true 157 | cleanup: true 158 | comment: true 159 | posts: true 160 | files: true 161 | ``` 162 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | # 4 | # WPDistillery Vagrantfile using Scotch Box 5 | # Check out https://box.scotch.io to learn more about Scotch Box 6 | # 7 | # File Version: 1.2.1 8 | 9 | Vagrant.configure("2") do |config| 10 | 11 | config.ssh.username = "vagrant" 12 | config.ssh.password = "vagrant" 13 | config.vm.box = "scotch/box" 14 | config.vm.network "private_network", ip: "192.168.33.10" 15 | config.vm.hostname = "wpdistillery.vm" 16 | 17 | # Use vagrant-winnfsd if available https://github.com/flurinduerst/WPDistillery/issues/78 18 | if Vagrant.has_plugin? 'vagrant-winnfsd' 19 | config.vm.synced_folder ".", "/var/www", 20 | nfs: true, 21 | mount_options: [ 22 | 'nfsvers=3', 23 | 'vers=3', 24 | 'actimeo=1', 25 | 'rsize=8192', 26 | 'wsize=8192', 27 | 'timeo=14' 28 | ] 29 | else 30 | config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=666"] 31 | end 32 | 33 | # WPDistillery Windows Support 34 | if Vagrant::Util::Platform.windows? 35 | config.vm.provision "shell", 36 | inline: "echo \"Converting Files for Windows\" && sudo apt-get install -y dos2unix && cd /var/www/ && dos2unix wpdistillery/config.yml && dos2unix wpdistillery/provision.sh && dos2unix wpdistillery/wpdistillery.sh", 37 | run: "always", privileged: false 38 | end 39 | 40 | # Run Provisioning – executed within the first `vagrant up` and every `vagrant provision` 41 | config.vm.provision "shell", path: "wpdistillery/provision.sh" 42 | 43 | # OPTIONAL - Update WordPress and all Plugins on vagrant up – executed within every `vagrant up` 44 | #config.vm.provision "shell", inline: "echo \"== Update WordPress & Plugins ==\" && cd /var/www/public && wp core update && wp plugin update --all", run: "always", privileged: false 45 | 46 | # OPTIONAL - Enable NFS. Make sure to remove line 13 (See https://stefanwrobel.com/how-to-make-vagrant-performance-not-suck) 47 | #config.vm.synced_folder ".", "/var/www", :nfs => { :mount_options => ["dmode=777","fmode=666"] } 48 | 49 | end 50 | -------------------------------------------------------------------------------- /wpdistillery/config.yml: -------------------------------------------------------------------------------- 1 | # Configuration for WPDistillery executed by setup.sh 2 | # 3 | # Author: Flurin Dürst 4 | # URL: https://wpdistillery.org 5 | # 6 | # For detailed instructions on this file read the config.yml-documentation at 7 | # https://wpdistillery.org/documentation/config-yml-documentation/ 8 | # 9 | # File Version: 1.8.3 10 | 11 | 12 | # INSTALLATION 13 | ################################################################# 14 | 15 | # WordPress version 16 | wpversion: latest 17 | 18 | # language/timezone 19 | wplocale: en_US 20 | timezone: "America/New_York" 21 | 22 | # admin user settings 23 | admin: 24 | user: admin 25 | password: admin 26 | email: mail@domain.tld 27 | first_name: "" 28 | last_name: "" 29 | 30 | # scotch box db access 31 | db: 32 | name: scotchbox 33 | user: root 34 | pass: root 35 | prefix: wp_ 36 | 37 | # SETTINGS 38 | ################################################################# 39 | 40 | wpsettings: 41 | url: wpdistillery.vm 42 | title: Example Title 43 | description: Example Description 44 | permalink_structure: "/%postname%/" 45 | thumbnail_width: 150 46 | thumbnail_height: 150 47 | medium_width: 300 48 | medium_height: 300 49 | large_width: 1024 50 | large_height: 1024 51 | # use page as frontpage 52 | page_on_front: true 53 | # define frontpage name (requires `page_on_front: true`) 54 | frontpage_name: Example Front Page 55 | # automatic conversion of smilies 56 | convert_smilies: false 57 | 58 | # THEMES 59 | ################################################################# 60 | 61 | # install a custom theme via url, rename it and remove the default themes 62 | theme: 63 | name: WPSeed 64 | url: "https://github.com/flurinduerst/WPSeed/archive/master.zip" 65 | rename: "" 66 | remove: 67 | - twentyfifteen 68 | - twentysixteen 69 | - twentyseventeen 70 | 71 | 72 | # PLUGINS 73 | ################################################################# 74 | 75 | # plugins to install & activate 76 | plugins_active: 77 | - disable-comments 78 | - duplicate-post 79 | - enable-media-replace 80 | - favicon-by-realfavicongenerator 81 | - regenerate-thumbnails 82 | - simple-page-ordering 83 | - user-switching 84 | 85 | # plugins to install 86 | plugins_inactive: 87 | #development 88 | - search-and-replace 89 | # seo 90 | - autodescription 91 | #security/backup 92 | - backwpup 93 | 94 | # WPDISTILLERY SETUP 95 | #################################################################### 96 | # if you don't want the setup to run all tasks, set them to false 97 | 98 | setup: 99 | wp: true 100 | settings: true 101 | theme: true 102 | plugins: true 103 | cleanup: true 104 | # adjust what data you want to be deleted within the cleanup (requires `cleanup: true`) 105 | comment: true 106 | posts: true 107 | files: true 108 | -------------------------------------------------------------------------------- /wpdistillery/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # WPDIstillery provisioning file 4 | # 5 | # Author: Flurin Dürst 6 | # URL: https://wpdistillery.org 7 | # 8 | # File version 1.1.1 9 | 10 | # update WP-CLI 11 | # since Scotch Box 3.0 (php7), we have to reinstall WP-CLI 12 | echo "== Update WP CLI (re-install) ==" 13 | cd ../../../ 14 | sudo rm usr/local/bin/wp 15 | sudo curl -O -s https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar > /dev/null 16 | sudo chmod +x wp-cli.phar 17 | sudo mv wp-cli.phar /usr/local/bin/wp 18 | echo "WP-CLI Update done" 19 | 20 | # run WPDistillery 21 | echo "== Run WPDistillery ==" 22 | cd ../../var/www/wpdistillery 23 | sudo -u vagrant bash wpdistillery.sh 24 | -------------------------------------------------------------------------------- /wpdistillery/wpdistillery.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # WPDistillery setup file 4 | # 5 | # Author: Flurin Dürst 6 | # URL: https://wpdistillery.org 7 | # 8 | # File version 1.8.3 9 | 10 | # ERROR Handler 11 | # ask user to continue on error 12 | function continue_error { 13 | read -p "$(echo -e "${RED}Do you want to continue anyway? (y/n) ${NC}")" -n 1 -r 14 | if [[ ! $REPLY =~ ^[Yy]$ ]]; then 15 | printf "\n${RED}»»» aborting WPDistillery setup! ${NC}\n" 16 | exit 1 17 | else 18 | printf "\n${GRN}»»» continuing WPDistillery setup... ${NC}\n" 19 | fi 20 | } 21 | trap 'continue_error' ERR 22 | 23 | # WP-CLI environment variable 24 | export WP_CLI_CACHE_DIR=/home/vagrant/.wp-cli/cache 25 | 26 | # REQUIREMENTS 27 | #################################################################################################### 28 | 29 | # YAML PARSER FUNCTION 30 | function parse_yaml() { 31 | local prefix=$2 32 | local s 33 | local w 34 | local fs 35 | s='[[:space:]]*' 36 | w='[a-zA-Z0-9_]*' 37 | fs="$(echo @|tr @ '\034')" 38 | sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \ 39 | -e "s|^\($s\)\($w\)$s[:-]$s\(.*\)$s\$|\1$fs\2$fs\3|p" "$1" | 40 | awk -F"$fs" '{ 41 | indent = length($1)/2; 42 | vname[indent] = $2; 43 | for (i in vname) {if (i > indent) {delete vname[i]}} 44 | if (length($3) > 0) { 45 | vn=""; for (i=0; i>> skipping WordPress installation...${NC}\n" 91 | fi 92 | 93 | if $CONF_setup_settings ; then 94 | printf "${BLU}»»» configure settings...${NC}\n" 95 | printf "» timezone:\n" 96 | wp option update timezone $CONF_timezone 97 | wp option update timezone_string $CONF_timezone 98 | printf "» permalink structure:\n" 99 | wp rewrite structure "$CONF_wpsettings_permalink_structure" 100 | wp rewrite flush --hard 101 | printf "» description:\n" 102 | wp option update blogdescription "$CONF_wpsettings_description" 103 | printf "» image sizes:\n" 104 | wp option update thumbnail_size_w $CONF_wpsettings_thumbnail_width 105 | wp option update thumbnail_size_h $CONF_wpsettings_thumbnail_height 106 | wp option update medium_size_w $CONF_wpsettings_medium_width 107 | wp option update medium_size_h $CONF_wpsettings_medium_height 108 | wp option update large_size_w $CONF_wpsettings_large_width 109 | wp option update large_size_h $CONF_wpsettings_large_height 110 | if ! $CONF_wpsettings_convert_smilies ; then 111 | wp option update convert_smilies 0 112 | fi 113 | if $CONF_wpsettings_page_on_front ; then 114 | printf "» front page:\n" 115 | # create and set frontpage 116 | wp post create --post_type=page --post_title="$CONF_wpsettings_frontpage_name" --post_content='Front Page created by WPDistillery' --post_status=publish 117 | wp option update page_on_front $(wp post list --post_type=page --post_status=publish --posts_per_page=1 --pagename="$CONF_wpsettings_frontpage_name" --field=ID --format=ids) 118 | wp option update show_on_front 'page' 119 | fi 120 | else 121 | printf "${BLU}>>> skipping settings...${NC}\n" 122 | fi 123 | 124 | # INSTALL/REMOVE THEME 125 | if $CONF_setup_theme ; then 126 | printf "${BRN}[=== CONFIGURE THEME ===]${NC}\n" 127 | printf "${BLU}»»» downloading $CONF_theme_name...${NC}\n" 128 | wp theme install $CONF_theme_url --force 129 | printf "${BLU}»»» installing/activating $CONF_theme_name...${NC}\n" 130 | if [ ! -z "$CONF_theme_rename" ]; then 131 | # rename theme 132 | printf "${BLU}»»» renaming $CONF_theme_name to $CONF_theme_rename...${NC}\n" 133 | mv wp-content/themes/$CONF_theme_name wp-content/themes/$CONF_theme_rename 134 | wp theme activate $CONF_theme_rename 135 | else 136 | wp theme activate $CONF_theme_name 137 | fi 138 | if [ ! -z "$CONF_theme_remove" ]; then 139 | printf "${BLU}»»» removing default themes...${NC}\n" 140 | # loop trough themes that shall be removed 141 | for loopedtheme in "${CONF_theme_remove[@]}" 142 | do : 143 | #make sure the theme to delete is not the chosen one 144 | if [ $loopedtheme != $CONF_theme_name ]; then 145 | printf "${BLU}» removing $loopedtheme...${NC}\n" 146 | wp theme delete $loopedtheme 147 | 148 | fi 149 | done 150 | # end loop 151 | fi 152 | 153 | else 154 | printf "${BLU}>>> skipping theme installation...${NC}\n" 155 | fi 156 | 157 | # CLEANUP 158 | if $CONF_setup_cleanup ; then 159 | printf "${BRN}[=== CLEANUP ===]${NC}\n" 160 | if $CONF_setup_cleanup_comment ; then 161 | printf "${BLU}»»» removing default comment...${NC}\n" 162 | wp comment delete 1 --force 163 | fi 164 | if $CONF_setup_cleanup_posts ; then 165 | printf "${BLU}»»» removing default posts...${NC}\n" 166 | wp post delete 1 2 --force 167 | fi 168 | if $CONF_setup_cleanup_files ; then 169 | printf "${BLU}»»» removing WP readme/license files...${NC}\n" 170 | # delete default files 171 | if [ -f readme.html ]; then rm readme.html; fi 172 | if [ -f license.txt ]; then rm license.txt; fi 173 | # delete german files 174 | if [ -f liesmich.html ]; then rm liesmich.html; fi 175 | fi 176 | else 177 | printf "${BLU}>>> skipping Cleanup...${NC}\n" 178 | fi 179 | 180 | # PLUGINS 181 | if $CONF_setup_plugins ; then 182 | printf "${BRN}[=== PLUGINS ===]${NC}\n" 183 | printf "${BLU}»»» removing WP default plugins${NC}\n" 184 | wp plugin delete akismet 185 | wp plugin delete hello 186 | printf "${BLU}»»» adding active plugins${NC}\n" 187 | for entry in "${CONF_plugins_active[@]}" 188 | do 189 | wp plugin install $entry --activate 190 | done 191 | 192 | printf "${BLU}»»» adding inactive plugins${NC}\n" 193 | for entry in "${CONF_plugins_inactive[@]}" 194 | do 195 | wp plugin install $entry 196 | done 197 | else 198 | printf "${BLU}>>> skipping Plugin installation...${NC}\n" 199 | fi 200 | 201 | # MISC 202 | printf "${BLU}»»» checking wp cli version${NC}\n" 203 | wp cli check-update 204 | 205 | printf "${BRN}========== WPDISTILLERY FINISHED ==========${NC}\n" 206 | --------------------------------------------------------------------------------