Commits

Markus Zapke-Gründemann committed c48499d

New deployment for multiple languages.

Comments (0)

Files changed (2)

 *.pyc
 .vagrant
 _build
+_deploy
 fabricrc
 class DeployTask(MarcadorBaseTask):
     """Builds and deploys the Sphinx documentation as HTML.
 
-    Use the language argument to deploy not the default language.
-
     Runs the tests before the build. Performs an automatic linkcheck
     after the build. If there were no errors the deployment starts
     afterwards.
             remotepath = env.get('remotepath')
         if not remotepath:
             abort('\n'.join(self.errmsg))
-        with hide('running'):
-            super(DeployTask, self).run('html', language, linkcheck=True, test=True)
-        question = 'Continue and deploy django-marcador %s ' % self.get_release()
-        question += 'to %(host_string)s:%(remotepath)s?' % env
-        if not console.confirm(question):
-            abort('Delpoyment cancelled.')
+        languages = ('de', 'en')
+        # Create deployment skeleton
+        local('rm -rf _deploy')
+        local('mkdir -p _deploy/{%s}' % ','.join(languages))
+        # Copy static files
+        local('cp static/.htaccess _deploy')
+        local('cp static/* _deploy')
+        # Build all languages
+        for language in languages:
+            with hide('running'):
+                fastprint('\nBuilding language %s.\n' % language)
+                if language == languages[0]:
+                    super(DeployTask, self).run('html', None, linkcheck=True,
+                        test=True)
+                else:
+                    super(DeployTask, self).run('html', language)
+            local('cp -r docs/_build/html/* _deploy/%s' % language)
+        # Do the deployment
+        msg = 'Continue and deploy django-marcador %s ' % self.get_release()
+        msg += 'to %(host_string)s:%(remotepath)s?' % env
+        if not console.confirm(msg):
+            abort('Deployment cancelled.')
         if files.exists(remotepath):
             run('rm -rf %s' % remotepath)
         run('mkdir %s' % remotepath)
-        put('docs/_build/html/*', remotepath)
-        put('docs/.htaccess', remotepath)
+        put('_deploy/*', remotepath)
         msg = 'Successfully deployed documentation files '
         msg += 'to %(host_string)s:%(remotepath)s.' % env
         fastprint(msg)
+        local('rm -rf _deploy')
 
 
 build = BuildHtmlTask()