DBMail on twitter

Tuesday, January 19. 2010

I've added a post-receive hook to my GIT repository at git.dbmail.eu so you can stay in touch with dbmail changes via twitter.

You can follow me at http://twitter.com/pjstevns.

The script I'm using is really simple. Some others might also find this useful:

#!/bin/sh

# copyright Paul Stevens, 2010, paul@nfg.nl
# licence GPLv2
#
# example hook script to send out twitter messages.
# This script will send out messages summarizing new revisions
# introduced by the change received
#
#
# Config
# ------
# hooks.twitterid
#   the username on twitter
# hooks.twitterpw
#   the password on twitter
# hooks.hashtag
#   insert a hashtag at the start of the message
# hooks.hashurl
#   replace hash signs in commit messages with an url. This
#   is used to link hash ids in messages to a bugtracker since
#   they typically refer to a bug-id.
#


GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
if [ -z "$GIT_DIR" ]; then
	echo >&2 "fatal: post-receive: GIT_DIR not set"
	exit 1
fi
projectdesc=$(sed -ne '1p' "$GIT_DIR/description")
# Check if the description is unchanged from it's default, and shorten it to a
# more manageable length if it is
if expr "$projectdesc" : "Unnamed repository.*$" >/dev/null
	then
	projectdesc="UNNAMED PROJECT"
fi


generate_message()
{
	oldrev=$(git rev-parse $1)
        newrev=$(git rev-parse $2)
	refname="$3"
	message=`git log --pretty=oneline ${oldrev}..${newrev} $refname|cut -f2- -d' '|sed 's/$/, /g'`
	hashurl=`echo "$hashurl"|sed 's/?/?/'`
	if [ -n "$hashtag" ]; then
		echo -n "#${hashtag} "
	fi
	echo $message|sed -e "s,#,${hashurl},g" -e 's/,$//'
}		

send_twitter()
{
	message="$@"
	curl --basic --user ${twitterid}:${twitterpw} --data status="$message" 
		https://twitter.com/statuses/update.xml >/dev/null
}




twitterid=$(git repo-config hooks.twitterid)
twitterpw=$(git repo-config hooks.twitterpw)
hashurl=$(git repo-config hooks.hashurl)
hashtag=$(git repo-config hooks.hashtag)

# --- Main loop
# Allow dual mode: run from the command line just like the update hook, or if
# no arguments are given then run as a hook script
if [ -n "$1" -a -n "$2" -a -n "$3" ]; then
        # Output to the terminal in command line mode - if someone wanted to
        # resend an email; they could redirect the output to sendmail themselves
        generate_message $1 $2 $3
else
        while read oldrev newrev refname
        do
                message=`generate_message $oldrev $newrev $refname`
		send_twitter "$message"
        done
fi

re-theming dbmail.org

Thursday, January 7. 2010

The look and functionality of dbmail.org has been a neglected steph-child of abandonment for too long. So I decided to spent some time revising and redesigning.

The major goal was offering a more professional impression to first time visitors, and providing a better insight into the dynamic of the project as a whole. This is why I made it a portal-style site, showing several small blocks of recent activity concerning code-changes, news, and yes blog entries like this one.

I'm not a graphics designer, but I still hope the designers among you won't be too offended by the lack of gloss and finish. Still, I did utilize one small trick by applying another project I've been buzy working on http://webfonts.biz - a font-service.

Hope you like it.

Welcome to my dbmail experience

Thursday, May 15. 2008

Here I will come to share what it means for me to work on this little open-source project called dbmail. Hopefully it will be as much of a learning experience to write about it, as it is to work on it.

But first, a disclaimer; Whatever I tell you, don't take my word for it! Seek confirmation from those you trust. If you want to talk about a specific problem, seek the best specialist you can find.

Dbmail, for me, is about writing code, enjoying the act of creation, learning to love C, dealing with matters of consistency, assurance, and trust. It's about getting it right. Making mistakes. And being honest about both.

Communities of trust don't just happen. They take a lot of effort, affection and rejection. Trust yourself as well as others. Where fear or lack of confidence do not deflect you from pursuing your vision, experience will be your teacher. Perseverance will take us halfway any task. Stick to it, and enjoy the ride.