diff --git a/generators/app.js b/generators/app.js
index f9c1c30..7ac2878 100644
--- a/generators/app.js
+++ b/generators/app.js
@@ -71,8 +71,6 @@ function replaceAllPlaceholdersWithAppName(appPath, appName, callback) {
function replacePlaceholderWithAppName(filename, appName, callback) {
var underscored = s.underscored(appName);
- var camelCased = s.camelize(underscored);
- var classCased = s.classify(underscored);
var dashed = s.dasherize(underscored);
var contents;
@@ -85,9 +83,7 @@ function replacePlaceholderWithAppName(filename, appName, callback) {
},
function writeFile(next) {
var replacedContent = contents
- .replaceAll('KALE_CAMEL_CASED_NAME', camelCased)
- .replaceAll('KALE_CLASS_CASED_NAME', classCased)
- .replaceAll('KALE_UNDERSCORED_NAME', underscored)
+ .replaceAll('kale_records', underscored)
.replaceAll('KALE_APP_NAME', appName)
.replaceAll('KALE_DASHERIZED_NAME', dashed);
diff --git a/generators/controller.js b/generators/controller.js
index 9666e6e..9d2ab02 100644
--- a/generators/controller.js
+++ b/generators/controller.js
@@ -19,7 +19,7 @@ function _controllerTemplate(className, singular, plural) {
let template = _template('controller.js');
return template
- .replace(/KaleClass/g, className)
+ .replace(/KaleRecord/g, className)
.replace(/kaleRecords/g, plural)
.replace(/kaleRecord/g, singular);
}
diff --git a/generators/model.js b/generators/model.js
index fc7a8a9..700b0e1 100644
--- a/generators/model.js
+++ b/generators/model.js
@@ -32,7 +32,7 @@ function _migrationTemplate(tableName) {
function _modelTemplate(className, tableName) {
return _template('model.js')
- .replace(/KaleClass/g, className)
+ .replace(/KaleRecord/g, className)
.replace(/kale_records/g, tableName);
}
diff --git a/generators/view.js b/generators/view.js
index 80fb8fd..ebb60a7 100644
--- a/generators/view.js
+++ b/generators/view.js
@@ -50,12 +50,12 @@ function replaceContents(filename, names, callback) {
},
function writeFile(next) {
var replacedContent = contents
- .replaceAll('SINGULAR_NAME_CAPITALIZED', names.singular.capitalized)
- .replaceAll('SINGULAR_NAME_LOWERCASE', names.singular.lowercase)
- .replaceAll('PLURAL_NAME_CAPITALIZED', names.plural.capitalized)
- .replaceAll('PLURAL_NAME_LOWERCASE_DASHED', names.plural.lowercaseDashed)
- .replaceAll('PLURAL_NAME_LOWERCASE_CAMELIZED', names.plural.lowercaseCamelized)
- .replaceAll('PLURAL_NAME_LOWERCASE', names.plural.lowercase);
+ .replaceAll('KaleRecord', names.singular.capitalized)
+ .replaceAll('kaleRecord', names.singular.lowercase)
+ .replaceAll('KaleRecords', names.plural.capitalized)
+ .replaceAll('kale-records', names.plural.lowercaseDashed)
+ .replaceAll('kaleRecords', names.plural.lowercaseCamelized)
+ .replaceAll('kaleRecords', names.plural.lowercase);
fs.writeFile(filename, replacedContent, next);
}
@@ -114,7 +114,7 @@ function installJavascript(names, callback) {
function installViews(names, callback) {
var templatePath = path.join(__dirname, '..', 'templates', 'view');
var viewsPath = path.join(templatePath, 'views');
- var outputPath = path.join('.', 'app', 'assets', 'views', `${names.plural.lowercaseDashed}`);
+ var outputPath = path.join('.', 'app', 'assets', 'views', `${names.plural.lowercaseCamelized}`);
async.series([
function copyViews(next) {
diff --git a/templates/app/bin/setup b/templates/app/bin/setup
index e9f3bcc..b0cbaec 100755
--- a/templates/app/bin/setup
+++ b/templates/app/bin/setup
@@ -18,7 +18,7 @@ if [ ! -f .env ]; then
fi
# Create and migrate the database
-createuser -s KALE_UNDERSCORED_NAME
-createdb KALE_UNDERSCORED_NAME_development -U KALE_UNDERSCORED_NAME
+createuser -s kale_records
+createdb kale_records_development -U kale_records
kale migrate
diff --git a/templates/app/config/environments/development.js b/templates/app/config/environments/development.js
index cbff92d..2934fb2 100644
--- a/templates/app/config/environments/development.js
+++ b/templates/app/config/environments/development.js
@@ -4,8 +4,8 @@ module.exports = {
db: {
connection: {
host: '127.0.0.1',
- user: 'KALE_UNDERSCORED_NAME',
- database: 'KALE_UNDERSCORED_NAME_development'
+ user: 'kale_records',
+ database: 'kale_records_development'
},
debug: true
},
diff --git a/templates/controller/controller.js b/templates/controller/controller.js
index c699737..8c0bbd4 100644
--- a/templates/controller/controller.js
+++ b/templates/controller/controller.js
@@ -3,7 +3,7 @@
const _ = require('lodash');
const index = (ctx) => {
- return ctx.models.KaleClass.collection()
+ return ctx.models.KaleRecord.collection()
.query(function(knex) {
knex.limit(50).offset(0).orderBy('created_at', 'asc');
})
@@ -16,7 +16,7 @@ const index = (ctx) => {
};
const show = (ctx) => {
- return _fetchKaleClass(ctx).then((kaleRecord) => {
+ return _fetchKaleRecord(ctx).then((kaleRecord) => {
ctx.body = {
kaleRecord
};
@@ -25,7 +25,7 @@ const show = (ctx) => {
const create = (ctx) => {
let params = _kaleRecordParams(ctx.request.body);
- let kaleRecord = new ctx.models.KaleClass(params);
+ let kaleRecord = new ctx.models.KaleRecord(params);
return kaleRecord.save().then((kaleRecord) => {
ctx.status = 201;
@@ -36,7 +36,7 @@ const create = (ctx) => {
};
const update = (ctx) => {
- return _fetchKaleClass(ctx).then((kaleRecord) => {
+ return _fetchKaleRecord(ctx).then((kaleRecord) => {
let params = _kaleRecordParams(ctx.request.body);
return kaleRecord.save(params, { patch: true });
@@ -49,19 +49,19 @@ const update = (ctx) => {
};
const destroy = (ctx) => {
- return _fetchKaleClass(ctx).then((kaleRecord) => {
+ return _fetchKaleRecord(ctx).then((kaleRecord) => {
return kaleRecord.destroy();
}).then(() => {
ctx.status = 204;
});
};
-function _fetchKaleClass(ctx) {
- return ctx.models.KaleClass.forge({ id: ctx.params.id }).fetch({ require: true });
+function _fetchKaleRecord(ctx) {
+ return ctx.models.KaleRecord.forge({ id: ctx.params.id }).fetch({ require: true });
}
function _kaleRecordParams(body) {
- // TODO: Whitelist params for creating & updating a KaleClass.
+ // TODO: Whitelist params for creating & updating a KaleRecord.
return _.pick(body, '');
}
diff --git a/templates/model/model.js b/templates/model/model.js
index bca8928..cf9ec15 100644
--- a/templates/model/model.js
+++ b/templates/model/model.js
@@ -2,9 +2,9 @@
const bookshelf = require('../../db');
-const KaleClass = bookshelf.Model.extend({
+const KaleRecord = bookshelf.Model.extend({
tableName: 'kale_records',
hasTimestamps: true
});
-module.exports = bookshelf.model('KaleClass', KaleClass);
+module.exports = bookshelf.model('KaleRecord', KaleRecord);
diff --git a/templates/view/javascripts/controller.js b/templates/view/javascripts/controller.js
index dadbf12..0432858 100644
--- a/templates/view/javascripts/controller.js
+++ b/templates/view/javascripts/controller.js
@@ -1,6 +1,6 @@
'use strict';
-require('./PLURAL_NAME_LOWERCASE_CAMELIZED/edit');
-require('./PLURAL_NAME_LOWERCASE_CAMELIZED/index');
-require('./PLURAL_NAME_LOWERCASE_CAMELIZED/new');
-require('./PLURAL_NAME_LOWERCASE_CAMELIZED/show');
+require('./kaleRecords/edit');
+require('./kaleRecords/index');
+require('./kaleRecords/new');
+require('./kaleRecords/show');
diff --git a/templates/view/javascripts/controller/edit.js b/templates/view/javascripts/controller/edit.js
index 102e815..e9cbf6b 100644
--- a/templates/view/javascripts/controller/edit.js
+++ b/templates/view/javascripts/controller/edit.js
@@ -1,13 +1,13 @@
'use strict';
angular.module('app.controllers')
- .controller('PLURAL_NAME_CAPITALIZEDEditController', ['$scope', '$state', 'SINGULAR_NAME_CAPITALIZED', 'SINGULAR_NAME_LOWERCASE',
- function($scope, $state, SINGULAR_NAME_CAPITALIZED, SINGULAR_NAME_LOWERCASE) {
- $scope.SINGULAR_NAME_LOWERCASE = SINGULAR_NAME_LOWERCASE;
+ .controller('KaleRecordsEditController', ['$scope', '$state', 'KaleRecord', 'kaleRecord',
+ function($scope, $state, KaleRecord, kaleRecord) {
+ $scope.kaleRecord = kaleRecord;
$scope.update = function() {
- new SINGULAR_NAME_CAPITALIZED($scope.SINGULAR_NAME_LOWERCASE).$update(function() {
- $state.go('PLURAL_NAME_LOWERCASE.index');
+ new KaleRecord($scope.kaleRecord).$update(function() {
+ $state.go('kaleRecords.index');
});
};
}
diff --git a/templates/view/javascripts/controller/index.js b/templates/view/javascripts/controller/index.js
index 79249e3..5af6123 100644
--- a/templates/view/javascripts/controller/index.js
+++ b/templates/view/javascripts/controller/index.js
@@ -1,12 +1,12 @@
'use strict';
angular.module('app.controllers')
- .controller('PLURAL_NAME_CAPITALIZEDIndexController', ['$scope', '$state', 'SINGULAR_NAME_CAPITALIZED', 'PLURAL_NAME_LOWERCASE',
- function($scope, $state, SINGULAR_NAME_CAPITALIZED, PLURAL_NAME_LOWERCASE) {
- $scope.PLURAL_NAME_LOWERCASE = PLURAL_NAME_LOWERCASE;
+ .controller('KaleRecordsIndexController', ['$scope', '$state', 'KaleRecord', 'kaleRecords',
+ function($scope, $state, KaleRecord, kaleRecords) {
+ $scope.kaleRecords = kaleRecords;
- $scope.destroy = function(SINGULAR_NAME_LOWERCASE) {
- SINGULAR_NAME_CAPITALIZED.delete({ id: SINGULAR_NAME_LOWERCASE.id }, function() {
+ $scope.destroy = function(kaleRecord) {
+ KaleRecord.delete({ id: kaleRecord.id }, function() {
$state.go($state.current, {}, { reload: true });
});
};
diff --git a/templates/view/javascripts/controller/new.js b/templates/view/javascripts/controller/new.js
index cdc0658..1f7f949 100644
--- a/templates/view/javascripts/controller/new.js
+++ b/templates/view/javascripts/controller/new.js
@@ -1,13 +1,13 @@
'use strict';
angular.module('app.controllers')
- .controller('PLURAL_NAME_CAPITALIZEDNewController', ['$scope', '$state', '$stateParams', 'SINGULAR_NAME_CAPITALIZED',
- function($scope, $state, $stateParams, SINGULAR_NAME_CAPITALIZED) {
- $scope.SINGULAR_NAME_LOWERCASE = new SINGULAR_NAME_CAPITALIZED();
+ .controller('KaleRecordsNewController', ['$scope', '$state', '$stateParams', 'KaleRecord',
+ function($scope, $state, $stateParams, KaleRecord) {
+ $scope.kaleRecord = new KaleRecord();
$scope.create = function() {
- $scope.SINGULAR_NAME_LOWERCASE.$save(function() {
- $state.go('PLURAL_NAME_LOWERCASE.index');
+ $scope.kaleRecord.$save(function() {
+ $state.go('kaleRecords.index');
});
};
}
diff --git a/templates/view/javascripts/controller/show.js b/templates/view/javascripts/controller/show.js
index 89a3bb9..d9d210b 100644
--- a/templates/view/javascripts/controller/show.js
+++ b/templates/view/javascripts/controller/show.js
@@ -1,8 +1,8 @@
'use strict';
angular.module('app.controllers')
- .controller('PLURAL_NAME_CAPITALIZEDShowController', ['$scope', 'SINGULAR_NAME_LOWERCASE',
- function($scope, SINGULAR_NAME_LOWERCASE) {
- $scope.SINGULAR_NAME_LOWERCASE = SINGULAR_NAME_LOWERCASE;
+ .controller('KaleRecordsShowController', ['$scope', 'kaleRecord',
+ function($scope, kaleRecord) {
+ $scope.kaleRecord = kaleRecord;
}
]);
diff --git a/templates/view/javascripts/routes.js b/templates/view/javascripts/routes.js
index c0f3547..7f16207 100644
--- a/templates/view/javascripts/routes.js
+++ b/templates/view/javascripts/routes.js
@@ -4,20 +4,20 @@ angular.module('app')
.config([ '$stateProvider',
function($stateProvider) {
$stateProvider
- .state('PLURAL_NAME_LOWERCASE_DASHED', {
+ .state('kaleRecords', {
abstract: true,
templateUrl: '/assets/views/layouts/application.html'
})
- .state('PLURAL_NAME_LOWERCASE_DASHED.index', {
- url: '/PLURAL_NAME_LOWERCASE_DASHED',
- templateUrl: '/assets/views/PLURAL_NAME_LOWERCASE_DASHED/index.html',
- controller: 'PLURAL_NAME_CAPITALIZEDIndexController',
+ .state('kaleRecords.index', {
+ url: '/kale-records',
+ templateUrl: '/assets/views/kaleRecords/index.html',
+ controller: 'KaleRecordsIndexController',
resolve: {
- PLURAL_NAME_LOWERCASE: ['$q', 'SINGULAR_NAME_CAPITALIZED', function($q, SINGULAR_NAME_CAPITALIZED) {
+ kaleRecords: ['$q', 'KaleRecord', function($q, KaleRecord) {
var deferred = $q.defer();
- SINGULAR_NAME_CAPITALIZED.get(function(body) {
- deferred.resolve(body.PLURAL_NAME_LOWERCASE);
+ KaleRecord.get(function(body) {
+ deferred.resolve(body.kaleRecords);
}, function() {
deferred.resolve([]);
});
@@ -26,25 +26,25 @@ angular.module('app')
}]
}
})
- .state('PLURAL_NAME_LOWERCASE_DASHED.new', {
- url: '/PLURAL_NAME_LOWERCASE_DASHED/new',
- templateUrl: '/assets/views/PLURAL_NAME_LOWERCASE_DASHED/new.html',
- controller: 'PLURAL_NAME_CAPITALIZEDNewController'
+ .state('kaleRecords.new', {
+ url: '/kale-records/new',
+ templateUrl: '/assets/views/kaleRecords/new.html',
+ controller: 'KaleRecordsNewController'
})
- .state('PLURAL_NAME_LOWERCASE_DASHED.show', {
- url: '/PLURAL_NAME_LOWERCASE_DASHED/:id',
- templateUrl: '/assets/views/PLURAL_NAME_LOWERCASE_DASHED/show.html',
- controller: 'PLURAL_NAME_CAPITALIZEDShowController',
+ .state('kaleRecords.show', {
+ url: '/kale-records/:id',
+ templateUrl: '/assets/views/kaleRecords/show.html',
+ controller: 'KaleRecordsShowController',
resolve: {
- SINGULAR_NAME_LOWERCASE: ['$q', '$state', '$stateParams', 'SINGULAR_NAME_CAPITALIZED',
- function($q, $state, $stateParams, SINGULAR_NAME_CAPITALIZED) {
+ kaleRecord: ['$q', '$state', '$stateParams', 'KaleRecord',
+ function($q, $state, $stateParams, KaleRecord) {
var deferred = $q.defer();
- SINGULAR_NAME_CAPITALIZED.get({ id: $stateParams.id }, function(body) {
- deferred.resolve(body.SINGULAR_NAME_LOWERCASE);
+ KaleRecord.get({ id: $stateParams.id }, function(body) {
+ deferred.resolve(body.kaleRecord);
}, function() {
deferred.reject();
- $state.go('PLURAL_NAME_LOWERCASE');
+ $state.go('kaleRecords');
});
return deferred.promise;
@@ -52,20 +52,20 @@ angular.module('app')
]
}
})
- .state('PLURAL_NAME_LOWERCASE_DASHED.edit', {
- url: '/PLURAL_NAME_LOWERCASE_DASHED/:id/edit',
- templateUrl: '/assets/views/PLURAL_NAME_LOWERCASE_DASHED/edit.html',
- controller: 'PLURAL_NAME_CAPITALIZEDEditController',
+ .state('kaleRecords.edit', {
+ url: '/kale-records/:id/edit',
+ templateUrl: '/assets/views/kaleRecords/edit.html',
+ controller: 'KaleRecordsEditController',
resolve: {
- SINGULAR_NAME_LOWERCASE: ['$q', '$state', '$stateParams', 'SINGULAR_NAME_CAPITALIZED',
- function($q, $state, $stateParams, SINGULAR_NAME_CAPITALIZED) {
+ kaleRecord: ['$q', '$state', '$stateParams', 'KaleRecord',
+ function($q, $state, $stateParams, KaleRecord) {
var deferred = $q.defer();
- SINGULAR_NAME_CAPITALIZED.get({ id: $stateParams.id }, function(body) {
- deferred.resolve(body.SINGULAR_NAME_LOWERCASE);
+ KaleRecord.get({ id: $stateParams.id }, function(body) {
+ deferred.resolve(body.kaleRecord);
}, function() {
deferred.reject();
- $state.go('PLURAL_NAME_LOWERCASE');
+ $state.go('kaleRecords');
});
return deferred.promise;
diff --git a/templates/view/javascripts/service.js b/templates/view/javascripts/service.js
index 75d30de..6cd780a 100644
--- a/templates/view/javascripts/service.js
+++ b/templates/view/javascripts/service.js
@@ -1,8 +1,8 @@
'use strict';
angular.module('app.services')
- .factory('SINGULAR_NAME_CAPITALIZED', ['$resource', function($resource) {
- return $resource('/api/v1/PLURAL_NAME_LOWERCASE_DASHED/:id', { id: '@id' }, {
+ .factory('KaleRecord', ['$resource', function($resource) {
+ return $resource('/api/v1/kale-records/:id', { id: '@id' }, {
update: {
method: 'PUT'
}
diff --git a/templates/view/views/_form.html b/templates/view/views/_form.html
index 5d3ad41..c8ab160 100644
--- a/templates/view/views/_form.html
+++ b/templates/view/views/_form.html
@@ -1,7 +1,7 @@
diff --git a/templates/view/views/edit.html b/templates/view/views/edit.html
index 994b128..a503026 100644
--- a/templates/view/views/edit.html
+++ b/templates/view/views/edit.html
@@ -1,3 +1,3 @@
diff --git a/templates/view/views/index.html b/templates/view/views/index.html
index 4755d45..ac4bd3f 100644
--- a/templates/view/views/index.html
+++ b/templates/view/views/index.html
@@ -1,14 +1,14 @@
-PLURAL_NAME_CAPITALIZED
+KaleRecords
-New SINGULAR_NAME_CAPITALIZED
+New KaleRecord
diff --git a/templates/view/views/new.html b/templates/view/views/new.html
index ccc5abe..33a652a 100644
--- a/templates/view/views/new.html
+++ b/templates/view/views/new.html
@@ -1,3 +1,3 @@
diff --git a/templates/view/views/show.html b/templates/view/views/show.html
index d867fd4..1c35604 100644
--- a/templates/view/views/show.html
+++ b/templates/view/views/show.html
@@ -1,10 +1,10 @@
-{{ SINGULAR_NAME_LOWERCASE.email }}
+{{ kaleRecord.email }}
ID |
- {{ SINGULAR_NAME_LOWERCASE.id }} |
+ {{ kaleRecord.id }} |
-Edit
+Edit