Browse Source

Initialize repository

Maxime Vidori 10 years ago
commit
77a1f03c68
5 changed files with 147 additions and 0 deletions
  1. 12 0
      Dockerfile
  2. 73 0
      fabfile.py
  3. 35 0
      pelicanconf.py
  4. 24 0
      publishconf.py
  5. 3 0
      requirements.txt

+ 12 - 0
Dockerfile

@@ -0,0 +1,12 @@
+FROM debian
+
+RUN apt-get update
+RUN apt-get install -y python-dev python-pip
+
+COPY requirements.txt /tmp/
+RUN pip install -r /tmp/requirements.txt
+
+WORKDIR /mnt
+
+ENTRYPOINT ["fab"]
+CMD ["serve"]

+ 73 - 0
fabfile.py

@@ -0,0 +1,73 @@
+from fabric.api import *
+import fabric.contrib.project as project
+import os
+import sys
+import SimpleHTTPServer
+import SocketServer
+
+# Local path configuration (can be absolute or relative to fabfile)
+env.deploy_path = 'output'
+DEPLOY_PATH = env.deploy_path
+
+# Remote server configuration
+production = 'root@localhost:22'
+dest_path = '/var/www'
+
+# Rackspace Cloud Files configuration settings
+env.cloudfiles_username = 'my_rackspace_username'
+env.cloudfiles_api_key = 'my_rackspace_api_key'
+env.cloudfiles_container = 'my_cloudfiles_container'
+
+
+def clean():
+    if os.path.isdir(DEPLOY_PATH):
+        local('rm -rf {deploy_path}'.format(**env))
+        local('mkdir {deploy_path}'.format(**env))
+
+def build():
+    local('pelican -s pelicanconf.py')
+
+def rebuild():
+    clean()
+    build()
+
+def regenerate():
+    local('pelican -r -s pelicanconf.py')
+
+def serve():
+    os.chdir(env.deploy_path)
+
+    PORT = 8000
+    class AddressReuseTCPServer(SocketServer.TCPServer):
+        allow_reuse_address = True
+
+    server = AddressReuseTCPServer(('', PORT), SimpleHTTPServer.SimpleHTTPRequestHandler)
+
+    sys.stderr.write('Serving on port {0} ...\n'.format(PORT))
+    server.serve_forever()
+
+def reserve():
+    build()
+    serve()
+
+def preview():
+    local('pelican -s publishconf.py')
+
+def cf_upload():
+    rebuild()
+    local('cd {deploy_path} && '
+          'swift -v -A https://auth.api.rackspacecloud.com/v1.0 '
+          '-U {cloudfiles_username} '
+          '-K {cloudfiles_api_key} '
+          'upload -c {cloudfiles_container} .'.format(**env))
+
+@hosts(production)
+def publish():
+    local('pelican -s publishconf.py')
+    project.rsync_project(
+        remote_dir=dest_path,
+        exclude=".DS_Store",
+        local_dir=DEPLOY_PATH.rstrip('/') + '/',
+        delete=True,
+        extra_opts='-c',
+    )

+ 35 - 0
pelicanconf.py

@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*- #
+from __future__ import unicode_literals
+
+AUTHOR = u'gitoyen'
+SITENAME = u'Gitoyen'
+SITEURL = ''
+
+PATH = 'content'
+
+TIMEZONE = 'Europe/Paris'
+
+DEFAULT_LANG = u'fr'
+
+# Feed generation is usually not desired when developing
+FEED_ALL_ATOM = None
+CATEGORY_FEED_ATOM = None
+TRANSLATION_FEED_ATOM = None
+AUTHOR_FEED_ATOM = None
+AUTHOR_FEED_RSS = None
+
+# Blogroll
+LINKS = (('Pelican', 'http://getpelican.com/'),
+         ('Python.org', 'http://python.org/'),
+         ('Jinja2', 'http://jinja.pocoo.org/'),
+         ('You can modify those links in your config file', '#'),)
+
+# Social widget
+SOCIAL = (('You can add links in your config file', '#'),
+          ('Another social link', '#'),)
+
+DEFAULT_PAGINATION = 10
+
+# Uncomment following line if you want document-relative URLs when developing
+#RELATIVE_URLS = True

+ 24 - 0
publishconf.py

@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*- #
+from __future__ import unicode_literals
+
+# This file is only used if you use `make publish` or
+# explicitly specify it as your config file.
+
+import os
+import sys
+sys.path.append(os.curdir)
+from pelicanconf import *
+
+SITEURL = ''
+RELATIVE_URLS = False
+
+FEED_ALL_ATOM = 'feeds/all.atom.xml'
+CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml'
+
+DELETE_OUTPUT_DIRECTORY = True
+
+# Following items are often useful when publishing
+
+#DISQUS_SITENAME = ""
+#GOOGLE_ANALYTICS = ""

+ 3 - 0
requirements.txt

@@ -0,0 +1,3 @@
+pelican
+fabric
+markdown