-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbarebones
97 lines (74 loc) · 2.41 KB
/
barebones
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/env bash
function barebones() {
set -e
# 0. The project name
project=$1
if [[ -z "$project" ]]; then
echo "Please provide a project name, for example 'barebones newsite'" 1>&2
exit 1
fi
echo "Downloading the latest version of WordPress into the current folder..." 1>&2
# 1. Download latest version of WordPress into current folder
wget https://wordpress.org/latest.tar.gz
tar -xvzf latest.tar.gz
# 2. Rename directory to given project name
mv wordpress $project
rm latest.tar.gz
cd $project
# 3. Remove unnecessary files
rm license.txt readme.html
# 4. Create .gitignore file
echo '.DS_Store
[Tt]humbs.db
.Trashes
.log
.env.php
sitemap.xml
wp-content/backup
wp-content/cache
wp-content/upgrade
wp-content/uploads
wp-content/blogs.dir
wp-content/backup-db
wp-content/advanced-cache.php
wp-content/wp-cache-config.php
wp-content/themes/*/.sass-cache
wp-content/themes/*/node_modules' > .gitignore
# 5. Plugins
## 5.1. Remove unnecessary plugins
cd wp-content/plugins
rm -rf hello.php
echo "Downloading useful plugins..." 1>&2
## 5.2. Download useful plugins
wget https://downloads.wordpress.org/plugin/regenerate-thumbnails.zip
wget https://downloads.wordpress.org/plugin/simple-history.zip
wget https://downloads.wordpress.org/plugin/wordpress-seo.zip
wget https://downloads.wordpress.org/plugin/classic-editor.zip
tar -xvzf regenerate-thumbnails.zip
tar -xvzf simple-history.zip
tar -xvzf wordpress-seo.zip
tar -xvzf classic-editor.zip
rm -rf *.zip */.git
# 6. Themes
## 6.1. Remove unnecessary themes
cd ../themes
rm -rf twentynineteen
rm -rf twentytwenty
echo "Cloning the barebones theme..." 1>&2
## 6.2. Clone barebones
git clone https://github.com/benchmarkstudios/barebones
mv barebones $project
## 6.3. Install barebones submodules
cd $project
git submodule init
git submodule update
## 6.4. Remove unnecessary stuff
rm -rf .git .gitattributes .gitignore .gitmodules README.md CHANGELOG.md assets/styles/vendor/simple-grid/.gitattributes assets/styles/vendor/simple-grid/README.md
## 6.5 Create ACF folder
mkdir acf-json
echo "Installing npm dependencies..." 1>&2
# 7. Install all npm dependencies
npm install
echo "✅ New WordPress site '$project' has been installed" 1>&2
}
barebones $1