Created
October 30, 2012 02:33
-
-
Save zachberry/3977973 to your computer and use it in GitHub Desktop.
Creates a new HTML5 project via command-line using initializr.com (OS X)
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/sh | |
# Replace this with your desired options (visit http://www.initializr.com/): | |
U="http://www.initializr.com/builder?h5bp-content&modernizr&jquerymin&h5bp-css&h5bp-csshelpers&h5bp-mediaqueryprint&h5bp-mediaqueries&simplehtmltag&izr-emptyscript" | |
# Usage: init-html [my-new-project-name] | |
# | |
# This will extract the initializr bootstrap files into the my-new-project-name | |
# folder (first creating the folder if it doesn't exist already) and start a | |
# new git repo. If no directory is given it will install into the current directory. | |
# The script will abort if the given directory is non-empty. | |
# | |
# Requires curl and git to be installed. | |
if [ $1 ] ; then | |
# if the path doesn't exist, create it: | |
[ -d $1 ] || mkdir $1 | |
cd "$1" | |
fi | |
if [ ! "$(ls -A . 2> /dev/null)" == "" ]; then | |
echo "The directory is not empty, aborting." | |
exit 1 | |
fi | |
echo "Downloading and extracting files from initializr.com..." | |
ZIP_FILE=`date +%s`.zip | |
touch "$ZIP_FILE" | |
curl -s "$U" > "$ZIP_FILE" | |
unzip -qq "$ZIP_FILE" | |
rm -f "./$ZIP_FILE" | |
mv initializr/* . | |
rm -rf ./initializr | |
git init | |
echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment