Skeleton structure of a Pillar extension.
This commit is contained in:
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
.DS_Store
|
||||||
|
.project
|
||||||
|
.coverage
|
||||||
|
*.pyc
|
||||||
|
__pycache__
|
||||||
|
|
||||||
|
/build
|
||||||
|
/.cache
|
||||||
|
/*.egg-info/
|
||||||
|
/.eggs/
|
13
LICENSE.txt
Normal file
13
LICENSE.txt
Normal file
@@ -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.
|
51
attract_server/__init__.py
Normal file
51
attract_server/__init__.py
Normal file
@@ -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]
|
8
attract_server/modules.py
Normal file
8
attract_server/modules.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
from flask import Blueprint
|
||||||
|
|
||||||
|
blueprint = Blueprint('attract', __name__)
|
||||||
|
|
||||||
|
|
||||||
|
@blueprint.route('/jemoeder')
|
||||||
|
def jemoeder():
|
||||||
|
return 'je moeder'
|
5
setup.cfg
Normal file
5
setup.cfg
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[pytest]
|
||||||
|
addopts = -v --cov attract_server --cov-report term-missing
|
||||||
|
|
||||||
|
[pep8]
|
||||||
|
max-line-length = 100
|
21
setup.py
Normal file
21
setup.py
Normal file
@@ -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,
|
||||||
|
)
|
Reference in New Issue
Block a user