Created
October 19, 2011 07:48
-
-
Save phelrine/1297701 to your computer and use it in GitHub Desktop.
repository update notifier
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## usage | |
# sh notify.sh REPOSITORY_PATH FORMAT_STRING | |
TWEET_PROGRAM="ruby tweet.rb" | |
pushd `dirname $0` | |
# update repository | |
cd $1 | |
git fetch | |
commit_count=`git rev-list master..origin | wc -l` | |
git stash | |
git merge origin/master > /dev/null 2>&1 | |
# return scripts dir | |
popd | |
# tweet | |
${TWEET_PROGRAM} "$(printf "$2" $commit_count)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'rubytter' | |
require 'oauth' | |
CONSUMER_TOKEN, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_SECRET = File.open("consumer").read.split | |
client = OAuthRubytter.new( | |
OAuth::AccessToken.new( | |
OAuth::Consumer.new(CONSUMER_TOKEN, CONSUMER_SECRET, :site => "https://api.twitter.com/"), | |
ACCESS_TOKEN, | |
ACCESS_SECRET | |
) | |
) | |
client.update ARGV[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment