mirror of
https://github.com/TryGhost/Ghost.git
synced 2023-12-13 21:00:40 +01:00
Update some server side errors/warnings
issue #2482 - add help messages to all package.json errors/warnings - change the pageUrl warning to have the correct version numbers
This commit is contained in:
parent
ae3c36797a
commit
ba1c1bd25d
3 changed files with 24 additions and 9 deletions
|
@ -121,7 +121,7 @@ coreHelpers.page_url = function (context, block) {
|
|||
//
|
||||
coreHelpers.pageUrl = function (context, block) {
|
||||
errors.logWarn('Warning: pageUrl is deprecated, please use page_url instead\n' +
|
||||
'The helper pageUrl has been replaced with page_url in Ghost 0.5, and will be removed entirely in Ghost 0.6\n' +
|
||||
'The helper pageUrl has been replaced with page_url in Ghost 0.4.2, and will be removed entirely in Ghost 0.6\n' +
|
||||
'In your theme\'s pagination.hbs file, pageUrl should be renamed to page_url');
|
||||
|
||||
/*jshint unused:false*/
|
||||
|
|
|
@ -246,11 +246,11 @@ function init(server) {
|
|||
|
||||
// Log all theme errors and warnings
|
||||
_.each(config().paths.availableThemes._messages.errors, function (error) {
|
||||
errors.logError(error.message, error.context);
|
||||
errors.logError(error.message, error.context, error.help);
|
||||
});
|
||||
|
||||
_.each(config().paths.availableThemes._messages.warns, function (warn) {
|
||||
errors.logWarn(warn.message, warn.context);
|
||||
errors.logWarn(warn.message, warn.context, warn.help);
|
||||
});
|
||||
|
||||
// ## Start Ghost App
|
||||
|
|
|
@ -16,7 +16,10 @@ var _ = require('lodash'),
|
|||
|
||||
fs.readFile(path, function (error, data) {
|
||||
if (error) {
|
||||
messages.errors.push({message: 'Could not read package.json file', context: path});
|
||||
messages.errors.push({
|
||||
message: 'Could not read package.json file',
|
||||
context: path
|
||||
});
|
||||
packageDeferred.resolve(false);
|
||||
return;
|
||||
}
|
||||
|
@ -25,11 +28,19 @@ var _ = require('lodash'),
|
|||
if (jsonContainer.hasOwnProperty('name') && jsonContainer.hasOwnProperty('version')) {
|
||||
packageDeferred.resolve(jsonContainer);
|
||||
} else {
|
||||
messages.errors.push({message: '"name" or "version" is missing from theme package.json file.', context: path});
|
||||
messages.errors.push({
|
||||
message: '"name" or "version" is missing from theme package.json file.',
|
||||
context: path,
|
||||
help: 'This will be required in future. Please see http://docs.ghost.org/themes/'
|
||||
});
|
||||
packageDeferred.resolve(false);
|
||||
}
|
||||
} catch (e) {
|
||||
messages.errors.push({message: 'Theme package.json file is malformed', context: path});
|
||||
messages.errors.push({
|
||||
message: 'Theme package.json file is malformed',
|
||||
context: path,
|
||||
help: 'This will be required in future. Please see http://docs.ghost.org/themes/'
|
||||
});
|
||||
packageDeferred.resolve(false);
|
||||
}
|
||||
});
|
||||
|
@ -70,7 +81,7 @@ var _ = require('lodash'),
|
|||
/*jslint unparam:true*/
|
||||
if (result.isDirectory()) {
|
||||
fileDeferred.resolve(readDir(fpath, options, depth + 1, messages));
|
||||
} else if (depth === 1 && file === "package.json") {
|
||||
} else if (depth === 1 && file === 'package.json') {
|
||||
fileDeferred.resolve(parsePackageJson(fpath, messages));
|
||||
} else {
|
||||
fileDeferred.resolve(fpath);
|
||||
|
@ -96,10 +107,14 @@ var _ = require('lodash'),
|
|||
|
||||
return when(readDir(dir, options, depth, messages)).then(function (paths) {
|
||||
// for all contents of the dir, I'm interested in the ones that are directories and within /theme/
|
||||
if (typeof paths === "object" && dir.indexOf('theme') !== -1) {
|
||||
if (typeof paths === 'object' && dir.indexOf('theme') !== -1) {
|
||||
_.each(paths, function (path, index) {
|
||||
if (typeof path === 'object' && !path.hasOwnProperty('package.json') && index.indexOf('.') !== 0) {
|
||||
messages.warns.push({message: 'Theme does not have a package.json file', context: index});
|
||||
messages.warns.push({
|
||||
message: 'Found a theme with no package.json file',
|
||||
context: 'Theme name: ' + index,
|
||||
help: 'This will be required in future. Please see http://docs.ghost.org/themes/'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue