Skip to content

Instantly share code, notes, and snippets.

@zachberry
Created October 30, 2012 02:33
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zachberry/3977973 to your computer and use it in GitHub Desktop.
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)
#!/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