Skip to content

Commit

Permalink
feat(cli): remove default option for controller (#768)
Browse files Browse the repository at this point in the history
The CLI no longer has a default ('new') name for the controller, and will prompt for a name until it is given properly.
  • Loading branch information
shimks committed Dec 1, 2017
1 parent f67db6c commit cc41fd6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
3 changes: 1 addition & 2 deletions packages/cli/lib/artifact-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ module.exports = class ArtifactGenerator extends Generator {
{
type: 'input',
name: 'name',
message: utils.toClassName(this.artifactInfo.type) + ' name:', // capitalization
message: utils.toClassName(this.artifactInfo.type) + ' class name:', // capitalization
when: this.artifactInfo.name === undefined,
default: this.artifactInfo.defaultName,
validate: utils.validateClassName,
},
];
Expand Down
25 changes: 0 additions & 25 deletions packages/cli/test/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,31 +51,6 @@ describe('lb4 controller', () => {
assert.fileContent(tmpDir + withInputName, /constructor\(\) {}/);
});
});
describe('without input', () => {
let tmpDir;
before(() => {
return helpers
.run(generator)
.inTmpDir(dir => {
tmpDir = dir;
fs.writeFileSync(
path.join(tmpDir, 'package.json'),
JSON.stringify({
keywords: ['loopback'],
})
);
})
.withPrompts(noInputProps);
});
it('writes correct file name', () => {
assert.file(tmpDir + noInputName);
assert.noFile(tmpDir + templateName);
});
it('scaffolds correct files', () => {
assert.fileContent(tmpDir + noInputName, /class NewController/);
assert.fileContent(tmpDir + noInputName, /constructor\(\) {}/);
});
});
describe('with arg', () => {
let tmpDir;
before(() => {
Expand Down

0 comments on commit cc41fd6

Please sign in to comment.