Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 13:56
What would you like to do?
A bash function for creating a new Octopress post from anywhere in the terminal
function octo_new {
cwd=$(pwd) #save pwd as cwd
cd /Users/$USER/Documents/code/
echo "Creating new octopress post called \""$1"\""
rake new_post["$1"]
cd source/_posts
FILENAME=`ls -t | head -1`
read -p "Would you like to commit & push your git and publish your Octopress blog now? (y/n) " -n 1 -r # Maybe give a "(d)elete this post" option
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
# commit git and publish blog
cd ../../
git add .
git commit -m "Used octo_new to publish a new post called "$FILENAME"." # $FILENAME ?
git push origin source
rake generate
rake deploy
cd $cwd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment