Move the logic for selecting a license template based on user input into
a standalone func (fetchTemplate), and add test cases for all code
paths.
Delay parsing predefined license templates. This allows the new
fetchTemplate method to modify these templates before returning in the
future (to add SPDX license information). Add tests to ensure that
these templates must always parse properly.
Rename copyrightData type to licenseData, since we will soon begin to
add more than just copyright data here (SPDX ID).
Rename prefix func to executeTemplate, since this better describes what
the function is doing.
These are all refactoring and cleanup changes; no behavioral changes.
Adds support for the .sdl file extension which is used for Spanner's
Schema Definition Language. It uses -- for comments in the manner of
.sql files.
Adds support for the .bzl file extension which is used for Bazel's
Starlark language. It uses # for comments in the manner of Python.
Looking at https://www.php.net/manual/en/language.basic-syntax.phptags.php
there are just too many variations and I'm not convinced the added
complexity to support all of them would be worth it here.
Thus, support only the case where closing tag "?>" is either omitted
or on a separate line. A workaround for all other cases is to add
the license header manually.
Can always revisit this later.
Adds support for Dockerfiles, Gemfiles, Ruby files, and Groovy files.
Also, in order to fully support Dockerfile and Gemfiles, a new file
extension parser was created to deal with files that do not have an
extension.
If a license text had blank lines, they would result in a trailing
whitespace when prefixed with the line comments.
This change removes trailing whitespace from the middle lines,
leaving top and bottom as is.
Fixes#10