0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00
ghost/core/server/data/export/index.js

23 lines
556 B
JavaScript
Raw Normal View History

var when = require('when'),
migration = require('../migration');
2013-06-15 15:52:03 -05:00
module.exports = function (version) {
var exporter;
2013-06-15 15:52:03 -05:00
if (version > migration.currentVersion) {
return when.reject("Your data version is ahead of the current Ghost version. Please upgrade in order to export.");
}
try {
exporter = require("./" + version);
} catch (ignore) {
// Zero effs given
}
2013-06-15 15:52:03 -05:00
if (!exporter) {
return when.reject("No exporter found for data version " + version);
}
2013-06-15 15:52:03 -05:00
return exporter.exportData();
};