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 yaml = require('js-yaml');

module.exports = class extends Generator {
  prompting() {
    if (this.options.project_machine_name) {
      return (this.databaseName = this.options.project_machine_name);
    }

    const prompts = [
      {
        type: 'input',
        name: 'databaseName',
        message: 'Enter database name:',
        required: true
      }
    ];

    return this.prompt(prompts).then(props => {
      // To access props later use this.props.someAnswer;
      this.props = props;
      this.databaseName = props.databaseName
        .trim()
        .toLowerCase()
        .replace(/\s+/g, '_');
    });
  }

  install() {
    if (!this.fs.exists(this.destinationPath('.lando.yml'))) {
      this.log.error(
        '.lando.yml not found. Please create one before proceeding.'
      );
      process.exit(1);
    }

    // Create Drupal site based on .lando.yml config
    this.log('Installing Drupal...');
    this.spawnCommandSync('lando', ['start']);

    // Install site using drush site-install
    this.spawnCommandSync('lando', [
      'drush',
      'si',
      'meltdrop',
      // '--db-url=mysql://drupal8:drupal8@database:3306/' + this.databaseName,
      '-y'
    ]);
  }
};