Skip to content
This repository has been archived by the owner on Nov 23, 2018. It is now read-only.

createproject

roblarsen edited this page Feb 4, 2013 · 5 revisions

createproject.sh

Setup

After you've cloned your fork of html5-boilerplate from github:

$ cd  html5-boilerplate
$ chmod +x build/createproject.sh

Once you've done this, createproject.sh can be run directly from the command line, like this:

$ cd build   
$ ./createproject.sh --help

This will show you the help text and most recent documentation for it:

./createproject.sh (c) 2011 by Rick Waldron & Michael Cetrulo version 1.0
USAGE: ./createproject.sh [--src SRC] [--dst DST] NAME
OPTIONS:
--src -s SRC     set the source directory where your html5boilerplate lives
--dst -d DST     set the destination directory in which to create your project
--vcs VCS        make the new location a VCS repository. Currently supported
                 VCSs are: git and hg(mercurial).
--commit -c      if set will commit the copied h5bp sources into the VCS.
                 this only works with the --vcs option set

If --src is not set it will use the toplevel dir of the current git dir
this behaviour expects that you are in the git repository of h5bp under /build

If --dst is not set it will try to create the directory in the current directory
You can also set the same options in the ~/.h5bprc file
Here are the possible options:
        src             -       The source directory from where h5bp is located
        dst             -       The destination in which the new project shoul be created
        which_vcs       -       The vcs you want to use
        commit_init     -       set this to "yes" if you want to commit the contents of the new project
Here is an example for the syntax(It is basically how shell variables are set):

src="~/src/html5boilerplate"
dst="~/src"
which_vcs="git"
commit_init="yes"

To create a simple directory with just your changes in it run:

$ createproject.sh --src /path/to/your/h5bp/clone --dst . myproject

This will create a directory with the name myproject to which the contents of your h5pb/clone have been copied.

In the new createproject.sh version it is semi-vital to add a --src option to the commandline since you can also set this with in the ~/.h5bprc file. But more on that later ;)

If you attempt to create a directory that already exists, createproject.sh will warn you and stop running.

If all goes smoothly, you will see the following messages:

 Created Directory: [name]

 [ A list of all the html5-boilerplate files being copied ]

 Created Project: [name]

Success! You now have a clean project to begin making the next HTML5 wunderkind demo!

It will be located in a folder that is a sibling to the html5-boilerplate folder or a sibling of the --dst directory you can specify at the commandline.

DVCS support

createproject.sh supports setting up a local checkout of a git/mercurial repository just add the --vcs on the commandline with the name of your favourite DVCSs name to it.

Want to automatically commit the initial source of your work as well? Just add the the --commit or -c command to your command and everything will be checked in.

~/.h5bprc

Newer versions of createproject.sh have the abillity to preset some of your favourite options from the commandline in a dotfile. Just add a file named .h5bprc (much like your .zshrc or your .bashrc) to your home directory.

Here is an example of what it can contain:

# your h5bp checkout is always located here
src="~/src/html5boilerplate"
# you will always want to create your directory here
dst="~/src"
# you want it to be a git repository
which_vcs="git"
# you want everything to be commited in an initial commit
commit_init="yes"

NOTE: You can always override these settings from the commandline.