CLI refactor with commander (#6058)
* CLI refactor with commander
- Modularized the functionality
- All functionality done directly from `./nodebb` now
(still available from `app` for backwards compatibility)
- Moved all CLI code from `./nodebb` to `src/cli`
- Fixed `nodebb.bat` to work from any location, like `./nodebb`, and
also hides command output
- Overwrite some commander methods to add CLI color support
- Added `./nodebb info` for quick info including git hash, NodeBB
version, node version, and some database info
- Refactored `./nodebb reset` to allow multiple resets at once
- Changed `./nodebb restart` to essentially stop and start, as Windows
doesn't support signals
- Added `-l, --log` option which works on `./nodebb start` and `./nodebb
restart` to show logging, like `./nodebb slog`
- Expanded `-d, --dev` option which works on them as well, like
`./nodebb dev`
- Improvements to self-help. `./nodebb build -h` will output all
possible targets
- `./nodebb reset` explains usage better
* Fix some style inconsistencies
* Fix prestart being required before modules installed
* Fix travis failures
* Fix `help` command to output help for subcommands
* Pick steps of the upgrade process to run
* Fix formatting for upgrade help
* Fix web installer
7 years ago
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var winston = require('winston');
|
|
|
|
var async = require('async');
|
|
|
|
|
|
|
|
var install = require('../../install/web').install;
|
|
|
|
|
|
|
|
function setup() {
|
|
|
|
var install = require('../install');
|
|
|
|
var build = require('../meta/build');
|
|
|
|
var prestart = require('../prestart');
|
|
|
|
|
|
|
|
winston.info('NodeBB Setup Triggered via Command Line');
|
|
|
|
|
|
|
|
console.log('\nWelcome to NodeBB!');
|
|
|
|
console.log('\nThis looks like a new installation, so you\'ll have to answer a few questions about your environment before we can proceed.');
|
|
|
|
console.log('Press enter to accept the default setting (shown in brackets).');
|
CLI refactor with commander (#6058)
* CLI refactor with commander
- Modularized the functionality
- All functionality done directly from `./nodebb` now
(still available from `app` for backwards compatibility)
- Moved all CLI code from `./nodebb` to `src/cli`
- Fixed `nodebb.bat` to work from any location, like `./nodebb`, and
also hides command output
- Overwrite some commander methods to add CLI color support
- Added `./nodebb info` for quick info including git hash, NodeBB
version, node version, and some database info
- Refactored `./nodebb reset` to allow multiple resets at once
- Changed `./nodebb restart` to essentially stop and start, as Windows
doesn't support signals
- Added `-l, --log` option which works on `./nodebb start` and `./nodebb
restart` to show logging, like `./nodebb slog`
- Expanded `-d, --dev` option which works on them as well, like
`./nodebb dev`
- Improvements to self-help. `./nodebb build -h` will output all
possible targets
- `./nodebb reset` explains usage better
* Fix some style inconsistencies
* Fix prestart being required before modules installed
* Fix travis failures
* Fix `help` command to output help for subcommands
* Pick steps of the upgrade process to run
* Fix formatting for upgrade help
* Fix web installer
7 years ago
|
|
|
|
|
|
|
async.series([
|
|
|
|
install.setup,
|
|
|
|
prestart.loadConfig,
|
|
|
|
build.buildAll,
|
|
|
|
], function (err, data) {
|
|
|
|
// Disregard build step data
|
|
|
|
data = data[0];
|
|
|
|
|
|
|
|
var separator = ' ';
|
|
|
|
if (process.stdout.columns > 10) {
|
|
|
|
for (var x = 0, cols = process.stdout.columns - 10; x < cols; x += 1) {
|
|
|
|
separator += '=';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log('\n' + separator + '\n');
|
CLI refactor with commander (#6058)
* CLI refactor with commander
- Modularized the functionality
- All functionality done directly from `./nodebb` now
(still available from `app` for backwards compatibility)
- Moved all CLI code from `./nodebb` to `src/cli`
- Fixed `nodebb.bat` to work from any location, like `./nodebb`, and
also hides command output
- Overwrite some commander methods to add CLI color support
- Added `./nodebb info` for quick info including git hash, NodeBB
version, node version, and some database info
- Refactored `./nodebb reset` to allow multiple resets at once
- Changed `./nodebb restart` to essentially stop and start, as Windows
doesn't support signals
- Added `-l, --log` option which works on `./nodebb start` and `./nodebb
restart` to show logging, like `./nodebb slog`
- Expanded `-d, --dev` option which works on them as well, like
`./nodebb dev`
- Improvements to self-help. `./nodebb build -h` will output all
possible targets
- `./nodebb reset` explains usage better
* Fix some style inconsistencies
* Fix prestart being required before modules installed
* Fix travis failures
* Fix `help` command to output help for subcommands
* Pick steps of the upgrade process to run
* Fix formatting for upgrade help
* Fix web installer
7 years ago
|
|
|
|
|
|
|
if (err) {
|
|
|
|
winston.error('There was a problem completing NodeBB setup', err);
|
|
|
|
throw err;
|
|
|
|
} else {
|
|
|
|
if (data.hasOwnProperty('password')) {
|
|
|
|
console.log('An administrative user was automatically created for you:');
|
|
|
|
console.log(' Username: ' + data.username + '');
|
|
|
|
console.log(' Password: ' + data.password + '');
|
|
|
|
console.log('');
|
CLI refactor with commander (#6058)
* CLI refactor with commander
- Modularized the functionality
- All functionality done directly from `./nodebb` now
(still available from `app` for backwards compatibility)
- Moved all CLI code from `./nodebb` to `src/cli`
- Fixed `nodebb.bat` to work from any location, like `./nodebb`, and
also hides command output
- Overwrite some commander methods to add CLI color support
- Added `./nodebb info` for quick info including git hash, NodeBB
version, node version, and some database info
- Refactored `./nodebb reset` to allow multiple resets at once
- Changed `./nodebb restart` to essentially stop and start, as Windows
doesn't support signals
- Added `-l, --log` option which works on `./nodebb start` and `./nodebb
restart` to show logging, like `./nodebb slog`
- Expanded `-d, --dev` option which works on them as well, like
`./nodebb dev`
- Improvements to self-help. `./nodebb build -h` will output all
possible targets
- `./nodebb reset` explains usage better
* Fix some style inconsistencies
* Fix prestart being required before modules installed
* Fix travis failures
* Fix `help` command to output help for subcommands
* Pick steps of the upgrade process to run
* Fix formatting for upgrade help
* Fix web installer
7 years ago
|
|
|
}
|
|
|
|
console.log('NodeBB Setup Completed. Run "./nodebb start" to manually start your NodeBB server.');
|
CLI refactor with commander (#6058)
* CLI refactor with commander
- Modularized the functionality
- All functionality done directly from `./nodebb` now
(still available from `app` for backwards compatibility)
- Moved all CLI code from `./nodebb` to `src/cli`
- Fixed `nodebb.bat` to work from any location, like `./nodebb`, and
also hides command output
- Overwrite some commander methods to add CLI color support
- Added `./nodebb info` for quick info including git hash, NodeBB
version, node version, and some database info
- Refactored `./nodebb reset` to allow multiple resets at once
- Changed `./nodebb restart` to essentially stop and start, as Windows
doesn't support signals
- Added `-l, --log` option which works on `./nodebb start` and `./nodebb
restart` to show logging, like `./nodebb slog`
- Expanded `-d, --dev` option which works on them as well, like
`./nodebb dev`
- Improvements to self-help. `./nodebb build -h` will output all
possible targets
- `./nodebb reset` explains usage better
* Fix some style inconsistencies
* Fix prestart being required before modules installed
* Fix travis failures
* Fix `help` command to output help for subcommands
* Pick steps of the upgrade process to run
* Fix formatting for upgrade help
* Fix web installer
7 years ago
|
|
|
|
|
|
|
// If I am a child process, notify the parent of the returned data before exiting (useful for notifying
|
|
|
|
// hosts of auto-generated username/password during headless setups)
|
|
|
|
if (process.send) {
|
|
|
|
process.send(data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
process.exit();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.setup = setup;
|
|
|
|
exports.webInstall = install;
|