Skip to content

Commit

Permalink
re-organize the theme-cleanup, add support for default themes while u…
Browse files Browse the repository at this point in the history
…sing cleanup
  • Loading branch information
flurinduerst committed Jan 24, 2018
1 parent c5e64e7 commit 06beddc
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 43 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@

# CHANGELOG

## HEAD | 2.2.2 | 23.01.2018
## HEAD | 2.3.0 | 24.01.2018
* re-organize the theme-cleanup (now located at `themes`, removed from `cleanup`)
* fix a bug caused by using a default theme with theme-cleanup activated
* silence curl command for downloading the current version of WP CLI to reduce cli-bloating
* change default local-domain to `.vm` (for "virtual machine") as `.local` has conflicts when using browsersync
* add note about the WP-Multisite feature to the readme. Thanks to @pjohanneson
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Screenshot](http://files.flurinduerst.ch/wpdistillery/wpdistillery_logo.png)

**Version 2.2.2** (24.01.2017)
**Version 2.3.0** (24.01.2017)

Since V2.1.0 WPDistillery is fully compatible with Scotch Box 3.0

Expand All @@ -14,8 +14,9 @@ One simple command will:
- download/install/configure WordPress
- set WordPress options
- install/activate your favorite WordPress theme (default [WPSeed](https://wpseed.org)).
- remove default themes
- install/activate the plugins you defined in the config
- clean WordPress defaults (contents, plugins, themes, unused files)
- clean WordPress defaults (contents, plugins, unused files)

You're able to adjust which of the above tasks will be executed. Simply set the desired tasks to true/false in the "Setup Options" section at the bottom of `config.yml`

Expand Down
26 changes: 13 additions & 13 deletions README_CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The configuration file is split into five sections:

* Installation
* Wordpress
* Theme
* Themes
* Plugins
* WPDistillery Setup

Expand Down Expand Up @@ -76,20 +76,22 @@ wpsettings:
convert_smilies: false
```

## Theme
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. If you're installing a theme from a git repository, make sure to add the branch in **`source_branch`** or leave it empty if not.
## Themes
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: ""`.

```yaml
# THEME
# THEMES
#################################################################
# theme to install, choose new name in 'rename' or leave empty
theme:
# install a custom theme via url, rename it and remove default themes
themes:
name: WPSeed
rename: ""
url: "https://github.com/flurinduerst/WPSeed/archive/master.zip"
# add branch (e.g. "master") or leave empty ("") if theme is not downloaded from a git repository
source_branch: "master"
rename: ""
remove:
- twentyfifteen
- twentysixteen
- twentyseventeen
```

## Plugins
Expand Down Expand Up @@ -138,13 +140,12 @@ Maybe you don't want WP Distillery to install a theme? Or you prefer keeping the

* **`wp`**: install WordPress core
* **`settings`**: set custom WordPress settings (Note: the value defined **`timezone`** is also considered a setting)
* **`theme`**: install and activate the theme defined above
* **`themes`**: install and activate the theme defined above and delete defined default themes
* **`plugins`**: install the plugins listed
* **`cleanup`**: delete WordPress defaults as followed
* **`comment`**: the default comment
* **`posts`**: the default post
* **`files`**: `readme.html`, `license.txt`
* **`themes`**: the twentyfourteen, twentyfifteen and twentysixteen theme.


```yaml
Expand All @@ -155,11 +156,10 @@ Maybe you don't want WP Distillery to install a theme? Or you prefer keeping the
setup:
wp: true
settings: true
theme: true
themes: true
plugins: true
cleanup: true
comment: true
posts: true
files: true
themes: true
```
22 changes: 13 additions & 9 deletions wpdistillery/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# For detailed instructions on this file read the config.yml-documentation at
# https://wpdistillery.org/documentation/config-yml-documentation/
#
# File Version: 1.7.1
# File Version: 1.8.0


# INSTALLATION
Expand Down Expand Up @@ -58,14 +58,19 @@ wpsettings:
# automatic conversion of smilies
convert_smilies: false

# THEME
# THEMES
#################################################################

# theme to install, choose new name in 'rename' or leave empty
theme:
name: WPSeed
url: "https://github.com/flurinduerst/WPSeed/archive/master.zip"
# install a custom theme via url, rename it and remove default themes
themes:
name: twentyseventeen
url: "https://downloads.wordpress.org/theme/twentyseventeen.1.1.zip"
rename: ""
remove:
- twentyfifteen
- twentysixteen
- twentyseventeen


# PLUGINS
#################################################################
Expand Down Expand Up @@ -103,11 +108,10 @@ plugins_inactive:
setup:
wp: true
settings: true
theme: true
themes: true
plugins: true
cleanup: true
# adjust what data you want to be deleted within the cleanup (required `cleanup: true`)
# adjust what data you want to be deleted within the cleanup (requires `cleanup: true`)
comment: true
posts: true
files: true
themes: true
45 changes: 27 additions & 18 deletions wpdistillery/wpdistillery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Author: Flurin Dürst
# URL: https://wpdistillery.org
#
# File version 1.7.2
# File version 1.8.0

# ERROR Handler
# ask user to continue on error
Expand Down Expand Up @@ -116,20 +116,35 @@ else
printf "${BLU}>>> skipping settings...${NC}\n"
fi

# INSTALL THEME
if $CONF_setup_theme ; then
printf "${BRN}[=== INSTALL $CONF_theme_name ===]${NC}\n"
printf "${BLU}»»» downloading $CONF_theme_name...${NC}\n"
wp theme install $CONF_theme_url
printf "${BLU}»»» installing/activating $CONF_theme_name...${NC}\n"
if [ ! -z "$CONF_theme_rename" ]; then
# INSTALL/REMOVE THEMES
if $CONF_setup_themes ; then
printf "${BRN}[=== CONFIGURE THEMES ===]${NC}\n"
printf "${BLU}»»» downloading $CONF_themes_name...${NC}\n"
wp theme install $CONF_themes_url --force
printf "${BLU}»»» installing/activating $CONF_themes_name...${NC}\n"
if [ ! -z "$CONF_themes_rename" ]; then
# rename theme
printf "${BLU}»»» renaming $CONF_theme_name to $CONF_theme_rename...${NC}\n"
mv wp-content/themes/$CONF_theme_name wp-content/themes/$CONF_theme_rename
wp theme activate $CONF_theme_rename
printf "${BLU}»»» renaming $CONF_themes_name to $CONF_themes_rename...${NC}\n"
mv wp-content/themes/$CONF_themes_name wp-content/themes/$CONF_themes_rename
wp theme activate $CONF_themes_rename
else
wp theme activate $CONF_theme_name
wp theme activate $CONF_themes_name
fi
if [ ! -z "$CONF_themes_remove" ]; then
printf "${BLU}»»» removing default themes...${NC}\n"
# loop trough themes that shall be removed
for loopedtheme in "${CONF_themes_remove[@]}"
do :
#make sure the theme to delete is not the chosen one
if [ $loopedtheme != $CONF_themes_name ]; then
printf "${BLU}» removing $loopedtheme...${NC}\n"
wp theme delete $loopedtheme

fi
done
# end loop
fi

else
printf "${BLU}>>> skipping theme installation...${NC}\n"
fi
Expand All @@ -153,12 +168,6 @@ if $CONF_setup_cleanup ; then
# delete german files
if [ -f liesmich.html ]; then rm liesmich.html; fi
fi
if $CONF_setup_cleanup_themes ; then
printf "${BLU}»»» removing default themes...${NC}\n"
wp theme delete twentyfifteen
wp theme delete twentysixteen
wp theme delete twentyseventeen
fi
else
printf "${BLU}>>> skipping Cleanup...${NC}\n"
fi
Expand Down

0 comments on commit 06beddc

Please sign in to comment.