hychen's octopress admin script
- python (>=2.5)
- git
- sensible-editor
- python modules:
- UCLTIP (>= 0.6)
user@host:~$ apt-get install git
user@host:~$ apt-get install python-ucltip
user@host:~$ git clone http://github.com/hychen/octopress-admin
user@host:~$ cd octopress-admin
user@host:octopress-admin$ python setup.py install
or just create a link
user@host:octopress-admin$ ln -s ~/bin/blog $PWD/octopress-admin/bin/octopress-admin
notice: if you want to use command located in ~/bin, you need to add ~/bin to PATH variable, like this
PATH=~/bin:$PATH
before using this tool, please setup your ruby enviroment for octopress
cloned octopress source
$ octopress-admin new hyblog
setup for deploy to github
note: a user gh_page repository in github link is required
$ octopress-admin new hyblog
create a new post and commit in a git branch, every draft post is mapping to a git branch name starts with a drafts prefix
$ octopress-admin post 'this is a new post'
---
layout: post
title: ""hello""
date: 2011-12-04 05:15
comments: true
categories:
---
here is how log look likes
2011-12-04 Hsin-Yi Chen (hyc~ o [source] enable facebook like
2011-12-04 Hsin-Yi Chen (hyc~ │ o [drafts/2011-12-04-hiello] start to write hiello
2011-12-04 Hsin-Yi Chen (hyc~ I─┘ Finished github deploy settings
list posts in drafts/* branchs
$ octopress-admin drafts
[1] source/_posts/2011-12-04-hello.markdown (branch: drafts/2011-12-04-hello)
checkout to a draft branch and use user favor editor to modify the draft post
$ octopress-admin edit 1
---
layout: post
title: ""hello""
date: 2011-12-04 05:15
comments: true
categories:
---
1 is a number as a index of draft branchs, it is recommand to use
octopress-admin drafts
to know the index of drafts now, because branch index is not always the same.
merge a draft post to source and also delete a draft branch which means the draft post will be include in next blog site building
$ octopress-admin publish 1
1 is a number as a index of draft branchs
here is the commit log after publish the draft
2011-12-04 Hsin-Yi Chen (hyc~ M─┐ [source] Merge branch 'drafts/2011-12-04-hello' into source
2011-12-04 Hsin-Yi Chen (hyc~ │ o start to write hello
2011-12-04 Hsin-Yi Chen (hyc~ o │ enable facebook like
2011-12-04 Hsin-Yi Chen (hyc~ o─┘ Finished github deploy settings
generate contents of blog site and push to github
$ octopress-admin deploy
get lastest octopress source code and install
$ octopress-admin upgrade
run rake preview
$ octopress-admin preview