A ridiculously simple mini web tool to generate C++ boilerplate files the way I like
PHP Makefile Smarty Shell Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
deploy
external
sources/favicon
support
templates
tools
.gitignore
ICanHaz.min.js
Makefile
README.mkd
common.php
config.php.sample
defaultauthor.txt.sample
defaultindentation.txt.sample
defaultlicense.txt.sample
dotest.sh
download.php
family.php
favicon.ico
favicon_16.png
favicon_32.png
favicon_48.png
generate.php
index.php
test-locally

README.mkd

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.

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

Requirements

  • 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.

Configuration

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.
  • The files in templates are one place to start. If you add new templates, you'll have to edit common.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.

Development and Testing

The Makefile is primarily for development, but does have a target to assist with deployment:

  • make or make build - Copies the required files for deployment into BUILD_DIR, defined by default as staging
  • make check - runs PHP in lint mode on the sources
  • make icon - Generates the favicon from SVG source; uses inkscape, pngcrush, and icotool (debian package icoutils)
  • make clean - Removes the staging directory and intermediate files from generating the favicon. (Does not remove the generated files committed to Git.)

Licenses

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