From a6ea3966cd92870ea2c5c34f980de556a969cedf Mon Sep 17 00:00:00 2001 From: Gust Date: Tue, 4 Aug 2015 10:49:09 -0300 Subject: [PATCH] Change repository structure, enable pip install --- .gitignore | 2 ++ MANIFEST.in | 6 ++++++ README.rst | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ __init__.py | 0 admin.py | 3 --- colab_spb/__init__.py | 3 +++ colab_spb/admin.py | 3 +++ colab_spb/apps.py | 7 +++++++ colab_spb/migrations/__init__.py | 0 colab_spb/models.py | 3 +++ colab_spb/urls.py | 5 +++++ colab_spb/views.py | 3 +++ migrations/__init__.py | 0 models.py | 3 --- requirements.txt | 1 + setup.py | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests.py | 3 --- tests/__init__.py | 0 tests/config_settings.py | 9 +++++++++ tests/plugins.d/gitlab.py | 12 ++++++++++++ tests/run.py | 37 +++++++++++++++++++++++++++++++++++++ tests/settings.py | 39 +++++++++++++++++++++++++++++++++++++++ views.py | 3 --- 23 files changed, 259 insertions(+), 12 deletions(-) create mode 100644 .gitignore create mode 100644 MANIFEST.in create mode 100644 README.rst delete mode 100644 __init__.py delete mode 100644 admin.py create mode 100644 colab_spb/__init__.py create mode 100644 colab_spb/admin.py create mode 100644 colab_spb/apps.py create mode 100644 colab_spb/migrations/__init__.py create mode 100644 colab_spb/models.py create mode 100644 colab_spb/urls.py create mode 100644 colab_spb/views.py delete mode 100644 migrations/__init__.py delete mode 100644 models.py create mode 100644 requirements.txt create mode 100644 setup.py delete mode 100644 tests.py create mode 100644 tests/__init__.py create mode 100644 tests/config_settings.py create mode 100644 tests/plugins.d/gitlab.py create mode 100755 tests/run.py create mode 100644 tests/settings.py delete mode 100644 views.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f58c183 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.egg* +*pyc diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..a6a8ad4 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +include README.rst +include MANIFEST.in +recursive-include colab_spb *.html *.txt *.xml +recursive-exclude * __pycache__ +recursive-exclude * *.py[co] +include requirements.txt diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..9564760 --- /dev/null +++ b/README.rst @@ -0,0 +1,75 @@ +.. -*- coding: utf-8 -*- + +.. highlight:: rest + +.. _colab_software: + +================================= +Colab-Spb - A Gitlab-Noosfero Connector for the SPB +================================= + + + +What is Colab? +============== + +Application that integrates existing systems to represent the contributions of the members through: + +* Discussions at the mailman list. + +* And other systems in the community. + + + +Features +======== + +* Developed by Interlegis Communities http://colab.interlegis.leg.br/ + +* Written in Python http://python.org/ + +* Built with Django Web Framework https://www.djangoproject.com/ + +* Search engine with Solr https://lucene.apache.org/solr/ + + + +Installation +============ + +After installing the colab + +.. code-block:: + + pip install colab-spb + +Create a colab plugin configuration fila with at least the following: + +.. code-block:: + + vim /etc/colab/plugins.d/colab_spb.py + + name='colab_spb' + +Running Colab +============= + +To run Colab with development server you will have to: + +1- Create the example configuration file: + +.. code-block:: + + colab-init-config > /etc/colab/settings.py + +2- Edit the configuration file. Make sure you set everything you need including **database** credentials. + +3- Run the development server: + +.. code-block:: + + colab-admin runserver 0.0.0.0:8000 + + +**NOTE**: In case you want to keep the configuration file else where just set the +desired location in environment variable **COLAB_SETTINGS**. diff --git a/__init__.py b/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/__init__.py +++ /dev/null diff --git a/admin.py b/admin.py deleted file mode 100644 index 8c38f3f..0000000 --- a/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/colab_spb/__init__.py b/colab_spb/__init__.py new file mode 100644 index 0000000..b11ca64 --- /dev/null +++ b/colab_spb/__init__.py @@ -0,0 +1,3 @@ +__version__ = '0.1.0' + +default_app_config = 'colab_spb.apps.SpbAppConfig' diff --git a/colab_spb/admin.py b/colab_spb/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/colab_spb/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/colab_spb/apps.py b/colab_spb/apps.py new file mode 100644 index 0000000..165332c --- /dev/null +++ b/colab_spb/apps.py @@ -0,0 +1,7 @@ + +from django.apps import AppConfig + + +class SpbAppConfig(AppConfig): + name = 'colab.plugins.colab_spb' + verbose_name = 'SPB' diff --git a/colab_spb/migrations/__init__.py b/colab_spb/migrations/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/colab_spb/migrations/__init__.py diff --git a/colab_spb/models.py b/colab_spb/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/colab_spb/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/colab_spb/urls.py b/colab_spb/urls.py new file mode 100644 index 0000000..1225304 --- /dev/null +++ b/colab_spb/urls.py @@ -0,0 +1,5 @@ +from django.conf.urls import patterns, url + + +urlpatterns = patterns('', +) diff --git a/colab_spb/views.py b/colab_spb/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/colab_spb/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/migrations/__init__.py b/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/migrations/__init__.py +++ /dev/null diff --git a/models.py b/models.py deleted file mode 100644 index 71a8362..0000000 --- a/models.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.db import models - -# Create your models here. diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..163f2f7 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +colab \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..57b1d39 --- /dev/null +++ b/setup.py @@ -0,0 +1,54 @@ +import codecs +import os +import re + +from setuptools import setup + +# if you are not using vagrant, just delete os.link directly, +# The hard link only saves a little disk space, so you should not care +if os.environ.get('USER', '') == 'vagrant': + del os.link + +def read(*parts): + return codecs.open(os.path.join(os.path.dirname(__file__), *parts), + encoding='utf8').read() + + +def find_version(*file_paths): + version_file = read(*file_paths) + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", + version_file, re.M) + if version_match: + return version_match.group(1) + raise RuntimeError("Unable to find version string.") + + +setup( + name='colab-spb', + url='https://github.com/colab/colab-spb', + description='Yet another Django reverse proxy application.', + version=find_version('colab_spb/__init__.py'), + long_description=read('README.rst'), + packages=['colab_spb'], + install_requires=[ + 'colab', + ], + tests_require=['mock'], + test_suite="tests.run.runtests", + author='Sergio Oliveira', + author_email='sergio@tracy.com.br', + license='GPL 2.0', + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Environment :: Web Environment', + 'Framework :: Django', + 'Intended Audience :: Developers', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Topic :: Internet :: WWW/HTTP', + 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', + 'Topic :: Internet :: WWW/HTTP :: WSGI', + ], +) diff --git a/tests.py b/tests.py deleted file mode 100644 index 7ce503c..0000000 --- a/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/__init__.py diff --git a/tests/config_settings.py b/tests/config_settings.py new file mode 100644 index 0000000..98ad124 --- /dev/null +++ b/tests/config_settings.py @@ -0,0 +1,9 @@ +SECRET_KEY = 'ddddddddddddddddddddddddddddddddddddddddddddddddddddddaddddddddd' + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': 'colab.sqlite', + } +} + diff --git a/tests/plugins.d/gitlab.py b/tests/plugins.d/gitlab.py new file mode 100644 index 0000000..0af12cd --- /dev/null +++ b/tests/plugins.d/gitlab.py @@ -0,0 +1,12 @@ +from django.utils.translation import ugettext_lazy as _ +from colab.plugins.utils.menu import colab_url_factory + +name = 'colab_spb' +verbose_name = 'Spb plugin' + +urls = { + 'include': 'colab_spb.urls', + 'namespace': 'spb', + 'prefix': 'spb', +} + diff --git a/tests/run.py b/tests/run.py new file mode 100755 index 0000000..c65158c --- /dev/null +++ b/tests/run.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +import os +import sys + +os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings' +os.environ['COLAB_SETTINGS'] = 'tests/config_settings.py' +os.environ['COLAB_YAML_SETTINGS'] = 'tests/settings.yaml' +os.environ['COLAB_PLUGINS'] = 'tests/plugins.d' +os.environ['COVERAGE_PROCESS_START'] = '.coveragerc' +os.environ['REUSE_DB'] = '0' + +import django +import coverage + +from django.test.utils import get_runner +from django.conf import settings + + +def runtests(): + if django.VERSION >= (1, 7, 0): + django.setup() + + test_runner = get_runner(settings) + failures = test_runner(interactive=False, failfast=False).run_tests([]) + sys.exit(failures) + + +def run_with_coverage(): + if os.path.exists('.coverage'): + os.remove('.coverage') + coverage.process_startup() + runtests() + + +if __name__ == '__main__': + run_with_coverage() diff --git a/tests/settings.py b/tests/settings.py new file mode 100644 index 0000000..d7670d2 --- /dev/null +++ b/tests/settings.py @@ -0,0 +1,39 @@ +from colab.settings import * # noqa + +SOCIAL_NETWORK_ENABLED = True +STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' + +LOGGING = { + 'version': 1, + + 'handlers': { + 'null': { + 'level': 'DEBUG', + 'class': 'logging.NullHandler', + }, + }, + + 'loggers': { + 'colab.mailman': { + 'handlers': ['null'], + 'propagate': False, + }, + 'haystack': { + 'handlers': ['null'], + 'propagate': False, + }, + 'pysolr': { + 'handlers': ['null'], + 'propagate': False, + }, + }, +} + +import os +HAYSTACK_CONNECTIONS = { + 'default': { + 'ENGINE': 'haystack.backends.solr_backend.SolrEngine', + 'URL': 'http://127.0.0.1:8983/solr' + }, +} + diff --git a/views.py b/views.py deleted file mode 100644 index 91ea44a..0000000 --- a/views.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.shortcuts import render - -# Create your views here. -- libgit2 0.21.2