Merge pull request #15 from mb-wali/module

module modification
* updated the module structure
* closed #11
This commit is contained in:
mb-wali
2020-07-27 11:20:46 +02:00
committed by GitHub
14 changed files with 15 additions and 152 deletions

View File

@@ -1,15 +0,0 @@
.git
*.gitignore
*.mo
*.pyc
*.swp
*.swo
*.~
.dockerignore
Dockerfile
docker-compose.yml
docker-compose-dev.yml
Procfile*

View File

@@ -33,7 +33,6 @@ python:
before_install:
- "nvm install 6; nvm use 6"
- "sudo apt-get install -y libxml2-dev libxmlsec1-dev"
- "travis_retry pip install --upgrade pip setuptools py"
- "travis_retry pip install twine wheel coveralls requirements-builder"
- "requirements-builder -e all --level=min setup.py > .travis-lowest-requirements.txt"
@@ -51,13 +50,15 @@ after_success:
- coveralls
deploy:
skip_cleanup: true
skip_existing: true
provider: pypi
user: inveniosoftware
username: __token__
password:
secure: TODO:PYPISECUREHASH
distributions: "compile_catalog sdist bdist_wheel"
secure: XJtAAKVZu/bhcS3/2VAYuHmx8QChSvKis22lhAhzArMF6g+T5NDsbrn2EppBbXE2wNqiwSiMAgsebu/9wxXIRIbPbwLqb4T9SF2j/zmnhpz9ORwrniawwsc+eKamZtpdSrEpCVlrSJeat9tGxV3jKy//4T50CHLRdQA/gGGlEfBEybTtorpEyQp08Y5xIbYrFFsidjMz++gQeHiWMJ7ZSWGewJ62exYNu/Hjr6h5hk6J7yC7FhFKtcDdvWrBfiuM6JkerCRxoXBEAQWki/D1tBO0N8w20wa9dw0rzx82T5Br1uqCC1kr68Sqt7jpXKp+nCs/ClHb4cFAnXtHJ3CZd+xRBE1BX2Akgj/YyP99Epw4UIJGuoZzqHCKjoF/Nj5toMiu8VqQeR2cLCuPbzubfIkLTYMJseClLsVIn8bh5fvucIBcvLYlceuW8XU0GFrh4kN/UJTkU5a2T8fdretWrbyrssjRislXFksYMOsJz1B70EGgRqZDkSm+t6otzXbkh0ZenjMRE/U2cYyOEv6zJ7PBQMfqKucTvdv8XrEjU8zLo33K034sVEJelLObO8tXher4ut8erAwZzrD1Up8+1/VqB/TvxPINbaET5ye4y+3Q8qqSQxcLnM3zUHVbEbOBMOvUoWyPfXzpEmo0I0TowTghvgncYQ6oLHr+5TiU/J0=
distributions: sdist bdist_wheel
on:
tags: true
python: "3.6"
repo: https://github.com/mb-wali/invenio-config-tugraz
repo: mb-wali/invenio-config-tugraz
condition: $DEPLOY = true

View File

@@ -9,7 +9,7 @@
invenio-config-tugraz
=======================
.. image:: https://img.shields.io/travis/inveniosoftware/invenio-config-tugraz.svg
.. image:: https://travis-ci.com/mb-wali/invenio-config-tugraz.svg
:target: https://travis-ci.com/github/mb-wali/invenio-config-tugraz
.. image:: https://img.shields.io/pypi/dm/invenio-config-tugraz.svg
@@ -24,8 +24,8 @@
.. image:: https://readthedocs.org/projects/invenio-config-tugraz/badge/?version=latest
:target: https://invenio-config-tugraz.readthedocs.io/en/latest/?badge=latest
.. image:: https://coveralls.io/repos/github/mb-wali/invenio-config-tugraz/badge.svg?branch=master
:target: https://coveralls.io/github/mb-wali/invenio-config-tugraz?branch=master
.. image:: https://img.shields.io/coveralls/mb-wali/invenio-config-tugraz.svg
:target: https://coveralls.io/r/mb-wali/invenio-config-tugraz
invenio module that adds tugraz configs.

View File

@@ -11,9 +11,3 @@ API Docs
.. automodule:: invenio_config_tugraz.ext
:members:
Views
-----
.. automodule:: invenio_config_tugraz.views
:members:

View File

@@ -10,12 +10,8 @@
from flask_babelex import gettext as _
INVENIO_CONFIG_TUGRAZ_DEFAULT_VALUE = 'foobar'
"""Default value for the application."""
INVENIO_CONFIG_TUGRAZ_BASE_TEMPLATE = 'invenio_config_tugraz/base.html'
"""Default base template for the demo page."""
INVENIO_CONFIG_TUGRAZ_SHIBBOLETH = True
"""Set True if SAML is configured"""
# Invenio-App
# ===========
@@ -94,9 +90,6 @@ MAIL_SUPPRESS_SEND = False
# ===========
# See https://invenio-shibboleth.readthedocs.io/en/latest/configuration.html
INVENIO_CONFIG_TUGRAZ_SHIBBOLETH = True
"""Set True if SAML is configured"""
USERPROFILES_EXTEND_SECURITY_FORMS = True
"""Set True in order to register user_profile.

View File

@@ -18,10 +18,6 @@ class invenioconfigtugraz(object):
def __init__(self, app=None):
"""Extension initialization."""
# TODO: This is an example of translation string with comment. Please
# remove it.
# NOTE: This is a note to a translator.
_('A translation string')
if app:
self.init_app(app)
@@ -32,12 +28,6 @@ class invenioconfigtugraz(object):
def init_config(self, app):
"""Initialize configuration."""
# Use theme's base template if theme is installed
if 'BASE_TEMPLATE' in app.config:
app.config.setdefault(
'INVENIO_CONFIG_TUGRAZ_BASE_TEMPLATE',
app.config['BASE_TEMPLATE'],
)
for k in dir(config):
if k.startswith('INVENIO_CONFIG_TUGRAZ_'):
app.config.setdefault(k, getattr(config, k))

View File

@@ -1,16 +0,0 @@
{#
Copyright (C) 2020 Mojib Wali.
invenio-config-tugraz is free software; you can redistribute it and/or
modify it under the terms of the MIT License; see LICENSE file for more
details.
#}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
</head>
<body>
{%- block page_body %}{%- endblock page_body %}
</body>
</html>

View File

@@ -1,15 +0,0 @@
{#
Copyright (C) 2020 Mojib Wali.
invenio-config-tugraz is free software; you can redistribute it and/or
modify it under the terms of the MIT License; see LICENSE file for more
details.
#}
{%- extends config.INVENIO_CONFIG_TUGRAZ_BASE_TEMPLATE %}
{%- block page_body %}
TODO: Example template, please remove if you do not need it.
{{_('Welcome to %(module_name)s', module_name=module_name)}}
{%- endblock %}

View File

@@ -12,4 +12,4 @@ This file is imported by ``invenio_config_tugraz.__init__``,
and parsed by ``setup.py``.
"""
__version__ = '1.0.0.dev20200000'
__version__ = '0.1.0'

View File

@@ -1,30 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 Mojib Wali.
#
# invenio-config-tugraz is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""invenio module that adds tugraz configs."""
# TODO: This is an example file. Remove it if you do not need it, including
# the templates and static folders as well as the test case.
from flask import Blueprint, render_template
from flask_babelex import gettext as _
blueprint = Blueprint(
'invenio_config_tugraz',
__name__,
template_folder='templates',
static_folder='static',
)
@blueprint.route("/")
def index():
"""Render a basic view."""
return render_template(
"invenio_config_tugraz/index.html",
module_name=_('invenio-config-tugraz'))

View File

@@ -8,7 +8,7 @@
# details.
pydocstyle invenio_config_tugraz tests docs && \
isort -rc -c -df && \
isort --check-only --diff && \
check-manifest --ignore ".travis-*" && \
sphinx-build -qnNW docs docs/_build/html && \
python setup.py test

View File

@@ -16,28 +16,13 @@ readme = open('README.rst').read()
history = open('CHANGES.rst').read()
tests_require = [
'check-manifest>=0.25',
'coverage>=4.0',
'isort>=4.3.3, <5.0.0',
'pydocstyle>=2.0.0',
'pytest-cov>=2.5.1',
'pytest-pep8>=1.0.6',
'pytest-invenio>=1.2.1',
'pytest-invenio>=1.3.2',
]
extras_require = {
'docs': [
'Sphinx>=1.5.1',
],
'mysql': [
'invenio-db[mysql]>=1.0.0',
],
'postgresql': [
'invenio-db[postgresql]>=1.0.0',
],
'sqlite': [
'invenio-db>=1.0.0',
],
'tests': tests_require,
}
@@ -52,7 +37,6 @@ setup_requires = [
install_requires = [
'Flask-BabelEx>=0.9.4',
'invenio_oauthclient>=1.2.1',
]
@@ -83,26 +67,12 @@ setup(
'invenio_base.apps': [
'invenio_config_tugraz = invenio_config_tugraz:invenioconfigtugraz',
],
'invenio_base.blueprints': [
'invenio_config_tugraz = invenio_config_tugraz.views:blueprint',
],
'invenio_i18n.translations': [
'messages = invenio_config_tugraz',
],
'invenio_config.module': [
'invenio_config_tugraz = invenio_config_tugraz.config',
],
# TODO: Edit these entry points to fit your needs.
# 'invenio_access.actions': [],
# 'invenio_admin.actions': [],
# 'invenio_assets.bundles': [],
# 'invenio_base.api_apps': [],
# 'invenio_base.api_blueprints': [],
# 'invenio_base.blueprints': [],
# 'invenio_celery.tasks': [],
# 'invenio_db.models': [],
# 'invenio_pidstore.minters': [],
# 'invenio_records.jsonresolver': [],
},
extras_require=extras_require,
install_requires=install_requires,
@@ -120,6 +90,6 @@ setup(
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Development Status :: 1 - Planning',
'Development Status :: 3 - Alpha',
],
)

View File

@@ -20,7 +20,6 @@ from flask import Flask
from flask_babelex import Babel
from invenio_config_tugraz import invenioconfigtugraz
from invenio_config_tugraz.views import blueprint
@pytest.fixture(scope='module')
@@ -40,6 +39,5 @@ def create_app(instance_path):
app.config.update(**config)
Babel(app)
invenioconfigtugraz(app)
app.register_blueprint(blueprint)
return app
return factory

View File

@@ -30,10 +30,3 @@ def test_init():
assert 'invenio-config-tugraz' not in app.extensions
ext.init_app(app)
assert 'invenio-config-tugraz' in app.extensions
def test_view(base_client):
"""Test view."""
res = base_client.get("/")
assert res.status_code == 200
assert 'Welcome to invenio-config-tugraz' in str(res.data)