mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
First run message
closes #682 - notification gives users the basic info they need to configure their app
This commit is contained in:
parent
a4aefb2b8e
commit
d92a0b98a2
1 changed files with 52 additions and 22 deletions
|
@ -28,8 +28,7 @@ var config = require('../config'),
|
||||||
|
|
||||||
Ghost,
|
Ghost,
|
||||||
instance,
|
instance,
|
||||||
defaults,
|
defaults;
|
||||||
statuses;
|
|
||||||
|
|
||||||
// ## Default values
|
// ## Default values
|
||||||
/**
|
/**
|
||||||
|
@ -129,24 +128,29 @@ Ghost = function () {
|
||||||
Ghost.prototype.init = function () {
|
Ghost.prototype.init = function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
return when.join(
|
function doFirstRun() {
|
||||||
instance.dataProvider.init(),
|
console.log('first run');
|
||||||
instance.getPaths(),
|
var firstRunMessage = [
|
||||||
instance.mail.init(self)
|
"Welcome to Ghost.",
|
||||||
|
"You're running under the <strong>",
|
||||||
|
process.env.NODE_ENV,
|
||||||
|
"</strong>environment.",
|
||||||
|
|
||||||
).then(function () {
|
"Your URL is set to",
|
||||||
return models.Settings.populateDefaults();
|
"<strong>" + self.config().url + "</strong>.",
|
||||||
}).then(function () {
|
"See <a href=\"http://docs.ghost.org/\">http://docs.ghost.org</a> for instructions."
|
||||||
// Initialize the settings cache
|
];
|
||||||
return self.updateSettingsCache();
|
|
||||||
}).then(function () {
|
self.notifications.push({
|
||||||
// Initialize plugins
|
type: 'info',
|
||||||
return self.initPlugins();
|
message: firstRunMessage.join(' '),
|
||||||
}).then(function () {
|
status: 'persistent',
|
||||||
// Initialize the permissions actions and objects
|
id: 'ghost-first-run'
|
||||||
return permissions.init();
|
});
|
||||||
}).then(function () {
|
return when.resolve();
|
||||||
// get the settings and whatnot
|
}
|
||||||
|
|
||||||
|
function initDbHashAndFirstRun() {
|
||||||
return when(models.Settings.read('dbHash')).then(function (dbhash) {
|
return when(models.Settings.read('dbHash')).then(function (dbhash) {
|
||||||
// we already ran this, chill
|
// we already ran this, chill
|
||||||
self.dbHash = dbhash.attributes.value;
|
self.dbHash = dbhash.attributes.value;
|
||||||
|
@ -154,12 +158,38 @@ Ghost.prototype.init = function () {
|
||||||
}).otherwise(function (error) {
|
}).otherwise(function (error) {
|
||||||
// this is where all the "first run" functionality should go
|
// this is where all the "first run" functionality should go
|
||||||
var dbhash = uuid.v4();
|
var dbhash = uuid.v4();
|
||||||
return when(models.Settings.add({key: 'dbHash', value: dbhash, type: 'core'})).then(function (returned) {
|
return when(models.Settings.add({key: 'dbHash', value: dbhash, type: 'core'})).then(function () {
|
||||||
self.dbHash = dbhash;
|
self.dbHash = dbhash;
|
||||||
return dbhash;
|
return dbhash;
|
||||||
});
|
}).then(doFirstRun);
|
||||||
});
|
});
|
||||||
}, errors.logAndThrowError);
|
}
|
||||||
|
|
||||||
|
// ### Initialisation
|
||||||
|
// make sure things are done in order
|
||||||
|
return when.join(
|
||||||
|
// Initialise the models
|
||||||
|
instance.dataProvider.init(),
|
||||||
|
// Calculate paths
|
||||||
|
instance.getPaths(),
|
||||||
|
// Initialise mail after first run
|
||||||
|
instance.mail.init(self)
|
||||||
|
).then(function () {
|
||||||
|
// Populate any missing default settings
|
||||||
|
return models.Settings.populateDefaults();
|
||||||
|
}).then(function () {
|
||||||
|
// Initialize the settings cache
|
||||||
|
return self.updateSettingsCache();
|
||||||
|
}).then(function () {
|
||||||
|
return when.join(
|
||||||
|
// Check for or initialise a dbHash.
|
||||||
|
initDbHashAndFirstRun(),
|
||||||
|
// Initialize plugins
|
||||||
|
self.initPlugins(),
|
||||||
|
// Initialize the permissions actions and objects
|
||||||
|
permissions.init()
|
||||||
|
);
|
||||||
|
}).otherwise(errors.logAndThrowError);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Maintain the internal cache of the settings object
|
// Maintain the internal cache of the settings object
|
||||||
|
|
Loading…
Add table
Reference in a new issue