0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Revert i18n in startup-check

- Removes preinstall dependencies
- Reintroduce old plain english strings
- Remove translations for startup check

closes #6332
This commit is contained in:
Fabian Becker 2016-01-13 14:38:34 +01:00
parent f3409ade45
commit eef37acc49
3 changed files with 18 additions and 42 deletions

View file

@ -116,30 +116,6 @@
"willBeRequired": "This will be required in future. Please see {url}", "willBeRequired": "This will be required in future. Please see {url}",
"themeFileIsMalformed": "Theme package.json file is malformed" "themeFileIsMalformed": "Theme package.json file is malformed"
}, },
"startupcheck": {
"unsupportedNodeVersion": {
"error": "ERROR: Unsupported version of Node",
"context": "Ghost needs Node version {neededVersion} you are using version {usedVersion}\n",
"help": "Please see {url} for more information"
},
"cannotFindConfigForCurrentNode": {
"error": "ERROR: Cannot find the configuration for the current NODE_ENV: {nodeEnv}\n",
"help": "Ensure your config.js has a section for the current NODE_ENV value and is formatted properly."
},
"ghostMissingDependencies": {
"error": "ERROR: Ghost is unable to start due to missing dependencies:\n {error}",
"explain": "\nPlease run `npm install --production` and try starting Ghost again.",
"help": "Help and documentation can be found at {url}.\n"
},
"unableToAccessContentPath": {
"error": "ERROR: Unable to access Ghost's content path:",
"help": "Check that the content path exists and file system permissions are correct. \nHelp and documentation can be found at {url}."
},
"unableToOpenSqlite3Db": {
"error": "ERROR: Unable to open sqlite3 database file for read/write",
"help": "\nCheck that the sqlite3 database file permissions allow read and write access. \nHelp and documentation can be found at {url}."
}
},
"validatethemes": { "validatethemes": {
"themeWithNoPackage": { "themeWithNoPackage": {
"message": "Found a theme with no package.json file", "message": "Found a theme with no package.json file",

View file

@ -2,7 +2,6 @@ var packages = require('../../../package.json'),
path = require('path'), path = require('path'),
crypto = require('crypto'), crypto = require('crypto'),
fs = require('fs'), fs = require('fs'),
i18n = require('../i18n'),
mode = process.env.NODE_ENV === undefined ? 'development' : process.env.NODE_ENV, mode = process.env.NODE_ENV === undefined ? 'development' : process.env.NODE_ENV,
appRoot = path.resolve(__dirname, '../../../'), appRoot = path.resolve(__dirname, '../../../'),
configFilePath = process.env.GHOST_CONFIG || path.join(appRoot, 'config.js'), configFilePath = process.env.GHOST_CONFIG || path.join(appRoot, 'config.js'),
@ -29,16 +28,14 @@ checks = {
nodeVersion: function checkNodeVersion() { nodeVersion: function checkNodeVersion() {
// Tell users if their node version is not supported, and exit // Tell users if their node version is not supported, and exit
var semver = require('semver'); var semver = require('semver');
i18n.init();
if (process.env.GHOST_NODE_VERSION_CHECK !== 'false' && if (process.env.GHOST_NODE_VERSION_CHECK !== 'false' &&
!semver.satisfies(process.versions.node, packages.engines.node) && !semver.satisfies(process.versions.node, packages.engines.node) &&
!semver.satisfies(process.versions.node, packages.engines.iojs)) { !semver.satisfies(process.versions.node, packages.engines.iojs)) {
console.error(i18n.t('errors.utils.startupcheck.unsupportedNodeVersion.error')); console.error('\x1B[31mERROR: Unsupported version of Node');
console.error(i18n.t('errors.utils.startupcheck.unsupportedNodeVersion.context', console.error('\x1B[31mGhost needs Node version ' + packages.engines.node +
{neededVersion: packages.engines.node, usedVersion: process.versions.node})); ' you are using version ' + process.versions.node + '\033[0m\n');
console.error(i18n.t('errors.utils.startupcheck.unsupportedNodeVersion.help', console.error('\x1B[32mPlease see http://support.ghost.org/supported-node-versions/ for more information\033[0m');
{url: 'http://support.ghost.org/supported-node-versions/'}));
process.exit(exitCodes.NODE_VERSION_UNSUPPORTED); process.exit(exitCodes.NODE_VERSION_UNSUPPORTED);
} }
@ -61,9 +58,10 @@ checks = {
config = configFile[mode]; config = configFile[mode];
if (!config) { if (!config) {
console.error(i18n.t('errors.utils.startupcheck.cannotFindConfigForCurrentNode.error', console.error('\x1B[31mERROR: Cannot find the configuration for the current NODE_ENV: ' +
{nodeEnv: process.env.NODE_ENV})); process.env.NODE_ENV + '\033[0m\n');
console.error(i18n.t('errors.utils.startupcheck.cannotFindConfigForCurrentNode.help')); console.error('\x1B[32mEnsure your config.js has a section for the current NODE_ENV value' +
' and is formatted properly.\033[0m');
process.exit(exitCodes.NODE_ENV_CONFIG_MISSING); process.exit(exitCodes.NODE_ENV_CONFIG_MISSING);
} }
@ -91,9 +89,9 @@ checks = {
errors = errors.join('\n '); errors = errors.join('\n ');
console.error(i18n.t('errors.utils.startupcheck.ghostMissingDependencies.error', {error: errors})); console.error('\x1B[31mERROR: Ghost is unable to start due to missing dependencies:\033[0m\n ' + errors);
console.error(i18n.t('errors.utils.startupcheck.ghostMissingDependencies.explain')); console.error('\x1B[32m\nPlease run `npm install --production` and try starting Ghost again.');
console.error(i18n.t('errors.utils.startupcheck.ghostMissingDependencies.help', {url: 'http://support.ghost.org'})); console.error('\x1B[32mHelp and documentation can be found at http://support.ghost.org.\033[0m\n');
process.exit(exitCodes.DEPENDENCIES_MISSING); process.exit(exitCodes.DEPENDENCIES_MISSING);
}, },
@ -109,8 +107,9 @@ checks = {
contentPath, contentPath,
contentSubPaths = ['apps', 'data', 'images', 'themes'], contentSubPaths = ['apps', 'data', 'images', 'themes'],
fd, fd,
errorHeader = i18n.t('errors.utils.startupcheck.unableToAccessContentPath.error'), errorHeader = '\x1B[31mERROR: Unable to access Ghost\'s content path:\033[0m',
errorHelp = i18n.t('errors.utils.startupcheck.unableToAccessContentPath.help', {url: 'http://support.ghost.org'}); errorHelp = '\x1B[32mCheck that the content path exists and file system permissions are correct.' +
'\nHelp and documentation can be found at http://support.ghost.org.\033[0m';
// Get the content path to test. If it's defined in config.js use that, if not use the default // Get the content path to test. If it's defined in config.js use that, if not use the default
try { try {
@ -203,9 +202,10 @@ checks = {
return; return;
} }
console.error(i18n.t('errors.utils.startupcheck.unableToOpenSqlite3Db.error')); console.error('\x1B[31mERROR: Unable to open sqlite3 database file for read/write\033[0m');
console.error(' ' + e.message); console.error(' ' + e.message);
console.error(i18n.t('errors.utils.startupcheck.unableToOpenSqlite3Db.help', {url: 'http://support.ghost.org'})); console.error('\n\x1B[32mCheck that the sqlite3 database file permissions allow read and write access.');
console.error('Help and documentation can be found at http://support.ghost.org.\033[0m');
process.exit(exitCodes.SQLITE_DB_NOT_WRITABLE); process.exit(exitCodes.SQLITE_DB_NOT_WRITABLE);
} }

View file

@ -18,7 +18,7 @@
"license": "MIT", "license": "MIT",
"main": "./core/index", "main": "./core/index",
"scripts": { "scripts": {
"preinstall": "npm install semver lodash chalk intl-messageformat intl && node -e \"require('./core/server/utils/startup-check.js').nodeVersion()\"", "preinstall": "npm install semver && node -e \"require('./core/server/utils/startup-check.js').nodeVersion()\"",
"start": "node index", "start": "node index",
"test": "grunt validate --verbose" "test": "grunt validate --verbose"
}, },