Generate C++ Boilerplate
I turned the shell scripts I habitually use to create new C++ files into a simple little PHP web app so my colleagues that aren't always in Linux can start the good habit too.
Related: A PowerShell script (and another script that installs it) for making send-to menu items to generate files using this web app: Boilerplate Send-To
Needs PHP 5.3 or newer. (uses anonymous functions)
You may wish to use git-deploy to push to production, though since this is such a simple little set of php scripts it may be overkill. I've done the
git deploy inittask already, you just need to do the other ones listed on the git-deploy page.
You'll probably want to fork and tweak things, and that's OK.
- There are files that end in
.sample: rename those to remove that string and edit to customize those details.
- There are
.txtfiles for the big chunks of text.
- For indentation, it's easiest to use the
config.phpinstead of a
.txtfile, which is why it looks like there are two ways of configuring indentation.
- There are
- The files in
templatesare one place to start. If you add new templates, you'll have to edit
common.phpto add them to the maps.
The main actual templating code takes place in
You can run
./test-locally if you have the
php command installed (debian package
php5-cli) to simulate a web hit without needing to set up apache and PHP.
Development and Testing
Makefile is primarily for development, but does have a target to assist with deployment:
make build- Copies the required files for deployment into
BUILD_DIR, defined by default as
make check- runs PHP in lint mode on the sources
make icon- Generates the favicon from SVG source; uses
make clean- Removes the staging directory and intermediate files from generating the favicon. (Does not remove the generated files committed to Git.)
The full package is free and open-source software. The main code (in the
support) are subject
to the following license:
Copyright Iowa State University 2012.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file
LICENSE_1_0.txtor copy at http://www.boost.org/LICENSE_1_0.txt)
The GUID generation code in
external/guid.php is used unmodified from