<commit_before>/**
 * Copyright 2013-2018 the original author or authors from the JHipster project.
 *
 * This file is part of the JHipster project, see https://www.jhipster.tech/
 * for more information.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const chalk = require('chalk');
const _ = require('lodash');
const BaseGenerator = require('../generator-base');
const cleanup = require('../cleanup');
const prompts = require('./prompts');
const packagejs = require('../../package.json');
const statistics = require('../statistics');

module.exports = class extends BaseGenerator {
    constructor(args, opts) {
        super(args, opts);

        this.configOptions = {};
        // This adds support for a `--from-cli` flag
        this.option('from-cli', {
            desc: 'Indicates the command is run from JHipster CLI',
            type: Boolean,
            defaults: false
        });
        // This adds support for a `--skip-client` flag
        this.option('skip-client', {
            desc: 'Skip the client-side application generation',
            type: Boolean,
            defaults: false
        });

        // This adds support for a `--skip-server` flag
        this.option('skip-server', {
            desc: 'Skip the server-side application generation',
            type: Boolean,
            defaults: false
        });

        // This adds support for a `--skip-git` flag
        this.option('skip-git', {
            desc: 'Skip the git initialization',
            type: Boolean,
            defaults: false
        });

        // This adds support for a `--skip-commit-hook` flag
        this.option('skip-commit-hook', {
            desc: 'Skip adding husky commit hooks',
            type: Boolean,
            defaults: false
        });

        // This adds support for a `--skip-user-management` flag
        this.option('skip-user-management', {
            desc: 'Skip the user management module during app generation',
            type: Boolean,
            defaults: false
        });

        // This adds support for a `--skip-check-length-of-identifier` flag
        this.option('skip-check-length-of-identifier', {
            desc: 'Skip check the length of the identifier, only for recent Oracle databases that support 30+ characters metadata',
            type: Boolean,
            defaults: false
        });

        // This adds support for a `--[no-]i18n` flag
        this.option('i18n', {
            desc: 'Disable or enable i18n when skipping client side generation, has no effect otherwise',
            type: Boolean,
            defaults: true
        });

        // This adds support for a `--with-entities` flag
        this.option('with-entities', {
            desc: 'Regenerate the existing entities if any',
            type: Boolean,
            defaults: false
        });

        // This adds support for a `--skip-checks` flag
        this.option('skip-checks', {
            desc: 'Check the status of the required tools',
            type: Boolean,
            defaults: false
        });

        // This adds support for a `--jhi-prefix` flag
        this.option('jhi-prefix', {
            desc: 'Add prefix before services, controllers and states name',
            type: String,
            defaults: 'jhi'
        });

        // This adds support for a `--yarn` flag
        this.option('yarn', {
            desc: 'Use yarn instead of npm',
            type: Boolean,
            defaults: false
        });

        // This adds support for a `--auth` flag
        this.option('auth', {
            desc: 'Provide authentication type for the application when skipping server',
            type: String
        });

        // This adds support for a `--db` flag
        this.option('db', {
            desc: 'Provide DB name for the application when skipping server',
            type: String
        });

        // This adds support for a `--blueprint` flag which can be used to specify a blueprint to use for generation
        this.option('blueprint', {
            desc: '[BETA] Specify a generator blueprint to use for the sub generators',
            type: String
        });

        // This adds support for a `--experimental` flag which can be used to enable experimental features
        this.option('experimental', {
            desc:
                'Enable experimental features. Please note that these features may be unstable and may undergo breaking changes at any time',
            type: Boolean,
            defaults: false
        });

        this.skipClient = this.configOptions.skipClient = this.options['skip-client'] || this.config.get('skipClient');
        this.skipServer = this.configOptions.skipServer = this.options['skip-server'] || this.config.get('skipServer');
        this.skipUserManagement = this.configOptions.skipUserManagement =
            this.options['skip-user-management'] || this.config.get('skipUserManagement');
        this.skipCheckLengthOfIdentifier = this.configOptions.skipCheckLengthOfIdentifier =
            this.options['skip-check-length-of-identifier'] || this.config.get('skipCheckLengthOfIdentifier');
        this.jhiPrefix = this.configOptions.jhiPrefix = _.camelCase(this.config.get('jhiPrefix') || this.options['jhi-prefix']);
        this.withEntities = this.options['with-entities'];
        this.skipChecks = this.options['skip-checks'];
        const blueprint = this.normalizeBlueprintName(this.options.blueprint || this.config.get('blueprint'));
        this.blueprint = this.configOptions.blueprint = blueprint;
        this.useNpm = this.configOptions.useNpm = !this.options.yarn;
        this.useYarn = !this.useNpm;

        this.isDebugEnabled = this.configOptions.isDebugEnabled = this.options.debug;
        this.experimental = this.configOptions.experimental = this.options.experimental;
        this.registerClientTransforms();
    }

    get initializing() {
        return {
            validateFromCli() {
                if (!this.options['from-cli']) {
                    this.warning(
                        `Deprecated: JHipster seems to be invoked using Yeoman command. Please use the JHipster CLI. Run ${chalk.red(
                            'jhipster <command>'
                        )} instead of ${chalk.red('yo jhipster:<command>')}`
                    );
                }
            },

            displayLogo() {
                this.printJHipsterLogo();
            },

            validateBlueprint() {
                if (this.blueprint) {
                    this.checkBlueprint(this.blueprint);
                }
            },

            validateJava() {
                this.checkJava();
            },

            validateNode() {
                this.checkNode();
            },

            validateGit() {
                this.checkGit();
            },

            validateYarn() {
                this.checkYarn();
            },

            checkForNewJHVersion() {
                if (!this.skipChecks) {
                    this.checkForNewVersion();
                }
            },

            validate() {
                if (this.skipServer && this.skipClient) {
                    this.error(
                        chalk.red(`You can not pass both ${chalk.yellow('--skip-client')} and ${chalk.yellow('--skip-server')} together`)
                    );
                }
            },

            setupconsts() {
                this.applicationType = this.config.get('applicationType');
                if (!this.applicationType) {
                    this.applicationType = 'monolith';
                }
                this.baseName = this.config.get('baseName');
                this.jhipsterVersion = packagejs.version;
                if (this.jhipsterVersion === undefined) {
                    this.jhipsterVersion = this.config.get('jhipsterVersion');
                }
                this.otherModules = this.config.get('otherModules');
                this.testFrameworks = this.config.get('testFrameworks');
                this.enableTranslation = this.config.get('enableTranslation');
                this.nativeLanguage = this.config.get('nativeLanguage');
                this.languages = this.config.get('languages');
                const configFound = this.baseName !== undefined && this.applicationType !== undefined;
                if (configFound) {
                    this.existingProject = true;
                    // If translation is not defined, it is enabled by default
                    if (this.enableTranslation === undefined) {
                        this.enableTranslation = true;
                    }
                }
                this.clientPackageManager = this.config.get('clientPackageManager');
                if (!this.clientPackageManager) {
                    if (this.useNpm) {
                        this.clientPackageManager = 'npm';
                    } else {
                        this.clientPackageManager = 'yarn';
                    }
                }
            }
        };
    }

    get prompting() {
        return {
            askForInsightOptIn: prompts.askForInsightOptIn,
            // TODO : enable this. It's a bit messy for now, it need better sync.
            // askForAccountLinking: prompts.askForAccountLinking,
            askForApplicationType: prompts.askForApplicationType,
            askForModuleName: prompts.askForModuleName
        };
    }

    get configuring() {
        return {
            setup() {
                this.configOptions.skipI18nQuestion = true;
                this.configOptions.baseName = this.baseName;
                this.configOptions.logo = false;
                this.configOptions.otherModules = this.otherModules;
                this.generatorType = 'app';
                if (this.reactive) {
                    // TODO: support client in reactive app
                    this.skipClient = true;
                    this.generatorType = 'server';
                }
                if (this.applicationType === 'microservice') {
                    this.skipClient = true;
                    this.generatorType = 'server';
                    this.skipUserManagement = this.configOptions.skipUserManagement = true;
                }
                if (this.applicationType === 'uaa') {
                    this.skipClient = true;
                    this.generatorType = 'server';
                    this.skipUserManagement = this.configOptions.skipUserManagement = false;
                    this.authenticationType = this.configOptions.authenticationType = 'uaa';
                }
                if (this.skipClient) {
                    // defaults to use when skipping client
                    this.generatorType = 'server';
                    this.configOptions.enableTranslation = this.options.i18n;
                }
                if (this.skipServer) {
                    // defaults to use when skipping server
                    this.generatorType = 'client';
                    this.configOptions.databaseType = this.getDBTypeFromDBValue(this.options.db);
                    this.configOptions.devDatabaseType = this.options.db;
                    this.configOptions.prodDatabaseType = this.options.db;
                    this.configOptions.authenticationType = this.options.auth;
                    this.configOptions.uaaBaseName = this.options.uaaBaseName;
                }
                this.configOptions.clientPackageManager = this.clientPackageManager;
            },

            // composeAccountLinking() {
            //     if (!this.linkAccount) return;

            //     this.composeWith(require.resolve('../link-account'));
            // },

            composeServer() {
                if (this.skipServer) return;

                this.composeWith(require.resolve('../server'), {
                    'client-hook': !this.skipClient,
                    'from-cli': this.options['from-cli'],
                    configOptions: this.configOptions,
                    force: this.options.force,
                    debug: this.isDebugEnabled
                });
            },

            composeClient() {
                if (this.skipClient) return;

                this.composeWith(require.resolve('../client'), {
                    'skip-install': this.options['skip-install'],
                    'skip-commit-hook': this.options['skip-commit-hook'],
                    'from-cli': this.options['from-cli'],
                    configOptions: this.configOptions,
                    force: this.options.force,
                    debug: this.isDebugEnabled
                });
            },

            askFori18n: prompts.askFori18n
        };
    }

    get default() {
        return {
            askForTestOpts: prompts.askForTestOpts,

            askForMoreModules: prompts.askForMoreModules,

            setSharedConfigOptions() {
                this.configOptions.testFrameworks = this.testFrameworks;
                this.configOptions.enableTranslation = this.enableTranslation;
                this.configOptions.nativeLanguage = this.nativeLanguage;
                this.configOptions.languages = this.languages;
                this.configOptions.clientPackageManager = this.clientPackageManager;
            },

            composeLanguages() {
                if (this.skipI18n) return;
                this.composeLanguagesSub(this, this.configOptions, this.generatorType);
            },

            saveConfig() {
                const config = {
                    jhipsterVersion: packagejs.version,
                    applicationType: this.applicationType,
                    baseName: this.baseName,
                    testFrameworks: this.testFrameworks,
                    jhiPrefix: this.jhiPrefix,
                    skipCheckLengthOfIdentifier: this.skipCheckLengthOfIdentifier,
                    otherModules: this.otherModules,
                    enableTranslation: this.enableTranslation,
                    clientPackageManager: this.clientPackageManager
                };
                if (this.enableTranslation) {
                    config.nativeLanguage = this.nativeLanguage;
                    config.languages = this.languages;
                }
                this.blueprint && (config.blueprint = this.blueprint);
                this.reactive && (config.reactive = this.reactive);
                this.skipClient && (config.skipClient = true);
                this.skipServer && (config.skipServer = true);
                this.skipUserManagement && (config.skipUserManagement = true);
                this.config.set(config);
            },

            insight() {
                const yorc = {
                    ..._.omit(this.configOptions, [
                        'jhiPrefix',
                        'baseName',
                        'jwtSecretKey',
                        'packageName',
                        'packagefolder',
                        'rememberMeKey'
                    ])
                };
                yorc.applicationType = this.applicationType;
                statistics.sendYoRc(yorc, this.existingProject, this.jhipsterVersion);
            }
        };
    }

    get writing() {
        return {
            cleanup() {
                cleanup.cleanupOldFiles(this);
            },

            regenerateEntities() {
                if (this.withEntities) {
                    this.getExistingEntities().forEach(entity => {
                        this.composeWith(require.resolve('../entity'), {
                            regenerate: true,
                            'skip-install': true,
                            'from-cli': this.options['from-cli'],
                            force: this.options.force,
                            debug: this.isDebugEnabled,
                            arguments: [entity.name]
                        });
                    });
                }
            },

            generatePackageForMS() {
                if (this.skipClient) {
                    if (this.otherModules === undefined) {
                        this.otherModules = [];
                    }
                    // Generate a package.json file containing the current version
                    // of the generator as dependency
                    this.dasherizedBaseName = _.kebabCase(this.baseName);
                    this.template('skipClientApp.package.json.ejs', 'package.json');
                }
            },

            initGitRepo() {
                if (!this.options['skip-git']) {
                    this.isGitInstalled(code => {
                        if (code === 0) {
                            this.gitExec('rev-parse --is-inside-work-tree', { trace: false }, (err, gitDir) => {
                                if (!gitDir) {
                                    this.gitExec('init', { trace: false }, () => {
                                        this.log(chalk.green.bold('Git repo initiated.'));
                                        this.gitInitialized = true;
                                    });
                                }
                            });
                        } else {
                            this.warning('Git repository could not be initialized, as Git is not installed on your system');
                        }
                    });
                }
            }
        };
    }

    get end() {
        return {
            gitCommit() {
                if (!this.options['skip-git']) {
                    this.debug('Committing files to git');
                    const done = this.async();
                    this.isGitInstalled(code => {
                        if (code === 0 && this.gitInitialized) {
                            this.gitExec('add -A', { trace: false }, () => {
                                let commitMsg = `Initial application generated by JHipster-${this.jhipsterVersion}`;
                                if (this.blueprint) {
                                    commitMsg += ` with blueprint: ${this.blueprint.replace('generator-jhipster-', '')}`;
                                }
                                this.gitExec(`commit -am "${commitMsg}"`, { trace: false }, () => {
                                    this.log(chalk.green.bold('Application successfully committed to Git.'))
                                    done();
                                });
                            });
                        } else {
                            this.warning(
                                'The generated application could not be committed to Git, as Git repository could not be initialized.'
                            );
                        }
                    });
                }
            },

            afterRunHook() {
                try {
                    const modules = this.getModuleHooks();
                    if (modules.length > 0) {
                        this.log(`\n${chalk.bold.green('Running post run module hooks\n')}`);
                        // run through all post app creation module hooks
                        this.callHooks('app', 'post', {
                            appConfig: this.configOptions,
                            force: this.options.force
                        });
                    }
                } catch (err) {
                    this.log(`\n${chalk.bold.red('Running post run module hooks failed. No modification done to the generated app.')}`);
                    this.debug('Error:', err);
                }
                this.log(
                    chalk.green(
                        `\nIf you find JHipster useful consider supporting our collective ${chalk.yellow(
                            'https://opencollective.com/generator-jhipster'
                        )}`
                    )
                );
            }
        };
    }
};
<commit_msg>Fix lint<commit_after>/**
 * Copyright 2013-2018 the original author or authors from the JHipster project.
 *
 * This file is part of the JHipster project, see https://www.jhipster.tech/
 * for more information.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const chalk = require('chalk');
const _ = require('lodash');
const BaseGenerator = require('../generator-base');
const cleanup = require('../cleanup');
const prompts = require('./prompts');
const packagejs = require('../../package.json');
const statistics = require('../statistics');

module.exports = class extends BaseGenerator {
    constructor(args, opts) {
        super(args, opts);

        this.configOptions = {};
        // This adds support for a `--from-cli` flag
        this.option('from-cli', {
            desc: 'Indicates the command is run from JHipster CLI',
            type: Boolean,
            defaults: false
        });
        // This adds support for a `--skip-client` flag
        this.option('skip-client', {
            desc: 'Skip the client-side application generation',
            type: Boolean,
            defaults: false
        });

        // This adds support for a `--skip-server` flag
        this.option('skip-server', {
            desc: 'Skip the server-side application generation',
            type: Boolean,
            defaults: false
        });

        // This adds support for a `--skip-git` flag
        this.option('skip-git', {
            desc: 'Skip the git initialization',
            type: Boolean,
            defaults: false
        });

        // This adds support for a `--skip-commit-hook` flag
        this.option('skip-commit-hook', {
            desc: 'Skip adding husky commit hooks',
            type: Boolean,
            defaults: false
        });

        // This adds support for a `--skip-user-management` flag
        this.option('skip-user-management', {
            desc: 'Skip the user management module during app generation',
            type: Boolean,
            defaults: false
        });

        // This adds support for a `--skip-check-length-of-identifier` flag
        this.option('skip-check-length-of-identifier', {
            desc: 'Skip check the length of the identifier, only for recent Oracle databases that support 30+ characters metadata',
            type: Boolean,
            defaults: false
        });

        // This adds support for a `--[no-]i18n` flag
        this.option('i18n', {
            desc: 'Disable or enable i18n when skipping client side generation, has no effect otherwise',
            type: Boolean,
            defaults: true
        });

        // This adds support for a `--with-entities` flag
        this.option('with-entities', {
            desc: 'Regenerate the existing entities if any',
            type: Boolean,
            defaults: false
        });

        // This adds support for a `--skip-checks` flag
        this.option('skip-checks', {
            desc: 'Check the status of the required tools',
            type: Boolean,
            defaults: false
        });

        // This adds support for a `--jhi-prefix` flag
        this.option('jhi-prefix', {
            desc: 'Add prefix before services, controllers and states name',
            type: String,
            defaults: 'jhi'
        });

        // This adds support for a `--yarn` flag
        this.option('yarn', {
            desc: 'Use yarn instead of npm',
            type: Boolean,
            defaults: false
        });

        // This adds support for a `--auth` flag
        this.option('auth', {
            desc: 'Provide authentication type for the application when skipping server',
            type: String
        });

        // This adds support for a `--db` flag
        this.option('db', {
            desc: 'Provide DB name for the application when skipping server',
            type: String
        });

        // This adds support for a `--blueprint` flag which can be used to specify a blueprint to use for generation
        this.option('blueprint', {
            desc: '[BETA] Specify a generator blueprint to use for the sub generators',
            type: String
        });

        // This adds support for a `--experimental` flag which can be used to enable experimental features
        this.option('experimental', {
            desc:
                'Enable experimental features. Please note that these features may be unstable and may undergo breaking changes at any time',
            type: Boolean,
            defaults: false
        });

        this.skipClient = this.configOptions.skipClient = this.options['skip-client'] || this.config.get('skipClient');
        this.skipServer = this.configOptions.skipServer = this.options['skip-server'] || this.config.get('skipServer');
        this.skipUserManagement = this.configOptions.skipUserManagement =
            this.options['skip-user-management'] || this.config.get('skipUserManagement');
        this.skipCheckLengthOfIdentifier = this.configOptions.skipCheckLengthOfIdentifier =
            this.options['skip-check-length-of-identifier'] || this.config.get('skipCheckLengthOfIdentifier');
        this.jhiPrefix = this.configOptions.jhiPrefix = _.camelCase(this.config.get('jhiPrefix') || this.options['jhi-prefix']);
        this.withEntities = this.options['with-entities'];
        this.skipChecks = this.options['skip-checks'];
        const blueprint = this.normalizeBlueprintName(this.options.blueprint || this.config.get('blueprint'));
        this.blueprint = this.configOptions.blueprint = blueprint;
        this.useNpm = this.configOptions.useNpm = !this.options.yarn;
        this.useYarn = !this.useNpm;

        this.isDebugEnabled = this.configOptions.isDebugEnabled = this.options.debug;
        this.experimental = this.configOptions.experimental = this.options.experimental;
        this.registerClientTransforms();
    }

    get initializing() {
        return {
            validateFromCli() {
                if (!this.options['from-cli']) {
                    this.warning(
                        `Deprecated: JHipster seems to be invoked using Yeoman command. Please use the JHipster CLI. Run ${chalk.red(
                            'jhipster <command>'
                        )} instead of ${chalk.red('yo jhipster:<command>')}`
                    );
                }
            },

            displayLogo() {
                this.printJHipsterLogo();
            },

            validateBlueprint() {
                if (this.blueprint) {
                    this.checkBlueprint(this.blueprint);
                }
            },

            validateJava() {
                this.checkJava();
            },

            validateNode() {
                this.checkNode();
            },

            validateGit() {
                this.checkGit();
            },

            validateYarn() {
                this.checkYarn();
            },

            checkForNewJHVersion() {
                if (!this.skipChecks) {
                    this.checkForNewVersion();
                }
            },

            validate() {
                if (this.skipServer && this.skipClient) {
                    this.error(
                        chalk.red(`You can not pass both ${chalk.yellow('--skip-client')} and ${chalk.yellow('--skip-server')} together`)
                    );
                }
            },

            setupconsts() {
                this.applicationType = this.config.get('applicationType');
                if (!this.applicationType) {
                    this.applicationType = 'monolith';
                }
                this.baseName = this.config.get('baseName');
                this.jhipsterVersion = packagejs.version;
                if (this.jhipsterVersion === undefined) {
                    this.jhipsterVersion = this.config.get('jhipsterVersion');
                }
                this.otherModules = this.config.get('otherModules');
                this.testFrameworks = this.config.get('testFrameworks');
                this.enableTranslation = this.config.get('enableTranslation');
                this.nativeLanguage = this.config.get('nativeLanguage');
                this.languages = this.config.get('languages');
                const configFound = this.baseName !== undefined && this.applicationType !== undefined;
                if (configFound) {
                    this.existingProject = true;
                    // If translation is not defined, it is enabled by default
                    if (this.enableTranslation === undefined) {
                        this.enableTranslation = true;
                    }
                }
                this.clientPackageManager = this.config.get('clientPackageManager');
                if (!this.clientPackageManager) {
                    if (this.useNpm) {
                        this.clientPackageManager = 'npm';
                    } else {
                        this.clientPackageManager = 'yarn';
                    }
                }
            }
        };
    }

    get prompting() {
        return {
            askForInsightOptIn: prompts.askForInsightOptIn,
            // TODO : enable this. It's a bit messy for now, it need better sync.
            // askForAccountLinking: prompts.askForAccountLinking,
            askForApplicationType: prompts.askForApplicationType,
            askForModuleName: prompts.askForModuleName
        };
    }

    get configuring() {
        return {
            setup() {
                this.configOptions.skipI18nQuestion = true;
                this.configOptions.baseName = this.baseName;
                this.configOptions.logo = false;
                this.configOptions.otherModules = this.otherModules;
                this.generatorType = 'app';
                if (this.reactive) {
                    // TODO: support client in reactive app
                    this.skipClient = true;
                    this.generatorType = 'server';
                }
                if (this.applicationType === 'microservice') {
                    this.skipClient = true;
                    this.generatorType = 'server';
                    this.skipUserManagement = this.configOptions.skipUserManagement = true;
                }
                if (this.applicationType === 'uaa') {
                    this.skipClient = true;
                    this.generatorType = 'server';
                    this.skipUserManagement = this.configOptions.skipUserManagement = false;
                    this.authenticationType = this.configOptions.authenticationType = 'uaa';
                }
                if (this.skipClient) {
                    // defaults to use when skipping client
                    this.generatorType = 'server';
                    this.configOptions.enableTranslation = this.options.i18n;
                }
                if (this.skipServer) {
                    // defaults to use when skipping server
                    this.generatorType = 'client';
                    this.configOptions.databaseType = this.getDBTypeFromDBValue(this.options.db);
                    this.configOptions.devDatabaseType = this.options.db;
                    this.configOptions.prodDatabaseType = this.options.db;
                    this.configOptions.authenticationType = this.options.auth;
                    this.configOptions.uaaBaseName = this.options.uaaBaseName;
                }
                this.configOptions.clientPackageManager = this.clientPackageManager;
            },

            // composeAccountLinking() {
            //     if (!this.linkAccount) return;

            //     this.composeWith(require.resolve('../link-account'));
            // },

            composeServer() {
                if (this.skipServer) return;

                this.composeWith(require.resolve('../server'), {
                    'client-hook': !this.skipClient,
                    'from-cli': this.options['from-cli'],
                    configOptions: this.configOptions,
                    force: this.options.force,
                    debug: this.isDebugEnabled
                });
            },

            composeClient() {
                if (this.skipClient) return;

                this.composeWith(require.resolve('../client'), {
                    'skip-install': this.options['skip-install'],
                    'skip-commit-hook': this.options['skip-commit-hook'],
                    'from-cli': this.options['from-cli'],
                    configOptions: this.configOptions,
                    force: this.options.force,
                    debug: this.isDebugEnabled
                });
            },

            askFori18n: prompts.askFori18n
        };
    }

    get default() {
        return {
            askForTestOpts: prompts.askForTestOpts,

            askForMoreModules: prompts.askForMoreModules,

            setSharedConfigOptions() {
                this.configOptions.testFrameworks = this.testFrameworks;
                this.configOptions.enableTranslation = this.enableTranslation;
                this.configOptions.nativeLanguage = this.nativeLanguage;
                this.configOptions.languages = this.languages;
                this.configOptions.clientPackageManager = this.clientPackageManager;
            },

            composeLanguages() {
                if (this.skipI18n) return;
                this.composeLanguagesSub(this, this.configOptions, this.generatorType);
            },

            saveConfig() {
                const config = {
                    jhipsterVersion: packagejs.version,
                    applicationType: this.applicationType,
                    baseName: this.baseName,
                    testFrameworks: this.testFrameworks,
                    jhiPrefix: this.jhiPrefix,
                    skipCheckLengthOfIdentifier: this.skipCheckLengthOfIdentifier,
                    otherModules: this.otherModules,
                    enableTranslation: this.enableTranslation,
                    clientPackageManager: this.clientPackageManager
                };
                if (this.enableTranslation) {
                    config.nativeLanguage = this.nativeLanguage;
                    config.languages = this.languages;
                }
                this.blueprint && (config.blueprint = this.blueprint);
                this.reactive && (config.reactive = this.reactive);
                this.skipClient && (config.skipClient = true);
                this.skipServer && (config.skipServer = true);
                this.skipUserManagement && (config.skipUserManagement = true);
                this.config.set(config);
            },

            insight() {
                const yorc = {
                    ..._.omit(this.configOptions, [
                        'jhiPrefix',
                        'baseName',
                        'jwtSecretKey',
                        'packageName',
                        'packagefolder',
                        'rememberMeKey'
                    ])
                };
                yorc.applicationType = this.applicationType;
                statistics.sendYoRc(yorc, this.existingProject, this.jhipsterVersion);
            }
        };
    }

    get writing() {
        return {
            cleanup() {
                cleanup.cleanupOldFiles(this);
            },

            regenerateEntities() {
                if (this.withEntities) {
                    this.getExistingEntities().forEach(entity => {
                        this.composeWith(require.resolve('../entity'), {
                            regenerate: true,
                            'skip-install': true,
                            'from-cli': this.options['from-cli'],
                            force: this.options.force,
                            debug: this.isDebugEnabled,
                            arguments: [entity.name]
                        });
                    });
                }
            },

            generatePackageForMS() {
                if (this.skipClient) {
                    if (this.otherModules === undefined) {
                        this.otherModules = [];
                    }
                    // Generate a package.json file containing the current version
                    // of the generator as dependency
                    this.dasherizedBaseName = _.kebabCase(this.baseName);
                    this.template('skipClientApp.package.json.ejs', 'package.json');
                }
            },

            initGitRepo() {
                if (!this.options['skip-git']) {
                    this.isGitInstalled(code => {
                        if (code === 0) {
                            this.gitExec('rev-parse --is-inside-work-tree', { trace: false }, (err, gitDir) => {
                                if (!gitDir) {
                                    this.gitExec('init', { trace: false }, () => {
                                        this.log(chalk.green.bold('Git repo initiated.'));
                                        this.gitInitialized = true;
                                    });
                                }
                            });
                        } else {
                            this.warning('Git repository could not be initialized, as Git is not installed on your system');
                        }
                    });
                }
            }
        };
    }

    get end() {
        return {
            gitCommit() {
                if (!this.options['skip-git']) {
                    this.debug('Committing files to git');
                    const done = this.async();
                    this.isGitInstalled(code => {
                        if (code === 0 && this.gitInitialized) {
                            this.gitExec('add -A', { trace: false }, () => {
                                let commitMsg = `Initial application generated by JHipster-${this.jhipsterVersion}`;
                                if (this.blueprint) {
                                    commitMsg += ` with blueprint: ${this.blueprint.replace('generator-jhipster-', '')}`;
                                }
                                this.gitExec(`commit -am "${commitMsg}"`, { trace: false }, () => {
                                    this.log(chalk.green.bold('Application successfully committed to Git.'));
                                    done();
                                });
                            });
                        } else {
                            this.warning(
                                'The generated application could not be committed to Git, as Git repository could not be initialized.'
                            );
                        }
                    });
                }
            },

            afterRunHook() {
                try {
                    const modules = this.getModuleHooks();
                    if (modules.length > 0) {
                        this.log(`\n${chalk.bold.green('Running post run module hooks\n')}`);
                        // run through all post app creation module hooks
                        this.callHooks('app', 'post', {
                            appConfig: this.configOptions,
                            force: this.options.force
                        });
                    }
                } catch (err) {
                    this.log(`\n${chalk.bold.red('Running post run module hooks failed. No modification done to the generated app.')}`);
                    this.debug('Error:', err);
                }
                this.log(
                    chalk.green(
                        `\nIf you find JHipster useful consider supporting our collective ${chalk.yellow(
                            'https://opencollective.com/generator-jhipster'
                        )}`
                    )
                );
            }
        };
    }
};
<|endoftext|>


<commit_before>(function (global) {
  'use strict';

  var TestUtils = React.addons.TestUtils;

  function isArray (arr) {
    return Object.prototype.toString.call(arr) === '[object Array]';
  }

  var SELECTORS = [
    {
      matcher: /^([A-Z]\w*)/,
      buildPredicate: function (match) {
        return function (component) {
          if (typeof component._currentElement.type !== 'string') {
            return component._currentElement.type.displayName === match[1];
          }

          return false;
        };
      }
    },
    {
      matcher: /^([a-z]\w*)/,
      buildPredicate: function (match) {
        return function (component) {
          if (typeof component._currentElement.type === 'string') {
            return component._currentElement.type === match[1];
          }

          return false;
        };
      }
    }
  ];

  function parseSelector (selector) {
    var predicate, match, selectorDef;

    for (var i = 0; i < SELECTORS.length; i++) {
      selectorDef = SELECTORS[i];
      match = selector.match(selectorDef.matcher);
      if (match) {
        predicate = selectorDef.buildPredicate(match);
        break;
      }
    }

    if (!predicate) {
      throw new Error('Invalid selector: ' + selector);
    }

    return predicate;
  };

  function rQuery (components) {
    if (!isArray(components)) {
      components = [components];
    }

    this.components = components;
    this.length = components.length;

    for (var i = 0; i < components.length; i++) {
      this[i] = components[i];
    }
  };

  rQuery.prototype.find = function (selector) {
    var predicate = parseSelector(selector);
    return this._generate(predicate);
  };

  rQuery.prototype._generate = function (predicate) {
    var matches = [].concat.apply([], this.components.map(function (component) {
      return TestUtils.findAllInRenderedTree(component, predicate);
    }));

    return new rQuery(matches);
  };

  var $R = global.$R = function (components) {
    return new rQuery(components);
  };
}(this));
<commit_msg>Use better component checkers<commit_after>(function (global) {
  'use strict';

  var TestUtils = React.addons.TestUtils;

  function isArray (arr) {
    return Object.prototype.toString.call(arr) === '[object Array]';
  }

  var SELECTORS = [
    {
      matcher: /^([A-Z]\w*)/,
      buildPredicate: function (match) {
        return function (component) {
          if (TestUtils.isCompositeComponent(component)) {
            return component._currentElement.type.displayName === match[1];
          }

          return false;
        };
      }
    },
    {
      matcher: /^([a-z]\w*)/,
      buildPredicate: function (match) {
        return function (component) {
          if (TestUtils.isDOMComponent(component)) {
            return component._tag === match[1];
          }

          return false;
        };
      }
    }
  ];

  function parseSelector (selector) {
    var predicate, match, selectorDef;

    for (var i = 0; i < SELECTORS.length; i++) {
      selectorDef = SELECTORS[i];
      match = selector.match(selectorDef.matcher);
      if (match) {
        predicate = selectorDef.buildPredicate(match);
        break;
      }
    }

    if (!predicate) {
      throw new Error('Invalid selector: ' + selector);
    }

    return predicate;
  };

  function rQuery (components) {
    if (!isArray(components)) {
      components = [components];
    }

    this.components = components;
    this.length = components.length;

    for (var i = 0; i < components.length; i++) {
      this[i] = components[i];
    }
  };

  rQuery.prototype.find = function (selector) {
    var predicate = parseSelector(selector);
    return this._generate(predicate);
  };

  rQuery.prototype._generate = function (predicate) {
    var matches = [].concat.apply([], this.components.map(function (component) {
      return TestUtils.findAllInRenderedTree(component, predicate);
    }));

    return new rQuery(matches);
  };

  var $R = global.$R = function (components) {
    return new rQuery(components);
  };
}(this));
<|endoftext|>


<commit_before>'use strict';

module.exports = function (grunt) {

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  // Automatically load required grunt tasks
  // Use jit-grunt instead of load-grunt-tasks here as it dramatically decreases grunt initialization time (27.5s -> 1.5s).
  require('jit-grunt')(grunt, {
      useminPrepare: 'grunt-usemin'
  });

  // Configurable options
  var config = {
    app: './app',
    dist: './dist',
    minimumCoverage: 90 // percents
  };

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    config: config,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      sass: {
        files: ['<%= config.app %>/styles/sass/{,*/}*.{scss,sass}'],
        tasks: ['sass']
      },
      templates: {
        files: ['<%= config.app %>/templates/{,*/}*.hbs'],
        tasks: ['handlebars']
      },
    },

    browserSync: {
      options: {
        notify: false,
        background: true,
        watchOptions: {
          ignored: ''
        }
      },
      livereload: {
        options: {
          files: [
            '<%= config.app %>/{,*/}*.html',
            '<%= config.app %>/styles/{,*/}*.css',
            '<%= config.app %>/images/{,*/}*',
            '<%= config.app %>/scripts/{,*/}*.js'
          ],
          port: 9000,
          server: {
            baseDir: ['<%= config.app %>', config.app],
            routes: {
              '/bower_components': './bower_components'
            }
          }
        }
      }
    },

    // Empties folders to start fresh
    clean: {
      options: {
        force: true
      },
      dist: {
        files: [{
          dot: true,
          src: [
            '<%= config.app %>/styles/main.css',
            '<%= config.app %>/styles/main.css.map',
            '<%= config.app %>/scripts/compiled-templates.js'
          ]
        }]
      },
    },

    handlebars: {
      compile: {
        options: {
          namespace: 'Handlebars.Templates',
          processName: function(filePath) { // input:  app/templates/AddressInputQuestion.hbs
            var pieces = filePath.split("/");
            return pieces[pieces.length - 1].replace(/\.hbs$/, ''); // output: AddressInputQuestion
          },
        },
        files: {
          '<%= config.app %>/scripts/compiled-templates.js': [ '<%= config.app %>/templates/*.hbs']
        }
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    sass: {
      options: {
        sourceMap: true,
        sourceMapEmbed: true,
        sourceMapContents: true,
        outputStyle: 'compact',
        includePaths: ['.']
      },
      dist: {
        files: {
          '<%= config.app %>/styles/main.css': '<%= config.app %>/styles/sass/master.scss',
        }
      }
    },

    // Automatically inject Bower components into the HTML file
    wiredep: {
      options: {
        cwd: '.'
      },
      app: {
        src: ['<%= config.app %>/index.html'],
        ignorePath: /^(\.\.\/)*\.\./
      },
      sass: {
        src: ['<%= config.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /^(\.\.\/)+/
      },
      js: {
        src: ['<%= config.app %>/scripts/{,*/}*.js'],
        options: {
          fileTypes: {
            js: {
              block: /(((?:[\t ])*)\/\/\s*bower:(\S*))((?:\r|\n|.)*?)(\/\/\s*endbower)/gi,
              detect: {
                js: /".*\.js"/gi
              },
              replace: {
                js: "'{{filePath}}',"
              }
            }
          }
        }
      }
    },

    useminPrepare: {
      options: {
        dest: '<% config.dist %>'
      },
      html: '<%= config.app %>/index.html'
    },

    usemin: {
      options: {
        assetsDirs: [
          '.tmp',
          '<%= config.dist %>',
          '<%= config.dist %>/scripts',
          '<%= config.dist %>/styles',
          '.'
        ]
      },
      html: ['<%= config.dist %>/{,*/}*.html']
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= config.app %>',
          dest: '<%= config.dist %>',
          src: [
            'styles/*.css',
            'styles/*.map',
            'images/{,*/}*',
            'fonts/{,*}*',
            '{,*/}*.html'
          ]
        }]
      }
    },
  });

  grunt.registerTask('build', [
    'clean',
    'wiredep',
    'useminPrepare',
    'sass',
    'handlebars',
    'concat',
    'uglify',
    'cssmin',
    'copy:dist',
    'usemin'
  ]);

  grunt.registerTask('default', [
    'build'
  ]);

  grunt.registerTask('serve', 'Prepares files for main serve task', [
    'clean',
    'sass',
    'handlebars',
    'wiredep',
    'browserSync:livereload',
    'watch'
  ]);
};
<commit_msg>removing dist directory on clean<commit_after>'use strict';

module.exports = function (grunt) {

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  // Automatically load required grunt tasks
  // Use jit-grunt instead of load-grunt-tasks here as it dramatically decreases grunt initialization time (27.5s -> 1.5s).
  require('jit-grunt')(grunt, {
      useminPrepare: 'grunt-usemin'
  });

  // Configurable options
  var config = {
    app: './app',
    dist: './dist',
    minimumCoverage: 90 // percents
  };

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    config: config,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      sass: {
        files: ['<%= config.app %>/styles/sass/{,*/}*.{scss,sass}'],
        tasks: ['sass']
      },
      templates: {
        files: ['<%= config.app %>/templates/{,*/}*.hbs'],
        tasks: ['handlebars']
      },
    },

    browserSync: {
      options: {
        notify: false,
        background: true,
        watchOptions: {
          ignored: ''
        }
      },
      livereload: {
        options: {
          files: [
            '<%= config.app %>/{,*/}*.html',
            '<%= config.app %>/styles/{,*/}*.css',
            '<%= config.app %>/images/{,*/}*',
            '<%= config.app %>/scripts/{,*/}*.js'
          ],
          port: 9000,
          server: {
            baseDir: ['<%= config.app %>', config.app],
            routes: {
              '/bower_components': './bower_components'
            }
          }
        }
      }
    },

    // Empties folders to start fresh
    clean: {
      options: {
        force: true
      },
      dist: {
        files: [{
          dot: true,
          src: [
            '<%= config.app %>/styles/main.css',
            '<%= config.app %>/styles/main.css.map',
            '<%= config.app %>/scripts/compiled-templates.js',
            '<%= config.dist %>'
          ]
        }]
      },
    },

    handlebars: {
      compile: {
        options: {
          namespace: 'Handlebars.Templates',
          processName: function(filePath) { // input:  app/templates/AddressInputQuestion.hbs
            var pieces = filePath.split("/");
            return pieces[pieces.length - 1].replace(/\.hbs$/, ''); // output: AddressInputQuestion
          },
        },
        files: {
          '<%= config.app %>/scripts/compiled-templates.js': [ '<%= config.app %>/templates/*.hbs']
        }
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    sass: {
      options: {
        sourceMap: true,
        sourceMapEmbed: true,
        sourceMapContents: true,
        outputStyle: 'compact',
        includePaths: ['.']
      },
      dist: {
        files: {
          '<%= config.app %>/styles/main.css': '<%= config.app %>/styles/sass/master.scss',
        }
      }
    },

    // Automatically inject Bower components into the HTML file
    wiredep: {
      options: {
        cwd: '.'
      },
      app: {
        src: ['<%= config.app %>/index.html'],
        ignorePath: /^(\.\.\/)*\.\./
      },
      sass: {
        src: ['<%= config.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /^(\.\.\/)+/
      },
      js: {
        src: ['<%= config.app %>/scripts/{,*/}*.js'],
        options: {
          fileTypes: {
            js: {
              block: /(((?:[\t ])*)\/\/\s*bower:(\S*))((?:\r|\n|.)*?)(\/\/\s*endbower)/gi,
              detect: {
                js: /".*\.js"/gi
              },
              replace: {
                js: "'{{filePath}}',"
              }
            }
          }
        }
      }
    },

    useminPrepare: {
      options: {
        dest: '<% config.dist %>'
      },
      html: '<%= config.app %>/index.html'
    },

    usemin: {
      options: {
        assetsDirs: [
          '.tmp',
          '<%= config.dist %>',
          '<%= config.dist %>/scripts',
          '<%= config.dist %>/styles',
          '.'
        ]
      },
      html: ['<%= config.dist %>/{,*/}*.html']
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= config.app %>',
          dest: '<%= config.dist %>',
          src: [
            'styles/*.css',
            'styles/*.map',
            'images/{,*/}*',
            'fonts/{,*}*',
            '{,*/}*.html'
          ]
        }]
      }
    },
  });

  grunt.registerTask('build', [
    'clean',
    'wiredep',
    'useminPrepare',
    'sass',
    'handlebars',
    'concat',
    'uglify',
    'cssmin',
    'copy:dist',
    'usemin'
  ]);

  grunt.registerTask('default', [
    'build'
  ]);

  grunt.registerTask('serve', 'Prepares files for main serve task', [
    'clean',
    'sass',
    'handlebars',
    'wiredep',
    'browserSync:livereload',
    'watch'
  ]);
};
<|endoftext|>


<commit_before>import Pointer from "../../input/Pointer.js";
import Matrix4 from "../../math/Matrix4.js";
import Vector2 from "../../math/Vector2.js";
import Vector3 from "../../math/Vector3.js";
import Quaternion from "../../math/Quaternion.js";

export default class TrackballController {
  constructor({
    matrix = new Matrix4(),
    domElement = document.body,
    distance = 0,
    invertRotation = true,
    rotationEaseRatio = .04,
    zoomStep = 1.,
    zoomEaseRatio = .1,
    autoupdate = true
  } = {}) {
    this.matrix = matrix;

    this.disabled = false;

    this._distance = distance;
    this.invertRotation = invertRotation;
    this.rotationEaseRatio = rotationEaseRatio;
    this.zoomStep = zoomStep;
    this.zoomEaseRatio = zoomEaseRatio;

    this._pointer = Pointer.get(domElement);
    this._nextDistance = this._distance;

    this._cachedQuaternion = new Quaternion();
    this._cachedMatrix = new Matrix4();
    this._cachedVector3 = new Vector3();

    this._velocity = new Vector2();
    this._velocityOrigin = new Vector2();

    this._position = new Vector3(this.matrix.x, this.matrix.y, this.matrix.z);
    this._positionPrevious = this._position.clone();
    this._positionOffset = new Vector3();

    domElement.addEventListener("wheel", this.onWheel.bind(this));

    this.update();
  }

  set distance(value) {
    this._distance = this._nextDistance = value;
  }

  get distance() {
    return this._distance;
  }

  onWheel(e) {
    if(e.deltaY > 0) {
      this._nextDistance += this.zoomStep;
    } else {
      this._nextDistance -= this.zoomStep;
    }
    this._nextDistance = Math.max(this._nextDistance, 0);
  }

  update() {
    if(this.disabled) {
      return;
    }

    this._cachedMatrix.identity();
    this._cachedQuaternion.identity();

    this._distance += (this._nextDistance - this._distance) * this.zoomEaseRatio;

    this._position.set(this.matrix.x, this.matrix.y, this.matrix.z).subtract(this._positionOffset);

    this.matrix.x = 0;
    this.matrix.y = 0;
    this.matrix.z = 0;

    if(this._pointer.downed) {
      this._velocity.copy(this._pointer.velocity).scale(.003);
    }

    this._velocity.lerp(this._velocityOrigin, this.rotationEaseRatio);

    this._cachedQuaternion.rotateY(this.invertRotation ? -this._velocity.x : this._velocity.x);
    this._cachedQuaternion.rotateX(this.invertRotation ? -this._velocity.y : this._velocity.y);

    this._cachedMatrix.fromQuaternion(this._cachedQuaternion);

    this.matrix.multiply(this._cachedMatrix);

    this._positionOffset.set(0, 0, 1);
    this._positionOffset.applyMatrix4(this.matrix);
    this._positionOffset.scale(this._distance);

    this._cachedVector3.copy(this._position).add(this._positionOffset);

    this.matrix.x = this._cachedVector3.x;
    this.matrix.y = this._cachedVector3.y;
    this.matrix.z = this._cachedVector3.z;
  }
}
<commit_msg>fix trackball controller with new Vector3 constructor<commit_after>import Pointer from "../../input/Pointer.js";
import Matrix4 from "../../math/Matrix4.js";
import Vector2 from "../../math/Vector2.js";
import Vector3 from "../../math/Vector3.js";
import Quaternion from "../../math/Quaternion.js";

export default class TrackballController {
  constructor({
    matrix = new Matrix4(),
    domElement = document.body,
    distance = 0,
    invertRotation = true,
    rotationEaseRatio = .04,
    zoomStep = 1.,
    zoomEaseRatio = .1,
    autoupdate = true
  } = {}) {
    this.matrix = matrix;

    this.disabled = false;

    this._distance = distance;
    this.invertRotation = invertRotation;
    this.rotationEaseRatio = rotationEaseRatio;
    this.zoomStep = zoomStep;
    this.zoomEaseRatio = zoomEaseRatio;

    this._pointer = Pointer.get(domElement);
    this._nextDistance = this._distance;

    this._cachedQuaternion = new Quaternion();
    this._cachedMatrix = new Matrix4();
    this._cachedVector3 = new Vector3();

    this._velocity = new Vector2();
    this._velocityOrigin = new Vector2();

    this._position = new Vector3([this.matrix.x, this.matrix.y, this.matrix.z]);
    this._positionPrevious = this._position.clone();
    this._positionOffset = new Vector3();

    domElement.addEventListener("wheel", this.onWheel.bind(this));

    this.update();
  }

  set distance(value) {
    this._distance = this._nextDistance = value;
  }

  get distance() {
    return this._distance;
  }

  onWheel(e) {
    if(e.deltaY > 0) {
      this._nextDistance += this.zoomStep;
    } else {
      this._nextDistance -= this.zoomStep;
    }
    this._nextDistance = Math.max(this._nextDistance, 0);
  }

  update() {
    if(this.disabled) {
      return;
    }

    this._cachedMatrix.identity();
    this._cachedQuaternion.identity();

    this._distance += (this._nextDistance - this._distance) * this.zoomEaseRatio;

    this._position.set(this.matrix.x, this.matrix.y, this.matrix.z).subtract(this._positionOffset);

    this.matrix.x = 0;
    this.matrix.y = 0;
    this.matrix.z = 0;

    if(this._pointer.downed) {
      this._velocity.copy(this._pointer.velocity).scale(.003);
    }

    this._velocity.lerp(this._velocityOrigin, this.rotationEaseRatio);

    this._cachedQuaternion.rotateY(this.invertRotation ? -this._velocity.x : this._velocity.x);
    this._cachedQuaternion.rotateX(this.invertRotation ? -this._velocity.y : this._velocity.y);

    this._cachedMatrix.fromQuaternion(this._cachedQuaternion);

    this.matrix.multiply(this._cachedMatrix);

    this._positionOffset.set(0, 0, 1);
    this._positionOffset.applyMatrix4(this.matrix);
    this._positionOffset.scale(this._distance);

    this._cachedVector3.copy(this._position).add(this._positionOffset);

    this.matrix.x = this._cachedVector3.x;
    this.matrix.y = this._cachedVector3.y;
    this.matrix.z = this._cachedVector3.z;
  }
}
<|endoftext|>


<commit_before>/*
 * grunt-submodule – copyright © 2014, Jonas Pommerening
 * Released under the MIT license.
 * https://github.com/jpommerening/grunt-submodule.git
 */
module.exports = function (grunt) {
  'use strict';

  grunt.initConfig({
    clean: {
      tests: ['tmp']
    },
    jshint: {
      options: {
        jshintrc: '.jshintrc',
      },
      tasks: [
        __filename,
        'tasks/*.js',
      ],
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: [
          'test/*.js'
        ]
      }
    },

    submodule: {
      'test/fixtures/test2': {
        options: {
          tasks: ['jshint']
        }
      },
      'test/fixtures/*': {
        options: {
          tasks: ['test']
        }
      }
    },

    mochacli: {
      options: {
        ui: 'bdd',
        reporter: 'spec'
      },
      test: [
        'test/*.js'
      ]
    },
    watch: {
      tasks: {
        files: [
          __filename,
          'tasks/*.js'
        ],
        tasks: ['newer:jshint:tasks', 'clean', 'submodule', 'mochacli']
      },
      test: {
        files: [
          'test/*.js'
        ],
        tasks: ['newer:jshint:test', 'newer:mochacli']
      }
    }
  });

  grunt.loadTasks('tasks');

  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-mocha-cli');
  grunt.loadNpmTasks('grunt-notify');
  grunt.loadNpmTasks('grunt-newer');

  grunt.registerTask('test', ['clean', 'submodule', 'mochacli']);
  grunt.registerTask('default', ['test', 'jshint']);
};
<commit_msg>Stuff<commit_after>/*
 * grunt-submodule – copyright © 2014, Jonas Pommerening
 * Released under the MIT license.
 * https://github.com/jpommerening/grunt-submodule.git
 */
module.exports = function (grunt) {
  'use strict';

  grunt.initConfig({
    clean: {
      tests: ['tmp']
    },
    jshint: {
      options: {
        jshintrc: '.jshintrc',
      },
      tasks: {
        src: [
          __filename,
          'tasks/*.js',
        ]
      },
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: [
          'test/*.js'
        ]
      }
    },

    submodule: {
      'test/fixtures/test2': {
        options: {
          tasks: ['jshint']
        }
      },
      'test/fixtures/*': {
        options: {
          tasks: ['test']
        }
      }
    },

    mochacli: {
      options: {
        ui: 'bdd',
        reporter: 'spec'
      },
      test: {
        src: [ 'test/*.js' ]
      }
    },
    watch: {
      tasks: {
        files: [
          __filename,
          'tasks/*.js'
        ],
        tasks: ['newer:jshint:tasks', 'clean', 'submodule', 'mochacli']
      },
      test: {
        files: [
          'test/*.js'
        ],
        tasks: ['newer:jshint:test', 'newer:mochacli']
      }
    }
  });

  grunt.loadTasks('tasks');

  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-mocha-cli');
  grunt.loadNpmTasks('grunt-notify');
  grunt.loadNpmTasks('grunt-newer');

  grunt.registerTask('test', ['clean', 'submodule', 'mochacli']);
  grunt.registerTask('default', ['test', 'jshint']);
};
<|endoftext|>


<commit_before>import Pointer from "../../input/Pointer";
import Ticker from "../../utils/Ticker";
import Matrix4 from "../../math/Matrix4";
import Vector2 from "../../math/Vector2";
import Vector3 from "../../math/Vector3";
import Quaternion from "../../math/Quaternion";

export default class TrackballControl {
  constructor(matrix = new Matrix4(), {
    domElement = document.body,
    distance = 0,
    invertRotation = true,
    rotationEaseRatio = .03,
    zoomStep = 1,
    zoomEaseRatio = .1
  } = {}) {
    this.matrix = matrix;

    this._distance = distance;
    this.invertRotation = invertRotation;
    this.rotationEaseRatio = rotationEaseRatio;
    this.zoomStep = zoomStep;
    this.zoomEaseRatio = zoomEaseRatio;

    this._pointer = Pointer.get(domElement);
    this._nextDistance = this._distance;

    this._cachedQuaternion = new Quaternion();
    this._cachedMatrix = new Matrix4();
    this._cachedVector3 = new Vector3();

    this._velocity = new Vector2();
    this._velocityOrigin = new Vector2();

    this._position = new Vector3(this.matrix.x, this.matrix.y, this.matrix.z);
    this._positionPrevious = this._position.clone();
    this._positionOffset = new Vector3();

    domElement.addEventListener("wheel", this.onWheel.bind(this));

    Ticker.add(this.update.bind(this));
  }

  set distance(value) {
    this._distance = this._nextDistance = value;
  }

  get distance() {
    return this._distance;
  }

  onWheel(e) {
    if(e.deltaY > 0) {
      this._nextDistance += this.zoomStep;
    } else {
      this._nextDistance -= this.zoomStep;
    }
    this._nextDistance = Math.max(this._nextDistance, 0);
  }

  update() {
    this._cachedMatrix.identity();
    this._cachedQuaternion.identity();

    this._distance += (this._nextDistance - this._distance) * this.zoomEaseRatio;

    this._position.set(this.matrix.x, this.matrix.y, this.matrix.z).subtract(this._positionOffset);

    this.matrix.x = 0;
    this.matrix.y = 0;
    this.matrix.z = 0;

    if(this._pointer.downed) {
      this._velocity.copy(this._pointer.velocity).scale(.002);
    }

    this._velocity.lerp(this._velocityOrigin, this.rotationEaseRatio);

    this._cachedQuaternion.rotateY(this.invertRotation ? -this._velocity.x : this._velocity.x);
    this._cachedQuaternion.rotateX(this.invertRotation ? -this._velocity.y : this._velocity.y);

    this._cachedMatrix.fromQuaternion(this._cachedQuaternion);

    this.matrix.multiply(this._cachedMatrix);

    this._positionOffset.set(0, 0, 1);
    this._positionOffset.applyMatrix4(this.matrix);
    this._positionOffset.scale(this._distance);

    this._cachedVector3.copy(this._position).add(this._positionOffset);

    this.matrix.x = this._cachedVector3.x;
    this.matrix.y = this._cachedVector3.y;
    this.matrix.z = this._cachedVector3.z;
  }
}
<commit_msg>add disabled method to TrackballController<commit_after>import Pointer from "../../input/Pointer";
import Ticker from "../../utils/Ticker";
import Matrix4 from "../../math/Matrix4";
import Vector2 from "../../math/Vector2";
import Vector3 from "../../math/Vector3";
import Quaternion from "../../math/Quaternion";

export default class TrackballControl {
  constructor(matrix = new Matrix4(), {
    domElement = document.body,
    distance = 0,
    invertRotation = true,
    rotationEaseRatio = .03,
    zoomStep = 1,
    zoomEaseRatio = .1
  } = {}) {
    this.matrix = matrix;

    this.disabled = false;

    this._distance = distance;
    this.invertRotation = invertRotation;
    this.rotationEaseRatio = rotationEaseRatio;
    this.zoomStep = zoomStep;
    this.zoomEaseRatio = zoomEaseRatio;

    this._pointer = Pointer.get(domElement);
    this._nextDistance = this._distance;

    this._cachedQuaternion = new Quaternion();
    this._cachedMatrix = new Matrix4();
    this._cachedVector3 = new Vector3();

    this._velocity = new Vector2();
    this._velocityOrigin = new Vector2();

    this._position = new Vector3(this.matrix.x, this.matrix.y, this.matrix.z);
    this._positionPrevious = this._position.clone();
    this._positionOffset = new Vector3();

    domElement.addEventListener("wheel", this.onWheel.bind(this));

    Ticker.add(this.update.bind(this));

    this.update();
  }

  set distance(value) {
    this._distance = this._nextDistance = value;
  }

  get distance() {
    return this._distance;
  }

  onWheel(e) {
    if(e.deltaY > 0) {
      this._nextDistance += this.zoomStep;
    } else {
      this._nextDistance -= this.zoomStep;
    }
    this._nextDistance = Math.max(this._nextDistance, 0);
  }

  update() {
    if(this.disabled) {
      return;
    }

    this._cachedMatrix.identity();
    this._cachedQuaternion.identity();

    this._distance += (this._nextDistance - this._distance) * this.zoomEaseRatio;

    this._position.set(this.matrix.x, this.matrix.y, this.matrix.z).subtract(this._positionOffset);

    this.matrix.x = 0;
    this.matrix.y = 0;
    this.matrix.z = 0;

    if(this._pointer.downed) {
      this._velocity.copy(this._pointer.velocity).scale(.002);
    }

    this._velocity.lerp(this._velocityOrigin, this.rotationEaseRatio);

    this._cachedQuaternion.rotateY(this.invertRotation ? -this._velocity.x : this._velocity.x);
    this._cachedQuaternion.rotateX(this.invertRotation ? -this._velocity.y : this._velocity.y);

    this._cachedMatrix.fromQuaternion(this._cachedQuaternion);

    this.matrix.multiply(this._cachedMatrix);

    this._positionOffset.set(0, 0, 1);
    this._positionOffset.applyMatrix4(this.matrix);
    this._positionOffset.scale(this._distance);

    this._cachedVector3.copy(this._position).add(this._positionOffset);

    this.matrix.x = this._cachedVector3.x;
    this.matrix.y = this._cachedVector3.y;
    this.matrix.z = this._cachedVector3.z;
  }
}
<|endoftext|>


<commit_before>module.exports = function (grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);
  // Time how long tasks take.
  require('time-grunt')(grunt);

  // window => global object browser
  // process => global object node

  var appConfig = {
    env: process.NODE_ENV || 'development', // 'dev', 'prod'
    app: require('./package.json').appPath || 'src',
    dist: 'dist',
    // Change this to '0.0.0.0' to access the server from outside.
    hostname: '0.0.0.0',
    ports: {
      // grunt --serverPort=4567 => http://localhost:4567
      server: grunt.option('serverPort') || 9000,
      liveReload: grunt.option('liveReloadPort') || 35729
    }
  };

  grunt.initConfig({
    // permitir acceso a la config desde los templates!!!
    config: appConfig,

    // config de grunt-contrib-connect
    connect: {
      // configuración global a todas las subtareas
      options: {
        port: appConfig.ports.server,
        // IP comodín: localhost|192.1.168.123|179.54.12.0
        hostname: appConfig.hostname,
        // socket para refrescar browser
        livereload: appConfig.ports.liveReload,
        // mantener server vivo siempre
        // keepalive: true
      },
      // subtarea livereload
      livereload: {
        options: {
          open: true,
          base: ['.tmp', '.', appConfig.app]
        }
      },
      // subtarea dist
      dist: {
        options: {
          open: true,
          base: ['.tmp', appConfig.dist]
        }
      }
    },

    watch: {
      sass: {
        files: [
          '<%= config.app %>/styles/**/*.{scss,sass}'
        ],
        tasks: []
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '.tmp/*.html',
          '<%= config.app %>/**/*.html',
          '.tmp/styles/**/*.css',
          '<%= config.app %>/images/**/*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    wiredep: {
      app: {
        src: [
          '<%= config.app %>/*.html'
        ],
        ignorePath: /\.\.\//
      },
      sass: {
        src: ['<%= config.app %>/styles/**/*.{scss,sass}']
      }
    },

    includeSource: {
      options: {
        basePath: ['<%= config.app %>', '.tmp'],
        baseUrl: '',
      },
      server: {
        files: {
          '.tmp/cv.html': '<%= config.app %>/cv.html',
          // '.tmp/index.html': '<%= config.app %>/index.html',
          // '.tmp/bootstrap.html': '<%= config.app %>/bootstrap.html'
        }
      },
      dist: {
        files: {
          '<%= config.dist %>/cv.html': '<%= config.app %>/cv.html'
        }
      }
    },

    // config de grunt-plugin1

    // config de grunt-plugin2

    // config de grunt-plugin3

  });

  // default task
  grunt.registerTask('default', ['build']);

  grunt.registerTask('build', [
    'wiredep',
    'includeSource:server',
    'connect:livereload',
    'watch'
  ]);

  // grunt composedTask === task1 => task2 => task3
  // grunt.registerTask('composedTask', ['task1', 'task2', 'task3']);

  // grunt.registerTask('customTask', () => { }));

};

/*
build =>
compilar sass
concatenar JS
concatenar CSS
minimizar HTML
minimizar JS
minimizar CSS
minimizar Imágenes
*/
<commit_msg>includeSource added to watch<commit_after>module.exports = function (grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);
  // Time how long tasks take.
  require('time-grunt')(grunt);

  // window => global object browser
  // process => global object node

  var appConfig = {
    env: process.NODE_ENV || 'development', // 'dev', 'prod'
    app: require('./package.json').appPath || 'src',
    dist: 'dist',
    // Change this to '0.0.0.0' to access the server from outside.
    hostname: '0.0.0.0',
    ports: {
      // grunt --serverPort=4567 => http://localhost:4567
      server: grunt.option('serverPort') || 9000,
      liveReload: grunt.option('liveReloadPort') || 35729
    }
  };

  grunt.initConfig({
    // permitir acceso a la config desde los templates!!!
    config: appConfig,

    // config de grunt-contrib-connect
    connect: {
      // configuración global a todas las subtareas
      options: {
        port: appConfig.ports.server,
        // IP comodín: localhost|192.1.168.123|179.54.12.0
        hostname: appConfig.hostname,
        // socket para refrescar browser
        livereload: appConfig.ports.liveReload,
        // mantener server vivo siempre
        // keepalive: true
      },
      // subtarea livereload
      livereload: {
        options: {
          open: true,
          base: ['.tmp', '.', appConfig.app]
        }
      },
      // subtarea dist
      dist: {
        options: {
          open: true,
          base: ['.tmp', appConfig.dist]
        }
      }
    },

    watch: {
      sass: {
        files: [
          '<%= config.app %>/styles/**/*.{scss,sass}'
        ],
        tasks: []
      },
      html: {
        files: [
          '<%= config.app %>/**/*.html'
        ],
        tasks: ['includeSource:server']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '.tmp/*.html',
          '<%= config.app %>/**/*.html',
          '.tmp/styles/**/*.css',
          '<%= config.app %>/images/**/*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    wiredep: {
      app: {
        src: [
          '<%= config.app %>/*.html'
        ],
        ignorePath: /\.\.\//
      },
      sass: {
        src: ['<%= config.app %>/styles/**/*.{scss,sass}']
      }
    },

    includeSource: {
      options: {
        basePath: ['<%= config.app %>', '.tmp'],
        baseUrl: '',
      },
      server: {
        files: {
          '.tmp/cv.html': '<%= config.app %>/cv.html',
          // '.tmp/index.html': '<%= config.app %>/index.html',
          // '.tmp/bootstrap.html': '<%= config.app %>/bootstrap.html'
        }
      },
      dist: {
        files: {
          '<%= config.dist %>/cv.html': '<%= config.app %>/cv.html'
        }
      }
    },

    // config de grunt-plugin1

    // config de grunt-plugin2

    // config de grunt-plugin3

  });

  // default task
  grunt.registerTask('default', ['build']);

  grunt.registerTask('build', [
    'wiredep',
    'includeSource:server',
    'connect:livereload',
    'watch'
  ]);

  // grunt composedTask === task1 => task2 => task3
  // grunt.registerTask('composedTask', ['task1', 'task2', 'task3']);

  // grunt.registerTask('customTask', () => { }));

};

/*
build =>
compilar sass
concatenar JS
concatenar CSS
minimizar HTML
minimizar JS
minimizar CSS
minimizar Imágenes
*/
<|endoftext|>


<commit_before>'use strict';

var generators = require('yeoman-generator');

var gen = generators.Base.extend({
    initializing: function() {

        try {
            this.username = process.env.USER || process.env.USERPROFILE.split(require('path').sep)[2];
        } catch (e) {
            this.username = '';
        }
    },
    prompting: function() {
        var done = this.async();
        var self = this;

        this.prompt([
            {
                type: 'input',
                name: 'name',
                message: 'Your slides name',
                validate: function(name) {
                    if (!name) {
                        return 'Slides name cannot be empty';
                    }
                    if (!/\w+/.test(name)) {
                        return 'Slides name should only consist of 0~9, a~z, A~Z, _, .';
                    }

                    var fs = require('fs');
                    if (!fs.existsSync(self.destinationPath(name))) {
                        return true;
                    }
                    if (require('fs').statSync(self.destinationPath(name)).isDirectory()) {
                        return 'Project already exist';
                    }
                    return true;
                }
            },
            {
                type: 'input',
                name: 'description',
                message: 'Your slides description',
                default: ''
            },
            {
                type: 'input',
                name: 'username',
                message: 'Your name',
                default: this.username
            },
            {
                type: 'input',
                name: 'email',
                message: 'Your email',
                default: ''
            },
            {
                type: 'list',
                name: 'theme',
                message: 'Choose a theme of this slides',
                choices: [
                    'beige',
                    'black',
                    'blood',
                    'league',
                    'moon',
                    'night',
                    'serif',
                    'simple',
                    'sky',
                    'solarized',
                    'white'
                ]
            },
            {
                type: 'checkbox',
                name: 'plugins',
                message: 'Choose plugins you\'d like to add',
                choices: [
                    {
                        checked: true,
                        name: 'highlight',
                        value: [
                            {
                                src: 'highlight/highlight.js',
                                async: true,
                                callback: 'function() { hljs.initHighlightingOnLoad(); }'
                            }
                        ]
                    },
                    {
                        checked: true,
                        name: 'markdown',
                        value: [
                            {
                                src: 'markdown/marked.js',
                                condition: 'function() { return !!document.querySelector( \'[data-markdown]\' ); }'
                            },
                            {
                                src: 'markdown/markdown.js',
                                condition: 'function() { return !!document.querySelector( \'[data-markdown]\' ); }'
                            }
                        ]
                    },
                    {
                        checked: true,
                        name: 'math',
                        value: [
                            {
                                src: 'math/math.js',
                                async: true
                            }
                        ]
                    },
                    {
                        checked: true,
                        name: 'search',
                        value: [
                            {
                                src: 'search/search.js',
                                async: true
                            }
                        ]
                    },
                    {
                        checked: true,
                        name: 'zoom-js',
                        value: [
                            {
                                src: 'zoom-js/zoom.js',
                                async: true
                            }
                        ]
                    }
                ]
            }
        ], function(answers) {
            this.answers = answers;
            this.obj = {answers: this.answers};
            done();
        }.bind(this));
    },
    configuring: function() {
        var path = require('path');
        var fs = require('fs');
        var self = this;
        var done = this.async();
        fs.exists(this.destinationPath(this.answers.name), function(exists) {
            if (exists && fs.statSync(self.destinationPath(self.answers.name)).isDirectory()) {
                self.log.error('Directory [' + self.answers.name + '] exists');
                process.exit(1);
            }
            self.destinationRoot(path.join(self.destinationRoot(), self.answers.name));
            done();
        });
    },
    writing: function() {
        this.bulkDirectory('css', this.destinationPath('css'));
        this.bulkDirectory('img', this.destinationPath('img'));
        this.bulkDirectory('js', this.destinationPath('js'));
        this.bulkDirectory('lib', this.destinationPath('lib'));
        this.bulkDirectory('plugin', this.destinationPath('plugin'));

        this.fs.copyTpl(this.templatePath('index.html'), this.destinationPath('index.html'), this.obj);
        this.fs.copyTpl(this.templatePath('package.json.vm'), this.destinationPath('package.json'), this.obj);

    },
    end: function() {
        this.log.ok('Slides ' + this.answers.name + ' generated!!!');
    }
});

module.exports = gen;
<commit_msg>update slides that search would not be checked as default<commit_after>'use strict';

var generators = require('yeoman-generator');

var gen = generators.Base.extend({
    initializing: function() {

        try {
            this.username = process.env.USER || process.env.USERPROFILE.split(require('path').sep)[2];
        } catch (e) {
            this.username = '';
        }
    },
    prompting: function() {
        var done = this.async();
        var self = this;

        this.prompt([
            {
                type: 'input',
                name: 'name',
                message: 'Your slides name',
                validate: function(name) {
                    if (!name) {
                        return 'Slides name cannot be empty';
                    }
                    if (!/\w+/.test(name)) {
                        return 'Slides name should only consist of 0~9, a~z, A~Z, _, .';
                    }

                    var fs = require('fs');
                    if (!fs.existsSync(self.destinationPath(name))) {
                        return true;
                    }
                    if (require('fs').statSync(self.destinationPath(name)).isDirectory()) {
                        return 'Project already exist';
                    }
                    return true;
                }
            },
            {
                type: 'input',
                name: 'description',
                message: 'Your slides description',
                default: ''
            },
            {
                type: 'input',
                name: 'username',
                message: 'Your name',
                default: this.username
            },
            {
                type: 'input',
                name: 'email',
                message: 'Your email',
                default: ''
            },
            {
                type: 'list',
                name: 'theme',
                message: 'Choose a theme of this slides',
                choices: [
                    'beige',
                    'black',
                    'blood',
                    'league',
                    'moon',
                    'night',
                    'serif',
                    'simple',
                    'sky',
                    'solarized',
                    'white'
                ]
            },
            {
                type: 'checkbox',
                name: 'plugins',
                message: 'Choose plugins you\'d like to add',
                choices: [
                    {
                        checked: true,
                        name: 'highlight',
                        value: [
                            {
                                src: 'highlight/highlight.js',
                                async: true,
                                callback: 'function() { hljs.initHighlightingOnLoad(); }'
                            }
                        ]
                    },
                    {
                        checked: true,
                        name: 'markdown',
                        value: [
                            {
                                src: 'markdown/marked.js',
                                condition: 'function() { return !!document.querySelector( \'[data-markdown]\' ); }'
                            },
                            {
                                src: 'markdown/markdown.js',
                                condition: 'function() { return !!document.querySelector( \'[data-markdown]\' ); }'
                            }
                        ]
                    },
                    {
                        checked: true,
                        name: 'math',
                        value: [
                            {
                                src: 'math/math.js',
                                async: true
                            }
                        ]
                    },
                    {
                        checked: false,
                        name: 'search',
                        value: [
                            {
                                src: 'search/search.js',
                                async: true
                            }
                        ]
                    },
                    {
                        checked: true,
                        name: 'zoom-js',
                        value: [
                            {
                                src: 'zoom-js/zoom.js',
                                async: true
                            }
                        ]
                    }
                ]
            }
        ], function(answers) {
            this.answers = answers;
            this.obj = {answers: this.answers};
            done();
        }.bind(this));
    },
    configuring: function() {
        var path = require('path');
        var fs = require('fs');
        var self = this;
        var done = this.async();
        fs.exists(this.destinationPath(this.answers.name), function(exists) {
            if (exists && fs.statSync(self.destinationPath(self.answers.name)).isDirectory()) {
                self.log.error('Directory [' + self.answers.name + '] exists');
                process.exit(1);
            }
            self.destinationRoot(path.join(self.destinationRoot(), self.answers.name));
            done();
        });
    },
    writing: function() {
        this.bulkDirectory('css', this.destinationPath('css'));
        this.bulkDirectory('img', this.destinationPath('img'));
        this.bulkDirectory('js', this.destinationPath('js'));
        this.bulkDirectory('lib', this.destinationPath('lib'));
        this.bulkDirectory('plugin', this.destinationPath('plugin'));

        this.fs.copyTpl(this.templatePath('index.html'), this.destinationPath('index.html'), this.obj);
        this.fs.copyTpl(this.templatePath('package.json.vm'), this.destinationPath('package.json'), this.obj);

    },
    end: function() {
        this.log.ok('Slides ' + this.answers.name + ' generated!!!');
    }
});

module.exports = gen;
<|endoftext|>