task2md 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- task2md-1.0.0/.gitignore +18 -0
- task2md-1.0.0/.gitlab-ci.yml +34 -0
- task2md-1.0.0/.markdownlint.yaml +9 -0
- task2md-1.0.0/.pre-commit-config.yaml +23 -0
- task2md-1.0.0/.python-version +1 -0
- task2md-1.0.0/.releaserc +26 -0
- task2md-1.0.0/.vale.ini +8 -0
- task2md-1.0.0/.yamllint +13 -0
- task2md-1.0.0/LICENSE +21 -0
- task2md-1.0.0/PKG-INFO +122 -0
- task2md-1.0.0/README.md +103 -0
- task2md-1.0.0/Taskfile.project.yml +52 -0
- task2md-1.0.0/Taskfile.yml +187 -0
- task2md-1.0.0/docs/cli.md +11 -0
- task2md-1.0.0/docs/index.md +6 -0
- task2md-1.0.0/docs/task/file.md +2 -0
- task2md-1.0.0/docs/task/header.md +2 -0
- task2md-1.0.0/docs/task/task.md +2 -0
- task2md-1.0.0/docs/task/variable.md +2 -0
- task2md-1.0.0/docs/task2md.md +2 -0
- task2md-1.0.0/docs/util/dir.md +2 -0
- task2md-1.0.0/lychee.toml +1 -0
- task2md-1.0.0/mkdocs.yml +24 -0
- task2md-1.0.0/pyproject.toml +76 -0
- task2md-1.0.0/requirements-dev.lock +138 -0
- task2md-1.0.0/requirements.lock +25 -0
- task2md-1.0.0/src/task2md/__init__.py +0 -0
- task2md-1.0.0/src/task2md/task/__init__.py +0 -0
- task2md-1.0.0/src/task2md/task/file.py +249 -0
- task2md-1.0.0/src/task2md/task/header.py +71 -0
- task2md-1.0.0/src/task2md/task/task.py +137 -0
- task2md-1.0.0/src/task2md/task/variable.py +30 -0
- task2md-1.0.0/src/task2md/task2md.py +126 -0
- task2md-1.0.0/src/task2md/util/__init__.py +0 -0
- task2md-1.0.0/src/task2md/util/dir.py +37 -0
- task2md-1.0.0/tests/__init__.py +0 -0
- task2md-1.0.0/tests/files/empty.yml +0 -0
- task2md-1.0.0/tests/files/lint.yml +573 -0
- task2md-1.0.0/tests/task/__init__.py +0 -0
- task2md-1.0.0/tests/task/test_file.py +276 -0
- task2md-1.0.0/tests/task/test_header.py +51 -0
- task2md-1.0.0/tests/task/test_task.py +76 -0
- task2md-1.0.0/tests/task/test_variable.py +19 -0
- task2md-1.0.0/tests/test_dir.py +119 -0
- task2md-1.0.0/tests/test_file.py +123 -0
- task2md-1.0.0/tests/test_task2md.py +19 -0
- task2md-1.0.0/tests/util/test_dir.py +21 -0
task2md-1.0.0/.gitignore
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
include:
|
|
3
|
+
- remote: 'https://gitlab.com/op_so/projects/gitlab-ci-templates/-/raw/main/templates/lint.gitlab-ci.yml'
|
|
4
|
+
- remote: 'https://gitlab.com/op_so/projects/gitlab-ci-templates/-/raw/main/templates/lint.python-rye.gitlab-ci.yml'
|
|
5
|
+
- remote: 'https://gitlab.com/op_so/projects/gitlab-ci-templates/-/raw/main/templates/gitlab-release.gitlab-ci.yml'
|
|
6
|
+
- remote: 'https://gitlab.com/op_so/projects/gitlab-ci-templates/-/raw/main/templates/python.rye-publish.gitlab-ci.yml'
|
|
7
|
+
|
|
8
|
+
variables:
|
|
9
|
+
IMAGE_PYTHON: jfxs/rye
|
|
10
|
+
LINT_VALE: "true"
|
|
11
|
+
LINT_MARKDOWN_GLOB: '"**/*.md" "#docs"'
|
|
12
|
+
|
|
13
|
+
stages:
|
|
14
|
+
- lint
|
|
15
|
+
- tests
|
|
16
|
+
- gitlab-release
|
|
17
|
+
- pypi-release
|
|
18
|
+
- pages-release
|
|
19
|
+
|
|
20
|
+
tests:pytest:
|
|
21
|
+
image: $IMAGE_PYTHON
|
|
22
|
+
stage: tests
|
|
23
|
+
before_script:
|
|
24
|
+
- rye --version
|
|
25
|
+
- rye sync
|
|
26
|
+
- rye run pytest --version
|
|
27
|
+
- mkdir -p reports/cov
|
|
28
|
+
script:
|
|
29
|
+
- rye run test
|
|
30
|
+
|
|
31
|
+
gitlab-release:
|
|
32
|
+
before_script:
|
|
33
|
+
- npx semantic-release --dry-run --no-ci
|
|
34
|
+
- if [ -s .VERSION ]; then task 00:project-set-version VERSION=$(cat .VERSION); fi
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
repos:
|
|
3
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
4
|
+
rev: v4.5.0
|
|
5
|
+
hooks:
|
|
6
|
+
- id: trailing-whitespace
|
|
7
|
+
- id: end-of-file-fixer
|
|
8
|
+
- id: check-yaml
|
|
9
|
+
- id: check-added-large-files
|
|
10
|
+
# Hooks added from sample-config
|
|
11
|
+
- id: check-executables-have-shebangs
|
|
12
|
+
- id: check-json
|
|
13
|
+
- id: check-merge-conflict
|
|
14
|
+
- id: check-shebang-scripts-are-executable
|
|
15
|
+
- id: check-symlinks
|
|
16
|
+
- id: check-toml
|
|
17
|
+
- id: check-xml
|
|
18
|
+
- id: detect-private-key
|
|
19
|
+
- id: end-of-file-fixer
|
|
20
|
+
- id: fix-byte-order-marker
|
|
21
|
+
- id: mixed-line-ending
|
|
22
|
+
- id: trailing-whitespace
|
|
23
|
+
args: [--markdown-linebreak-ext=md]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12.2
|
task2md-1.0.0/.releaserc
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"branches": [
|
|
3
|
+
"main",
|
|
4
|
+
"master"
|
|
5
|
+
],
|
|
6
|
+
"plugins": [
|
|
7
|
+
"@semantic-release/commit-analyzer",
|
|
8
|
+
"@semantic-release/release-notes-generator",
|
|
9
|
+
[
|
|
10
|
+
"@semantic-release/exec",
|
|
11
|
+
{
|
|
12
|
+
"verifyReleaseCmd": "echo ${nextRelease.version} > .VERSION"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
[
|
|
16
|
+
"@semantic-release/gitlab",
|
|
17
|
+
{
|
|
18
|
+
"assets": [
|
|
19
|
+
{
|
|
20
|
+
"path": "src/"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
]
|
|
26
|
+
}
|
task2md-1.0.0/.vale.ini
ADDED
task2md-1.0.0/.yamllint
ADDED
task2md-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2024 FX Soubirou soubirou@yahoo.fr
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
task2md-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: task2md
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A program to generate markdown documentation files from Task files
|
|
5
|
+
Project-URL: Homepage, https://gitlab.com/op_so/task/task2md
|
|
6
|
+
Project-URL: Documentation, https://op_so.gitlab.io/task/task2md/
|
|
7
|
+
Author-email: FX Soubirou <soubirou@yahoo.fr>
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Requires-Dist: click>=8.1.7
|
|
15
|
+
Requires-Dist: pydantic>=2.6.3
|
|
16
|
+
Requires-Dist: pyyaml>=6.0.1
|
|
17
|
+
Requires-Dist: types-pyyaml>=6.0.12.12
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# `task2md`
|
|
21
|
+
|
|
22
|
+
[](LICENSE)
|
|
23
|
+
[](https://github.com/semantic-release/semantic-release)
|
|
24
|
+
[](https://gitlab.com/op_so/task/task2md/pipelines)
|
|
25
|
+
|
|
26
|
+
[](https://op_so.gitlab.io/task/task2md/) Source code documentation
|
|
27
|
+
|
|
28
|
+
A CLI tool to generate from [Task](https://taskfile.dev/) files, some markdown
|
|
29
|
+
documentation files for [`mkdocs`](https://squidfunk.github.io/mkdocs-material/) static site.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
Usage: task2md [OPTIONS] COMMAND [ARGS]...
|
|
33
|
+
|
|
34
|
+
A CLI tool to generate markdown documentation files from Task files.
|
|
35
|
+
|
|
36
|
+
Options:
|
|
37
|
+
--version Show the version and exit.
|
|
38
|
+
--help Show this message and exit.
|
|
39
|
+
|
|
40
|
+
Commands:
|
|
41
|
+
dir Command to generate a markdown documentation file from a directory.
|
|
42
|
+
file Command to generate a markdown documentation file from a Task file.
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## `dir`
|
|
46
|
+
|
|
47
|
+
Get all files with `yaml/yml` extension from the input directory and generate the
|
|
48
|
+
markdown files in the output directory.
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
Usage: task2md dir [OPTIONS]
|
|
52
|
+
|
|
53
|
+
Command to generate a markdown documentation file from a directory.
|
|
54
|
+
|
|
55
|
+
Raises: click.ClickException: Error when reading input file or writing
|
|
56
|
+
output file
|
|
57
|
+
|
|
58
|
+
Options:
|
|
59
|
+
-i, --input DIRECTORY Input directory [required]
|
|
60
|
+
-d, --dir DIRECTORY Output markdown documentation files directory.
|
|
61
|
+
Default current directory.
|
|
62
|
+
--help Show this message and exit.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Example:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
task2md dir --input Taskfile.d/ -d doc_dir/
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## `file`
|
|
72
|
+
|
|
73
|
+
Generate from the input file a markdown file in the output directory.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
Usage: task2md file [OPTIONS]
|
|
77
|
+
|
|
78
|
+
Command to generate a markdown documentation file from a Task file.
|
|
79
|
+
|
|
80
|
+
Raises: click.ClickException: Error when reading input file or writing
|
|
81
|
+
output file
|
|
82
|
+
|
|
83
|
+
Options:
|
|
84
|
+
-i, --input FILE Input Task yaml file. [required]
|
|
85
|
+
-d, --dir DIRECTORY Output markdown documentation files directory. Default
|
|
86
|
+
current directory.
|
|
87
|
+
--help Show this message and exit.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Example:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
task2md file --input Taskfile.d/lint.yml -d doc_dir/
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Installation
|
|
97
|
+
|
|
98
|
+
### With `Python` environment
|
|
99
|
+
|
|
100
|
+
To use:
|
|
101
|
+
|
|
102
|
+
- Minimal Python version: 3.10
|
|
103
|
+
|
|
104
|
+
Installation with Python `pip`:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
python3 -m pip install task2md
|
|
108
|
+
task2md --help
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Authors
|
|
112
|
+
|
|
113
|
+
<!-- vale off -->
|
|
114
|
+
- **FX Soubirou** - *Initial work* - [GitLab repositories](https://gitlab.com/op_so)
|
|
115
|
+
<!-- vale on -->
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
<!-- vale off -->
|
|
120
|
+
This program is free software: you can redistribute it and/or modify it under the terms of the MIT License (MIT).
|
|
121
|
+
See the [LICENSE](https://opensource.org/licenses/MIT) for details.
|
|
122
|
+
<!-- vale on -->
|
task2md-1.0.0/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# `task2md`
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
[](https://github.com/semantic-release/semantic-release)
|
|
5
|
+
[](https://gitlab.com/op_so/task/task2md/pipelines)
|
|
6
|
+
|
|
7
|
+
[](https://op_so.gitlab.io/task/task2md/) Source code documentation
|
|
8
|
+
|
|
9
|
+
A CLI tool to generate from [Task](https://taskfile.dev/) files, some markdown
|
|
10
|
+
documentation files for [`mkdocs`](https://squidfunk.github.io/mkdocs-material/) static site.
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
Usage: task2md [OPTIONS] COMMAND [ARGS]...
|
|
14
|
+
|
|
15
|
+
A CLI tool to generate markdown documentation files from Task files.
|
|
16
|
+
|
|
17
|
+
Options:
|
|
18
|
+
--version Show the version and exit.
|
|
19
|
+
--help Show this message and exit.
|
|
20
|
+
|
|
21
|
+
Commands:
|
|
22
|
+
dir Command to generate a markdown documentation file from a directory.
|
|
23
|
+
file Command to generate a markdown documentation file from a Task file.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## `dir`
|
|
27
|
+
|
|
28
|
+
Get all files with `yaml/yml` extension from the input directory and generate the
|
|
29
|
+
markdown files in the output directory.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
Usage: task2md dir [OPTIONS]
|
|
33
|
+
|
|
34
|
+
Command to generate a markdown documentation file from a directory.
|
|
35
|
+
|
|
36
|
+
Raises: click.ClickException: Error when reading input file or writing
|
|
37
|
+
output file
|
|
38
|
+
|
|
39
|
+
Options:
|
|
40
|
+
-i, --input DIRECTORY Input directory [required]
|
|
41
|
+
-d, --dir DIRECTORY Output markdown documentation files directory.
|
|
42
|
+
Default current directory.
|
|
43
|
+
--help Show this message and exit.
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Example:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
task2md dir --input Taskfile.d/ -d doc_dir/
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## `file`
|
|
53
|
+
|
|
54
|
+
Generate from the input file a markdown file in the output directory.
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
Usage: task2md file [OPTIONS]
|
|
58
|
+
|
|
59
|
+
Command to generate a markdown documentation file from a Task file.
|
|
60
|
+
|
|
61
|
+
Raises: click.ClickException: Error when reading input file or writing
|
|
62
|
+
output file
|
|
63
|
+
|
|
64
|
+
Options:
|
|
65
|
+
-i, --input FILE Input Task yaml file. [required]
|
|
66
|
+
-d, --dir DIRECTORY Output markdown documentation files directory. Default
|
|
67
|
+
current directory.
|
|
68
|
+
--help Show this message and exit.
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Example:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
task2md file --input Taskfile.d/lint.yml -d doc_dir/
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Installation
|
|
78
|
+
|
|
79
|
+
### With `Python` environment
|
|
80
|
+
|
|
81
|
+
To use:
|
|
82
|
+
|
|
83
|
+
- Minimal Python version: 3.10
|
|
84
|
+
|
|
85
|
+
Installation with Python `pip`:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
python3 -m pip install task2md
|
|
89
|
+
task2md --help
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Authors
|
|
93
|
+
|
|
94
|
+
<!-- vale off -->
|
|
95
|
+
- **FX Soubirou** - *Initial work* - [GitLab repositories](https://gitlab.com/op_so)
|
|
96
|
+
<!-- vale on -->
|
|
97
|
+
|
|
98
|
+
## License
|
|
99
|
+
|
|
100
|
+
<!-- vale off -->
|
|
101
|
+
This program is free software: you can redistribute it and/or modify it under the terms of the MIT License (MIT).
|
|
102
|
+
See the [LICENSE](https://opensource.org/licenses/MIT) for details.
|
|
103
|
+
<!-- vale on -->
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
# https://taskfile.dev
|
|
3
|
+
#
|
|
4
|
+
# Taskfile.project.yml for your main project tasks. Must be commited.
|
|
5
|
+
# If you always want the last version of the task templates, add the following line in your .gitignore file
|
|
6
|
+
# /Taskfile.d/
|
|
7
|
+
#
|
|
8
|
+
version: '3'
|
|
9
|
+
|
|
10
|
+
vars:
|
|
11
|
+
# TO MODIFY: Task templates to download separated by comma
|
|
12
|
+
# Example: TASK_TEMPLATES: go,lint,yarn
|
|
13
|
+
TASK_TEMPLATES: git,lint
|
|
14
|
+
|
|
15
|
+
tasks:
|
|
16
|
+
|
|
17
|
+
00-get-list-templates:
|
|
18
|
+
# Get the list of templates to download
|
|
19
|
+
# Do not remove
|
|
20
|
+
cmds:
|
|
21
|
+
- echo "{{.TASK_TEMPLATES}}"
|
|
22
|
+
silent: true
|
|
23
|
+
|
|
24
|
+
project-set-version:
|
|
25
|
+
desc: "[PROJECT] Set version in different files. Arguments: VERSION|V=x.y.z"
|
|
26
|
+
vars:
|
|
27
|
+
PY_FILE_VERSION: src/task2md/task2md.py
|
|
28
|
+
MD_FILE_VERSION: docs/index.md
|
|
29
|
+
VERSION: '{{default .V .VERSION}}'
|
|
30
|
+
cmds:
|
|
31
|
+
- echo "Version {{.VERSION}}"
|
|
32
|
+
- sed -i.bu "s/0\.0\.0/{{.VERSION}}/g" pyproject.toml
|
|
33
|
+
- defer: rm -f pyproject.toml.bu
|
|
34
|
+
- sed -i.bu "s/0\.0\.0/{{.VERSION}}/g" {{.PY_FILE_VERSION}}
|
|
35
|
+
- defer: rm -f {{.PY_FILE_VERSION}}.bu
|
|
36
|
+
- sed -i.bu "s/0\.0\.0/{{.VERSION}}/g" {{.MD_FILE_VERSION}}
|
|
37
|
+
- defer: rm -f {{.MD_FILE_VERSION}}.bu
|
|
38
|
+
preconditions:
|
|
39
|
+
- sh: test -n "{{.VERSION}}"
|
|
40
|
+
msg: "VERSION|V argument is required"
|
|
41
|
+
silent: true
|
|
42
|
+
|
|
43
|
+
30-pre-commit:
|
|
44
|
+
desc: "[PROJECT] Pre-commit checks."
|
|
45
|
+
cmds:
|
|
46
|
+
- date > {{.FILE_TASK_START}}
|
|
47
|
+
- defer: rm -f {{.FILE_TASK_START}}
|
|
48
|
+
- task lint:pre-commit
|
|
49
|
+
- task lint:all MEX='"#docs" "#styles" "#Taskfile.d" "#.venv" "#.cache"'
|
|
50
|
+
- echo "run also -> rye run lint & rye fmt"
|
|
51
|
+
- echo "" && echo "Checks Start $(cat {{.FILE_TASK_START}}) - End $(date)"
|
|
52
|
+
silent: true
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
# https://taskfile.dev
|
|
3
|
+
#
|
|
4
|
+
# Do not edit this file, instead use Taskfile.project.yml.
|
|
5
|
+
#
|
|
6
|
+
version: '3'
|
|
7
|
+
|
|
8
|
+
vars:
|
|
9
|
+
DIR_TASKFILES: Taskfile.d
|
|
10
|
+
FILE_TASK_START: "task-start-{{.TASK}}.txt"
|
|
11
|
+
FILE_TASK_START1: "task-start-{{.TASK}}1.txt"
|
|
12
|
+
TT_GIT_REPO: https://gitlab.com/op_so/task/task-templates/-/raw
|
|
13
|
+
|
|
14
|
+
includes:
|
|
15
|
+
00:
|
|
16
|
+
taskfile: Taskfile.project.yml
|
|
17
|
+
optional: true
|
|
18
|
+
# BEGIN-INCLUDES-TEMPLATES
|
|
19
|
+
git:
|
|
20
|
+
taskfile: Taskfile.d/git.yml
|
|
21
|
+
optional: true
|
|
22
|
+
lint:
|
|
23
|
+
taskfile: Taskfile.d/lint.yml
|
|
24
|
+
optional: true
|
|
25
|
+
# END-INCLUDES-TEMPLATES
|
|
26
|
+
|
|
27
|
+
tasks:
|
|
28
|
+
|
|
29
|
+
install-templates:
|
|
30
|
+
desc: "[CORE] Download/update tasks templates. Arguments: [PROXY|P=http://proxy:8080] [PROXY_CREDENTIALS|PC=username:password] (*)"
|
|
31
|
+
summary: |
|
|
32
|
+
[CORE] Download/update tasks templates.
|
|
33
|
+
Usage: task install-templates [PROXY|P=http://proxy_url:proxy_port] [PROXY_CREDENTIALS|PC=username:password]
|
|
34
|
+
|
|
35
|
+
Arguments:
|
|
36
|
+
PROXY | P Proxy URL (optional)
|
|
37
|
+
PROXY_CREDENTIALS | PC Proxy credentials username:password (optional)
|
|
38
|
+
|
|
39
|
+
Requirements:
|
|
40
|
+
- wget or curl
|
|
41
|
+
vars:
|
|
42
|
+
PROXY: '{{default .P .PROXY}}'
|
|
43
|
+
D_PROXY: '{{default .TASK_PROXY .PROXY}}'
|
|
44
|
+
PROXY_CREDENTIALS: '{{default .PC .PROXY_CREDENTIALS}}'
|
|
45
|
+
TASK_TEMPLATES:
|
|
46
|
+
sh: task 00:00-get-list-templates
|
|
47
|
+
FILE: '{{default .F .FILE}}'
|
|
48
|
+
D_FILE: '{{default "Taskfile.yml" .FILE}}'
|
|
49
|
+
BEGIN: " # BEGIN-INCLUDES-TEMPLATES"
|
|
50
|
+
PATTERN_BEGIN: "^{{.BEGIN}}"
|
|
51
|
+
END: "# END-INCLUDES-TEMPLATES"
|
|
52
|
+
cmds:
|
|
53
|
+
- date > {{.FILE_TASK_START}}
|
|
54
|
+
- defer: rm -f {{.FILE_TASK_START}}
|
|
55
|
+
- mkdir -p "{{.DIR_TASKFILES}}"
|
|
56
|
+
- if [ -z "{{.TASK_TEMPLATES}}" ]; then echo "Error TASK_TEMPLATES variable is empty in Taskfile.project.yml file" && exit 1; else echo "Download templates -> {{.TASK_TEMPLATES}}"; fi
|
|
57
|
+
- |
|
|
58
|
+
line_include_template_begin=$(grep -Fn '{{.BEGIN}}' "{{.D_FILE}}" | head -n 1 | cut -d ':' -f 1)
|
|
59
|
+
line_delete_begin=$(expr $line_include_template_begin + 1)
|
|
60
|
+
line_include_template_end=$(grep -Fn '{{.END}}' "{{.D_FILE}}" | head -n 1 | cut -d ':' -f 1)
|
|
61
|
+
line_delete_end=$(expr $line_include_template_end - 1)
|
|
62
|
+
if [ $line_delete_end -ge $line_delete_begin ]; then
|
|
63
|
+
sed -i'.bu' "${line_delete_begin},${line_delete_end}d" "{{.D_FILE}}"
|
|
64
|
+
fi
|
|
65
|
+
- defer: rm -f "{{.D_FILE}}".bu
|
|
66
|
+
- |
|
|
67
|
+
includes="{{.BEGIN}}"
|
|
68
|
+
for t in $(echo "{{.TASK_TEMPLATES}}" | tr "," " "); do
|
|
69
|
+
if echo "$t" | grep -q "\[" 2>/dev/null; then
|
|
70
|
+
task=$(echo "$t" | cut -d '[' -f 1)
|
|
71
|
+
else
|
|
72
|
+
task="$t"
|
|
73
|
+
fi
|
|
74
|
+
includes="$includes\\n ${task}:\\n taskfile: {{.DIR_TASKFILES}}/${task}.yml\\n optional: true"
|
|
75
|
+
done
|
|
76
|
+
sed -i'.bu' "s={{.PATTERN_BEGIN}}=${includes}=g" "{{.D_FILE}}"
|
|
77
|
+
- |
|
|
78
|
+
templates_list=$(task 00:00-get-list-templates)
|
|
79
|
+
for t in $(echo "{{.TASK_TEMPLATES}}" | tr "," " "); do
|
|
80
|
+
if echo "$t" | grep -q "\[" 2>/dev/null; then
|
|
81
|
+
task=$(echo "$t" | cut -d '[' -f 1)
|
|
82
|
+
v=$(echo "$t" | sed -e 's/.*\[\(.*\)\]/\1/')
|
|
83
|
+
version="v${v}"
|
|
84
|
+
else
|
|
85
|
+
task="$t"
|
|
86
|
+
version="main"
|
|
87
|
+
fi
|
|
88
|
+
echo "Download template: $task version: $version"
|
|
89
|
+
task download-template TEMPLATE=${task}.yml VERSION=$version PROXY={{.D_PROXY}} PROXY_CREDENTIALS={{.PROXY_CREDENTIALS}}
|
|
90
|
+
done
|
|
91
|
+
- echo "Install templates Start $(cat {{.FILE_TASK_START}}) - End $(date)"
|
|
92
|
+
silent: true
|
|
93
|
+
|
|
94
|
+
usage:
|
|
95
|
+
desc: "[CORE] Show the usage of a task. Arguments: TSK|T=task-name [FILE|F=Taskfile.dist.yml] (*)"
|
|
96
|
+
summary: |
|
|
97
|
+
[CORE] Show the usage of a task.
|
|
98
|
+
Usage: task [-t Taskfile.dist.yml] usage TSK|T=<task-name> [FILE|F=Taskfile.dist.yml]
|
|
99
|
+
|
|
100
|
+
Arguments:
|
|
101
|
+
TSK | T Name of the task (required)
|
|
102
|
+
FILE | F Taskfile path (optional, by default Taskfile.yml)
|
|
103
|
+
vars:
|
|
104
|
+
TSK: '{{default .T .TSK}}'
|
|
105
|
+
FILE: '{{default .F .FILE}}'
|
|
106
|
+
D_FILE: '{{default "Taskfile.yml" .FILE}}'
|
|
107
|
+
cmds:
|
|
108
|
+
- |
|
|
109
|
+
if [ ! -f "{{.D_FILE}}" ]; then
|
|
110
|
+
echo "{{.D_FILE}} does not exist!"
|
|
111
|
+
exit 1
|
|
112
|
+
fi
|
|
113
|
+
- task -t "{{.D_FILE}}" --summary "{{.TSK}}" | sed '/^dependencies:$/,$d' | sed '/^commands:$/,$d'
|
|
114
|
+
preconditions:
|
|
115
|
+
- sh: test -n "{{.TSK}}" || test -n "{{.T}}"
|
|
116
|
+
msg: "TSK|T argument is required"
|
|
117
|
+
silent: true
|
|
118
|
+
|
|
119
|
+
default:
|
|
120
|
+
desc: "[CORE] List of available tasks. Arguments: [FILE|F=Taskfile.project.yml] (*)"
|
|
121
|
+
summary: |
|
|
122
|
+
[CORE] Show the list of available tasks.
|
|
123
|
+
Usage: task [FILE|F=Taskfile.project.yml]
|
|
124
|
+
|
|
125
|
+
Arguments:
|
|
126
|
+
FILE | F Taskfile project path (optional, by default Taskfile.project.yml)
|
|
127
|
+
vars:
|
|
128
|
+
FILE: '{{default .F .FILE}}'
|
|
129
|
+
D_FILE: '{{default "Taskfile.project.yml" .FILE}}'
|
|
130
|
+
cmds:
|
|
131
|
+
- |
|
|
132
|
+
if [ -d "{{.DIR_TASKFILES}}" ]; then
|
|
133
|
+
ls -1 {{.DIR_TASKFILES}}/*.yml |
|
|
134
|
+
while IFS= read -r template; do
|
|
135
|
+
template_name=$(basename "$template")
|
|
136
|
+
printf "\033[0;33m[ %s: ]\033[0m " "${template_name%.yml}" && task --list -t "$template" || true
|
|
137
|
+
echo ""
|
|
138
|
+
done
|
|
139
|
+
fi
|
|
140
|
+
- |
|
|
141
|
+
if [ ! -z "{{.D_FILE}}" ]; then
|
|
142
|
+
printf "\033[0;33m[ %s: ]\033[0m " "00" && task --list -t "{{.D_FILE}}" || true
|
|
143
|
+
fi
|
|
144
|
+
- echo ""
|
|
145
|
+
- echo " <task install-templates [PROXY|P=http://proxy:8080]> to install or update templates (Variable TASK_TEMPLATES in Taskfile.project.yml file)."
|
|
146
|
+
- echo " (*) <task usage TSK=task-name> will show the usage of the task."
|
|
147
|
+
silent: true
|
|
148
|
+
|
|
149
|
+
download-template:
|
|
150
|
+
cmds:
|
|
151
|
+
- |
|
|
152
|
+
if [ -x "$(command -v curl)" ]; then
|
|
153
|
+
if [ -z "{{.PROXY}}" ]; then
|
|
154
|
+
curl --progress-bar -o "{{.DIR_TASKFILES}}/{{.TEMPLATE}}" "{{.TT_GIT_REPO}}/{{.VERSION}}/{{.DIR_TASKFILES}}/{{.TEMPLATE}}"
|
|
155
|
+
else
|
|
156
|
+
if [ -z "{{.PROXY_CREDENTIALS}}" ]; then
|
|
157
|
+
echo "Proxy: {{.PROXY}}"
|
|
158
|
+
curl -x "{{.PROXY}}" --progress-bar -o "{{.DIR_TASKFILES}}/{{.TEMPLATE}}" "{{.TT_GIT_REPO}}/{{.VERSION}}/{{.DIR_TASKFILES}}/{{.TEMPLATE}}"
|
|
159
|
+
else
|
|
160
|
+
echo "Proxy with auth: {{.PROXY}}"
|
|
161
|
+
curl -U "{{.PROXY_CREDENTIALS}}" -x "{{.PROXY}}" --progress-bar -o "{{.DIR_TASKFILES}}/{{.TEMPLATE}}" "{{.TT_GIT_REPO}}/{{.VERSION}}/{{.DIR_TASKFILES}}/{{.TEMPLATE}}" --proxy-anyauth
|
|
162
|
+
fi
|
|
163
|
+
fi
|
|
164
|
+
else
|
|
165
|
+
if [ -z "{{.PROXY}}" ]; then
|
|
166
|
+
wget -cq -O "{{.DIR_TASKFILES}}/{{.TEMPLATE}}" "{{.TT_GIT_REPO}}/{{.VERSION}}/{{.DIR_TASKFILES}}/{{.TEMPLATE}}"
|
|
167
|
+
else
|
|
168
|
+
if [ -z "{{.PROXY_CREDENTIALS}}" ]; then
|
|
169
|
+
proxy={{.PROXY}}
|
|
170
|
+
echo "Proxy: $proxy"
|
|
171
|
+
else
|
|
172
|
+
proto=$(echo {{.PROXY}} | sed -e's,^\(.*://\).*,\1,g')
|
|
173
|
+
url=$(echo {{.PROXY}} | sed -e's,^.*://\(.*\),\1,g')
|
|
174
|
+
proxy="${proto}{{.PROXY_CREDENTIALS}}@${url}"
|
|
175
|
+
echo "Proxy: ${proto}****:****@${url}"
|
|
176
|
+
fi
|
|
177
|
+
export use_proxy=on && export http_proxy=$proxy && export https_proxy=$proxy && wget -cq -O "{{.DIR_TASKFILES}}/{{.TEMPLATE}}" "{{.TT_GIT_REPO}}/{{.VERSION}}/{{.DIR_TASKFILES}}/{{.TEMPLATE}}"
|
|
178
|
+
fi
|
|
179
|
+
fi
|
|
180
|
+
preconditions:
|
|
181
|
+
- sh: test -n "{{.TEMPLATE}}"
|
|
182
|
+
msg: "TEMPLATE argument is required"
|
|
183
|
+
- sh: test -n "{{.VERSION}}"
|
|
184
|
+
msg: "VERSION argument is required"
|
|
185
|
+
- sh: command -v curl || command -v wget
|
|
186
|
+
msg: "curl or wget are not installed"
|
|
187
|
+
silent: true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exclude_path = ["styles"]
|