Last active
October 13, 2015 12:58
-
-
Save chrisvanpatten/4199768 to your computer and use it in GitHub Desktop.
wpframe Bootstrap Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# wpframe Bootstrap Script | |
# This is really only a proof of concept. There are likely a lot of | |
# improvements that could be made to streamline this and accomplish | |
# things in fewer/faster steps. | |
# | |
# Please READ THE SCRIPT before you run it. I'm not responsible if | |
# you break something. Report any bugs and suggest improvements, | |
# please! | |
# | |
# TO USE: | |
# Get the "raw" link to the current script, and replace the URL in | |
# the command below (then, of course, run it): | |
# bash <(curl -s https://raw.github.com/path/to/wpframe-bootstrap.sh) | |
# | |
# License: see the wpframe license | |
# https://github.com/vanpattenmedia/wpframe/blob/master/README.md | |
# Initial setup | |
read -p "Are you starting from scratch (in a folder that is not yet a Git repo)? (Y/N) " -n 1 -r | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
git init | |
touch .wpframe | |
git add .wpframe | |
git commit -m 'Initial commit.' | |
fi | |
# Add and merge wpframe | |
git remote add wpframe git://github.com/vanpattenmedia/wpframe.git | |
git fetch wpframe | |
git merge --squash wpframe/master | |
# Pull in wpframe dependencies | |
git submodule update --init | |
# Move the example configs to just regular configs | |
read -p "Would you like us to rename the .example files? (Y/N) " -n 1 -r | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
mv config/database.example.yml config/database.yml | |
mv config/s3.example.yml config/s3.yml | |
git rm config/database.example.yml config/s3.example.yml | |
fi | |
# Ask for the theme folder | |
read -p "What will your theme folder be? (e.g. twentytwelve, awesome-theme, etc.) " theme_folder | |
# Create the theme | |
mkdir -p public/content/themes/$theme_folder | |
# Fix .gitignore | |
sed s/themename/"$theme_folder"/g .gitignore > .gitignore.2 | |
mv .gitignore.2 .gitignore | |
# Fix assets.yml | |
sed s/themename/"$theme_folder"/g config/assets.yml > config/assets.yml.2 | |
mv config/assets.yml.2 config/assets.yml | |
# Fix Makefile | |
sed s/themename/"$theme_folder"/g Makefile > Makefile.2 | |
mv Makefile.2 Makefile | |
# Create the wp-salts.php file | |
echo '<?php' > ./config/wp-salts.php && curl https://api.wordpress.org/secret-key/1.1/salt >> ./config/wp-salts.php | |
# Add and remove things to and from the git staging ground | |
git add . | |
git rm .wpframe | |
# Should we commit these changes? | |
read -p "Would you like us to commit your changes? (Y/N) " -n 1 -r | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
git commit -m 'Added wpframe files.' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment