Skip to content

Commit b712f67

Browse files
committed
initial commit, including travis
1 parent faf60a8 commit b712f67

9 files changed

+381
-0
lines changed

Diff for: .gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Content of the .gitignore file:
2+
*.pid
3+
*.pyc
4+
*.swp
5+
output/

Diff for: .travis.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
branches:
2+
only:
3+
- master
4+
language: python
5+
python:
6+
- 2.7
7+
install:
8+
- pip install -r requirements.txt --use-mirrors
9+
script:
10+
- make html
11+
notifications:
12+
email:
13+
on_success: always
14+
on_failure: always
15+
env:
16+
global:
17+
- secure: W9jdJcVLMok2QnSWn94bkBZL6yiP88paWBSQvj5pNwx6rMA/KAuAmEDTmxWCRpvte9CP1mTpPgNRwn7UhhmZsw4f1AKEAClxNbpbVUhiISW+LoVmlkhw//fp+qGplhun2ID9sJpfjsgun5Ue4+dcpvI2rHP17lC5ZgJBj3fx85M=
18+
- secure: EuleRVAaoed/C7mn6swpagRyfCf/ffhvavamXpqAx2KnbnAY1HX9sRFO8E2zCnjLLLz6ShgoWSNA4cloFnCbX41XbOnPXuUJkyBrV61X4twvVOcoDw/w2KVZfyhJ9umU5Ci4rr8kkGgIw8RPu8hFXP/0vVCk/I43t2K0KDshXrs=
19+
- secure: Ulkj49L/h79obgxk1rFT2cVXipwchgWbrXxapKa/YsYa7Ab81JFd32VyD+MZfA5d8kRubQ/lR4iao7dEg0zbNTDRzGOyJ0adStekOVgKWeQE7VAuJM9og4XU0rWz39Oztkx/ewdHfltWNWN80Chg9j8dVirc4GzGm+pb+X6DJExuEUFIu+nR+SoXdl0Hze8a6Ye+HE1yJNONTkIukYpBIjVutzUvYOOY1iqn8Zym+fsM+O6WSC6UCfq3JPWLPUjyVJmSRQdSlq/WXf13x+DOtxc7TErn0WZArvyAdHuNH9cmDGjwDKQ6IrgzG6y4stkcYDkrszX+/9+PZjxxo7drZSSL7BiqppTSEZ9xJdirCehWDO/kA7JweXlq5IvYGj+0/PPusdIumGDvaM/ZOq0hDoBTkqgTTUVrJcaiRmrO8xbfTH1hLC3zQebMcvmwgKRpbMxSlPbJEWTxnWljNGEmncEdrTvU/VpzZ6RD9IR+RiZ87+EyCU2lY2ryU4UIjSbNJxwF5/974SRavDdIz2F6f4lKF8kMgq/1N+a80+v2EIN+LthibpMx0dtnwxtxRsYLf2R9vRaU12z12LdC1MPvZrlMVp6uORqBwalfA+Mhw27gCfPm2ep0DrgmD1XvhujWE/5QKxIVmw3hHkgGHM1+nOWuOfN6GMepf4MCST5TNtA=
20+
before_install:
21+
- git submodule update --init --recursive
22+
after_success: bash deploy.sh

Diff for: Makefile

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
PY=python
2+
PELICAN=pelican
3+
PELICANOPTS=
4+
5+
BASEDIR=$(CURDIR)
6+
INPUTDIR=$(BASEDIR)/content
7+
OUTPUTDIR=$(BASEDIR)/output
8+
CONFFILE=$(BASEDIR)/pelicanconf.py
9+
PUBLISHCONF=$(BASEDIR)/publishconf.py
10+
11+
FTP_HOST=localhost
12+
FTP_USER=anonymous
13+
FTP_TARGET_DIR=/
14+
15+
SSH_HOST=localhost
16+
SSH_PORT=22
17+
SSH_USER=root
18+
SSH_TARGET_DIR=/var/www
19+
20+
S3_BUCKET=my_s3_bucket
21+
22+
CLOUDFILES_USERNAME=my_rackspace_username
23+
CLOUDFILES_API_KEY=my_rackspace_api_key
24+
CLOUDFILES_CONTAINER=my_cloudfiles_container
25+
26+
DROPBOX_DIR=~/Dropbox/Public/
27+
28+
DEBUG ?= 0
29+
ifeq ($(DEBUG), 1)
30+
PELICANOPTS += -D
31+
endif
32+
33+
help:
34+
@echo 'Makefile for a pelican Web site '
35+
@echo ' '
36+
@echo 'Usage: '
37+
@echo ' make html (re)generate the web site '
38+
@echo ' make clean remove the generated files '
39+
@echo ' make regenerate regenerate files upon modification '
40+
@echo ' make publish generate using production settings '
41+
@echo ' make serve [PORT=8000] serve site at http://localhost:8000'
42+
@echo ' make devserver [PORT=8000] start/restart develop_server.sh '
43+
@echo ' make stopserver stop local server '
44+
@echo ' make ssh_upload upload the web site via SSH '
45+
@echo ' make rsync_upload upload the web site via rsync+ssh '
46+
@echo ' make dropbox_upload upload the web site via Dropbox '
47+
@echo ' make ftp_upload upload the web site via FTP '
48+
@echo ' make s3_upload upload the web site via S3 '
49+
@echo ' make cf_upload upload the web site via Cloud Files'
50+
@echo ' make github upload the web site via gh-pages '
51+
@echo ' '
52+
@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
53+
@echo ' '
54+
55+
html:
56+
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
57+
58+
clean:
59+
[ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)
60+
61+
regenerate:
62+
$(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
63+
64+
serve:
65+
ifdef PORT
66+
cd $(OUTPUTDIR) && $(PY) -m pelican.server $(PORT)
67+
else
68+
cd $(OUTPUTDIR) && $(PY) -m pelican.server
69+
endif
70+
71+
devserver:
72+
ifdef PORT
73+
$(BASEDIR)/develop_server.sh restart $(PORT)
74+
else
75+
$(BASEDIR)/develop_server.sh restart
76+
endif
77+
78+
stopserver:
79+
kill -9 `cat pelican.pid`
80+
kill -9 `cat srv.pid`
81+
@echo 'Stopped Pelican and SimpleHTTPServer processes running in background.'
82+
83+
publish:
84+
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
85+
86+
ssh_upload: publish
87+
scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR)
88+
89+
rsync_upload: publish
90+
rsync -e "ssh -p $(SSH_PORT)" -P -rvz --delete $(OUTPUTDIR)/ $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) --cvs-exclude
91+
92+
dropbox_upload: publish
93+
cp -r $(OUTPUTDIR)/* $(DROPBOX_DIR)
94+
95+
ftp_upload: publish
96+
lftp ftp://$(FTP_USER)@$(FTP_HOST) -e "mirror -R $(OUTPUTDIR) $(FTP_TARGET_DIR) ; quit"
97+
98+
s3_upload: publish
99+
s3cmd sync $(OUTPUTDIR)/ s3://$(S3_BUCKET) --acl-public --delete-removed
100+
101+
cf_upload: publish
102+
cd $(OUTPUTDIR) && swift -v -A https://auth.api.rackspacecloud.com/v1.0 -U $(CLOUDFILES_USERNAME) -K $(CLOUDFILES_API_KEY) upload -c $(CLOUDFILES_CONTAINER) .
103+
104+
github: publish
105+
ghp-import $(OUTPUTDIR)
106+
git push origin gh-pages
107+
108+
.PHONY: html help clean regenerate serve devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github

Diff for: deploy.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
BRANCH=master
3+
TARGET_REPO=diana-hep/diana-hep.github.io.git
4+
PELICAN_OUTPUT_FOLDER=output
5+
6+
echo -e "Testing travis-encrypt"
7+
echo -e "$VARNAME"
8+
9+
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
10+
echo -e "Starting to deploy to Github Pages\n"
11+
if [ "$TRAVIS" == "true" ]; then
12+
git config --global user.email "[email protected]"
13+
git config --global user.name "Travis"
14+
fi
15+
#using token clone gh-pages branch
16+
git clone --quiet --branch=$BRANCH https://${GH_TOKEN}@github.com/$TARGET_REPO built_website > /dev/null
17+
#go into directory and copy data we're interested in to that directory
18+
cd built_website
19+
rsync -rv --exclude=.git ../$PELICAN_OUTPUT_FOLDER/* .
20+
#add, commit and push files
21+
git add -f .
22+
git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed to Github Pages"
23+
git push -fq origin $BRANCH > /dev/null
24+
echo -e "Deploy completed\n"
25+
fi

Diff for: develop_server.sh

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#!/usr/bin/env bash
2+
##
3+
# This section should match your Makefile
4+
##
5+
PY=python
6+
PELICAN=pelican
7+
PELICANOPTS=
8+
9+
BASEDIR=$(pwd)
10+
INPUTDIR=$BASEDIR/content
11+
OUTPUTDIR=$BASEDIR/output
12+
CONFFILE=$BASEDIR/pelicanconf.py
13+
14+
###
15+
# Don't change stuff below here unless you are sure
16+
###
17+
18+
SRV_PID=$BASEDIR/srv.pid
19+
PELICAN_PID=$BASEDIR/pelican.pid
20+
21+
function usage(){
22+
echo "usage: $0 (stop) (start) (restart) [port]"
23+
echo "This starts pelican in debug and reload mode and then launches"
24+
echo "A pelican.server to help site development. It doesn't read"
25+
echo "your pelican options so you edit any paths in your Makefile"
26+
echo "you will need to edit it as well"
27+
exit 3
28+
}
29+
30+
function alive() {
31+
kill -0 $1 >/dev/null 2>&1
32+
}
33+
34+
function shut_down(){
35+
PID=$(cat $SRV_PID)
36+
if [[ $? -eq 0 ]]; then
37+
if alive $PID; then
38+
echo "Killing pelican.server"
39+
kill $PID
40+
else
41+
echo "Stale PID, deleting"
42+
fi
43+
rm $SRV_PID
44+
else
45+
echo "pelican.server PIDFile not found"
46+
fi
47+
48+
PID=$(cat $PELICAN_PID)
49+
if [[ $? -eq 0 ]]; then
50+
if alive $PID; then
51+
echo "Killing Pelican"
52+
kill $PID
53+
else
54+
echo "Stale PID, deleting"
55+
fi
56+
rm $PELICAN_PID
57+
else
58+
echo "Pelican PIDFile not found"
59+
fi
60+
}
61+
62+
function start_up(){
63+
local port=$1
64+
echo "Starting up Pelican and pelican.server"
65+
shift
66+
$PELICAN --debug --autoreload -r $INPUTDIR -o $OUTPUTDIR -s $CONFFILE $PELICANOPTS &
67+
pelican_pid=$!
68+
echo $pelican_pid > $PELICAN_PID
69+
cd $OUTPUTDIR
70+
$PY -m pelican.server $port &
71+
srv_pid=$!
72+
echo $srv_pid > $SRV_PID
73+
cd $BASEDIR
74+
sleep 1
75+
if ! alive $pelican_pid ; then
76+
echo "Pelican didn't start. Is the pelican package installed?"
77+
return 1
78+
elif ! alive $srv_pid ; then
79+
echo "pelican.server didn't start. Is there something else which uses port 8000?"
80+
return 1
81+
fi
82+
echo 'Pelican and pelican.server processes now running in background.'
83+
}
84+
85+
###
86+
# MAIN
87+
###
88+
[[ ($# -eq 0) || ($# -gt 2) ]] && usage
89+
port=''
90+
[[ $# -eq 2 ]] && port=$2
91+
92+
if [[ $1 == "stop" ]]; then
93+
shut_down
94+
elif [[ $1 == "restart" ]]; then
95+
shut_down
96+
start_up $port
97+
elif [[ $1 == "start" ]]; then
98+
if ! start_up $port; then
99+
shut_down
100+
fi
101+
else
102+
usage
103+
fi

Diff for: fabfile.py

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
from fabric.api import *
2+
import fabric.contrib.project as project
3+
import os
4+
5+
# Local path configuration (can be absolute or relative to fabfile)
6+
env.deploy_path = 'output'
7+
DEPLOY_PATH = env.deploy_path
8+
9+
# Remote server configuration
10+
production = 'root@localhost:22'
11+
dest_path = '/var/www'
12+
13+
# Rackspace Cloud Files configuration settings
14+
env.cloudfiles_username = 'my_rackspace_username'
15+
env.cloudfiles_api_key = 'my_rackspace_api_key'
16+
env.cloudfiles_container = 'my_cloudfiles_container'
17+
18+
19+
def clean():
20+
if os.path.isdir(DEPLOY_PATH):
21+
local('rm -rf {deploy_path}'.format(**env))
22+
local('mkdir {deploy_path}'.format(**env))
23+
24+
def build():
25+
local('pelican -s pelicanconf.py')
26+
27+
def rebuild():
28+
clean()
29+
build()
30+
31+
def regenerate():
32+
local('pelican -r -s pelicanconf.py')
33+
34+
def serve():
35+
local('cd {deploy_path} && python -m SimpleHTTPServer'.format(**env))
36+
37+
def reserve():
38+
build()
39+
serve()
40+
41+
def preview():
42+
local('pelican -s publishconf.py')
43+
44+
def cf_upload():
45+
rebuild()
46+
local('cd {deploy_path} && '
47+
'swift -v -A https://auth.api.rackspacecloud.com/v1.0 '
48+
'-U {cloudfiles_username} '
49+
'-K {cloudfiles_api_key} '
50+
'upload -c {cloudfiles_container} .'.format(**env))
51+
52+
@hosts(production)
53+
def publish():
54+
local('pelican -s publishconf.py')
55+
project.rsync_project(
56+
remote_dir=dest_path,
57+
exclude=".DS_Store",
58+
local_dir=DEPLOY_PATH.rstrip('/') + '/',
59+
delete=True
60+
)

Diff for: pelicanconf.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*- #
3+
from __future__ import unicode_literals
4+
5+
AUTHOR = u'DIANA HEP'
6+
SITENAME = u'DIANA HEP'
7+
SITEURL = ''
8+
9+
TIMEZONE = 'Europe/Paris'
10+
11+
DEFAULT_LANG = u'en'
12+
13+
# Feed generation is usually not desired when developing
14+
FEED_ALL_ATOM = None
15+
CATEGORY_FEED_ATOM = None
16+
TRANSLATION_FEED_ATOM = None
17+
18+
# Blogroll
19+
LINKS = (('Pelican', 'http://getpelican.com/'),
20+
('Python.org', 'http://python.org/'),
21+
('Jinja2', 'http://jinja.pocoo.org/'),
22+
('You can modify those links in your config file', '#'),)
23+
24+
# Social widget
25+
SOCIAL = (('You can add links in your config file', '#'),
26+
('Another social link', '#'),)
27+
28+
DEFAULT_PAGINATION = 10
29+
30+
# Uncomment following line if you want document-relative URLs when developing
31+
#RELATIVE_URLS = True

Diff for: publishconf.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*- #
3+
from __future__ import unicode_literals
4+
5+
# This file is only used if you use `make publish` or
6+
# explicitly specify it as your config file.
7+
8+
import os
9+
import sys
10+
sys.path.append(os.curdir)
11+
from pelicanconf import *
12+
13+
SITEURL = ''
14+
RELATIVE_URLS = False
15+
16+
FEED_ALL_ATOM = 'feeds/all.atom.xml'
17+
CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml'
18+
19+
DELETE_OUTPUT_DIRECTORY = True
20+
21+
# Following items are often useful when publishing
22+
23+
#DISQUS_SITENAME = ""
24+
#GOOGLE_ANALYTICS = ""

Diff for: requirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pelican
2+
Markdown
3+
fabric

0 commit comments

Comments
 (0)