Last active
December 26, 2015 22:19
-
-
Save acairns/7222280 to your computer and use it in GitHub Desktop.
Create GitHub-based Jekyll Project
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 | |
# Requirements | |
command -v git > /dev/null 2>&1 || { echo >&2 "I require git but it's not installed. Aborting."; exit 1; } | |
command -v gem > /dev/null 2>&1 || { echo >&2 "I require gem but it's not installed. Aborting."; exit 1; } | |
gem list jekyll -i > /dev/null 2>&1 || { echo >&2 "I require the jekyll ruby gem but it's not installed. Aborting."; exit 1; } | |
# Configuration | |
while [[ -z $PROJECTNAME ]]; do read -p "Enter name of the project: " PROJECTNAME; done | |
while [[ -z $PROJECTDESC ]]; do read -p "Enter description of the project: " PROJECTDESC; done | |
while [[ -z $GITHUBUSER ]]; do read -p "Enter username for GitHub: " GITHUBUSER; done | |
# Setup GitHub Repository | |
echo -n "Enter password for GitHub: " | |
curl -u ${GITHUBUSER} https://api.github.com/user/repos -d "{\"name\": \"${PROJECTNAME}\", \"description\": \"${PROJECTDESC}\", \"private\": false, \"has_issues\": true, \"has_downloads\": false, \"has_wiki\": false, \"auto_init\": true}" > /dev/null 2>&1 | |
git clone [email protected]:${GITHUBUSER}/${PROJECTNAME}.git | |
# Jekyll scaffolding | |
jekyll new ${PROJECTNAME} --force | |
# Push | |
cd ${PROJECTNAME} | |
git add . | |
git commit -m "Setting up ${PROJECTNAME} with Jekyll" | |
git push origin master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment