Script File uploads to Lion Server Wiki

We have 000s of files on an AFP share, used by 4 or 5 people. The share is on an OSX 10.7 server.

There is no attempt at version control or de-duplication by the users. I would like to hold each document in a seperate wiki page and use the document management features of the Wiki that comes with Lion Server to track changes against each document. I am looking for a scripted way to:

  1. select each document in the shared folder
  2. create a wiki page as a “New File”
  3. upload the document to the page
  4. tag the page with the path of the document (to enable searching by users)
    The Wiki is part of the collabd services which are a series of ruby programs.

I can see that the scripting could be done in ruby or as applescript using URL access scripting. I’m looking for sample code that I can adapt. Any hints or pointers?

Model: Mac Mini Server
AppleScript: 2.2.1
Browser: Safari 534.52.7
Operating System: Mac OS X (10.7)