UNPKG

bricks-cli

Version:

Command line tool for developing ambitious ember.js apps

37 lines (32 loc) 916 B
var Blueprint = require('../../lib/models/blueprint'); var Promise = require('../../lib/ext/promise'); var merge = require('lodash-node/compat/objects/merge'); var inflection = require('inflection'); module.exports = Blueprint.extend({ install: function(options) { var modelOptions = merge({}, options, { entity: { name: inflection.singularize(options.entity.name) } }); var routeOptions = merge({}, options, { entity: { options: { type: 'resource' } } }); return Promise.all([ this._installBlueprint('model', modelOptions), this._installBlueprint('route', routeOptions) ]); }, _installBlueprint: function(name, options) { var blueprint = Blueprint.lookup(name, { ui: this.ui, analytics: this.analytics, project: this.project }); return blueprint.install(options); } });