*** CAUTION ***
This tool includes the template for:
GNU General Public License version 3
Apache License, Version 2.0
But I may have the mistake in those template, because I do not have enough knowledge about the legal area.
If you distribute your projects under:
GNU General Public License version 3
Apache License, Version 2.0
it is your responsibility to follow the suggestions at:
https://www.gnu.org/licenses/gpl-howto.html
http://www.apache.org/dev/apply-license.html
respectively.
IF YOU USE MY TEMPLATES, PLEASE DO IT ON YOUR OWN RISK!
---------------------------------------
$. Where is it?
The main shell script of this tool is:
11_shell/21_converter.sh
---------------------------------------
$. What it does?
This tool walks down through the source directory tree.
Within each directory node, it reads the files.
By the file extension, you can specify which kind of the files to be read.
While iterating those files, it inserts the comment lines for the copyright notice into each of them.
Finally, the new files are written to the corresponding directory node under the destination directory tree.
---------------------------------------
$. How it works?
In the UNIX shell scripting, the idiom by 'here document' can make the variable substitution easier.
And this shell script depends on the 'here document' expression.
So, you can think of it as the example of how to use the 'here document'.
---------------------------------------
$. Preparation
Please edit:
11_shell/00_common.sh
And update the lines like below:
PROJECT_NAME="Example Project"
DATE_FM="+%Y"
YEAR=`(date ${DATE_FM})`
# Or you can list the arbitrary years ...
#YEAR="2015, 2016"
AUTHOR="Foo Bar"
---------------------------------------
$. Default templates
As default, I wrote the templates for the copyright notice of:
GNU General Public License version 3
Apache License, Version 2.0
And those templates are included in the next directories:
91_template4gnu3later
92_template4apache2
But I may have the mistake in those template, because I do not have enough knowledge about the legal area.
If you distribute your projects under:
GNU General Public License version 3
Apache License, Version 2.0
it is your responsibility to follow the suggestions at:
https://www.gnu.org/licenses/gpl-howto.html
http://www.apache.org/dev/apply-license.html
respectively.
IF YOU USE MY TEMPLATES, PLEASE DO IT ON YOUR OWN RISK!
---------------------------------------
$. Templates for GNU General Public License version 3
To apply the template of:
GNU General Public License version 3
please update:
11_shell/11_shell4java.sh
11_shell/12_shell4bash.sh
11_shell/13_shell4xml.sh
11_shell/14_shell4text.sh
And please specify:
TEMPLATE="../91_template4gnu3later/91_comment4java.txt"
TEMPLATE="../91_template4gnu3later/92_comment4bash.txt"
TEMPLATE="../91_template4gnu3later/93_comment4xml.txt"
TEMPLATE="../91_template4gnu3later/94_comment4text.txt"
within those shell scripts.
---------------------------------------
$. Templates for Apache License, Version 2.0
To apply the template of:
Apache License, Version 2.0
please update:
11_shell/11_shell4java.sh
11_shell/12_shell4bash.sh
11_shell/13_shell4xml.sh
11_shell/14_shell4text.sh
And please specify:
TEMPLATE="../92_template4apache2/91_apache2_4java.txt"
TEMPLATE="../92_template4apache2/92_apache2_4bash.txt"
TEMPLATE="../92_template4apache2/93_apache2_4xml.txt"
TEMPLATE="../92_template4apache2/94_apache2_4text.txt"
within those shell scripts.
---------------------------------------
$. Additional templates
You can write the template for the copyright notice other than:
GNU General Public License version 3
Apache License, Version 2.0
To call the templates of your own, please edit:
11_shell/11_shell4java.sh
11_shell/12_shell4bash.sh
11_shell/13_shell4xml.sh
11_shell/14_shell4text.sh
and update the following lines:
TEMPLATE="../91_template4gnu3later/91_comment4java.txt"
TEMPLATE="../91_template4gnu3later/92_comment4bash.txt"
TEMPLATE="../91_template4gnu3later/93_comment4xml.txt"
TEMPLATE="../91_template4gnu3later/94_comment4text.txt"
so that they point your template.
---------------------------------------
$. Runtime parameters
Again, the main shell script of this tool is:
11_shell/21_converter.sh
And it takes the following runtime parameters:
1) the path to the shell script for the target file extension
2) the source directory
3) the destination directory
-----------------
1) the path to the shell script for the target file extension
As you know,
a) the expression of of the comment lines
b) the place for the comment lines
depends on the file type.
For instance, the comment lines in:
XML
look different than those of:
Java
So, the different rules should be applied per the file extension.
For each of the supported file extent ions, the set of the functions are defined in the shell script.
They are:
11_shell/11_shell4java.sh
11_shell/12_shell4bash.sh
11_shell/13_shell4xml.sh
11_shell/14_shell4text.sh
For instance ...
If you are going to insert the comment lines into your Java source files, the first parameter is:
11_shell/11_shell4java.sh
-----------------
2) the source directory
The root of the source directory tree.
-----------------
3) the destination directory
The root of the destination directory tree.
You may want specify the same directory as (2).
But it is strongly recommended to specify the different directory.
IT IS SAFE TO KEEP THE ORIGINAL FILES UNTOUCHED!
NOTE:
On the destination side, this tool creates the same directory tree structure as the source side.
So you can specify the empty directory as the destination side.
---------------------------------------
$. Example
In the typical case for working on the Java source files, the command will look like below:
21_converter.sh \
11_shell4java.sh \
/home/foo/project/Bar/src \
/home/foo/tmp/Bar/src
What the above command does are:
1)
It walks through the sub directories beneath:
/home/foo/project/Bar/src
2)
Within each directory node, it reads the files with the extension of:
.java
It inserts the comment lines for the copyright notice into each of them.
3)
It writes out the new files into the corresponding directory node under:
/home/foo/tmp/Bar/src
---------------------------------------
$. The original comment lines in the Java source files
The original Java source files may already have its own comment lines.
You may want to leave them as they are.
And you may want to insert the new comment lines above them by this tool.
Or, you mat want replace the existing comment lines with the new ones by this tool.
To leave as they are, please set the next variable to 1.
To replace them with the new ones, please set the next variable to 99.
ORIGINAL_COMMENT=1
You can update this variable within:
11_shell/11_shell4java.sh