forked from FoundKeyGang/FoundKey
Rename DependencyChecker to DependencyInfo
This commit is contained in:
parent
7e4091c779
commit
6ead284f31
2 changed files with 9 additions and 9 deletions
|
@ -19,7 +19,7 @@ const isRoot = require('is-root');
|
||||||
import ProgressBar from './utils/cli/progressbar';
|
import ProgressBar from './utils/cli/progressbar';
|
||||||
import initdb from './db/mongodb';
|
import initdb from './db/mongodb';
|
||||||
import MachineInfo from './utils/machineInfo';
|
import MachineInfo from './utils/machineInfo';
|
||||||
import DependencyChecker from './utils/dependencyChecker';
|
import DependencyInfo from './utils/dependencyInfo';
|
||||||
|
|
||||||
// Init babel
|
// Init babel
|
||||||
require('babel-core/register');
|
require('babel-core/register');
|
||||||
|
@ -160,7 +160,7 @@ async function init(): Promise<State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
MachineInfo.show();
|
MachineInfo.show();
|
||||||
new DependencyChecker().checkAll();
|
new DependencyInfo().showAll();
|
||||||
|
|
||||||
let configLogger = new Logger('Config');
|
let configLogger = new Logger('Config');
|
||||||
if (!fs.existsSync(`${__dirname}/../.config/config.yml`)) {
|
if (!fs.existsSync(`${__dirname}/../.config/config.yml`)) {
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
import Logger from './logger';
|
import Logger from './logger';
|
||||||
import { exec } from 'shelljs';
|
import { exec } from 'shelljs';
|
||||||
|
|
||||||
export default class DependencyChecker {
|
export default class DependencyInfo {
|
||||||
logger: Logger;
|
logger: Logger;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.logger = new Logger('Deps');
|
this.logger = new Logger('Deps');
|
||||||
}
|
}
|
||||||
|
|
||||||
checkAll(): void {
|
showAll(): void {
|
||||||
this.logger.info('Checking started');
|
this.logger.info('Checking started');
|
||||||
this.check('Node.js', 'node -v', x => x.match(/^v(.*)\r?\n$/));
|
this.show('Node.js', 'node -v', x => x.match(/^v(.*)\r?\n$/));
|
||||||
this.check('npm', 'npm -v', x => x.match(/^(.*)\r?\n$/));
|
this.show('npm', 'npm -v', x => x.match(/^(.*)\r?\n$/));
|
||||||
this.check('MongoDB', 'mongo --version', x => x.match(/^MongoDB shell version: (.*)\r?\n$/));
|
this.show('MongoDB', 'mongo --version', x => x.match(/^MongoDB shell version: (.*)\r?\n$/));
|
||||||
this.check('Redis', 'redis-server --version', x => x.match(/v=([0-9\.]*)/));
|
this.show('Redis', 'redis-server --version', x => x.match(/v=([0-9\.]*)/));
|
||||||
this.logger.info('Checking finished');
|
this.logger.info('Checking finished');
|
||||||
}
|
}
|
||||||
|
|
||||||
check(serviceName: string, command: string, transform: (x: string) => RegExpMatchArray): void {
|
show(serviceName: string, command: string, transform: (x: string) => RegExpMatchArray): void {
|
||||||
const code = {
|
const code = {
|
||||||
success: 0,
|
success: 0,
|
||||||
notFound: 127
|
notFound: 127
|
Loading…
Reference in a new issue