Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
i1504
committed
Aug 20, 2012
0 parents
commit 5e3d7c3
Showing
27 changed files
with
1,075 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*~ | ||
._* | ||
*.lock | ||
*.DS_Store | ||
*.swp | ||
*.out | ||
*.py[cod] | ||
output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
PELICAN=pelican | ||
PELICANOPTS= | ||
|
||
BASEDIR=$(PWD) | ||
INPUTDIR=$(BASEDIR)/content | ||
OUTPUTDIR=$(BASEDIR)/output | ||
CONFFILE=$(BASEDIR)/pelicanconf.py | ||
PUBLISHCONF=$(BASEDIR)/publishconf.py | ||
|
||
FTP_HOST=localhost | ||
FTP_USER=anonymous | ||
FTP_TARGET_DIR=/ | ||
|
||
SSH_HOST=localhost | ||
SSH_PORT=22 | ||
SSH_USER=root | ||
SSH_TARGET_DIR=/var/www | ||
|
||
DROPBOX_DIR=~/Dropbox/Public/ | ||
|
||
help: | ||
@echo 'Makefile for a pelican Web site ' | ||
@echo ' ' | ||
@echo 'Usage: ' | ||
@echo ' make html (re)generate the web site ' | ||
@echo ' make clean remove the generated files ' | ||
@echo ' make regenerate regenerate files upon modification ' | ||
@echo ' make publish generate using production settings ' | ||
@echo ' make serve serve site at http://localhost:8000' | ||
@echo ' make devserver start/restart develop_server.sh ' | ||
@echo ' ssh_upload upload the web site via SSH ' | ||
@echo ' rsync_upload upload the web site via rsync+ssh ' | ||
@echo ' dropbox_upload upload the web site via Dropbox ' | ||
@echo ' ftp_upload upload the web site via FTP ' | ||
@echo ' github upload the web site via gh-pages ' | ||
@echo ' install_theme install theme ' | ||
@echo ' ' | ||
|
||
|
||
html: clean $(OUTPUTDIR)/index.html | ||
@echo 'Done' | ||
|
||
$(OUTPUTDIR)/%.html: | ||
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) | ||
|
||
clean: | ||
find $(OUTPUTDIR) -mindepth 1 -delete | ||
|
||
regenerate: clean | ||
$(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) | ||
|
||
serve: | ||
cd $(OUTPUTDIR) && python -m SimpleHTTPServer | ||
|
||
devserver: | ||
$(BASEDIR)/develop_server.sh restart | ||
|
||
publish: | ||
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS) | ||
|
||
ssh_upload: publish | ||
scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) | ||
|
||
rsync_upload: publish | ||
rsync -e "ssh -p $(SSH_PORT)" -P -rvz --delete $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) | ||
|
||
dropbox_upload: publish | ||
cp -r $(OUTPUTDIR)/* $(DROPBOX_DIR) | ||
|
||
ftp_upload: publish | ||
lftp ftp://$(FTP_USER)@$(FTP_HOST) -e "mirror -R $(OUTPUTDIR) $(FTP_TARGET_DIR) ; quit" | ||
|
||
github: publish | ||
ghp-import $(OUTPUTDIR) | ||
git push origin gh-pages | ||
|
||
install_theme: | ||
pelican-themes --install $(BASEDIR)/pelican-theme | ||
|
||
.PHONY: html help clean regenerate serve devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload github install_theme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Pelican-powered blog | ||
==================== | ||
|
||
1. Install [Pelican](http://docs.getpelican.com/): ``pip install -r requirements.txt`` | ||
2. Apply theme: ``make install_theme`` | ||
3. Generate blog: ``pelican content -s pelicanconf.py`` | ||
4. Update gh-pages branch: ``ghp-import output`` | ||
5. Upload on GitHub: ``git push origin gh-pages`` | ||
6. [Setting up a custom domain](https://help.github.com/articles/setting-up-a-custom-domain-with-pages) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Date: 2012-08-19 | ||
Title: First post | ||
Slug: 2012/08/first-post | ||
Author: Дмитрий Кукушкин | ||
|
||
hello world! | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Date: 2012-08-19 | ||
Title: Second post | ||
Slug: 2012/08/second-post | ||
Author: Дмитрий Кукушкин | ||
|
||
asdsdadas | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Date: 2012-08-19 | ||
Title: third post | ||
Slug: 2012/08/third-post | ||
Author: Дмитрий Кукушкин | ||
|
||
sadasdasdsa | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/bin/bash | ||
## | ||
# This section should match your Makefile | ||
## | ||
PELICAN=pelican | ||
PELICANOPTS= | ||
|
||
BASEDIR=$(PWD) | ||
INPUTDIR=$BASEDIR/content | ||
OUTPUTDIR=$BASEDIR/output | ||
CONFFILE=$BASEDIR/pelicanconf.py | ||
|
||
### | ||
# Don't change stuff below here unless you are sure | ||
### | ||
|
||
SRV_PID=$BASEDIR/srv.pid | ||
PELICAN_PID=$BASEDIR/pelican.pid | ||
|
||
function usage(){ | ||
echo "usage: $0 (stop) (start) (restart)" | ||
echo "This starts pelican in debug and reload mode and then launches" | ||
echo "A SimpleHTTP server to help site development. It doesn't read" | ||
echo "your pelican options so you edit any paths in your Makefile" | ||
echo "you will need to edit it as well" | ||
exit 3 | ||
} | ||
|
||
function shut_down(){ | ||
if [[ -f $SRV_PID ]]; then | ||
PID=$(cat $SRV_PID) | ||
PROCESS=$(ps -p $PID | tail -n 1 | awk '{print $4}') | ||
if [[ $PROCESS == python ]]; then | ||
echo "Killing SimpleHTTPServer" | ||
kill $PID | ||
else | ||
echo "Stale PID, deleting" | ||
fi | ||
rm $SRV_PID | ||
else | ||
echo "SimpleHTTPServer PIDFile not found" | ||
fi | ||
|
||
if [[ -f $PELICAN_PID ]]; then | ||
PID=$(cat $PELICAN_PID) | ||
PROCESS=$(ps -p $PID | tail -n 1 | awk '{print $4}') | ||
if [[ $PROCESS != "" ]]; then | ||
echo "Killing Pelican" | ||
kill $PID | ||
else | ||
echo "Stale PID, deleting" | ||
fi | ||
rm $PELICAN_PID | ||
else | ||
echo "Pelican PIDFile not found" | ||
fi | ||
} | ||
|
||
function start_up(){ | ||
echo "Starting up Pelican and SimpleHTTPServer" | ||
shift | ||
$PELICAN --debug --autoreload -r $INPUTDIR -o $OUTPUTDIR -s $CONFFILE $PELICANOPTS & | ||
echo $! > $PELICAN_PID | ||
cd $OUTPUTDIR | ||
python -m SimpleHTTPServer & | ||
echo $! > $SRV_PID | ||
cd $BASEDIR | ||
} | ||
|
||
### | ||
# MAIN | ||
### | ||
[[ $# -ne 1 ]] && usage | ||
if [[ $1 == "stop" ]]; then | ||
shut_down | ||
elif [[ $1 == "restart" ]]; then | ||
shut_down | ||
start_up | ||
elif [[ $1 == "start" ]]; then | ||
start_up | ||
else | ||
usage | ||
fi |
Oops, something went wrong.