Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Cold Fusion Communication

New Here ,
Feb 22, 2010 Feb 22, 2010

I want to find out whether coldfusion can talk with SVN ,the reason is I should be able to download the component from SVN to my local system modify and then add it again to back to SVN or directly upload a new component from my local system to SVN. Basically my cold fusion application sholud be able to talk with SVN to perform the above functions.

TOPICS
Event gateways
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 27, 2010 Feb 27, 2010

This is some dude named Dan's Prior Art, His site is dead but google gave a cached page...  I can imagine all kinds of mods and uses for something like this...

Cool ColdFusion and Subversion integration

I recently decided to outsource my souce code management to CVSDude. I had been running SVN on my VPS that I have at Slicehost and that had been running okay.  However, I’m only good enough at SVN administration to get the server up and running and create a few repositories and there were other things that I needed to do with SVN that I frankly didn’t have time to learn how to do.

One of the things that I’d heard talked about that made life much easier was using Subversion’s various hooks to automate some things around different SVN events.  I emailed tech support asking how we could configure the “post-commit” hook to update the files on my VPS each time I made a commit into the SVN module.  The tech told me that they do this by configuring an HTTP call to a page (or script etc) on your server.  That page then triggers an SVN update of the specific module.

After hearing this, I began thinking about how to use CFEXECUTE to trigger the SVN update and was actually surprised how simple it was.  My VPS runs on Fedora Core 6, so, like any *nix operating system, you need to make sure permissions on the files are set so that the user which runs ColdFusion can write to the directories.  Once that was accomplished, all it took was a few lines of code and we’re ready to start receiving HTTP callbacks from CVSDude’s servers.

CVSDude structures their SVN URLs in the format http://username-svn.cvsdude.com/modulename (or https://).  All my modules are named in reverse domain order for the web site that it is for (for example, this one is ws.skaggsfamily.dan).  I had already checked out all my modules into a specific directory.

The HTTP callback from CFSDude’s server has 4 URL parameters that they send over: root (full path to module), author (user), revision and date.  So all I really had to do was grab the URL.root value and extract the name of the module, pass that to the CFEXECUTE tag and, voila, automatic updating of the module immediately after the commit.

There were only 2 gotchas that I had to figure out:

  1. Put the full path to the svn executable
  2. Add in your username and password to the string in the arguments attribute of CFEXECUTE

The code that I used is below.  I’m sure there’s more that I could have done with it, but this is a good start I think.

<cfif structKeyExists(URL, “date”) AND URL.date NEQ “” AND

    structKeyExists(URL,”author”) AND URL.author NEQ “” AND

    structKeyExists(URL, “revision”) AND URL.revision NEQ “” AND

    structKeyExists(URL, “root”) AND URL.root NEQ “”>

    <cfset module = replaceNoCase(URL.root, “http://username-svn.cvsdude.com/”, “”)>

    <cfexecute name=”/usr/bin/svn”

      arguments=”up /var/sites/#module# –username yourUserName –password yourPassword”

      timeout=”300″

      variable=”result”>

    </cfexecute>

    <cflog log=”Application”

      type=”information”

      text=”#URL.author#:#URL.root#:#URL.revision# – #result#”>

<cfmail to=”someone@somewhere.com”

    from=”somoneelse@somewhere.com”

    subject=”Server updated successfully”>

The server has been successfully updated with your lastest changes. 

Details of the update are below:

Date: #URL.date#

Module: #URL.root#

Revision: #URL.revision#

Results:

#result#

</cfmail>

</cfif>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 24, 2010 Mar 24, 2010
LATEST

This question isn't on Gateways. You should ask it in any of the sections  Coldfusion, Getting Started or Advanced Techniques. Then you will have a  higher chance to get an answer.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources