Skip to content

Commit

Permalink
fix: Bundle template configuration file next to code (#189)
Browse files Browse the repository at this point in the history
* fix: Bundle template configuration file next to code

* fix: Bundle more assets
  • Loading branch information
Heiko Nickerl authored Aug 2, 2021
1 parent c635629 commit 3c82cf2
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 24 deletions.
17 changes: 0 additions & 17 deletions bin/sodalite

This file was deleted.

4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ readme = "README.md"
homepage = "https://github.com/hnicke/sodalite"
repository = "https://github.com/hnicke/sodalite"
include = [
"CHANGELOG.md", "docs/sodalite.conf",
"CHANGELOG.md", "copyright","sodalite.desktop",
"scripts/shell-integration.*",
"scripts/sodalite-open",
"docs/sodalite.1.md", "docs/sodalite.1",
"docs/sodalite-open.1.md", "docs/sodalite-open.1",
]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion sodalite/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class ConfigNotFound(Exception):

_ENV_CONFIG_FILE = 'CONFIG_FILE'

CONFIG_TEMPLATE = Path(__file__).parent.absolute() / 'sodalite.conf'


@functools.cache
def _config_file() -> Path:
Expand All @@ -37,7 +39,7 @@ def _config_file() -> Path:
return config_file
else:
logger.info(f"Creating config file '{config_file}'")
shutil.copy(src=env.DOCS / 'sodalite.conf', dst=config_file)
shutil.copy(src=CONFIG_TEMPLATE, dst=config_file)
return config_file

raise ConfigNotFound()
Expand Down
File renamed without changes.
3 changes: 0 additions & 3 deletions sodalite/util/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,3 @@
dirs = [USER_DATA, USER_CONFIG, buffer]
for directory in dirs:
os.makedirs(directory, exist_ok=True)

ROOT = Path(__file__).parent.parent.parent.absolute()
DOCS = ROOT / 'docs'
5 changes: 3 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from pathlib import Path
from unittest.mock import Mock

from _pytest.monkeypatch import MonkeyPatch
from pytest import fixture

from sodalite.core import config


@fixture(autouse=True)
def config_env_variable(monkeypatch: MonkeyPatch) -> None:
monkeypatch.setenv('CONFIG_FILE', str(Path('docs/sodalite.conf').absolute()))
monkeypatch.setenv('CONFIG_FILE', str(config.CONFIG_TEMPLATE))


@fixture
Expand Down

0 comments on commit 3c82cf2

Please sign in to comment.