This folder contains several tools designed to help with the maintenance of the
project.
-**Copyright headers:** The [`copyright-headers`](https://storage.bsc.es/gitlab/hpc/gekkofs/-/tree/master/scripts/maintainer-tools/copyright-headers) folder contains a
script to add/remove copyright headers from source files in the project.
The script relies on a Docker container that encapsulates a patched version of
The copyright headers generated by the scripts can be controlled by editing the
following files:
* `gekkofs-syntax.yml`: A YAML file that describes the details of how each source
file type should be handled, e.g. which extensions should be considered for a
certain file type, which types of comments should be used, etc.
* `gekkofs-template.erb`: The main template for the copyright header. It supports
limited Ruby expansion from the variables defined in `project.config`.
* `project.config`: The main project configuration file. It contains variables
that control how the copyright header is produced, such as the name of the
software, its description or the years for which copyright applies, as well as
which templates should be used to expand these variables.
#### NOTES
1. To prevent undesired modifications to source files, the `manage-headers.sh`
script only considers files that are already under version control.
2. Due to limitations on how the `manage-headers.sh` script currently handles
Docker volumes, manually selecting targets may fail if the target itself is
not a sub-path of the current project directory, which defaults to `$PWD`
unless explicitly set with `--project-dir`.
### Osterman's 'copyright-headers' Ruby gem
The `manage-header.sh` relies on a [Ruby gem by Erik Osterman](https://github.com/cloudposse/copyright-header) to do the header imprinting. To make it more suitable for
our needs, the gem has been patched with several modifications and encapsulated
into the `gekkofs/copyright-header` Docker image for ease of use. The following
files are used in this process.
* `Dockerfile`: The Docker file for the `gekkofs/copyright-header` image. It
basically downloads the latest version of Osterman's gem, patches it and
defines an entrypoint for it.
* `patch.diff`: Our specific modifications to the original Ruby gem.
### Tips and Tricks
The following techniques may be useful to find out what's happening if the
`manage-headers.sh` script is not behaving as expected:
1. Checking which targets will be considered by the script:
--copyright-software NAME The common name for this piece of software (e.g. "Copyright Header")
--copyright-software-description DESC
The detailed description for this piece of software (e.g. "A utility to manipulate copyright headers on source code files")
--copyright-holder NAME The legal owner of the copyright for the software. (e.g. "Erik Osterman <e@osterman.com>"). Repeat argument for multiple names.
--copyright-year YEAR The years for which the copyright exists (e.g. "2012"). Repeat argument for multiple years.
-w, --word-wrap LEN Maximum number of characters per line for license (default: 80)
-a, --add-path PATH Recursively insert header in all files found in path (allows multiple paths separated by platform path-separator ":")
-r, --remove-path PATH Recursively remove header in all files found in path (allows multiple paths separated by platform path-separator ":")
-g, --guess-extension Use the GitHub Linguist gem to guess the extension of the source code when no extension can be determined (experimental).
-c, --syntax FILE Syntax configuration file
-V, --version Display version information
-h, --help Display this screen
```
2. Invoking the docker image directly (with full volume substitution):