Skip to content

Commit

Permalink
Fix preset value logging
Browse files Browse the repository at this point in the history
  • Loading branch information
unional committed May 19, 2016
1 parent 4c894f5 commit 700a86e
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions generators/beta/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,26 @@ module.exports = yeoman.Base.extend({
this.log('Got it! The template is saved.')
});
};
this.applyConfigTemplate = function () {
this.props.username = this.configTemplate.username;
this.props.repositoryName = this.props.repositoryName || this.configTemplate.repositoryNamePrefix + this.props.sourceDeliveryPackageName;
this.props.repositoryOrganization = this.props.repositoryOrganization || this.configTemplate.repositoryOrganization;
this.props.repositoryRemoteUrl = this.props.repositoryRemoteUrl || `https://github.com/${this.props.repositoryOrganization}/${this.props.repositoryName}.git`;

this.props.license = this.configTemplate.license;
this.props.licenseSignature = this.configTemplate.licenseSignature;
this.generatePropsFromConfigTemplate = function () {
let props = {
username: this.configTemplate.username,
repositoryName: this.props.repositoryName || this.configTemplate.repositoryNamePrefix + this.props.sourceDeliveryPackageName,
repositoryOrganization: this.props.repositoryOrganization || this.configTemplate.repositoryOrganization,
repositoryRemoteUrl: this.props.repositoryRemoteUrl || `https://github.com/${this.props.repositoryOrganization}/${this.props.repositoryName}.git`,
license: this.configTemplate.license,
licenseSignature: this.configTemplate.licenseSignature,
};

if (~this.props.sourcePlatforms.indexOf('node')) {
this.props.testFramework = this.configTemplate.testFramework;
props.testFramework = this.configTemplate.testFramework;
}

if (~this.props.sourcePlatforms.indexOf('browser')) {
this.props.browserTestHarness = this.configTemplate.browserTestHarness;
props.testFramework = this.configTemplate.testFramework;
props.browserTestHarness = this.configTemplate.browserTestHarness;
}

return props;
};

this.readGitConfig = function readGitConfig(name) {
Expand Down Expand Up @@ -438,13 +442,16 @@ module.exports = yeoman.Base.extend({
this.log(`Good, now about the ${chalk.yellow('typings')} itself...`);
},
confirmQuickSetup() {
let genProps = this.generatePropsFromConfigTemplate();
this.log('Based on your configured template, ...');
this.log(`${chalk.green('repository')}: ${chalk.cyan(`${this.props.repositoryOrganization}/${this.props.repositoryName}`)}`);
this.log(`${chalk.green('Github username')}: ${chalk.cyan(this.props.username)}`);
this.log(`${chalk.green('test framework')}: ${chalk.cyan(this.props.testFramework)}`);
this.log(`${chalk.green('brower test harness')} (if applicable): ${chalk.cyan(this.props.browserTestHarness)}`);
this.log(`${chalk.green('license')}: ${chalk.cyan(this.props.license)}`);
this.log(`${chalk.green('license signature')}: ${chalk.cyan(this.props.licenseSignature)}`);
this.log(`${chalk.green('repository')}: ${chalk.cyan(`${genProps.repositoryOrganization}/${genProps.repositoryName}`)}`);
this.log(`${chalk.green('Github username')}: ${chalk.cyan(genProps.username)}`);
this.log(`${chalk.green('license')}: ${chalk.cyan(genProps.license)}`);
this.log(`${chalk.green('license signature')}: ${chalk.cyan(genProps.licenseSignature)}`);
this.log(`${chalk.green('test framework')}: ${chalk.cyan(genProps.testFramework)}`);
if (genProps.browserTestHarness) {
this.log(`${chalk.green('brower test harness')}: ${chalk.cyan(genProps.browserTestHarness)}`);
}

return this.prompt([
{
Expand All @@ -454,10 +461,10 @@ module.exports = yeoman.Base.extend({
default: true
}
]).then((props) => {
extend(this.props, props);
if (props.usePresetValues) {
this.applyConfigTemplate();
extend(props, genProps);
}
extend(this.props, props);
});
},
confirmExistingRepository() {
Expand Down

0 comments on commit 700a86e

Please sign in to comment.