Skip to content

Commit

Permalink
home, help and common module auto generation implemented and all libr…
Browse files Browse the repository at this point in the history
…aries updated to latest version. Tickets #5, #6 and #17
  • Loading branch information
tapas4java committed Nov 8, 2014
1 parent fc84aaa commit acbacb2
Show file tree
Hide file tree
Showing 49 changed files with 743 additions and 113 deletions.
21 changes: 18 additions & 3 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@ var AppGenerator = module.exports = function AppGenerator(args, options, config)
}
};
this.config.set('inject', inject);
var defaultModules = [
{
"name": "home",
"file": path.join('app/home', 'home.js')
},
{
"name": "help",
"file": path.join('app/help', 'help.js')
},
{
"name": "common",
"file": path.join('app/common', 'common.js')
}
];
this.config.set('modules', defaultModules);
this.config.save();
this.installDependencies({ skipInstall: options['skip-install'] });
});
Expand Down Expand Up @@ -60,12 +75,12 @@ AppGenerator.prototype.askForUiRouter = function askFor() {
name: 'router',
type:'list',
message: 'Which router would you like to use?',
default: 0,
choices: ['Standard Angular Router','Angular UI Router']
default: 1,
choices: ['Standard Angular Router(ngRoute)', 'Angular UI Router(ui.router)']
}];

this.prompt(prompts, function (props) {
if (props.router === 'Angular UI Router') {
if (props.router === 'Angular UI Router(ui.router)') {
this.uirouter = true;
this.routerJs = 'bower_components/angular-ui-router/release/angular-ui-router.js';
this.routerModuleName = 'ui.router';
Expand Down
2 changes: 1 addition & 1 deletion app/templates/skeleton/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ module.exports = function (grunt) {

//if index.html changed, we need to reread the <script> tags so our next run of karma
//will have the correct environment
if (filepath === 'index.html') {//Tapas:Need to check later if got an issue
if (filepath === 'app/index.html') {
tasksToRun.push('dom_munger:read');
}

Expand Down
20 changes: 10 additions & 10 deletions app/templates/skeleton/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#generator-ngappgen
#generator-ng-appgen

>Yeoman Generator for Enterprise Angular Projects
Expand Down Expand Up @@ -71,13 +71,13 @@ Prerequisites: Node, Grunt, Yeoman, and Bower. Once Node is installed, do:

Next, install this generator:

npm install -g generator-ngappgen
npm install -g generator-ng-appgen

To create a project:

mkdir MyApp
cd MyApp
yo ngappgen
yo ng-appgen

Grunt Tasks
-------------
Expand All @@ -104,13 +104,13 @@ There are generators for `directive`, `template`, `service`, `filter`, `module`,

Running a generator:

yo ngappgen:directive my-awesome-directive
yo ngappgen:template my-template
yo ngappgen:service my-service
yo ngappgen:service my-controller
yo ngappgen:filter my-filter
yo ngappgen:module my-module
yo ngappgen:modal my-modal
yo ng-appgen:directive my-awesome-directive
yo ng-appgen:template my-template
yo ng-appgen:service my-service
yo ng-appgen:service my-controller
yo ng-appgen:filter my-filter
yo ng-appgen:module my-module
yo ng-appgen:modal my-modal

The name paramater passed (i.e. 'my-awesome-directive') will be used as the file names. The generators will derive appropriate class names from this parameter (ex. 'my-awesome-directive' will convert to a class name of 'MyAwesomeDirective'). Each sub-generator will ask for the folder in which to create the new skeleton files. You may override the default folder for each sub-generator in the `.yo-rc.json` file.

Expand Down
4 changes: 2 additions & 2 deletions app/templates/skeleton/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

/**
* This is the main application file.
* Generated by ngappgen Yeomen/Angular generator.
* Generated by ng-appgen Yeomen/Angular generator.
*
* @author: Tapas Jena
* @copyright: Anitech Consulting Services Pvt Ltd.
*/
angular.module('<%= _.camelize(appname) %>', ['ui.bootstrap','ui.utils','<%= routerModuleName %>','ngAnimate']);
angular.module('<%= _.camelize(appname) %>', ['ui.bootstrap','ui.utils', '<%= routerModuleName %>', 'ngAnimate', 'restangular', 'angular-loading-bar', 'home', 'help', 'common']);
<% if (!uirouter) { %>
angular.module('<%= _.camelize(appname) %>').config(function($routeProvider) {

Expand Down
16 changes: 4 additions & 12 deletions app/templates/skeleton/app/app.less
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
@import "../bower_components/bootstrap/less/bootstrap.less";
//@import "bower_components/bootstrap/less/theme.less";
@import "../bower_components/bootstrap/less/theme.less";
@import "../bower_components/font-awesome/less/font-awesome.less";
@fa-font-path: "../bower_components/font-awesome/fonts";

/* Component LESS */
@import "home/home.less";
@import "help/help.less";
@import "common/common.less";
/* Add Component LESS Above */

/* Required for Angular UI Bootstrap */
.nav, .pagination, .carousel a { cursor: pointer; }

/* Personal preference for BS modal. The LESS below makes the backdrop white and
causes the modal to fade in rather than slide in. */
//@modal-backdrop-bg: white;
//.modal {
// &.fade {
// .transition(opacity .3s);
// }
// &.fade .modal-dialog {
// .translate(0,0);
// }
//}
Binary file not shown.
26 changes: 26 additions & 0 deletions app/templates/skeleton/app/common/common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
(function(){
'use strict';

/**
* This is a sample module for all application level common tasks
* Generated by ng-appgen Yeomen/Angular generator.
*
* @author: Tapas Jena
* @copyright: Anitech Consulting Services Pvt Ltd.
*/
angular.module('common', ['ui.bootstrap', 'ui.utils', '<%= routerModuleName %>', 'ngAnimate', 'restangular']);
<% if (!uirouter) { %>
angular.module('common').config(function($routeProvider) {

/* Add New Routes Above */

});
<% } %><% if (uirouter) { %>
angular.module('common').config(function($stateProvider) {

/* Add New States Above */

});
<% } %>

})();
3 changes: 3 additions & 0 deletions app/templates/skeleton/app/common/common.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* Component LESS */
/* Add Component LESS Above */

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
(function(){
'use strict';

/**
* This is a sample controller spec
* Generated by ng-appgen Yeomen/Angular generator.
*
* @author: Tapas Jena
* @copyright: Anitech Consulting Services Pvt Ltd.
*/
describe('commonController', function() {

var scope, ctrl;

beforeEach(module('common'));

beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('commonController', {$scope: scope});
}));

it('should ...', inject(function(commonController) {

//TODO: Implement your controller spec logic here
//expect(commonController.doSomething()).toEqual('something');

}));

});

})();
18 changes: 18 additions & 0 deletions app/templates/skeleton/app/common/controllers/common-controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(function(){
'use strict';

/**
* This is a sample controller for application level common tasks
* Generated by ng-appgen Yeomen/Angular generator.
*
* @author: Tapas Jena
* @copyright: Anitech Consulting Services Pvt Ltd.
*/
angular.module('common').controller('commonController', ['$scope', function($scope) {

//TODO: Implement your controller logic here

}]);


})();
24 changes: 24 additions & 0 deletions app/templates/skeleton/app/common/services/common-service-spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(function(){
'use strict';

/**
* This is a sample service spec
* Generated by ng-appgen Yeomen/Angular generator.
*
* @author: Tapas Jena
* @copyright: Anitech Consulting Services Pvt Ltd.
*/
describe('commonService', function() {

beforeEach(module('common'));

it('should ...', inject(function(commonService) {

//TODO: Implement your service spec logic here
//expect(commonService.doSomething()).toEqual('something');

}));

});

})();
18 changes: 18 additions & 0 deletions app/templates/skeleton/app/common/services/common-service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(function(){
'use strict';

/**
* This is a sample service
* Generated by ng-appgen Yeomen/Angular generator.
*
* @author: Tapas Jena
* @copyright: Anitech Consulting Services Pvt Ltd.
*/
angular.module('common').service('commonService', ['$http', '$q', function($http, $q) {

//TODO: Implement your service logic here

}]);


})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
(function(){
'use strict';

/**
* This is a sample controller spec
* Generated by ng-appgen Yeomen/Angular generator.
*
* @author: Tapas Jena
* @copyright: Anitech Consulting Services Pvt Ltd.
*/
describe('helpController', function() {

var scope, ctrl;

beforeEach(module('help'));

beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('helpController', {$scope: scope});
}));

it('should ...', inject(function(helpController) {

//TODO: Implement your controller spec logic here
//expect(helpController.doSomething()).toEqual('something');

}));

});

})();
17 changes: 17 additions & 0 deletions app/templates/skeleton/app/help/controllers/help-controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
(function(){
'use strict';

/**
* This is a sample controller
* Generated by ng-appgen Yeomen/Angular generator.
*
* @author: Tapas Jena
* @copyright: Anitech Consulting Services Pvt Ltd.
*/
angular.module('help').controller('helpController', ['$scope', 'loadContent', function($scope, loadContent) {

$scope.helpContentList = loadContent;

}]);

})();
45 changes: 45 additions & 0 deletions app/templates/skeleton/app/help/help.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
(function(){
'use strict';

/**
* This is a sample module
* Generated by ng-appgen Yeomen/Angular generator.
*
* @author: Tapas Jena
* @copyright: Anitech Consulting Services Pvt Ltd.
*/
angular.module('help', ['ui.bootstrap', 'ui.utils', '<%= routerModuleName %>', 'ngAnimate', 'restangular']);
<% if (!uirouter) { %>
angular.module('help').config(function($routeProvider) {

$routeProvider.when('/help', {
templateUrl: 'help/templates/help-template.html',
controller: 'helpController',
resolve: {
loadContent: function( helpService ){
return helpService.getHelpContent();
}
}
});
/* Add New Routes Above */

});
<% } %><% if (uirouter) { %>
angular.module('help').config(function($stateProvider) {

$stateProvider.state('help-template', {
url: '/help',
templateUrl: 'help/templates/help-template.html',
controller: 'helpController',
resolve: {
loadContent: function( helpService ){
return helpService.getHelpContent();
}
}
});
/* Add New States Above */

});
<% } %>

})();
4 changes: 4 additions & 0 deletions app/templates/skeleton/app/help/help.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* Component LESS */
@import "templates/help-template.less";
/* Add Component LESS Above */

24 changes: 24 additions & 0 deletions app/templates/skeleton/app/help/services/help-service-spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(function(){
'use strict';

/**
* This is a sample service spec
* Generated by ng-appgen Yeomen/Angular generator.
*
* @author: Tapas Jena
* @copyright: Anitech Consulting Services Pvt Ltd.
*/
describe('helpService', function() {

beforeEach(module('help'));

it('should ...', inject(function(helpService) {

//TODO: Implement your service spec logic here
//expect(helpService.doSomething()).toEqual('something');

}));

});

})();
Loading

0 comments on commit acbacb2

Please sign in to comment.