1 | 'use strict';
|
2 |
|
3 | var SilentError = require('silent-error');
|
4 |
|
5 | module.exports = function normalizeEntityName(entityName) {
|
6 |
|
7 | if (!entityName) {
|
8 | throw new SilentError('The `ember generate <entity-name>` command requires an ' +
|
9 | 'entity name to be specified. ' +
|
10 | 'For more details, use `ember help`.');
|
11 | }
|
12 |
|
13 | var trailingSlash = /(\/$|\\$)/;
|
14 | if(trailingSlash.test(entityName)) {
|
15 | throw new SilentError('You specified "' + entityName + '", but you can\'t use a ' +
|
16 | 'trailing slash as an entity name with generators. Please ' +
|
17 | 're-run the command with "' + entityName.replace(trailingSlash, '') + '".');
|
18 | }
|
19 |
|
20 | return entityName;
|
21 | };
|