I'm using Visual SVN Server on my local machine running Windows 7 x64.
I'm looking for a simplest way to create a post-commit hook to some of my local repositories, allowing me to post commit information to my Facebook wall.
Bonus feature would be queueing the messages, if at the time of commit my pc isn't connected to Internet (it's laptop PC).
Best solution wouldn't require installing any other software. I am able of writing HTTP connecting program, I'd however like to use existing software, if any could be helpful.
I've managed to implement a solution that creates a new feed object (i.e. a creates a new post) on Facebook after each commit. The recipe is not fully tested and you should consider it as a proof of concept. I would not use a real Facebook account to test this.
Creating Facebook application for our SVN server's commit messages.
Configuring Subversion post-commit hook.
Powershell script execution must be enabled for the VisualSVN Server service user account.
Run the command:
New-FBConnection -AppID <YOUR-APP-ID> -RedirectUri <YOUR-APP-DOMAIN-URL>
Now you see a web-browser with a Facebook page requesting you to login and to allow access for the SVN server Facebook web app. Login and agree.
Start VisualSVN Server Manager, choose a repository and go to hooks management,
Choose to edit a post-commit hook,
Enter the following code and click OK:
@echo off set PWSH=%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe %PWSH% -command $input ^| %1\hooks\Facebook.ps1 %1 %2 if errorlevel 1 exit %errorlevel%
Create C:\Repositories\<repo-name>\hooks\Facebook.ps1
and enter the following code to the file:
$repos = $args[0] $rev = $args[1] $logmessage = svnlook info $repos -r $rev New-FBFeed -Message "$logmessage"
That's it! Though the messages are not formatted and the solution has a GREAT ROOM FOR IMPROVEMENT. The room can be compared to the size of the whole universe.