From 3da87b82c83f629a05bd9d2d6f4e4143adc65702 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sat, 31 Dec 2016 23:33:02 +0900 Subject: [PATCH] Remove DependencyInfo --- src/index.ts | 2 -- src/utils/dependencyInfo.ts | 39 ------------------------------------- 2 files changed, 41 deletions(-) delete mode 100644 src/utils/dependencyInfo.ts diff --git a/src/index.ts b/src/index.ts index 75bfa35062..6267adc081 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,7 +19,6 @@ import initdb from './db/mongodb'; import LastCommitInfo from './utils/lastCommitInfo'; import EnvironmentInfo from './utils/environmentInfo'; import MachineInfo from './utils/machineInfo'; -import DependencyInfo from './utils/dependencyInfo'; // Init babel require('babel-core/register'); @@ -137,7 +136,6 @@ async function init(): Promise { await LastCommitInfo.show(); EnvironmentInfo.show(); MachineInfo.show(); - new DependencyInfo().showAll(); let configLogger = new Logger('Config'); if (!fs.existsSync(`${__dirname}/../.config/config.yml`)) { diff --git a/src/utils/dependencyInfo.ts b/src/utils/dependencyInfo.ts deleted file mode 100644 index a184a849b7..0000000000 --- a/src/utils/dependencyInfo.ts +++ /dev/null @@ -1,39 +0,0 @@ -import Logger from './logger'; -import { exec } from 'shelljs'; - -export default class DependencyInfo { - logger: Logger; - - constructor() { - this.logger = new Logger('Deps'); - } - - showAll(): void { - this.logger.info('Checking started'); - 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.show('GraphicsMagick', 'gm -version', x => x.match(/^GraphicsMagick ([0-9\.]*) .*/)); - this.logger.info('Checking finished'); - } - - show(serviceName: string, command: string, transform: (x: string) => RegExpMatchArray): void { - const code = { - success: 0, - notFound: 127 - }; - const x = exec(command, { silent: true }) as any; - if (x.code === code.success) { - let ver = transform(x.stdout); - if (ver != null) { - this.logger.info(`${serviceName} ${ver[1]} found`); - } else { - this.logger.warn(`${serviceName} not found`); - this.logger.warn(`Regexp used for version check of ${serviceName} is probably messed up`); - } - } else if (x.code === code.notFound) { - this.logger.warn(`${serviceName} not found`); - } - } -}