Skip to content

Commit

Permalink
feature(scripts): Added Console Output to config Command.
Browse files Browse the repository at this point in the history
Added more logging to build.
  • Loading branch information
acederberg committed Nov 22, 2024
1 parent f8268d5 commit 522bb7e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
12 changes: 9 additions & 3 deletions acederbergio/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@ def fromRepo(
_git_commit = env.get("build_git_commit", _git_commit)
_git_ref = env.get("build_git_ref", _git_ref)

repo = git.Repo(env.ROOT)
git_ref = _git_ref or str(repo.head.ref)
git_commit = _git_commit or str(repo.head.commit)
if _git_commit is None or _git_ref is None:
logger.debug("Getting repository information from repository.")
repo = git.Repo(env.ROOT)
git_ref = _git_ref or str(repo.head.ref)
git_commit = _git_commit or str(repo.head.commit)

return cls(git_ref=git_ref, git_commit=git_commit) # type: ignore

Expand Down Expand Up @@ -316,6 +318,7 @@ def google_analytics(
"Add google analytics."

context: Context = _context.obj
rich.print(f"[green]Adding google analytics to ``{context.quarto}``.")
google_tracking_id = env.require("google_tracking_id", _google_tracking_id)
context.set_tracking_id(google_tracking_id)

Expand Down Expand Up @@ -344,6 +347,7 @@ def announcement(
raise typer.Exit(105)

context: Context = _context.obj
rich.print(f"[green]Adding announcement to ``{context.quarto}``.")
context.set_announcement(content, position=position, type_=type_) # type: ignore


Expand All @@ -356,6 +360,7 @@ def build_info(
"Create ``build.json``."

context: Context = _context.obj
rich.print(f"[green]Adding build metadata in ``{context.build_json}``.")
context.spawn_variables(_git_commit=_git_commit, _git_ref=_git_ref)


Expand All @@ -369,6 +374,7 @@ def icons(
with open(env.PYPROJECT_TOML, "r") as file:
config = toml.load(file)

rich.print("[green]Cloning iconify iconsets.")
if not _include:
_include = list(
item["name"] for item in config["tool"]["acederbergio"]["icons"]["sets"]
Expand Down
2 changes: 1 addition & 1 deletion acederbergio/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def validator(v: Any) -> Any:

def create_logger(name: str):

level = require("log_level", "WARNING")
level = require("log_level", "WARNING").upper()
logger = logging.getLogger(name)
logger.setLevel(level)

Expand Down
7 changes: 4 additions & 3 deletions docker/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ RUN \
&& poetry install --no-root --with quarto"


COPY ./acederbergio /quarto/app/acederbergio
RUN \
--mount=type=bind,target=/quarto/app/acederbergio,source=./acederbergio \
bash -c "\
source $ACEDERBERG_IO_VENV/bin/activate \
&& touch README.md \
Expand All @@ -125,14 +125,15 @@ ARG ACEDERBERG_IO_PREVIEW
ENV \
ACEDERBERG_IO_BUILD_GIT_COMMIT="${ACEDERBERG_IO_BUILD_GIT_COMMIT}" \
ACEDERBERG_IO_BUILD_GIT_REF="${ACEDERBERG_IO_BUILD_GIT_REF}" \
ACEDERBERG_IO_PREVIEW="${ACEDERBERG_IO_PREVIEW}"
ACEDERBERG_IO_PREVIEW="${ACEDERBERG_IO_PREVIEW}" \
ACEDERBERG_IO_LOG_LEVEL="INFO"

RUN \
--mount=type=secret,id=kaggle_json,target=/quarto/kaggle.json,required \
--mount=type=secret,id=google_tracking_id,env=ACEDERBERG_IO_GOOGLE_TRACKING_ID,required \
bash -c "\
source $ACEDERBERG_IO_VENV/bin/activate \
poetry run python -m acederbergio.config all \
poetry run acederbergio config all \
&& poetry run quarto render blog"

# end snippet builder
Expand Down

0 comments on commit 522bb7e

Please sign in to comment.