Skip to content
This repository has been archived by the owner on Nov 23, 2018. It is now read-only.

Commit

Permalink
Upgrade to new prompt lib
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jun 12, 2013
1 parent f8dc45d commit 000c438
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
21 changes: 6 additions & 15 deletions app/index.js
Expand Up @@ -11,15 +11,12 @@ var Generator = module.exports = function () {
];

this.prompt([{
type: 'confirm',
name: 'docs',
message: 'Would you like docs included?',
default: 'y/N'
}], function (err, props) {
if (err) {
return this.emit('error', err);
}

if (!/n/i.test(props.docs)) {
default: false
}], function (props) {
if (props.docs) {
this.directory('doc');
}

Expand All @@ -31,14 +28,8 @@ var Generator = module.exports = function () {
cwd: this.sourceRoot(),
dot: true
}).forEach(function (el) {
if (/n/i.test(props.docs)) {
if (ignores.indexOf(el) === -1) {
this.copy(el, el);
}
} else {
if (el !== '.git') {
this.copy(el, el);
}
if (ignores.indexOf(el) === -1) {
this.copy(el, el);
}
}, this);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -24,7 +24,7 @@
"test": "mocha"
},
"dependencies": {
"yeoman-generator": "~0.11.2"
"yeoman-generator": "~0.12.0"
},
"devDependencies": {
"mocha": "~1.9.0"
Expand Down
4 changes: 2 additions & 2 deletions test/test-file-creation.js
Expand Up @@ -18,9 +18,9 @@ describe('H5BP Mobile Boilerplate generator', function () {
});

it('generates expected files', function (cb) {
var expected = ['index.html', 'README.md'];
var expected = ['index.html', 'doc'];

helpers.mockPrompt(this.generator, { docs: 'y' });
helpers.mockPrompt(this.generator, { docs: true });

this.generator.run({}, function () {
helpers.assertFiles(expected);
Expand Down

0 comments on commit 000c438

Please sign in to comment.