forked from opendata-swiss/ckanext-switzerland
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Stefan Oderbolz
committed
Jul 31, 2015
0 parents
commit 959cd0c
Showing
19 changed files
with
1,086 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[report] | ||
omit = | ||
*/site-packages/* | ||
*/python?.?/* | ||
ckan/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.ropeproject | ||
node_modules | ||
bower_components | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
sdist/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
|
||
# Sphinx documentation | ||
docs/_build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
language: python | ||
python: | ||
- "2.6" | ||
- "2.7" | ||
env: PGVERSION=9.1 | ||
install: | ||
- bash bin/travis-build.bash | ||
- pip install coveralls | ||
script: sh bin/travis-run.sh | ||
after_success: | ||
- coveralls |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include README.rst | ||
recursive-include ckanext/switzerland *.html *.json *.js *.less *.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
.. You should enable this project on travis-ci.org and coveralls.io to make | ||
these badges work. The necessary Travis and Coverage config files have been | ||
generated for you. | ||
.. image:: https://travis-ci.org/ogdch/ckanext-switzerland.svg?branch=master | ||
:target: https://travis-ci.org/ogdch/ckanext-switzerland | ||
|
||
.. image:: https://coveralls.io/repos/ogdch/ckanext-switzerland/badge.png?branch=master | ||
:target: https://coveralls.io/r/ogdch/ckanext-switzerland?branch=master | ||
|
||
.. image:: https://pypip.in/download/ckanext-switzerland/badge.svg | ||
:target: https://pypi.python.org/pypi//ckanext-switzerland/ | ||
:alt: Downloads | ||
|
||
.. image:: https://pypip.in/version/ckanext-switzerland/badge.svg | ||
:target: https://pypi.python.org/pypi/ckanext-switzerland/ | ||
:alt: Latest Version | ||
|
||
.. image:: https://pypip.in/py_versions/ckanext-switzerland/badge.svg | ||
:target: https://pypi.python.org/pypi/ckanext-switzerland/ | ||
:alt: Supported Python versions | ||
|
||
.. image:: https://pypip.in/status/ckanext-switzerland/badge.svg | ||
:target: https://pypi.python.org/pypi/ckanext-switzerland/ | ||
:alt: Development Status | ||
|
||
.. image:: https://pypip.in/license/ckanext-switzerland/badge.svg | ||
:target: https://pypi.python.org/pypi/ckanext-switzerland/ | ||
:alt: License | ||
|
||
============= | ||
ckanext-switzerland | ||
============= | ||
|
||
.. Put a description of your extension here: | ||
What does it do? What features does it have? | ||
Consider including some screenshots or embedding a video! | ||
------------ | ||
Requirements | ||
------------ | ||
|
||
For example, you might want to mention here which versions of CKAN this | ||
extension works with. | ||
|
||
|
||
------------ | ||
Installation | ||
------------ | ||
|
||
.. Add any additional install steps to the list below. | ||
For example installing any non-Python dependencies or adding any required | ||
config settings. | ||
To install ckanext-switzerland: | ||
|
||
1. Activate your CKAN virtual environment, for example:: | ||
|
||
. /usr/lib/ckan/default/bin/activate | ||
|
||
2. Install the ckanext-switzerland Python package into your virtual environment:: | ||
|
||
pip install ckanext-switzerland | ||
|
||
3. Add ``switzerland`` to the ``ckan.plugins`` setting in your CKAN | ||
config file (by default the config file is located at | ||
``/etc/ckan/default/production.ini``). | ||
|
||
4. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:: | ||
|
||
sudo service apache2 reload | ||
|
||
|
||
--------------- | ||
Config Settings | ||
--------------- | ||
|
||
Document any optional config settings here. For example:: | ||
|
||
# The minimum number of hours to wait before re-checking a resource | ||
# (optional, default: 24). | ||
ckanext.switzerland.some_setting = some_default_value | ||
|
||
|
||
------------------------ | ||
Development Installation | ||
------------------------ | ||
|
||
To install ckanext-switzerland for development, activate your CKAN virtualenv and | ||
do:: | ||
|
||
git clone https://github.com/ogdch/ckanext-switzerland.git | ||
cd ckanext-switzerland | ||
python setup.py develop | ||
pip install -r dev-requirements.txt | ||
|
||
|
||
----------------- | ||
Running the Tests | ||
----------------- | ||
|
||
To run the tests, do:: | ||
|
||
nosetests --nologcapture --with-pylons=test.ini | ||
|
||
To run the tests and produce a coverage report, first make sure you have | ||
coverage installed in your virtualenv (``pip install coverage``) then run:: | ||
|
||
nosetests --nologcapture --with-pylons=test.ini --with-coverage --cover-package=ckanext.switzerland --cover-inclusive --cover-erase --cover-tests | ||
|
||
|
||
--------------------------------- | ||
Registering ckanext-switzerland on PyPI | ||
--------------------------------- | ||
|
||
ckanext-switzerland should be availabe on PyPI as | ||
https://pypi.python.org/pypi/ckanext-switzerland. If that link doesn't work, then | ||
you can register the project on PyPI for the first time by following these | ||
steps: | ||
|
||
1. Create a source distribution of the project:: | ||
|
||
python setup.py sdist | ||
|
||
2. Register the project:: | ||
|
||
python setup.py register | ||
|
||
3. Upload the source distribution to PyPI:: | ||
|
||
python setup.py sdist upload | ||
|
||
4. Tag the first release of the project on GitHub with the version number from | ||
the ``setup.py`` file. For example if the version number in ``setup.py`` is | ||
0.0.1 then do:: | ||
|
||
git tag 0.0.1 | ||
git push --tags | ||
|
||
|
||
---------------------------------------- | ||
Releasing a New Version of ckanext-switzerland | ||
---------------------------------------- | ||
|
||
ckanext-switzerland is availabe on PyPI as https://pypi.python.org/pypi/ckanext-switzerland. | ||
To publish a new version to PyPI follow these steps: | ||
|
||
1. Update the version number in the ``setup.py`` file. | ||
See `PEP 440 <http://legacy.python.org/dev/peps/pep-0440/#public-version-identifiers>`_ | ||
for how to choose version numbers. | ||
|
||
2. Create a source distribution of the new version:: | ||
|
||
python setup.py sdist | ||
|
||
3. Upload the source distribution to PyPI:: | ||
|
||
python setup.py sdist upload | ||
|
||
4. Tag the new release of the project on GitHub with the version number from | ||
the ``setup.py`` file. For example if the version number in ``setup.py`` is | ||
0.0.2 then do:: | ||
|
||
git tag 0.0.2 | ||
git push --tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
echo "This is travis-build.bash..." | ||
|
||
echo "Installing the packages that CKAN requires..." | ||
sudo apt-get update -qq | ||
sudo apt-get install postgresql-$PGVERSION solr-jetty libcommons-fileupload-java:amd64=1.2.2-1 | ||
|
||
echo "Installing CKAN and its Python dependencies..." | ||
git clone https://github.com/ckan/ckan | ||
cd ckan | ||
git checkout release-v2.2 | ||
python setup.py develop | ||
pip install -r requirements.txt --allow-all-external | ||
pip install -r dev-requirements.txt --allow-all-external | ||
cd - | ||
|
||
echo "Creating the PostgreSQL user and database..." | ||
sudo -u postgres psql -c "CREATE USER ckan_default WITH PASSWORD 'pass';" | ||
sudo -u postgres psql -c 'CREATE DATABASE ckan_test WITH OWNER ckan_default;' | ||
|
||
echo "Initialising the database..." | ||
cd ckan | ||
paster db init -c test-core.ini | ||
cd - | ||
|
||
echo "Installing ckanext-ckanext-switzerland and its requirements..." | ||
python setup.py develop | ||
pip install -r dev-requirements.txt | ||
|
||
echo "Moving test.ini into a subdir..." | ||
mkdir subdir | ||
mv test.ini subdir | ||
|
||
echo "travis-build.bash is done." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh -e | ||
|
||
echo "NO_START=0\nJETTY_HOST=127.0.0.1\nJETTY_PORT=8983\nJAVA_HOME=$JAVA_HOME" | sudo tee /etc/default/jetty | ||
sudo cp ckan/ckan/config/solr/schema.xml /etc/solr/conf/schema.xml | ||
sudo service jetty restart | ||
nosetests --nologcapture --with-pylons=subdir/test.ini --with-coverage --cover-package=ckanext.switzerland --cover-inclusive --cover-erase --cover-tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# this is a namespace package | ||
try: | ||
import pkg_resources | ||
pkg_resources.declare_namespace(__name__) | ||
except ImportError: | ||
import pkgutil | ||
__path__ = pkgutil.extend_path(__path__, __name__) |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import ckan.plugins as plugins | ||
import ckan.plugins.toolkit as toolkit | ||
|
||
|
||
class SwitzerlandPlugin(plugins.SingletonPlugin): | ||
plugins.implements(plugins.IConfigurer) | ||
|
||
# IConfigurer | ||
|
||
def update_config(self, config_): | ||
toolkit.add_template_directory(config_, 'templates') | ||
toolkit.add_public_directory(config_, 'public') | ||
toolkit.add_resource('fanstatic', 'switzerland') |
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
"""Tests for plugin.py.""" | ||
import ckanext.switzerland.plugin as plugin | ||
|
||
def test_plugin(): | ||
pass |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
from setuptools import setup, find_packages # Always prefer setuptools over distutils | ||
from codecs import open # To use a consistent encoding | ||
from os import path | ||
|
||
here = path.abspath(path.dirname(__file__)) | ||
|
||
# Get the long description from the relevant file | ||
with open(path.join(here, 'README.rst'), encoding='utf-8') as f: | ||
long_description = f.read() | ||
|
||
setup( | ||
name='''ckanext-switzerland''', | ||
|
||
# Versions should comply with PEP440. For a discussion on single-sourcing | ||
# the version across setup.py and the project code, see | ||
# http://packaging.python.org/en/latest/tutorial.html#version | ||
version='0.0.1', | ||
|
||
description='''DCAT-AP Switzerland and Scheming extensions''', | ||
long_description=long_description, | ||
|
||
# The project's main homepage. | ||
url='https://github.com/ogdch/ckanext-switzerland', | ||
|
||
# Author details | ||
author='''Liip AG''', | ||
author_email='''[email protected]''', | ||
|
||
# Choose your license | ||
license='AGPL', | ||
|
||
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers | ||
classifiers=[ | ||
# How mature is this project? Common values are | ||
# 3 - Alpha | ||
# 4 - Beta | ||
# 5 - Production/Stable | ||
'Development Status :: 4 - Beta', | ||
|
||
# Pick your license as you wish (should match "license" above) | ||
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)', | ||
|
||
# Specify the Python versions you support here. In particular, ensure | ||
# that you indicate whether you support Python 2, Python 3 or both. | ||
'Programming Language :: Python :: 2.6', | ||
'Programming Language :: Python :: 2.7', | ||
], | ||
|
||
|
||
# What does your project relate to? | ||
keywords='''CKAN schema dcat dcat-ap switzerland''', | ||
|
||
# You can just specify the packages manually here if your project is | ||
# simple. Or you can use find_packages(). | ||
packages=find_packages(exclude=['contrib', 'docs', 'tests*']), | ||
|
||
# List run-time dependencies here. These will be installed by pip when your | ||
# project is installed. For an analysis of "install_requires" vs pip's | ||
# requirements files see: | ||
# https://packaging.python.org/en/latest/technical.html#install-requires-vs-requirements-files | ||
install_requires=[], | ||
|
||
# If there are data files included in your packages that need to be | ||
# installed, specify them here. If using Python 2.6 or less, then these | ||
# have to be included in MANIFEST.in as well. | ||
include_package_data=True, | ||
package_data={ | ||
}, | ||
|
||
# Although 'package_data' is the preferred approach, in some case you may | ||
# need to place data files outside of your packages. | ||
# see http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files | ||
# In this case, 'data_file' will be installed into '<sys.prefix>/my_data' | ||
data_files=[], | ||
|
||
# To provide executable scripts, use entry points in preference to the | ||
# "scripts" keyword. Entry points provide cross-platform support and allow | ||
# pip to create the appropriate form of executable for the target platform. | ||
entry_points=''' | ||
[ckan.plugins] | ||
switzerland=ckanext.switzerland.plugin:SwitzerlandPlugin | ||
''', | ||
) |
Oops, something went wrong.