Skip to content

Commit

Permalink
Merge pull request #24 from real-digital/refactor
Browse files Browse the repository at this point in the history
Refactor stuff
  • Loading branch information
hfjn committed Jul 19, 2019
2 parents c6cb17f + 1f9a450 commit af1b1c6
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
PYTHONPATH=.
ESQUE_ENV=dev
ESQUE_CONF_PATH=esque.cfg
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dist: xenial
language: python
cache: pip
env:
- TEST_CMD="pytest tests/ --integration --cov=esque --local"
- ESQUE_ENV=dev TEST_CMD="pytest tests/ --integration --cov=esque --local"
before_install:
- wget https://mirror.netcologne.de/apache.org/kafka/2.2.0/kafka_2.12-2.2.0.tgz -O kafka.tgz
- mkdir -p kafka && tar xzf kafka.tgz -C kafka --strip-components 1
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 real.digital

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include esque/config/sample_config.cfg
include scripts/auto_completion.sh
include README.md
include LICENSE
Empty file removed config/__init__.py
Empty file.
9 changes: 4 additions & 5 deletions esque/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import click

from esque.environment import ESQUE_ENV
from esque.environment import ESQUE_CONF_PATH
from esque.errors import ConfigNotExistsException, ContextNotDefinedException

RANDOM = "".join(random.choices(string.ascii_lowercase, k=8))
Expand All @@ -18,18 +18,17 @@


def config_dir() -> Path:
if ESQUE_ENV == "dev":
return Path(__file__).parent.parent
return Path(click.get_app_dir("esque", force_posix=True))


def config_path() -> Path:
if ESQUE_CONF_PATH:
return Path(ESQUE_CONF_PATH)
return config_dir() / "esque.cfg"


def sample_config_path() -> Path:
sample_path = Path(__file__).parent.parent / "config" / "sample_config.cfg"
return sample_path
return Path(__file__).parent / "config" / "sample_config.cfg"


class Config:
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion esque/environment.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import os

ESQUE_ENV = os.environ.get("ESQUE_ENV")
ESQUE_CONF_PATH = os.environ.get("ESQUE_CONF_PATH")
File renamed without changes.
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class InstallWithPostCommand(install):
def run(self):
install.run(self)
print("installing auto completion")
call(["./auto_completion.sh"])
call(["./scripts/auto_completion.sh"])


setup(
Expand All @@ -55,7 +55,6 @@ def run(self):
author_email="opensource@real-digital.de",
packages=find_packages(exclude=["tests", "tests.*"]),
entry_points={"console_scripts": ["esque=esque.cli.commands:esque"]},
package_data={"config": ["sample_config.cfg"]},
python_requires=">=3.6",
setup_requires=[],
install_requires=required,
Expand Down

0 comments on commit af1b1c6

Please sign in to comment.