Sirius Stuff

Sirius Stuff header image 2

Script to update Blogofile blog on Amazon S3

April 29, 2011 at 03:00 PM | categories: Blogging | View Comments
Because BlogofileBlogofile (at least the 0.7.1 version I'm using) regenerates every file and directory every time it makes it hard to update just the changed files on >Amazon's S3 (Simple Storage System).
So I wrote a shell script that updates only the changed files and also pings GooglePing so that Google and other services come along and read your update.
Over time, the difference between what the old page 2 on S3 has and what it should be will build. There's a simple answer, which is to just upload all of the page files.
Every 10 blog posts or so, you could just update all the category and archive files as well. Maybe that's somthing to automate as well

# !/bin/bash
# jdeibele [ at ] gmail . com
# What this does:
#   builds your blog with blogofile, then builds a list of key 
#   files that have changed.  Blogofile is a python program
#   that uses Mako to generate static pages.
#
# Blogofile: http://www.blogofile.com
#
# For me, these files are:
#   the post itself
#   the first page of the categories it appears in 
#   feeds for the categories (RSS and atom)
#   the archive page (year/month) 
#   the first page of /page/
#   feed for the blog (RSS and atom)
#   the main page (index.html) for the blog
#
#
BLOGURL="www.siriusventures.com"
BLOGNAME="Sirius Stuff"
BLOGHOME=$HOMEDIR/siriusventures
#
#
cd $BLOGHOME 
blogofile build
rmdir *
# blogofile builds extra directories for these but they're empty
cd $BLOGHOME/_posts
file=`ls -t * | head -1`
permalink=`grep "^permalink:" $file | cut -f3 -d: | cut -f4 -d"/"`
archive=`grep "^date:" $file | cut -f2 -d: | cut -f1,2 -d/ | sed 's/ //g'`
#
# "slugify" the category names 
#
categories=`grep "^categories:" $file | tr [:upper:] [:lower:]  | cut -f2 -d: | sed s'/^ //' | sed s'/ /-/'`
echo $categories
cd $BLOGHOME/_site
IFS=','
echo index.html > /tmp/postit
for category in $categories
do
    echo category/$category/index.html >> /tmp/postit
    echo category/$category/1/index.html >> /tmp/postit
    echo category/$category/feed/index.xml >> /tmp/postit
    echo category/$category/feed/atom/index.xml >> /tmp/postit
done
echo archive/$archive/1/index.html>> /tmp/postit
echo feed/index.xml >> /tmp/postit
echo feed/atom/index.xml >> /tmp/postit
echo page/1/index.html>> /tmp/postit
# 
# s3cmd can be installed with homebrew - brew install s3cmd
#
#
# s3cmd needs -recursive to upload a new directory
#
s3cmd put --recursive $BLOGHOME/_site/$permalink s3://$BLOGURL
#
while read file
do
    s3cmd put $BLOGHOME/_site/$file s3://$BLOGURL/$file
    echo $BLOGHOME/_site/$file
done 


What's not perfect with Blogofile

April 28, 2011 at 03:00 PM | categories: Web, User Interface, Blogging | View Comments
In Switched from WordPress to Blogofile there are two good things about using Blogofile:
  • flat files are almost impossible to hack
  • Amazon's S3 (Simple Storage System) can scale incredibly high


There's some downsides:
  • blogofile build seems to copy or regenerate every single file
  • it's not totally happy being on S3 - it doesn't make index.html files for the archive and category directories.
  • there's no easy way to post-via-email or send a link to start a post


Right now I'm writing this with vi and that's far less comfortable than WordPress's editor which I really liked. But I'm sure I'll find TextWrangler or something as suitable for writing blog posts.

Celebrity Worship and the American Dream · Violent Acres

June 15, 2007 at 06:06 AM | categories: Blogging | View Comments

Love this quote from Violent Acres about Celebrity Worship and the American Dream

Speaking of the American dream, has anyone noticed how much it’s changed? The American dream used to be about owning a modest home, having a happy family, and supporting yourself with honest, hard work. No one vies for things like that anymore.

She certainly expresses herself in ways that I wouldn’t. But like the way so many of her posts cut to the heart of things. Recommended reading.


Google Reader Optimized

June 13, 2007 at 06:06 AM | categories: Blogging | View Comments

I’ve been using Google Reader more and more. I’m not thrilled with the layout, so I was really pleased to see that I could modify it either using the Stylish FireFox Extension or via Greasemonkey Google Reader Optimized

I started out with Stylish but am trying to cut down on the number of extensions I have. Of course, whether it’s better to have it as a Greasemonkey script seems more open to problems than an extension. You’re one level away from the scripts and they don’t go through the official Mozilla check-in process.


I'm Sorry You Feel That Way

May 29, 2007 at 05:05 AM | categories: Blogging, General | View Comments

Wow, this is a great post. Pet Peeve #7: I’m Sorry You Feel That Way · Violent Acres totally sums up how snotty some people are when saying “I’m sorry you feel that way”. Wow.