Skip to content

Instantly share code, notes, and snippets.

@robi42
Created April 15, 2010 15:41
Show Gist options
  • Save robi42/367259 to your computer and use it in GitHub Desktop.
Save robi42/367259 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ringo
// Lives in: `ringowiki/db/`
var fs = require('fs');
var path = fs.path('Page');
fs.list(path).forEach(function (file) {
var filePath = fs.join(path, file);
var data = JSON.parse(fs.read(filePath));
print('Old data:', JSON.stringify(data));
data.revisions.reverse();
data.revisions = data.revisions.map(function (it) {
return {body: it, created: new Date()};
});
print('New data:', JSON.stringify(data));
fs.write(filePath, JSON.stringify(data));
print('Done w/ file:', file);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment