From db97251d0a900edffdf952c6d3e15ae95e721176 Mon Sep 17 00:00:00 2001 From: Cariad Eccleston Date: Tue, 19 Jan 2021 10:16:23 +0000 Subject: [PATCH] Cleanup (#12) --- docs/create-a-plugin/plugin.py.md | 2 +- docs/create-a-plugin/testing.md | 2 +- example.wev.yml | 8 -------- setup.py | 1 + wev/executor.py | 4 +--- wev/state/state.py | 10 +++++++++- wev/text/test_normalize.py | 1 + 7 files changed, 14 insertions(+), 14 deletions(-) delete mode 100644 example.wev.yml diff --git a/docs/create-a-plugin/plugin.py.md b/docs/create-a-plugin/plugin.py.md index 797a97a..b694710 100644 --- a/docs/create-a-plugin/plugin.py.md +++ b/docs/create-a-plugin/plugin.py.md @@ -24,7 +24,7 @@ class Plugin(PluginBase): ## Reading configuration -For your plugin to be invoked, the user must have a `.wev.yml` configuration that refers to it. +For your plugin to be invoked, the user must have a configuration (i.e. `wev.yml`) that refers to it. Our example plugin will resolve to whatever the user enters, but let's say we want the option to translate the input to upper or lower case. diff --git a/docs/create-a-plugin/testing.md b/docs/create-a-plugin/testing.md index a9764f3..a6cfe57 100644 --- a/docs/create-a-plugin/testing.md +++ b/docs/create-a-plugin/testing.md @@ -1,4 +1,4 @@ -Create a `.wev.yml` configuration file suitable for your plugin: +Create a `wev.yml` configuration file suitable for your plugin: ```yaml # Invoke the wev-ask plugin to set the DEFAULT_FOO environment variable: diff --git a/example.wev.yml b/example.wev.yml deleted file mode 100644 index 729af5a..0000000 --- a/example.wev.yml +++ /dev/null @@ -1,8 +0,0 @@ -MY_NAME: - plugin: - id: wev-echo - value: Bobby Pringles - -[AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN]: - plugin: - id: wev-awsmfa diff --git a/setup.py b/setup.py index bebdd35..4bcfcb6 100644 --- a/setup.py +++ b/setup.py @@ -58,6 +58,7 @@ name="wev", packages=[ "wev", + "wev.wev_echo", "wev.logging", "wev.sdk", "wev.state", diff --git a/wev/executor.py b/wev/executor.py index 7206a03..4a19333 100644 --- a/wev/executor.py +++ b/wev/executor.py @@ -1,8 +1,6 @@ from subprocess import run from typing import List -from colorama import Style - from wev.logging import get_logger from wev.resolver import resolve @@ -19,5 +17,5 @@ def execute(command: List[str]) -> int: """ logger = get_logger() variables = resolve() - logger.info("Starting %s%s%s...", Style.BRIGHT, command[0], Style.RESET_ALL) + logger.debug("Starting %s...", command[0]) return run(command, env=variables).returncode diff --git a/wev/state/state.py b/wev/state/state.py index d825e4c..36c8b09 100644 --- a/wev/state/state.py +++ b/wev/state/state.py @@ -10,7 +10,15 @@ class State(BaseState): def __init__(self) -> None: super().__init__() - self.config = dwalk(filenames=[".wev.yml", ".wev.user.yml"], include_meta=True) + self.config = dwalk( + filenames=[ + ".wev.yml", + "wev.yml", + ".wev.user.yml", + "wev.user.yml", + ], + include_meta=True, + ) self.logger.debug("Merged configuration: %s", self.config) self.logger.debug("Getting context...") self.context = self.config["__dwalk__"]["__dwalk__"]["most_specific_src"] diff --git a/wev/text/test_normalize.py b/wev/text/test_normalize.py index 3a3a1ef..0d540da 100644 --- a/wev/text/test_normalize.py +++ b/wev/text/test_normalize.py @@ -8,6 +8,7 @@ @mark.parametrize( "value, expect", [ + ((), ""), (("one",), "one"), (("one", "two"), "one and two"), (("one", "two", "three"), "one, two and three"),