Ghost/core/server/data/export/index.js
Hannah Wolfe 338109c762 Data models import, export, and reset for 002
- added line to index.js to set node_env to development if it is not set
 - fixed a small bug with the persistent notifications and used them on debug page from server side
 - added 002 files to manage export and import for 002
 - 002 import is somewhat smarter than 001, merging settings (except version), replacing user & clearing primary keys
 - added reset to models and migration, which does the down operation the same way that init does the up operation
 - import and reset clear session & redirect to login / signup
 - additional unit tests
2013-08-05 13:56:30 +01:00

23 lines
556 B
JavaScript

var when = require('when'),
migration = require('../migration');
module.exports = function (version) {
var exporter;
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
}
if (!exporter) {
return when.reject("No exporter found for data version " + version);
}
return exporter.exportData();
};