SVN Post Fix for Posting on Facebook Wall

I am using Visual SVN Server on my local computer running Windows 7 x64.

I'm looking for the easiest way to create a post-commit link to some of my local repositories, allowing me to post commit information on my Facebook wall.

The bonus feature will place messages in the queue if during fixation my computer is not connected to the Internet (this is a laptop).

The best solution will not require the installation of any other software. I can write a program for connecting HTTP, but I would like to use existing software if it were useful.

+4
source share
1 answer

I managed to implement a solution that creates a new feed object (i.e. 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 verify this.

Environment:

  • Windows Server 2012,
  • VisualSVN Server 2.5.8,
  • Windows Powershell / Powershell ISE,
  • FacebookPSModule .

Actions:

Creating a Facebook app for our SVN server commit messages.

  • Go to https://developers.facebook.com/ ,
  • Applications | choose to create a new Facebook application,
  • For the display name, use something like "Smart and Shiny SVN Server",
  • Request the application domain for the application ( remember the URL! ),
  • Remember the application identifier.

Configuring the post-commit subversion hook.

The Powershell script action must be enabled for the VisualSVN Server service user account.

  • Install FacebookPSModule (check docs )
  • Launch Powershell ISE,
  • Run the command:

    New-FBConnection -AppID <YOUR-APP-ID> -RedirectUri <YOUR-APP-DOMAIN-URL>

    Now you see a web browser with a Facebook page asking you to log in and allow access to the web application of the SVN server web server. Log in and agree.

  • Launch VisualSVN Server Manager, select the repository and go to hook management,

  • Select to edit the binding after commit,

  • 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 into the file:

     $repos = $args[0] $rev = $args[1] $logmessage = svnlook info $repos -r $rev New-FBFeed -Message "$logmessage" 

What is it! Although the messages are not formatted, the solution has a BIG ROOM FOR IMPROVEMENT. A room can be compared to the size of the entire universe.

+4
source

Source: https://habr.com/ru/post/1383400/


All Articles