Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
'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);
    // }
  }
};