Skip to content

Commit

Permalink
chore: Name 'engine' consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
bow committed Oct 14, 2023
1 parent fa6a5ad commit 0b73608
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions tests/engines_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@ def test_engine_spec_load_err_engines_file_missing(
)
theme = Theme.from_config(config)

assert theme.engines_module_path.exists()
theme.engines_module_path.unlink()
assert theme.engine_module_path.exists()
theme.engine_module_path.unlink()

with pytest.raises(VoltConfigError, match="theme engines file not found"):
with pytest.raises(VoltConfigError, match="theme engine file not found"):
EngineSpec(
config=config,
theme=theme,
Expand Down
6 changes: 3 additions & 3 deletions volt/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@
# Root module name for the theme.
THEME_ROOT_MOD_QUAL_NAME = f"{PROJECT_MOD_QUAL_NAME}.{SITE_THEMES_DIR_NAME}"

# Theme engines module name.
ENGINES_MOD_NAME = "engines"
# Theme engine module name.
ENGINES_MOD_NAME = "engine"

# File name for theme engines.
ENGINES_FILE_NAME = f"{ENGINES_MOD_NAME}.py"
ENGINE_FILE_NAME = f"{ENGINES_MOD_NAME}.py"

# Theme base settings file name.
THEME_SETTINGS_FILE_NAME = "theme.toml"
Expand Down
6 changes: 3 additions & 3 deletions volt/engines/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ def _load_engine_class(
if not name.isidentifier():
raise err.VoltConfigError(f"invalid engine class specifier: {name!r}")

fp = theme.engines_module_path
fp = theme.engine_module_path
if not fp.exists():
raise err.VoltConfigError("theme engines file not found")
raise err.VoltConfigError("theme engine file not found")

mod_name = theme.engines_module_name
mod_name = theme.engine_module_name

log.debug("loading file as module", path=fp, module=mod_name)
mod = import_file(fp, mod_name)
Expand Down
6 changes: 3 additions & 3 deletions volt/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ def module_name(self) -> str:
return f"{constants.THEME_ROOT_MOD_QUAL_NAME}.{self.name}"

@cached_property
def engines_module_name(self) -> str:
def engine_module_name(self) -> str:
"""Module name for theme engines."""
return f"{self.module_name}.{constants.ENGINES_MOD_NAME}"

@cached_property
def engines_module_path(self) -> Path:
def engine_module_path(self) -> Path:
"""Path to theme engines."""
return self.path / constants.ENGINES_FILE_NAME
return self.path / constants.ENGINE_FILE_NAME

@cached_property
def hooks_module_name(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion volt/themes/ion/theme.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[theme]
name = "ion"

[theme.engines.markdown]
[theme.engine.markdown]
module = "volt.engines:MarkdownEngine"

0 comments on commit 0b73608

Please sign in to comment.