From 0eb8be33c009507ac483cdda9a6df931baebf4b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 29 Jul 2016 16:48:43 +0200 Subject: [PATCH] Skeleton structure of a Pillar extension. --- .gitignore | 10 ++++++++ LICENSE.txt | 13 ++++++++++ attract_server/__init__.py | 51 ++++++++++++++++++++++++++++++++++++++ attract_server/modules.py | 8 ++++++ setup.cfg | 5 ++++ setup.py | 21 ++++++++++++++++ 6 files changed, 108 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE.txt create mode 100644 attract_server/__init__.py create mode 100644 attract_server/modules.py create mode 100644 setup.cfg create mode 100644 setup.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1c17879 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +.DS_Store +.project +.coverage +*.pyc +__pycache__ + +/build +/.cache +/*.egg-info/ +/.eggs/ diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..41fbe44 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,13 @@ +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. diff --git a/attract_server/__init__.py b/attract_server/__init__.py new file mode 100644 index 0000000..183f89d --- /dev/null +++ b/attract_server/__init__.py @@ -0,0 +1,51 @@ +from pillar_server.extension import PillarExtension + +from .modules import blueprint + + +class AttractExtension(PillarExtension): + @property + def name(self): + return 'attract' + + def flask_config(self): + """Returns extension-specific defaults for the Flask configuration. + + Use this to set sensible default values for configuration settings + introduced by the extension. + + :rtype: dict + """ + + return {} + + def eve_settings(self): + """Returns extensions to the Eve settings. + + Currently only the DOMAIN key is used to insert new resources into + Eve's configuration. + + :rtype: dict + """ + return { + 'DOMAIN': { + 'tasks': { + 'schema': { + 'name': { + 'type': 'string', + }, + + } + } + } + } + + def blueprints(self): + """Returns the list of top-level blueprints for the extension. + + These blueprints will be mounted at the url prefix given to + app.load_extension(). + + :rtype: list of flask.Blueprint objects. + """ + return [blueprint] diff --git a/attract_server/modules.py b/attract_server/modules.py new file mode 100644 index 0000000..0c0b317 --- /dev/null +++ b/attract_server/modules.py @@ -0,0 +1,8 @@ +from flask import Blueprint + +blueprint = Blueprint('attract', __name__) + + +@blueprint.route('/jemoeder') +def jemoeder(): + return 'je moeder' diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..1bddd2f --- /dev/null +++ b/setup.cfg @@ -0,0 +1,5 @@ +[pytest] +addopts = -v --cov attract_server --cov-report term-missing + +[pep8] +max-line-length = 100 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..cf132a5 --- /dev/null +++ b/setup.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +"""Setup file for the Attract extension.""" + +import setuptools + +setuptools.setup( + name='attract-server', + version='1.0', + packages=setuptools.find_packages('.', exclude=['test']), + install_requires=[ + 'pillar-server>=2.0', + ], + tests_require=[ + 'pytest>=2.9.1', + 'responses>=0.5.1', + 'pytest-cov>=2.2.1', + 'mock>=2.0.0', + ], + zip_safe=False, +)