Ruby Userland

(Back in 2003 I ran a moderately popular tech blog on the Radio UserLand platform. This is an archived version of a post from that blog. You can view an index of all the archived posts.)

Friday, 21 November 2003

As I previously mentioned, I've been toying with custom clients to the XmlStorageSystem XML-RPC protocol used by Radio Userland and several open source blog servers, with the ultimate goal of hosting a custom blog on the host.

Over the past couple of evenings I've hacked out xmlStorageSystem.rb, a reasonably functional Ruby-based client to the XmlStorageSystem system protocol. It works like this:

To create a new instance of the client, use:<usernumber>,<md5-hash-of-password>,<root-directory>)

For instance, I use:'122027','8c8034f5c9d68564e155c67a6d4e4612','/0122027/')

although that's not my actual password.

Actually, my local copy of xmlStorageSystem.rb has these value specified as the defaults, so I just user, and I'll use that form in the rest of these examples. The constructor also accepts an number of arguments that should allow one to connect to the Python Community Server and others, although Radio is the only server I've tried.

To get a listing of the files currently stored on the server, use:

To download all those files to a local directory 'backupdir'

To upload a file (or files) to the server, use: 'local-base-dir', [ 'file1', 'file2', 'etc' ])

To delete a file (or files) from the server, use: [ 'file1', 'file2', 'etc' ])

Finally, the really handy one: 'localdir'

Which will compare the list of files in the local directory with those on the server, delete the ones that don't appear locally, and load/update the rest.

Since this is Ruby, it's easy to set up little shell scripts that invoke those commands in ways useful to your personal work style.

If one wanted to be clever, there is metadata available via XmlStorageSystem.getMyDirectory that would allow one to determine whether or not a file has changed since it was last uploaded, but I haven't gotten around to that yet.

I'm still pretty much a Ruby neophyte, so there's probably substantial room for improvement there. In particular, (1) there's no error handling present just yet and (2) the current implementation supports hackablity (changing the script itself) more than extensibility. Nevertheless, it's neat that a Ruby neophyte can write a basic XmlStorageSystem client in 150 lines of readable code.

This page was generated at 9:56 PM on 15 Jan 2016.
Copyright © 1999 - 2016 Rodney Waldhoff.