Skip to content

Commit

Permalink
Apply upstream plugin template changes to project
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmayer committed Jul 6, 2024
1 parent 95b89d9 commit 7a1505f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/getpelican/cookiecutter-pelican-plugin",
"commit": "0579066539904eb127ff24841f2bdb29fd7d57ad",
"commit": "f9a088515d09675d433595982ae643c3fe323c50",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ jobs:
uses: pdm-project/setup-pdm@v4
with:
python-version: "3.10"
cache: true
cache-dependency-path: ./pyproject.toml

- name: Install dependencies
run: pdm install
Expand Down
2 changes: 1 addition & 1 deletion pelican/plugins/featured_image/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .featured_image import * # NOQA
from .featured_image import * # noqa: F403,PGH004,RUF100
14 changes: 13 additions & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
BIN_DIR = "bin" if os.name != "nt" else "Scripts"
VENV_BIN = Path(VENV) / Path(BIN_DIR)

TOOLS = ("pdm", "pre-commit")
TOOLS = ("cruft", "pdm", "pre-commit")
PDM = which("pdm") if which("pdm") else (VENV_BIN / "pdm")
CMD_PREFIX = f"{VENV_BIN}/" if ACTIVE_VENV else f"{PDM} run "
CRUFT = which("cruft") if which("cruft") else f"{CMD_PREFIX}cruft"
PRECOMMIT = which("pre-commit") if which("pre-commit") else f"{CMD_PREFIX}pre-commit"
PTY = os.name != "nt"

Expand Down Expand Up @@ -79,6 +80,17 @@ def precommit(c):
c.run(f"{PRECOMMIT} install")


@task
def update(c, check=False):
"""Apply upstream plugin template changes to this project."""
if check:
logger.info("** Checking for upstream template changes **")
c.run(f"{CRUFT} check", pty=PTY)
else:
logger.info("** Updating project from upstream template **")
c.run(f"{CRUFT} update", pty=PTY)


@task
def setup(c):
"""Set up the development environment."""
Expand Down

0 comments on commit 7a1505f

Please sign in to comment.