Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

97 lines (68 sloc) 3.52 KB

Vortex CMS Utilities

A small set of utilities for publishing and managing files stored in the Vortex Content Managament System. Uses the 'net_dav' gem to communcate with WebDAV.


If Ruby and Rubygems package management is installed, simply run the command:

  $ gem install vortex_utils

Hello World

This script will prompt for username and password and publish a simple article.

  require 'rubygems'
  require 'net/dav'
  require 'json'
  require 'vortex_utils'

  dav ='')
  article = {
    "resourcetype" => "structured-article",
    "properties" =>    {
      "title" => "Hello world!",
      "introduction" => "This is the introduction.",
      "content" => "<p>And this is the main content.</p>"
  dav.put_string('hello-world.html', article.to_json)

The 'vortex_utils' library included in this script modifies the method so it will prompt for username and password. The 'net/dav' library is used for communicating with the server using the WebDAV extensions to the HTTP protocol. Homepage for Net::DAV with documentation and wiki.

If you are running OS X, 'vortex_utils' can store the password in the encrypted keychain store with the option :osx_keychain => true

  require 'rubygems'
  require 'net/dav'
  require 'json'
  require 'vortex_utils'

  dav ='', :osx_keychain => true)

Documents are generally stored as JSON encoded files in Vortex. JSON hashmaps are very similar to hashmaps in Ruby, and can be converted with the to_json method if the 'json' library is included. See also a full list of properties for documents and collections in Vortex.

Creating readable url's

To generate a filename from a title use the 'to_readable_url' method on strings. The output confirms to the policy at University of Oslo for translating nordic letters into standard letters. This script will print out the string "this-is-a-circumflexed-sentence".

  require 'rubygems'
  require 'vortex_utils'
  print "this is a çircûmflexed senteñce".to_readable_url
  # => "this-is-a-circumflexed-sentence"

Uploading graphics and other binary files

  require 'rubygems'
  require 'net/dav'
  require 'json'
  require 'vortex_utils'

  dav ='')'/test/')
  dav.put_string('dice_6.gif', open('dice_6.gif').read)

Creating folders

Folders are called collections in WebDAV servers. In Vortex folders can for instance have titles, a type and be hidden from navigation.

    @dav.set_vortex_collection_title('/test/test-folder','My folder title')
    title = @dav.get_vortex_collection_title('/test/test-folder')  # => Returns "My folder title"

Tip: Reverse engingeer Vortex

The document types in vortex can change over time. When creating a script that should publish something to vortex, it's good practice to create a document manually with the admin user interface and look at the generated JSON source. To do this visit the 'About' tab in the admin pages, then click the "Source address" link.

Author: Thomas Flemming

Jump to Line
Something went wrong with that request. Please try again.