0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/core/server/data/import/index.js
Hannah Wolfe e0edb6455d Temporary Importer
closes #735

 - make sure the importer gets loaded
 - additional preprocessing to ensure data can be loaded
 - removed old importers
2013-09-18 04:20:21 +01:00

31 lines
764 B
JavaScript

var when = require('when');
module.exports = function (version, data) {
var importer;
try {
importer = require("./" + version);
} catch (ignore) {
// Zero effs given
}
if (!importer) {
return when.reject("No importer found");
}
return importer.importData(data).otherwise(function (err) {
if (err === "Unsupported version of data: 001" || err === "Unsupported version of data: 002") {
try {
importer = require("./temp.js");
} catch (ignore) {
// Zero effs given
}
if (!importer) {
return when.reject("No importer found");
}
return importer.importData(data);
}
});
};