From b9055c7fc8caed025fd28c12532bd462edb8c78d Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Rekucki?= Date: Tue, 18 May 2010 10:55:52 +0200 Subject: [PATCH] Cleanup for easier builds using hudson. --- apps/toolbar/__init__.py | 1 + apps/toolbar/migrations/__init__.py | 1 + apps/wiki/__init__.py | 1 + apps/wiki/nice_diff.py | 0 apps/wiki/templatetags/__init__.py | 0 apps/wiki/templatetags/wiki.py | 14 +++++++ hudson_build.sh | 6 +++ lib/{vstorage.py => vstorage/__init__.py} | 0 lib/{test_vstorage.py => vstorage/tests.py} | 0 lib/{wlapi.py => wlapi/__init__.py} | 0 lib/{test_wlapi.py => wlapi/tests.py} | 0 redakcja.vhost.template | 1 - redakcja/settings/__init__.py | 32 ++++++++++++++ redakcja/{settings.py => settings/common.py} | 44 -------------------- redakcja/settings/test.py | 28 +++++++++++++ redakcja/static/js/wiki/wikiapi.js | 16 +++---- requirements.txt | 4 -- scripts/crop.py | 0 scripts/imgconv.py | 0 scripts/rip-themes-from-redmine.py | 0 20 files changed, 91 insertions(+), 57 deletions(-) mode change 100755 => 100644 apps/wiki/nice_diff.py create mode 100644 apps/wiki/templatetags/__init__.py create mode 100644 apps/wiki/templatetags/wiki.py create mode 100644 hudson_build.sh rename lib/{vstorage.py => vstorage/__init__.py} (100%) rename lib/{test_vstorage.py => vstorage/tests.py} (100%) rename lib/{wlapi.py => wlapi/__init__.py} (100%) rename lib/{test_wlapi.py => wlapi/tests.py} (100%) create mode 100644 redakcja/settings/__init__.py rename redakcja/{settings.py => settings/common.py} (75%) create mode 100644 redakcja/settings/test.py mode change 100644 => 100755 scripts/crop.py mode change 100644 => 100755 scripts/imgconv.py mode change 100644 => 100755 scripts/rip-themes-from-redmine.py diff --git a/apps/toolbar/__init__.py b/apps/toolbar/__init__.py index e69de29b..c53f0e73 100644 --- a/apps/toolbar/__init__.py +++ b/apps/toolbar/__init__.py @@ -0,0 +1 @@ + # pragma: no cover diff --git a/apps/toolbar/migrations/__init__.py b/apps/toolbar/migrations/__init__.py index e69de29b..9012566c 100644 --- a/apps/toolbar/migrations/__init__.py +++ b/apps/toolbar/migrations/__init__.py @@ -0,0 +1 @@ +# pragma: no cover diff --git a/apps/wiki/__init__.py b/apps/wiki/__init__.py index e69de29b..c53f0e73 100644 --- a/apps/wiki/__init__.py +++ b/apps/wiki/__init__.py @@ -0,0 +1 @@ + # pragma: no cover diff --git a/apps/wiki/nice_diff.py b/apps/wiki/nice_diff.py old mode 100755 new mode 100644 diff --git a/apps/wiki/templatetags/__init__.py b/apps/wiki/templatetags/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/apps/wiki/templatetags/wiki.py b/apps/wiki/templatetags/wiki.py new file mode 100644 index 00000000..614858df --- /dev/null +++ b/apps/wiki/templatetags/wiki.py @@ -0,0 +1,14 @@ +from __future__ import absolute_import + +from django.template.defaultfilters import stringfilter +from django import template + +register = template.Library() + +# from wiki.models import split_name + +@register.filter +@stringfilter +def wiki_title(value): + parts = (p.replace('_', ' ').title() for p in split_name(value)) + return ' / '.join(parts) diff --git a/hudson_build.sh b/hudson_build.sh new file mode 100644 index 00000000..c2b85df0 --- /dev/null +++ b/hudson_build.sh @@ -0,0 +1,6 @@ +cd $WORKSPACE +virtualenv -q ve +source ./ve/bin/activate +pip install -q -E ./ve -r requirements.txt +pip install -q -E ./ve -r requirements-test.txt +django-admin.py test --settings=redakcja.settings.test diff --git a/lib/vstorage.py b/lib/vstorage/__init__.py similarity index 100% rename from lib/vstorage.py rename to lib/vstorage/__init__.py diff --git a/lib/test_vstorage.py b/lib/vstorage/tests.py similarity index 100% rename from lib/test_vstorage.py rename to lib/vstorage/tests.py diff --git a/lib/wlapi.py b/lib/wlapi/__init__.py similarity index 100% rename from lib/wlapi.py rename to lib/wlapi/__init__.py diff --git a/lib/test_wlapi.py b/lib/wlapi/tests.py similarity index 100% rename from lib/test_wlapi.py rename to lib/wlapi/tests.py diff --git a/redakcja.vhost.template b/redakcja.vhost.template index fbd21a9a..1d24c675 100644 --- a/redakcja.vhost.template +++ b/redakcja.vhost.template @@ -14,7 +14,6 @@ Alias /media $MEDIA_ROOT - Options Indexes, FollowLinks Order allow,deny Allow from all diff --git a/redakcja/settings/__init__.py b/redakcja/settings/__init__.py new file mode 100644 index 00000000..e6ee2038 --- /dev/null +++ b/redakcja/settings/__init__.py @@ -0,0 +1,32 @@ +from __future__ import absolute_import +from .common import * + +DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. +DATABASE_NAME = PROJECT_ROOT + '/dev.sqlite' # Or path to database file if using sqlite3. +DATABASE_USER = '' # Not used with sqlite3. +DATABASE_PASSWORD = '' # Not used with sqlite3. +DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. +DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. + +try: + from localsettings import * +except ImportError: + pass + +try: + LOGGING_CONFIG_FILE +except NameError: + LOGGING_CONFIG_FILE = os.path.join(PROJECT_ROOT, 'config', + ('logging.cfg' if not DEBUG else 'logging.cfg.dev')) +try: + import logging + + if os.path.isfile(LOGGING_CONFIG_FILE): + import logging.config + logging.config.fileConfig(LOGGING_CONFIG_FILE) + else: + import sys + logging.basicConfig(stream=sys.stderr) +except ImportError as exc: + raise + diff --git a/redakcja/settings.py b/redakcja/settings/common.py similarity index 75% rename from redakcja/settings.py rename to redakcja/settings/common.py index fb262051..24a4258c 100644 --- a/redakcja/settings.py +++ b/redakcja/settings/common.py @@ -15,13 +15,6 @@ ADMINS = ( MANAGERS = ADMINS -DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. -DATABASE_NAME = PROJECT_ROOT + '/dev.sqlite' # Or path to database file if using sqlite3. -DATABASE_USER = '' # Not used with sqlite3. -DATABASE_PASSWORD = '' # Not used with sqlite3. -DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. -DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. - # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. @@ -129,22 +122,6 @@ INSTALLED_APPS = ( 'toolbar', ) - -# -# Nose tests -# - -TEST_RUNNER = 'django_nose.run_tests' -TEST_MODULES = ('wiki', 'toolbar', 'vstorage') -NOSE_ARGS = ( - '--tests=' + ','.join(TEST_MODULES), - '--cover-package=' + ','.join(TEST_MODULES), - '-d', - '--with-coverage', - '--with-doctest', -) - - FILEBROWSER_URL_FILEBROWSER_MEDIA = STATIC_URL + 'filebrowser/' FILEBROWSER_DIRECTORY = 'images/' FILEBROWSER_ADMIN_VERSIONS = [] @@ -163,24 +140,3 @@ WL_API_CONFIG = { } # Import localsettings file, which may override settings defined here -try: - from localsettings import * -except ImportError: - pass - -try: - LOGGING_CONFIG_FILE -except NameError: - LOGGING_CONFIG_FILE = os.path.join(PROJECT_ROOT, 'config', - ('logging.cfg' if not DEBUG else 'logging.cfg.dev')) -try: - import logging - - if os.path.isfile(LOGGING_CONFIG_FILE): - import logging.config - logging.config.fileConfig(LOGGING_CONFIG_FILE) - else: - import sys - logging.basicConfig(stream=sys.stderr) -except ImportError as exc: - raise diff --git a/redakcja/settings/test.py b/redakcja/settings/test.py new file mode 100644 index 00000000..118c7ffb --- /dev/null +++ b/redakcja/settings/test.py @@ -0,0 +1,28 @@ +# +# Nose tests +# + +from redakcja.settings.common import * + +# ROOT_URLCONF = 'yourapp.settings.test.urls' + +DATABASE_ENGINE = 'sqlite3' +DATABASE_NAME = ':memory:' + +import tempfile + +WIKI_REPOSITORY_PATH = tempfile.mkdtemp(prefix='wikirepo') + +INSTALLED_APPS += ('django_nose',) + +TEST_RUNNER = 'django_nose.run_tests' +TEST_MODULES = ('wiki', 'toolbar', 'vstorage') +NOSE_ARGS = ( + '--tests=' + ','.join(TEST_MODULES), + '--cover-package=' + ','.join(TEST_MODULES), + '-d', + '--with-coverage', + '--with-doctest', + '--with-xunit', + '--with-xcoverage', +) diff --git a/redakcja/static/js/wiki/wikiapi.js b/redakcja/static/js/wiki/wikiapi.js index 27ab97e2..d62d8fe4 100644 --- a/redakcja/static/js/wiki/wikiapi.js +++ b/redakcja/static/js/wiki/wikiapi.js @@ -7,11 +7,11 @@ failure: noop }; /* - * Return absolute reverse path of given named view. - * (at least he have it hard-coded in one place) - * + * Return absolute reverse path of given named view. (at least he have it + * hard-coded in one place) + * * TODO: think of a way, not to hard-code it here ;) - * + * */ function reverse() { var vname = arguments[0]; @@ -103,10 +103,10 @@ }; /* * Fetch history of this document. - * - * from - First revision to fetch (default = 0) - * upto - Last revision to fetch (default = tip) - * + * + * from - First revision to fetch (default = 0) upto - Last revision to + * fetch (default = tip) + * */ WikiDocument.prototype.fetchHistory = function(params) { /* this doesn't modify anything, so no locks */ diff --git a/requirements.txt b/requirements.txt index d247c761..b52baefe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,7 +14,3 @@ django-maintenancemode>=0.9 # migrations south>=0.6 - -## Debugging utils, uncomment this if you want tests -# django-nose>=0.0.3 -# django-debug-toolbar>=0.8 \ No newline at end of file diff --git a/scripts/crop.py b/scripts/crop.py old mode 100644 new mode 100755 diff --git a/scripts/imgconv.py b/scripts/imgconv.py old mode 100644 new mode 100755 diff --git a/scripts/rip-themes-from-redmine.py b/scripts/rip-themes-from-redmine.py old mode 100644 new mode 100755 -- 2.20.1