Skip to content

Commit 443b415

Browse files
huxuanmsclock
andauthored
chore: change repo_host_type to repo_platform (#533)
Signed-off-by: Xuan (Sean) Hu <[email protected]> Co-authored-by: msclock <[email protected]>
1 parent 21db07d commit 443b415

22 files changed

+38
-33
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ doc: changelog doc-gen doc-mypy doc-coverage
154154

155155
consistency:
156156
find . -maxdepth 1 | grep -vE '(\.|\.git|template|includes|copier\.yaml|pdm\.lock)$$' | xargs -I {} rm -r {}
157-
copier copy -r HEAD --data-file includes/copier-answers-sample.yml --data repo_host_type=gitlab.com -f . .
157+
copier copy -r HEAD --data-file includes/copier-answers-sample.yml --data repo_platform=gitlab -f . .
158158
rm -rf .copier-answers.yml
159159
copier copy -r HEAD --data-file includes/copier-answers-sample.yml -f . .
160160
rm -rf .copier-answers.yml

copier.yaml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,39 +67,44 @@ author_email:
6767
default: '{{ author_name|lower|replace(" ", ".") }}@{{ organization_name|lower|replace(" ", "-") }}.com'
6868
help: 'Specify the email address of the author:'
6969
type: str
70-
repo_host_type:
71-
default: github.com
70+
repo_platform:
71+
default: github
7272
choices:
73-
GitHub: github.com
74-
GitLab: gitlab.com
73+
GitHub: github
74+
GitLab: gitlab
7575
GitLab (self-managed): gitlab-self-managed
76-
help: 'Choose the host for the repository:'
76+
help: 'Choose the platform for the repository:'
7777
type: str
7878
repo_host:
79-
default: '{{ repo_host_type }}'
79+
default: |-
80+
[% if repo_platform == 'github' -%]
81+
github.com
82+
[%- elif repo_platform == 'gitlab' -%]
83+
gitlab.com
84+
[%- endif %]
8085
help: 'Specify the host of the self-managed GitLab:'
8186
type: str
82-
when: '{{ repo_host_type == "gitlab-self-managed" }}'
87+
when: '{{ repo_platform == "gitlab-self-managed" }}'
8388
page_host:
8489
default: |-
85-
[% if repo_host_type == 'github.com' -%]
90+
[% if repo_platform == 'github' -%]
8691
github.io
87-
[%- elif repo_host_type == 'gitlab.com' -%]
92+
[%- elif repo_platform == 'gitlab' -%]
8893
gitlab.io
8994
[%- endif %]
9095
help: 'Specify the host of the self-managed GitLab Pages:'
9196
type: str
92-
when: '{{ repo_host_type == "gitlab-self-managed" }}'
97+
when: '{{ repo_platform == "gitlab-self-managed" }}'
9398
container_registry_host:
9499
default: |-
95-
[% if repo_host_type == 'github.com' -%]
100+
[% if repo_platform == 'github' -%]
96101
ghcr.io
97-
[%- elif repo_host_type == 'gitlab.com' -%]
102+
[%- elif repo_platform == 'gitlab' -%]
98103
registry.gitlab.com
99104
[%- endif %]
100105
help: 'Specify the host of the self-managed GitLab Container Registry:'
101106
type: str
102-
when: '{{ repo_host_type == "gitlab-self-managed" }}'
107+
when: '{{ repo_platform == "gitlab-self-managed" }}'
103108
repo_namespace:
104109
default: '{{ organization_name|lower|replace(" ", "-") }}'
105110
help: 'Indicate the GitHub Repository Owner or GitLab Namespace. This is typically the account name of the author or the organization:'

includes/copier-answers-sample.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ project_description:
1919
An evolving Python project template that covers the full development
2020
lifecycle.
2121
project_name: Serious Scaffold Python
22-
repo_host_type: github.com
2322
repo_name: ss-python
2423
repo_namespace: serious-scaffold
24+
repo_platform: github

includes/sample.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
Setting up a project often involves more than just establishing a basic project structure. It involves tasks like integrating GitHub Actions or GitLab CI/CD, configuring lint, test and documentation, as well as implementing settings, logging and other frequently used modules. [Serious Scaffold Python](https://github.com/serious-scaffold/ss-python) streamlines this process. Powered by [`copier`](https://copier.readthedocs.io/), bootstrapping a new Python project can be done with a single command. By answering a few questions, the project will be fully configured and ready for development. Furthermore, the project can be updated alongside the advancement of the template.
99

10-
[% if repo_host_type == 'github.com' -%]
10+
[% if repo_platform == 'github' -%]
1111
If you find this helpful, please consider [sponsorship](https://github.com/sponsors/{{ author_name }}).
1212

1313
[% endif -%]

includes/variable.jinja

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
[% macro coverage_badge() -%]
2-
[% if repo_host_type == 'github.com' -%]
2+
[% if repo_platform == 'github' -%]
33
[![Coverage](https://img.shields.io/endpoint?url=https://{{ page_url() }}/_static/badges/coverage.json)](https://{{ page_url() }}/reports/coverage)
4-
[%- elif repo_host_type == 'gitlab.com' or repo_host_type == 'gitlab-self-managed' -%]
4+
[%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' -%]
55
[![coverage report](https://{{ repo_url() }}/badges/main/coverage.svg)](https://{{ repo_url() }}/-/commits/main)
66
[%- endif %]
77
[%- endmacro %]
88

99
[% macro license_badge() -%]
10-
[% if repo_host_type == 'github.com' -%]
10+
[% if repo_platform == 'github' -%]
1111
[![GitHub](https://img.shields.io/github/license/{{ repo_namespace }}/{{ repo_name }})]({{ license_url() }})
12-
[%- elif repo_host_type == 'gitlab.com' or repo_host_type == 'gitlab-self-managed' -%]
12+
[%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' -%]
1313
[![GitLab](https://img.shields.io/gitlab/license/{{ repo_namespace }}/{{ repo_name }}?gitlab_url=https%3A%2F%2F{{ repo_host }})]({{ license_url() }})
1414
[%- endif -%]
1515
[%- endmacro %]
1616

1717
[% macro license_url() -%]
18-
[% if repo_host_type == 'github.com' -%]
18+
[% if repo_platform == 'github' -%]
1919
https://{{ repo_url() }}/blob/main/LICENSE
20-
[%- elif repo_host_type == 'gitlab.com' or repo_host_type == 'gitlab-self-managed' -%]
20+
[%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' -%]
2121
https://{{ repo_url() }}/-/blob/main/LICENSE
2222
[%- endif -%]
2323
[%- endmacro %]
@@ -31,28 +31,28 @@
3131
[%- endmacro %]
3232

3333
[% macro page_url() -%]
34-
[% if repo_host_type == 'github.com' -%]
34+
[% if repo_platform == 'github' -%]
3535
{{ repo_namespace }}.github.io/{{ repo_name }}
36-
[%- elif repo_host_type == 'gitlab.com' or repo_host_type == 'gitlab-self-managed' -%]
36+
[%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' -%]
3737
[%- set repo_namespace_root = repo_namespace.split("/")[0] -%]
3838
{{ repo_namespace_root }}.{{ page_host }}{{ repo_namespace | replace(repo_namespace_root, "", 1) }}/{{ repo_name }}
3939
[%- endif %]
4040
[%- endmacro %]
4141

4242
[% macro pipeline_badge() -%]
43-
[% if repo_host_type == 'github.com' -%]
43+
[% if repo_platform == 'github' -%]
4444
[![CI](https://{{ repo_url() }}/actions/workflows/ci.yml/badge.svg)](https://{{ repo_url() }}/actions/workflows/ci.yml)
4545
[![CommitLint](https://{{ repo_url() }}/actions/workflows/commitlint.yml/badge.svg)](https://{{ repo_url() }}/actions/workflows/commitlint.yml)
4646
[![DevContainer](https://{{ repo_url() }}/actions/workflows/devcontainer.yml/badge.svg)](https://{{ repo_url() }}/actions/workflows/devcontainer.yml)
4747
[![Release](https://{{ repo_url() }}/actions/workflows/release.yml/badge.svg)](https://{{ repo_url() }}/actions/workflows/release.yml)
4848
[![Renovate](https://{{ repo_url() }}/actions/workflows/renovate.yml/badge.svg)](https://{{ repo_url() }}/actions/workflows/renovate.yml)
49-
[%- elif repo_host_type == 'gitlab.com' or repo_host_type == 'gitlab-self-managed' -%]
49+
[%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' -%]
5050
[![pipeline status](https://{{ repo_url() }}/badges/main/pipeline.svg)](https://{{ repo_url() }}/-/commits/main)
5151
[%- endif %]
5252
[%- endmacro %]
5353

5454
[% macro release_badge() -%]
55-
[%- if repo_host_type == 'gitlab.com' or repo_host_type == 'gitlab-self-managed' -%]
55+
[%- if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' -%]
5656
[![Latest Release](https://{{ repo_url() }}/-/badges/release.svg)](https://{{ repo_url() }}/-/releases)
5757
[%- endif -%]
5858
[![PyPI](https://img.shields.io/pypi/v/{{ package_name }})](https://pypi.org/project/{{ package_name }}/)

template/.renovaterc.json.jinja

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
":enablePreCommit",
9898
":maintainLockFilesWeekly"
9999
],
100-
[%- if repo_host_type == "gitlab.com" or reop_host_type == "gitlab-self-managed" or project_name == "Serious Scaffold Python" %]
100+
[%- if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' or project_name == 'Serious Scaffold Python' %]
101101
"gitlabci": {
102102
"fileMatch": [
103103
"^.gitlab/workflows/.*\\.yml$"
@@ -203,10 +203,10 @@
203203
"github-tags"
204204
],
205205
"matchDepNames": [
206-
[%- if repo_host_type == "github.com" %]
206+
[%- if repo_platform == "github" %]
207207
"ghcr.io/renovatebot/renovate",
208208
[%- endif %]
209-
[%- if repo_host_type == "gitlab.com" or reop_host_type == "gitlab-self-managed" or project_name == "Serious Scaffold Python" %]
209+
[%- if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' or project_name == 'Serious Scaffold Python' %]
210210
"renovate/renovate",
211211
[%- endif %]
212212
"renovatebot/pre-commit-hooks"

template/Makefile.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ doc: changelog doc-gen doc-mypy doc-coverage
157157

158158
consistency:
159159
find . -maxdepth 1 | grep -vE '(\.|\.git|template|includes|copier\.yaml|pdm\.lock)$$' | xargs -I {} rm -r {}
160-
copier copy -r HEAD --data-file includes/copier-answers-sample.yml --data repo_host_type=gitlab.com -f . .
160+
copier copy -r HEAD --data-file includes/copier-answers-sample.yml --data repo_platform=gitlab -f . .
161161
rm -rf .copier-answers.yml
162162
copier copy -r HEAD --data-file includes/copier-answers-sample.yml -f . .
163163
rm -rf .copier-answers.yml

0 commit comments

Comments
 (0)