Skip to content

Commit 647e2b6

Browse files
committed
refactor: ♻️ update copier vars
1 parent 4b78898 commit 647e2b6

File tree

5 files changed

+30
-31
lines changed

5 files changed

+30
-31
lines changed

copier.yaml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ _tasks:
99
# Message to show after generating or regenerating the project successfully
1010
_message_after_copy: |
1111
12-
Your project "{{ package_abbrev }}" has been created successfully!
12+
Your project "{{ github_repo }}" has been created successfully!
1313
1414
See the [guide](https://template-data-package.seedcase-project.org/docs/guide) for more detail
1515
on the next steps. Briefly:
@@ -49,14 +49,14 @@ _message_after_copy: |
4949
```
5050
5151
# Questions:
52-
package_github_repo:
52+
github_user:
5353
type: str
54-
help: "What is the GitHub repository spec for the package?"
55-
placeholder: "user/repo"
56-
validator: |
57-
{% if package_github_repo and not (package_github_repo | regex_search('^[\w.-]+\/[\w.-]+$')) %}
58-
Must be in the format `user/repo` and contain only alphanumeric characters and `_`, `-`, or `.`.
59-
{% endif %}
54+
help: "What is the name of the GitHub user or organisation where the repository will be or is stored?"
55+
56+
github_repo:
57+
type: str
58+
help: "What is the name of the GitHub repository where the data package will be or is stored? We strongly recommend using the default given."
59+
default: "{{ _folder_name }}"
6060

6161
author_given_name:
6262
type: str
@@ -70,16 +70,10 @@ author_email:
7070
type: str
7171
help: "What is your email address?"
7272

73-
package_abbrev:
74-
type: str
75-
help: "What is the abbreviated name of the package? This could be the name of your GitHub repository and should be a short, lowercase name without spaces or special characters. For example, 'template-data-package'."
76-
default: "{{ _copier_conf.dst_path | basename }}"
77-
7873
review_team:
7974
type: str
8075
help: What GitHub team is responsible for reviewing pull requests?
81-
default: >-
82-
{{ "@%s/developers" % package_github_repo.split('/')[0] if package_github_repo else "" }}
76+
default: "{{ '@%s/developers' % github_user if github_user else '' }}"
8377

8478
github_board_number:
8579
type: str
@@ -89,12 +83,18 @@ github_board_number:
8983
The board number must be an integer.
9084
{% endif %}
9185
92-
copyright_year:
93-
type: str
94-
default: "{{ copyright_year | default('%Y' | strftime) }}"
95-
when: false
96-
9786
cc0_license:
9887
type: bool
9988
default: true
10089
help: "Do you want to use the CC0 license for the data in this data package?"
90+
91+
# Configurations not asked
92+
github_repo_spec:
93+
type: str
94+
default: "{{ github_user }}/{{ github_repo }}"
95+
when: false
96+
97+
copyright_year:
98+
type: str
99+
default: "{{ copyright_year | default('%Y' | strftime) }}"
100+
when: false

justfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ test:
4545
--vcs-ref=$commit \
4646
--defaults \
4747
--trust \
48-
--data package_abbrev=$test_name \
49-
--data package_github_repo="first-last/${test_name}" \
48+
--data github_repo=$test_name \
49+
--data github_user="first-last" \
5050
--data author_given_name="First" \
5151
--data author_family_name="Last" \
5252
--data author_email="first.last@example.com" \
@@ -80,8 +80,8 @@ test:
8080
--defaults \
8181
--trust \
8282
--overwrite \
83-
--data package_abbrev=$test_name \
84-
--data package_github_repo="first-last/${test_name}" \
83+
--data github_repo=$test_name \
84+
--data github_user="first-last" \
8585
--data author_given_name="First" \
8686
--data author_family_name="Last" \
8787
--data author_email="first.last@example.com" \

template/CITATION.cff.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ keywords:
2121
# TODO: Add a data license for the data package.
2222
license: ""
2323
message: "If you use this data package, please cite it using these metadata."
24-
repository-code: "https://github.com/{{ package_github_repo }}"
24+
repository-code: "https://github.com/{{ github_repo_spec }}"
2525
# TODO: Add a URL for any website for the data package.
2626
# url: ""

template/LICENSE-MIT.md.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22

3-
Copyright (c) {{ copyright_year }} {{ package_abbrev }} authors
3+
Copyright (c) {{ copyright_year }} {{ github_repo }} authors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

template/pyproject.toml.jinja

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[project]
2-
name = "{{ package_abbrev }}"
2+
name = "{{ github_repo }}"
33
version = "0.1.0"
44
# TODO: Add a description of the package.
55
description = ""
@@ -20,8 +20,7 @@ license = "MIT"
2020
license-files = ["LICENSE-MIT.md"]
2121
{% endif %}
2222
requires-python = ">=3.12"
23-
{% if package_github_repo %}
23+
2424
[project.urls]
25-
issues = "https://github.com/{{ package_github_repo }}/issues"
26-
repository = "https://github.com/{{ package_github_repo }}"
27-
{% endif %}
25+
issues = "https://github.com/{{ github_repo_spec }}/issues"
26+
repository = "https://github.com/{{ github_repo_spec }}"

0 commit comments

Comments
 (0)