NTICompass / twitvn

TwitVN lets you publish your SVN commits to a twitter feed and include a trac link with it.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Twitter Setup

You need to set up your own Twitter app for this script to work.

    Go to this site: https://dev.twitter.com/apps/new
    Set up an app, and then enter the consumer secret/consumer key into twitvn.py and auth.py 
    If you want to use bit.ly so that your trac links appear shorter and save space in the tweet, set up an user account at http://dev.bitly.com/. Direct account creation at: http://bitly.com/a/your_api_key. Enter the username and key into twitvn.py 

Pre-installation

You will need to install tweepy (simpleJSON if you have python 2.5, it's included with 2.6), , and optionally bitlyapi for getting shorter http links.

    easy_install simplejson (python 2.5 only)
    easy_install tweepy
    For GIT: easy_install gitpython 
    easy_install bitlyapi (optional)

Installation

    Make a TwitVN folder in the SVN or GIT hooks folder
    Put twitvn.py (or twitvn-git.py) and auth.py into the TwitVN folder
    For SVN:
        Add the following line to post-commit in the SVN hooks folder (trac is optional).  The new trac ver 0.12 and above have the opportunity to work with different svn repos. Because the creation of the trac url's has changed, you also need to supply the repo name with the -n parameter.

        python /path/to/svn/repo/hooks/TwitVN/twitvn.py -f "${REPOS}" -r "${REV}" -t "<url for trac>" -n "<trac repository name>"

    For GIT:
        Add the following line to update in the GIT hooks folder

        echo "-o ${2} -n ${3}" > twitvn.tmp

        Add the following line to post-update in the GIT hooks folder

        DIR=$(cd `dirname $0` && pwd)
        PARENT=`dirname $DIR`
        python "${PARENT}"/hooks/twitvn/twitvn-git.py -f "${PARENT}" `cat twitvn.tmp`
        rm twitvn.tmp

OAuth Setup

In order for TwitVN to post to Twitter it must be authorized to your account. To do this follow the instructions below.

    Go into the TwitVN folder, and launch the auth.py script

    python auth.py

    The script will print a URL, copy and paste that into your browser
    Login to twitter, and authorize the TwitVN app
    Enter the PIN number given in the browser into the python script
    The python script will print out an Access Key and an Access Secret
    Copy these 2 keys into the twitvn.py script:

About

TwitVN lets you publish your SVN commits to a twitter feed and include a trac link with it.


Languages

Language:Python 100.0%