mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Renamed "image" importer to generic ContentFileImporter
refs https://github.com/TryGhost/Toolbox/issues/523 - This is ground work before introducing a "media" content type importer - Previous "image" file name was not describing well what the importer was capable of doing
This commit is contained in:
parent
6361f27ec1
commit
49553e5942
4 changed files with 10 additions and 11 deletions
|
@ -15,7 +15,7 @@ const MediaHandler = require('@tryghost/importer-handler-media');
|
|||
const RevueHandler = require('./handlers/revue');
|
||||
const JSONHandler = require('./handlers/json');
|
||||
const MarkdownHandler = require('./handlers/markdown');
|
||||
const ImageImporter = require('./importers/image');
|
||||
const ContentFileImporter = require('./importers/ContentFileImporter');
|
||||
const RevueImporter = require('@tryghost/importer-revue');
|
||||
const DataImporter = require('./importers/data');
|
||||
const urlUtils = require('../../../shared/url-utils');
|
||||
|
@ -60,7 +60,7 @@ class ImportManager {
|
|||
storage: mediaStorage
|
||||
});
|
||||
|
||||
const imageImporter = new ImageImporter({
|
||||
const imageImporter = new ContentFileImporter({
|
||||
type: 'images',
|
||||
store: imageStorage
|
||||
});
|
||||
|
|
|
@ -46,7 +46,7 @@ preProcessUsers = function (data, image) {
|
|||
});
|
||||
};
|
||||
|
||||
class ImageImporter {
|
||||
class ContentFileImporter {
|
||||
/** @property {string} */
|
||||
type;
|
||||
|
||||
|
@ -56,7 +56,7 @@ class ImageImporter {
|
|||
/**
|
||||
*
|
||||
* @param {Object} deps
|
||||
* @param {string} deps.type - importer type
|
||||
* @param {'images'} deps.type - importer type
|
||||
* @param {import('ghost-storage-base')} deps.store
|
||||
*/
|
||||
constructor(deps) {
|
||||
|
@ -88,4 +88,4 @@ class ImageImporter {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = ImageImporter;
|
||||
module.exports = ContentFileImporter;
|
|
@ -1,12 +1,11 @@
|
|||
const _ = require('lodash');
|
||||
const sinon = require('sinon');
|
||||
|
||||
const storage = require('../../../../../../core/server/adapters/storage');
|
||||
const ImageImporter = require('../../../../../../core/server/data/importer/importers/image');
|
||||
const ContentFileImporter = require('../../../../../../core/server/data/importer/importers/ContentFileImporter');
|
||||
|
||||
describe('ImageImporter', function () {
|
||||
it('has the correct interface', function () {
|
||||
const imageImporter = new ImageImporter({
|
||||
const imageImporter = new ContentFileImporter({
|
||||
type: 'images',
|
||||
store: {}
|
||||
});
|
||||
|
@ -17,7 +16,8 @@ describe('ImageImporter', function () {
|
|||
|
||||
it('does preprocess posts, users and tags correctly', function () {
|
||||
let inputData = require('../../../../../utils/fixtures/import/import-data-1.json');
|
||||
const imageImporter = new ImageImporter({
|
||||
const imageImporter = new ContentFileImporter({
|
||||
type: 'images',
|
||||
store: {}
|
||||
});
|
||||
let outputData = imageImporter.preProcess(_.cloneDeep(inputData));
|
||||
|
@ -52,7 +52,7 @@ describe('ImageImporter', function () {
|
|||
const storageApi = {
|
||||
save: sinon.stub().returns(Promise.resolve())
|
||||
};
|
||||
const imageImporter = new ImageImporter({
|
||||
const imageImporter = new ContentFileImporter({
|
||||
store: storageApi
|
||||
});
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ let ImageHandler = rewire('../../../../../core/server/data/importer/handlers/ima
|
|||
const MarkdownHandler = require('../../../../../core/server/data/importer/handlers/markdown');
|
||||
const RevueHandler = require('../../../../../core/server/data/importer/handlers/revue');
|
||||
const DataImporter = require('../../../../../core/server/data/importer/importers/data');
|
||||
const ImageImporter = require('../../../../../core/server/data/importer/importers/image');
|
||||
const RevueImporter = require('@tryghost/importer-revue');
|
||||
const configUtils = require('../../../../utils/configUtils');
|
||||
const logging = require('@tryghost/logging');
|
||||
|
|
Loading…
Add table
Reference in a new issue