Commit 25bf1c77 authored by Felix Delattre's avatar Felix Delattre
Browse files

Renamed rcli to rabotai

parent ca959b4f
Pipeline #22540 passed with stage
in 3 minutes and 2 seconds
...@@ -19,7 +19,7 @@ test: ...@@ -19,7 +19,7 @@ test:
coverage: coverage:
script: script:
- pytest --cov=rcli/ tests/ - pytest --cov=rabotai/ tests/
- coverage xml - coverage xml
artifacts: artifacts:
reports: reports:
......
...@@ -28,15 +28,15 @@ from .argument_factory import ArgumentFactory ...@@ -28,15 +28,15 @@ from .argument_factory import ArgumentFactory
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class RCLI: class RABOTAI:
"""The Rabotnik Command-Line Interface (RCLI). """The Rabotnik Command-Line Interface (RABOTAI).
Communicate with nodes running within the `rabotnik` ecosystem via the `message_bus`. Communicate with nodes running within the `rabotnik` ecosystem via the `message_bus`.
Args: Args:
parser: Creates and parses command line arguments. parser: Creates and parses command line arguments.
Attributes: Attributes:
arguments: The arguments that are made available in the rcli. arguments: The arguments that are made available in the rabotai.
""" """
def __init__(self, parser: argparse.ArgumentParser): def __init__(self, parser: argparse.ArgumentParser):
...@@ -73,7 +73,7 @@ class RCLI: ...@@ -73,7 +73,7 @@ class RCLI:
def main(args: list = None, message_bus: MessageBus = None): def main(args: list = None, message_bus: MessageBus = None):
"""RCLI entry point. """RABOTAI entry point.
Args: Args:
args: List of arguments. If not provided, read arguments from commandline args: List of arguments. If not provided, read arguments from commandline
...@@ -88,8 +88,8 @@ def main(args: list = None, message_bus: MessageBus = None): ...@@ -88,8 +88,8 @@ def main(args: list = None, message_bus: MessageBus = None):
args = args or sys.argv[1:] args = args or sys.argv[1:]
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
rcli = RCLI(parser=parser) rabotai = RABOTAI(parser=parser)
rcli.setup_parser() rabotai.setup_parser()
group = parser.add_argument_group("message bus") group = parser.add_argument_group("message bus")
...@@ -131,9 +131,9 @@ def main(args: list = None, message_bus: MessageBus = None): ...@@ -131,9 +131,9 @@ def main(args: list = None, message_bus: MessageBus = None):
) )
) )
rcli.set_message_bus(message_bus) rabotai.set_message_bus(message_bus)
# Parse `args` to dictionary. # Parse `args` to dictionary.
args_dict = vars(args) args_dict = vars(args)
loop.run_until_complete(rcli.execute(args_dict)) loop.run_until_complete(rabotai.execute(args_dict))
...@@ -17,12 +17,8 @@ ...@@ -17,12 +17,8 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from setuptools import setup, find_packages from setuptools import setup, find_packages
with open(os.path.join("VERSION")) as version_file:
version = version_file.read().strip()
tests_require = [ tests_require = [
"pytest", "pytest",
"pytest-asyncio", "pytest-asyncio",
...@@ -33,18 +29,18 @@ tests_require = [ ...@@ -33,18 +29,18 @@ tests_require = [
linters_require = ["pylint", "pre-commit"] linters_require = ["pylint", "pre-commit"]
setup( setup(
name="rcli", name="rabotai",
version=version, version="0.0.3",
description="Rabotnik command-line interface", description="Rabotnik command-line interface",
author="Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ", author="Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ",
license="AGPLv3+", license="AGPLv3+",
install_requires=["rabotnik==0.0.2"], install_requires=["rabotnik==0.0.3"],
tests_require=tests_require, tests_require=tests_require,
extras_require={ extras_require={
"tests": tests_require, "tests": tests_require,
"linters": linters_require, "linters": linters_require,
}, },
entry_points={"console_scripts": ["rcli = rcli.rcli:main"]}, entry_points={"console_scripts": ["rabotai = rabotai.rabotai:main"]},
packages=find_packages(), packages=find_packages(),
python_requires=">=3.6", python_requires=">=3.6",
) )
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see http://www.gnu.org/licenses/. # along with this program. If not, see http://www.gnu.org/licenses/.
from rcli.argument_base import ArgumentBase from rabotai.argument_base import ArgumentBase
def test_get_format_argument(): def test_get_format_argument():
......
...@@ -20,7 +20,7 @@ import asyncio ...@@ -20,7 +20,7 @@ import asyncio
import pytest import pytest
import argparse import argparse
from rcli.rcli import RCLI from rabotai.rabotai import RABOTAI
class MockMessageBus: class MockMessageBus:
...@@ -34,19 +34,19 @@ class MockMessageBus: ...@@ -34,19 +34,19 @@ class MockMessageBus:
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_rcli(): async def test_rabotai():
message_bus = MockMessageBus() message_bus = MockMessageBus()
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
rcli = RCLI(parser=parser) rabotai = RABOTAI(parser=parser)
rcli.set_message_bus(message_bus) rabotai.set_message_bus(message_bus)
rcli.setup_parser() rabotai.setup_parser()
help_formatted = parser.format_help() help_formatted = parser.format_help()
assert help_formatted.startswith("usage:") assert help_formatted.startswith("usage:")
arguments = {"building_id": "1"} arguments = {"building_id": "1"}
await rcli.execute(arguments) await rabotai.execute(arguments)
assert message_bus.calls == [((), {"message": "building", "payload": {"building_id": "1"}})] assert message_bus.calls == [((), {"message": "building", "payload": {"building_id": "1"}})]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment