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.
generate-cpp-boilerplate homepage on GitHub
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
Original author: Ryan Pavlik, ryan.pavlik@gmail.com abiryan@ryand.net
-
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 init
task 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
.txt
files for the big chunks of text. - For indentation, it's easiest to use the
config.php
instead of a.txt
file, which is why it looks like there are two ways of configuring indentation.
- There are
- The files in
templates
are one place to start. If you add new templates, you'll have to editcommon.php
to add them to the maps.
The main actual templating code takes place in generate.php
.
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.
The Makefile
is primarily for development, but does have a target to assist with deployment:
make
ormake build
- Copies the required files for deployment intoBUILD_DIR
, defined by default asstaging
make check
- runs PHP in lint mode on the sourcesmake icon
- Generates the favicon from SVG source; usesinkscape
,pngcrush
, andicotool
(debian packageicoutils
)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
root directory, templates
, and 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.txt
or copy at http://www.boost.org/LICENSE_1_0.txt)
The GUID generation code in external/guid.php
is used unmodified from
http://randomtweak.com/node/54