Repository URL to install this package:
|
Version:
1.0.3 ▾
|
'use strict';
const Generator = require('yeoman-generator');
const chalk = require('chalk');
const yosay = require('yosay');
const path = require('path');
const cp = require('child_process');
module.exports = class extends Generator {
greeting() {
this.log(
yosay(
'Welcome to the astounding ' +
chalk.red('Drupal@melt ') +
chalk.green('System Check')
)
);
}
checkSystem() {
// Check that Lando is installed
var res = cp.spawnSync('lando', ['version']);
if (res.error) {
this.log(chalk.red('Error!') + ' Lando does not appear to be installed!');
} else {
this.log(chalk.green('Lando version: ') + res.stdout.toString('ascii'));
}
// Check that Docker is installed
res = cp.spawnSync('docker', ['--version']);
if (res.error) {
this.log(
chalk.red('Error!') + ' Docker does not appear to be installed!'
);
} else {
this.log(chalk.green('Docker version: ') + res.stdout.toString('ascii'));
}
// Check for /etc/hosts entry for Docker
res = cp.spawnSync(
'grep',
['"127.0.0.1[[:space:]]*localunixsocket"', '/etc/hosts'],
{ shell: true }
);
if (res.error || res.stdout.toString('ascii').length === 0) {
this.log(
chalk.red('Error!') +
' /etc/hosts does not appear to havve localunixsocket alias!'
);
} else {
this.log(chalk.green('localunixsocket alias appears to be configured!'));
}
// Check that composer is installed
res = cp.spawnSync('composer', ['--version']);
if (res.error) {
this.log(
chalk.red('Error!') + ' Composer does not appear to be installed!'
);
} else {
this.log(
chalk.green('Composer version: ') + res.stdout.toString('ascii')
);
}
// Check that NVM is installed
// res = cp.spawnSync('nvm', ['--version']);
// if (res.error) {
// this.log(chalk.red('Error!') + ' NVM does not appear to be installed!')
// } else {
// this.log(chalk.green('NVM version: ') + res.stderr.toString('ascii'));
// this.log(res);
// }
}
};