A node module providing a pure JavaScript re-implementation PressGang CCMS Content Spec Processor functionality.
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
index.js
package.json

README.md

#node-pressgang-cylon-processor

Update (April 2013): Don't use this now. The node-pressgang-rest (npm install pressgang-rest) does it all.

A node module that provides a pure JavaScript re-implementation PressGang CCMS Content Spec Processor functionality. "Why?" I hear you ask. This reimplementation provides Content Spec Processor functionality as a library, so that you can hook all kinds of weird and wonderful things into the processing.

##Installation

npm install pressgang-cylon

Basic Usage

First, require pressgang-cylon:

var cylon = require('pressgang-cylon');

The Cylon Processor implements csprocessor checkout:

var url = 'http://pressgang.server.com:8080/TopicIndex';
var id = 8432;
var dir = '/opt/checkouts'

cylon.checkout(url, id, dir, 
	function(err, md){
		if (err) { 
			console.log(err) 
		} else { 
			console.log('Successfully checked out %s to %s',
				md.title, md.bookdir);
	}
});

The callback function receives a Content Specification metadata object with all the metadata from the Content Specification. This is useful if you want to generate an index of checked out books.

You can extract the metadata from a Content Specification using getSpecMetadata:

cylon.getSpecMetadata(url, id, 
	function(err, md){
		if (err) { 
			console.log(err); 
		} else { 
			console.log(md); 
		}
	}
); 

You can get a Content Specification with getSpec:

cylon.getSpec(url, id,
	function(err, spec){
		if (err) 
			{ console.log(err); } 
		else
			{ console.log(spec); }
	}
);