diff --git a/old/checker/cloner-lib-general b/old/checker/cloner-lib-general deleted file mode 100644 index 84e5ea0..0000000 --- a/old/checker/cloner-lib-general +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# configure -export CCLONE_PATH=$BASE/repos -export CCLONE_CACHE=$BASE/cache -export CONFIG_DIR=$BASE/config - -function die(){ - echo "$@" 1>&2 - exit 1 -} - diff --git a/old/checker/run-checker b/old/checker/run-checker index cb41281..2048fc7 100755 --- a/old/checker/run-checker +++ b/old/checker/run-checker @@ -4,7 +4,6 @@ IFS=$'\n\t' # source libs mydir=$(dirname $(realpath $0)) -source $mydir/cloner-lib-general source $mydir/cloner-lib-cfg source $mydir/detector-lib-cfg diff --git a/repo_cloner/lib/default_cloner_config.py b/repo_cloner/lib/default_cloner_config.py new file mode 100644 index 0000000..d4f5e05 --- /dev/null +++ b/repo_cloner/lib/default_cloner_config.py @@ -0,0 +1,29 @@ +class DefaultClonerConfig: + def __init__(self): + properties = list(filter(lambda prop: not str(prop).startswith("__"), dir(self))) + self.__properties: list = properties + + @property + def cloner_repo_url(self) -> str: + return "" + + @property + def cloner_project_name(self) -> str: + return "" + + @property + def cloner_interval(self) -> int: + return 5 + + @property + def cloner_submodules(self) -> bool: + return True + + @property + def cloner_submodule_depth(self) -> int: + return 50000 + + def has_property(self, prop: str) -> bool: + if prop == "has_property": + return False + return prop in self.__properties \ No newline at end of file diff --git a/tests/lib/test_default_cloner_config.py b/tests/lib/test_default_cloner_config.py new file mode 100644 index 0000000..cd79520 --- /dev/null +++ b/tests/lib/test_default_cloner_config.py @@ -0,0 +1,36 @@ +from repo_cloner.lib.default_cloner_config import DefaultClonerConfig + + +def test_init(): + x = DefaultClonerConfig() + assert isinstance(x, DefaultClonerConfig) + + +def test_types(): + x = DefaultClonerConfig() + assert isinstance(x.cloner_project_name, str) + assert isinstance(x.cloner_repo_url, str) + assert isinstance(x.cloner_interval, int) + assert isinstance(x.cloner_submodules, bool) + assert isinstance(x.cloner_submodule_depth, int) + assert isinstance(x.has_property("wut"), bool) + + +def test_values(): + x = DefaultClonerConfig() + assert x.cloner_project_name == "" + assert x.cloner_repo_url == "" + assert x.cloner_interval == 5 + assert x.cloner_submodules + assert x.cloner_submodule_depth == 50000 + + +def test_has_property(): + x = DefaultClonerConfig() + assert not x.has_property("nonexistent") + assert x.has_property("cloner_project_name") + assert x.has_property("cloner_repo_url") + assert x.has_property("cloner_interval") + assert x.has_property("cloner_submodules") + assert x.has_property("cloner_submodule_depth") + \ No newline at end of file