- its a source file header management utility base on Spairaru framework.
- developed for internal use originally, free for public use.
- collaboration or service request, contact me.
- a coffee donation will help to keep the package updated :)
- With custom files stored in
.scl
folder in each directory, settings can be overridden and stacked up. - As the result, you can apply different header template with dynamitic text to all or specified file accordingly.
- Easy switch to license and un-license files for development or release branch, development or production state, by the use of your scenario.
- Auto generate
LICENSE.txt
with default or customized template, and with dynamic text.
Currently supported source file types are below, will continue to expand in future release.
- .cnf, .css, .cmd, .html, .ini, .java, js, .php, .py, .sh, .swift, .ts, .xml
- Python version 3.9+
# importing spairaru must be fesible
import sprr
- PIP
- To be determine.
# TBD
$ pip install xxxxxxxxx
- Installer
- Manually
To apply license
# long syntax
from scl import SourceCodeLicenser
SourceCodeLicenser.license( "__path_of_application_root__" )
# short syntax
from scl import scl
scl.lic( "__path_of_application_root__" )
To dispose license
# long syntax
from scl import SourceCodeLicenser
SourceCodeLicenser.unlicense( "__path_of_application_root__" )
# short syntax
from scl import scl
scl.ulic( "__path_of_application_root__" )
copy to and license in different folder
# give `dist` or `distribution` option
scl.lic(
"__path_of_application_root__"
# Locational Options
# distribution_directory
, dist = "__path_of_distribution_root__"
)
license over symbolic folders and files
# give `flw_lnk` or `flow_link` option
scl.lic(
"__path_of_application_root__"
# Search Options
# follow_link
, flw_lnk = True
)
- place add custom
.tpl
template files or.cnf
configuration files, or.ign
ignore glob patterns in.scl
folder.
# Exanple Hierarchy
__path_of_application_root__
+ .scl
- custom.tpl
- custom.ign
- custom.cnf
+ __some_folder__
+ __some_folder__
+ .scl
- custom.tpl
- custom.ign
- custom.cnf
- If no
.tpl
present, settings will inherit from parent directory.
Naming
- For default template, name it to
@.tpl
. - To specify template, name it to
__name__.__extention__.tpl
.
# Exanple Naming
__path_of_application_root__
+ .scl
- @.tpl
+ __some_folder__
+ .scl
- test.html.tpl
- test.html
- In above hierarchy,
test.html
will apply totest.html.tpl
.- the rest of file will apply
@.tpl
Design
- Input text without comment in template file.
- Where the dynamic variable surround it with double braces plus parent mark.
- Dynamic variables can define in
.cnf
configuration files.
# Exanple of xxx.tpl
{{%SCL_PTN_NM}} {{%SCL_PTN_VER}}
Copyright {{%SCL_LIC_HLDR}} {{%SCL_LIC_YR}}. All Rights Reserved.
This file is part of {{%SCL_PTN_NM}}, which released under {{%SCL_LIC_TYP}}.
# above example in licensing stage outputs below
SourceCodeLicenser-Python sr1.0.0
Copyright EtroTech, and its contributor 2022. All Rights Reserved.
This file is part of SourceCodeLicenser, which released under GPL-3.0-or-later.
.cnf
configuration file use standard.conf
or.ini
file syntax.- Configuration category must be
[scl]
# Exanple of xxx.cnf
[scl]
__custom_var_Name__=__Custom_Var_Value__
- By adding glob pattern to
.ign
ignore file be faster license or un-license processes. - Accept standard glob syntax.
# Exanple of xxx.ign
**/**.__extension__
**/__folder_name__