Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Re-apply additions to support docs in git.

This reverts commit 45632fc.
  • Loading branch information...
commit 6035ad984311b2a8aec642740a9a85592a781ff2 1 parent 4763660
@jacobian jacobian authored
View
2  deploy-requirements.txt
@@ -11,7 +11,7 @@ FeedParser >= 5.0, <= 5.1
Jinja2 >= 2.4, < 2.5
psycopg2 >= 2.2, < 2.3
python-memcached >= 1.45, < 2.0
-Sphinx >= 1.0, < 1.1
+Sphinx == 1.0.3
South >= 0.7, < 0.8
Unipath >= 0.2, < 0.3
raven == 1.4.6
View
26 django_website/docs/management/commands/update_docs.py
@@ -4,6 +4,7 @@
"""
from __future__ import absolute_import
+import os
import json
import haystack
import optparse
@@ -58,6 +59,11 @@ def handle_noargs(self, **kwargs):
#
# Use Sphinx to build the release docs into JSON and HTML documents.
#
+ if release.docs_subdir:
+ source_dir = destdir.child(*release.docs_subdir.split('/'))
+ else:
+ source_dir = destdir
+
for builder in ('json', 'html'):
# Make the directory for the built files - sphinx-build doesn't
# do it for us, apparently.
@@ -67,11 +73,11 @@ def handle_noargs(self, **kwargs):
# "Shell out" (not exactly, but basically) to sphinx-build.
if verbosity >= 2:
- print " building %s (into %s)" % (builder, build_dir)
+ print " building %s (%s -> %s)" % (builder, source_dir, build_dir)
sphinx.cmdline.main(['sphinx-build',
'-b', builder,
'-q', # Be vewy qwiet
- destdir, # Source file directory
+ source_dir, # Source file directory
build_dir, # Destination directory
])
@@ -155,3 +161,19 @@ def zipfile_inclusion_filter(f):
def update_svn(self, url, destdir):
subprocess.call(['svn', 'checkout', '-q', url, destdir])
+
+ def update_git(self, url, destdir):
+ if '@' in url:
+ repo, branch = url.rsplit('@', 1)
+ else:
+ repo, branch = url, 'master'
+ if destdir.child('.git').exists():
+ try:
+ cwd = os.getcwdu()
+ os.chdir(destdir)
+ subprocess.call(['git', 'fetch'])
+ subprocess.call(['git', 'reset', '--hard', branch])
+ finally:
+ os.chdir(cwd)
+ else:
+ subprocess.call(['git', 'clone', '-q', '--branch', branch, repo, destdir])
View
17 django_website/docs/models.py
@@ -12,25 +12,28 @@ class DocumentRelease(models.Model):
"""
DEFAULT_CACHE_KEY = "%s_recent_release" % settings.CACHE_MIDDLEWARE_KEY_PREFIX
SVN = 'svn'
+ GIT = 'git'
SCM_CHOICES = (
(SVN, 'SVN'),
+ (GIT, 'git'),
)
-
+
lang = models.CharField(max_length=2, choices=settings.LANGUAGES, default='en')
version = models.CharField(max_length=20)
scm = models.CharField(max_length=10, choices=SCM_CHOICES)
- scm_url = models.URLField()
+ scm_url = models.CharField(max_length=200)
+ docs_subdir = models.CharField(max_length=200, blank=True)
is_default = models.BooleanField()
-
+
objects = DocumentReleaseManager()
-
+
def __unicode__(self):
return "%s/%s" % (self.lang, self.version)
-
+
@models.permalink
def get_absolute_url(self):
return ('document-index', [], {'lang': self.lang, 'version': self.version})
-
+
def save(self, *args, **kwargs):
# There can be only one. Default, that is.
if self.is_default:
@@ -41,7 +44,7 @@ def save(self, *args, **kwargs):
settings.CACHE_MIDDLEWARE_SECONDS,
)
super(DocumentRelease, self).save(*args, **kwargs)
-
+
@property
def human_version(self):
"""
View
2  fabfile.py
@@ -72,7 +72,7 @@ def update_docs():
"""
Force an update of the docs on the server.
"""
- managepy('update_docs', site='docs')
+ managepy('update_docs -v2', site='docs')
def copy_db():
"""
Please sign in to comment.
Something went wrong with that request. Please try again.