Created
April 15, 2010 15:41
-
-
Save robi42/367259 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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