Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dirs.push( 'app/controllers/' + namespace + '/' );
dirs.push( 'app/views/' + namespace + '/' );
}
dirs.push( view_path );
// start manipulation
lib.init();
// check if dir exists, if not creates it
dirs.forEach( lib.create_dir );
model = lib.valid_model_name( splited_controller );
replace.init({
capital : model,
plural : splited_controller,
singular : inflection.singularize( splited_controller ),
view_path : controller
});
var replace_rules = [
replace.capital,
replace.plural,
replace.singular,
replace.view_path
];
generate_model( args, model, true );
generate_view( args, controller, splited_controller, model, view_path, replace_rules );
lib.create_file_by_template( controller_path, 'controllers/scaffold.js', replace_rules );
generate_route( args, controller, has_namespace, true );
});
}
locals: function(options) {
var resource = options.entity.name || options.args[1];
return {
friendlyTestName: testInfo.name(resource, "Unit", "Initializer"),
dependencyDepth: getDependencyDepth(resource),
entity: stringUtil.dasherize(inflector.singularize(resource)),
resource: stringUtil.dasherize(inflector.pluralize(resource))
};
},
const t = obj.type || obj.Type
if ((t === String || t === Number) ||
(t === 'string' || t === 'number') ||
(Model.isPrototypeOf(t) && t.modelName) ||
(obj.modelName && Model.isPrototypeOf(t)) ||
(obj.modelName && t === Model)) {
const path = getPathFromContext(ctx) || key
let name = obj.indexName
if (!name) {
name = ctx.key || key
const reg = new RegExp('^\\d+$')
if (reg.test(name)) {
name = ctx.path[ctx.path.length - 2]
}
name = inflection.singularize(name)
}
let indexType = obj.indexType ? obj.indexType.toLowerCase() : 'single'
if (indexType !== 'single' && indexType !== 'array') {
indexType = 'single'
}
const indexData = { path, name, indexType }
if (obj.refKeyCase) {
indexData.refKeyCase = obj.refKeyCase.toLowerCase()
}
inds.push(indexData)
}
}
})
function properize(word, options) {
options = _.extend({inflect: false}, options);
if (!/\./.test(word)) {
word = changeCase(word);
if (options.inflect === false) {
return word;
}
return inflection.singularize(word);
}
return word;
}
static name(dat_file) {
return singularize(camelize(dat_file.replace(/\.dat$/, '')));
}
locals: function(options){
var modelName = inflection.camelize(inflection.singularize(options.entity.name), true);
return {
modelName: modelName
};
},
locals(argv: any) {
let name = argv.name;
name = pluralize(name);
let plural = {
name,
camelCased: camelCase(name),
className: upperFirst(camelCase(name)),
dasherized: kebabCase(name),
humanized: lowerCase(name)
};
name = singularize(name);
let singular = {
name,
camelCased: camelCase(name),
className: upperFirst(camelCase(name)),
dasherized: kebabCase(name),
humanized: lowerCase(name)
};
return { plural, singular };
}
function addNamed(gen: Base, file: string): void {
const name = basename(file, extname(file))
gen.addNamedDefaultExport(file, singularize(camelize(name)))
}
parseType(type) {
return singularize(type);
}
locals: function(options) {
var resource = options.entity.name || options.args[1];
var resourceSingular = inflector.singularize(resource);
var resourcePlural = inflector.pluralize(resource);
var relativePath = pathUtil.getRelativeParentPath(resource);
var servicePath = relativePath + [ 'services', resourcePlural ].join('/');
var modelPath = relativePath + [ 'models', resourceSingular ].join('/');
var adapterPath = relativePath + [ 'adapters', resourceSingular ].join('/');
var serializerPath = relativePath + [ 'serializers', resourceSingular ].join('/');
if (options.pod) {
servicePath = relativePath + [ resourceSingular, 'service' ].join('/');
modelPath = relativePath + [ resourceSingular, 'model' ].join('/');
adapterPath = relativePath + [ resourceSingular, 'adapter' ].join('/');
serializerPath = relativePath + [ resourceSingular, 'serializer' ].join('/');
}
return {