Rename DependencyChecker to DependencyInfo

This commit is contained in:
Aya Morisawa 2016-12-31 03:24:07 +09:00
parent 7e4091c779
commit 6ead284f31
2 changed files with 9 additions and 9 deletions

View file

@ -19,7 +19,7 @@ const isRoot = require('is-root');
import ProgressBar from './utils/cli/progressbar';
import initdb from './db/mongodb';
import MachineInfo from './utils/machineInfo';
import DependencyChecker from './utils/dependencyChecker';
import DependencyInfo from './utils/dependencyInfo';
// Init babel
require('babel-core/register');
@ -160,7 +160,7 @@ async function init(): Promise<State> {
}
MachineInfo.show();
new DependencyChecker().checkAll();
new DependencyInfo().showAll();
let configLogger = new Logger('Config');
if (!fs.existsSync(`${__dirname}/../.config/config.yml`)) {

View file

@ -1,23 +1,23 @@
import Logger from './logger';
import { exec } from 'shelljs';
export default class DependencyChecker {
export default class DependencyInfo {
logger: Logger;
constructor() {
this.logger = new Logger('Deps');
}
checkAll(): void {
showAll(): void {
this.logger.info('Checking started');
this.check('Node.js', 'node -v', x => x.match(/^v(.*)\r?\n$/));
this.check('npm', 'npm -v', x => x.match(/^(.*)\r?\n$/));
this.check('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('Node.js', 'node -v', x => x.match(/^v(.*)\r?\n$/));
this.show('npm', 'npm -v', x => x.match(/^(.*)\r?\n$/));
this.show('MongoDB', 'mongo --version', x => x.match(/^MongoDB shell version: (.*)\r?\n$/));
this.show('Redis', 'redis-server --version', x => x.match(/v=([0-9\.]*)/));
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 = {
success: 0,
notFound: 127