add new option of prosopopee command
This commit is contained in:
parent
0749e9fec2
commit
c4d782613f
@ -1,6 +1,9 @@
|
||||
Build the website
|
||||
=================
|
||||
|
||||
Generate
|
||||
--------
|
||||
|
||||
**Note: You need to be in an activated virtualenv.**
|
||||
|
||||
In a folder containing the **root** settings.yaml file, simply do::
|
||||
@ -9,3 +12,20 @@ In a folder containing the **root** settings.yaml file, simply do::
|
||||
|
||||
A `build` folder will be created in the current directory, containing an
|
||||
index.html, static files (css & js) and pictures.
|
||||
|
||||
Preview
|
||||
-------
|
||||
|
||||
In a root folder launch this command::
|
||||
|
||||
prosopopee preview
|
||||
|
||||
After you can check your website on http://localhost:9000
|
||||
|
||||
Deployment
|
||||
----------
|
||||
|
||||
Prosopopee can upload your website with rsync, for do it run::
|
||||
|
||||
prosopopee deploy
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ Changelog
|
||||
* Add audio HTML5 player
|
||||
* Update Material theme
|
||||
* Add youtube section
|
||||
* Add deploy and preview option
|
||||
|
||||
0.4 (2016-12-11)
|
||||
|
||||
|
||||
@ -188,6 +188,19 @@ Optionnal: You need use description and lang key in settings gallery.
|
||||
|
||||
for more informations about Open Graph http://ogp.me/
|
||||
|
||||
Deployment
|
||||
~~~~~~~~~~
|
||||
|
||||
If you wanna configure the deployement of your website by rsync::
|
||||
|
||||
settings:
|
||||
deploy:
|
||||
username: beudbeud (optional need for ssh)
|
||||
hostname: beudibox.fr (optional need for ssh)
|
||||
dest: /var/www/surleschemins/build/
|
||||
others: --delete-afte (optional)
|
||||
|
||||
|
||||
Gallery settings.yaml
|
||||
---------------------
|
||||
|
||||
|
||||
@ -20,6 +20,10 @@ or::
|
||||
|
||||
apt-get install libav-tools
|
||||
|
||||
The deployment need rsync::
|
||||
|
||||
apt-get install rsync
|
||||
|
||||
Installation in virtualenv
|
||||
--------------------------
|
||||
|
||||
|
||||
@ -1,8 +1,26 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""Prosopopee. Static site generator for your story.
|
||||
Usage:
|
||||
prosopopee.py
|
||||
prosopopee.py preview
|
||||
prosopopee.py deploy
|
||||
prosopopee.py (-h | --help)
|
||||
prosopopee.py --version
|
||||
Options:
|
||||
-h --help Show this screen.
|
||||
--version Show version.
|
||||
"""
|
||||
|
||||
import os
|
||||
import yaml
|
||||
import shutil
|
||||
from docopt import docopt
|
||||
|
||||
import SocketServer
|
||||
import SimpleHTTPServer
|
||||
|
||||
import subprocess
|
||||
|
||||
from path import Path
|
||||
|
||||
@ -500,6 +518,7 @@ def build_index(settings, galleries_cover, templates, gallery_path='', sub_index
|
||||
|
||||
|
||||
def main():
|
||||
arguments = docopt(__doc__, version='0.5')
|
||||
settings = get_settings()
|
||||
|
||||
front_page_galleries_cover = []
|
||||
@ -510,8 +529,36 @@ def main():
|
||||
"directory (NOT the settings.yaml in your current directory, but one INSIDE A "
|
||||
"DIRECTORY in your current working directory), you don't have any gallery?")
|
||||
|
||||
Path("build").makedirs_p()
|
||||
if arguments['preview']:
|
||||
error(Path("build").exists(), "Please build the website before launch preview")
|
||||
|
||||
os.chdir('build')
|
||||
|
||||
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
|
||||
httpd = SocketServer.TCPServer(("", 9000), Handler)
|
||||
|
||||
print "Start server on http://localhost:9000"
|
||||
# gracefully handle interrupt here
|
||||
httpd.serve_forever()
|
||||
|
||||
if arguments['deploy']:
|
||||
error(os.system("which rsync > /dev/null") == 0, "I can't locate the rsync, "
|
||||
"please install the 'rsync' package.\n")
|
||||
error(Path("build").exists(), "Please build the website before launch deployment")
|
||||
r_username = settings["settings"]["deploy"]["username"]
|
||||
r_hostname = settings["settings"]["deploy"]["hostname"]
|
||||
r_dest = settings["settings"]["deploy"]["dest"]
|
||||
if settings["settings"]["deploy"]["others"]:
|
||||
r_others = settings["settings"]["deploy"]["others"]
|
||||
else:
|
||||
r_others = ''
|
||||
r_cmd = "rsync -avz --progress %s build/* %s@%s:%s" % (r_others, r_username, r_hostname, r_dest)
|
||||
print r_cmd
|
||||
error(os.system(r_cmd) == 0, "deployment failed")
|
||||
#proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, preexec_fn=os.setsid)
|
||||
return
|
||||
|
||||
Path("build").makedirs_p()
|
||||
theme = settings["settings"].get("theme", "exposure")
|
||||
templates = get_gallery_templates(theme)
|
||||
templates.add_extension('jinja2.ext.with_')
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
jinja2
|
||||
pyyaml
|
||||
path.py
|
||||
docopt
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user