├── .editorconfig ├── .gitattributes ├── .gitignore ├── .jshintrc ├── .travis.yml ├── LISENCE.txt ├── README.md ├── angm-directive ├── index.js └── templates │ ├── _controller.js │ ├── _directive.js │ ├── _template.html │ └── _test.js ├── angm-module ├── index.js └── templates │ ├── _app.js │ ├── _controller.js │ ├── _karma.conf.js │ ├── _module.js │ ├── _navService.js │ ├── _route.js │ ├── _service.js │ ├── _template-material.html │ ├── _template.html │ └── _test.js ├── app ├── index.js └── templates │ ├── LICENSE.md │ ├── README.md │ ├── _Gruntfile.js │ ├── _bower.json │ ├── _index-material.html │ ├── _index.html │ ├── _package.json │ ├── app │ ├── _app.config.js │ ├── app.js │ └── modules │ │ ├── home │ │ ├── _home-test.js │ │ ├── dashboard.html │ │ ├── home-material.html │ │ ├── home.html │ │ ├── homeCtrl.js │ │ ├── homeModule.js │ │ ├── homeRoute.js │ │ └── homeService.js │ │ └── layouts │ │ ├── main-page │ │ ├── main-page.html │ │ ├── main-pageRoute.js │ │ └── mainPageCtrl.js │ │ ├── nav-bar │ │ ├── navBarCtrl.js │ │ ├── navbar-tpl.html │ │ ├── navbar.html │ │ ├── navbarDirective.js │ │ └── navbarService.js │ │ └── side-nav │ │ ├── sidenav.html │ │ ├── sidenavCtrl.js │ │ └── sidenavService.js │ ├── bowerrc │ ├── editorconfig │ ├── jshintrc │ └── karma.conf.js ├── generator-angm.png ├── index.html ├── package.json └── test └── test-app.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = tab 6 | indent_size = 4 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .idea/ 3 | 4 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "esnext": true, 4 | "bitwise": true, 5 | "camelcase": true, 6 | "curly": true, 7 | "eqeqeq": true, 8 | "immed": true, 9 | "indent": 2, 10 | "latedef": true, 11 | "newcap": true, 12 | "noarg": true, 13 | "quotmark": "single", 14 | "undef": true, 15 | "unused": true, 16 | "strict": false 17 | } 18 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '0.10' 4 | before_install: 5 | - currentfolder=${PWD##*/} 6 | - if [ "$currentfolder" != 'generator-angm' ]; then cd .. && eval "mv $currentfolder generator-angm" && cd generator-angm; fi 7 | -------------------------------------------------------------------------------- /LISENCE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 fernando monteiro 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Generator-angm [![NPM Downloads](http://img.shields.io/npm/dm/generator-angm.svg)](https://www.npmjs.org/package/generator-angm) [![npm version](https://badge.fury.io/js/generator-angm.svg)](http://badge.fury.io/js/generator-angm) 2 | 3 | ![AngularJS Modular Generator](./generator-angm.png) 4 | 5 | # AngularJS Yeoman Generator to help you getting started with a new project based on AngularJS/Angular Material or Bootstrap to build large scale applications. # 6 | 7 | > [Modular AngularJS Applications](http://www.newaeonweb.com.br/generator-angm) with Generator-angm 8 | 9 | # Disclaimer 10 | The main reason for creating this project, and do not use any other, was the need to optimize the creation time of each application from scratch. 11 | It was built using the best practices of development with AngularJS and uses the latest stable version (1.5.0.). 12 | The project does not intend to migrate to the new version(2.0) in a short time, we have in mind that this version is very stable and meets most web projects, so when version 2.0 is reasonably stable we do the migration. 13 | 14 | ## Getting Started 15 | 16 | #### Installing Yeoman 17 | Open your Terminal/Shell and type: 18 | 19 | ```bash 20 | npm install -g yo 21 | ``` 22 | 23 | #### Installing the ANGM Generator 24 | 25 | To install generator-angm from npm, run: 26 | 27 | ```bash 28 | npm install -g generator-angm 29 | ``` 30 | 31 | #### Installing Grunt CLI 32 | 33 | To run Grunt commands from our terminal, we'll need grunt-cli: 34 | 35 | ```bash 36 | npm install -g grunt-cli 37 | ``` 38 | 39 | #### Installing bower-installer 40 | 41 | ```bash 42 | npm install -g bower-installer 43 | ``` 44 | > The building process will use bower-installer plugin. 45 | 46 | 47 | #### Starting an application 48 | 49 | From the command line, initiate the generator: 50 | 51 | ```bash 52 | yo angm 53 | ``` 54 | 55 | > You'll receive some prompts to fill with useful informations as Project name, author, what UI: Bootstrap or Angular Material. 56 | 57 | ## Running project on development 58 | Open your Terminal/Shell and type: 59 | 60 | ```bash 61 | grunt dev 62 | ``` 63 | 64 | After the command your application should start right in your default browser at `localhost:4000`. 65 | 66 | > NOTE: after using **yo angm** command, we recorded some useful informations on **.yo-rc.json** file created at the project root folder. So you can't execute the generator command to create the application more than one time per folder! 67 | 68 | ## Running project on production 69 | Open your Terminal/Shell and type: 70 | 71 | ```bash 72 | grunt build 73 | ``` 74 | 75 | The `Gruntfile.js` already have some tasks like: Concat, Uglify, Injector and template cache. 76 | 77 | > NOTE: The command will concat and minify all (JS) application files and the HTML templates will be mixed in on file called `templates.js`, all this files will be injected on **index.html**. 78 | 79 | # Built in SubGenerators 80 | Generator-angm have a subgenerator to create your application modules and directives. 81 | 82 | 1. Modules 83 | 2. Directives 84 | 85 | ## Modules 86 | To create a module just type on your Terminal/Shell: 87 | 88 | ``` 89 | yo angm:angm-module 90 | ``` 91 | 92 | After that, you must entry the module name and choose what files you want to include. 93 | 94 | The subgenerator will produce the following directory structure: 95 | 96 | ``` 97 | moduleName/ 98 | moduleName.html 99 | moduleNameModule.js 100 | moduleNameCtrl.js 101 | moduleNameRoute.js 102 | moduleNameService.js 103 | moduleName-test.js 104 | ``` 105 | 106 | **Note: Subgenerators are to be run from the root directory of your application.** 107 | 108 | ## Directives 109 | To create a directive just type on your terminal window: 110 | 111 | ``` 112 | yo angm:angm-directive 113 | ``` 114 | 115 | After that you must entry the directive name and choose what dependencies you want, by default we using external templates and external controllers. 116 | 117 | The subgenerator will produce the following directory structure: 118 | 119 | ``` 120 | shared/ 121 | directives/ 122 | directiveName/ 123 | assets/ /* optional folder 124 | directiveName.html 125 | directiveNameCtrl.j 126 | directiveName-test.js 127 | ``` 128 | 129 | # Application files: 130 | ## View (Html Template) 131 | File: `app/modules/moduleName/moduleName.html`. 132 | 133 | Code: 134 | ```html 135 |
136 | Content from: "Page = moduleName" 137 |
138 | ``` 139 | --- 140 | ## Controller 141 | 142 | File: `app/modules/moduleName/moduleNameCtrl.js`. 143 | 144 | Code: 145 | ```javascript 146 | 'use strict'; 147 | 148 | /** 149 | * @ngdoc function 150 | * @name appName.controller:moduleNameCtrl 151 | * @description 152 | * # moduleNameCtrl 153 | * Controller of the appName 154 | */ 155 | angular.module('appName') 156 | .controller('ModuleNameCtrl', ModuleNameCtrl); 157 | 158 | ModuleNameCtrl.$inject = ['Array of Dependencies optional']; 159 | 160 | function ModuleNameCtrl ('Array of Dependencies is the same above') { 161 | 162 | } 163 | 164 | ``` 165 | --- 166 | 167 | ## Route 168 | 169 | File: `app/modules/moduleName/moduleNameRoute.js`. 170 | 171 | Code: 172 | ```javascript 173 | 'use strict'; 174 | 175 | /** 176 | * @ngdoc function 177 | * @name appName.route:moduleNameRoute 178 | * @description 179 | * # moduleNameRoute 180 | * Route of the appName 181 | */ 182 | angular.module('appName') 183 | .config(function ($stateProvider) { 184 | $stateProvider 185 | .state('moduleName', { 186 | url: '/moduleName', 187 | templateUrl: 'appName/modules/moduleName/moduleName.html', 188 | controller: 'moduleNameCtrl', 189 | controllerAs: 'vm' 190 | }); 191 | }); 192 | ``` 193 | --- 194 | 195 | ## Module 196 | 197 | File: `app/modules/moduleName/moduleNameModule.js`. 198 | 199 | Code: 200 | ```javascript 201 | 'use strict'; 202 | 203 | /** 204 | * @ngdoc function 205 | * @name appName.route:moduleNameModule 206 | * @description 207 | * # moduleNameModule 208 | * Route of the appName 209 | */ 210 | 211 | (function() { 212 | 'use strict'; 213 | 214 | angular.module('moduleName', []); 215 | 216 | })(); 217 | ``` 218 | --- 219 | 220 | ## App starter script 221 | 222 | File: `app/app.js`. 223 | 224 | Code: 225 | ```javascript 226 | (function() { 227 | 'use strict'; 228 | 229 | /** 230 | * @ngdoc index 231 | * @name app 232 | * @description 233 | * # app 234 | * 235 | * Main module of the application. 236 | */ 237 | 238 | angular.module('Application name', [ 239 | 'ngResource', 240 | 'ngAria', 241 | 'ngMaterial', 242 | 'ngMdIcons', 243 | 'ngCookies', 244 | 'ngAnimate', 245 | 'ngSanitize', 246 | 'ui.router', 247 | 'home', 248 | ]); 249 | 250 | })(); 251 | 252 | ``` 253 | --- 254 | 255 | ## App config script 256 | 257 | File: `app/app-config.js`. 258 | 259 | Code: 260 | ```javascript 261 | ((function () { 262 | 'use strict'; 263 | 264 | /** 265 | * @ngdoc configuration file 266 | * @name app.config:config 267 | * @description 268 | * # Config and run block 269 | * Configutation of the app 270 | */ 271 | 272 | 273 | angular 274 | .module('ang-modular') 275 | .config(configure) 276 | .run(runBlock); 277 | 278 | configure.$inject = ['$stateProvider', '$urlRouterProvider', '$locationProvider', '$httpProvider']; 279 | 280 | function configure($stateProvider, $urlRouterProvider, $locationProvider, $httpProvider) { 281 | 282 | $locationProvider.hashPrefix('!'); 283 | 284 | // This is required for Browser Sync to work poperly 285 | $httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 286 | 287 | 288 | $urlRouterProvider 289 | .otherwise('/dashboard'); 290 | 291 | } 292 | 293 | runBlock.$inject = ['$rootScope']; 294 | 295 | function runBlock($rootScope) { 296 | 'use strict'; 297 | 298 | console.log('AngularJS run() function...'); 299 | } 300 | })(); 301 | ``` 302 | --- 303 | 304 | # Gruntfile tasks 305 | By default, new scripts are added to the `index.html` file. Using Grunt-injector, but only on setup configuration, after that you must run `grunt injector` or `grunt dev` every time you add a new module, directive or script. 306 | 307 | 308 | # Bower Components 309 | 310 | The following packages are always installed by the angm-generator: 311 | 312 | * "json3" 313 | * "es5-shim" 314 | * "bootstrap" 315 | * "angular" 316 | * "angular-resource" 317 | * "angular-aria" 318 | * "angular-mocks" 319 | * "angular-touch" 320 | * "angular-bootstrap" 321 | * "angular-ui-router" 322 | 323 | > NOTE: Angular Material have the following dependencies: 324 | * angular-material-icons 325 | * angular-material 326 | * angular-messages 327 | 328 | 329 | The following modules are optional on first install: 330 | 331 | * "angular-cookies" 332 | * "angular-animate" 333 | * "angular-sanitize" 334 | 335 | All of these can be updated with `bower update` as new versions of AngularJS are released. Always on first install the generator will use the last stable version of all libraries. 336 | 337 | 338 | # Testing 339 | 340 | We implemented only one kind of test at this moment: Unit tests. On next weeks e2e tests will be available too. 341 | 342 | ## Running Tests 343 | 344 | The tests are written in **Jasmine**, which we run with the [Karma Test Runner][karma]. We provide a Karma configuration file pre-configured with some default options to run them. 345 | 346 | * the configuration is found at `karma.conf.js` 347 | * the unit tests are found on each module created named as `moduleName-test.js`. 348 | 349 | The easiest way to run the unit tests is to use the supplied npm script on `package.json` file: 350 | 351 | ``` 352 | npm test 353 | ``` 354 | 355 | This script will start the Karma test runner to execute the unit tests. 356 | 357 | 358 | # Contribute 359 | 360 | To submitting an issue, please check if pass on travis. 361 | To submitting a bugfix, write a test that exposes the bug and fails before applying your fix. 362 | To submitting a new feature, add tests that cover the feature. 363 | 364 | 365 | ## License 366 | 367 | MIT 368 | -------------------------------------------------------------------------------- /angm-directive/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var util = require('util'); 3 | var chalk = require('chalk'); 4 | var generators = require('yeoman-generator'); 5 | var yosay = require('yosay'); 6 | var slugify = require("underscore.string/slugify"); 7 | var s = require('underscore.string'); 8 | var _ = require('underscore'); 9 | _.mixin(require('underscore.inflections')); 10 | var mkdirp = require('mkdirp'); 11 | 12 | 13 | var ModuleGenerator = generators.Base.extend({ 14 | init: function () { 15 | 16 | // Greetings to the user. 17 | this.log(yosay( 18 | 'Ohhh ' + chalk.cyan('Let\`s create a new directive') + ' now!' 19 | )); 20 | 21 | this.slugifiedName = slugify(this.name); 22 | 23 | // Get app name from config. 24 | this.nameApp = this.config.get('appName'); 25 | 26 | // Get app options from config 27 | this.angularCookies = this.config.get('angularCookies'); 28 | this.angularAnimate = this.config.get('angularAnimate'); 29 | this.angularTouch = this.config.get('angularTouch'); 30 | this.angularSanitize = this.config.get('angularSanitize'); 31 | 32 | console.log(chalk.white('Attention', chalk.underline.bgRed('name your directives with camelCase.') + '!')); 33 | 34 | }, 35 | 36 | askForDirectiveName: function () { 37 | var done = this.async(); 38 | 39 | var prompts = [{ 40 | name: 'moduleName', 41 | message: 'What would you like to call the Directive?', 42 | default: 'Directive name must be here' 43 | }]; 44 | 45 | this.prompt(prompts, function (props) { 46 | this.moduleName = props.moduleName; 47 | 48 | this.slugifiedName = slugify(this.moduleName); 49 | 50 | this.slugifiedNameCapitalize = _.camelize(this.moduleName); 51 | 52 | this.slugifiedNameCamelize = s.decapitalize(this.moduleName); 53 | 54 | // Get Directives from user config 55 | this.modules = this.config.get('directives'); 56 | 57 | if (!this.modules) { 58 | this.modules = []; 59 | } 60 | 61 | for (var i = 0; i < this.modules.length; i++) { 62 | 63 | this.listModules = this.modules[i].name; 64 | 65 | if (this.slugifiedName === this.listModules) { 66 | 67 | return this.log.writeln(chalk.red(' Directive name already exists')); 68 | 69 | } 70 | } 71 | ; 72 | 73 | this.modules.push({name: this.slugifiedName}); 74 | 75 | this.config.set('directives', this.modules); 76 | 77 | done(); 78 | }.bind(this)); 79 | }, 80 | 81 | askForDirectiveFolder: function () { 82 | var done = this.async(); 83 | 84 | var prompts = [{ 85 | type: 'checkbox', 86 | name: 'folders', 87 | message: 'Which files would you like your Directive to include?', 88 | choices: [{ 89 | value: 'addControllerFile', 90 | name: 'External Controller', 91 | checked: true 92 | }, { 93 | value: 'addTemplateFile', 94 | name: 'External Template', 95 | checked: true 96 | }, { 97 | value: 'addAssetsFolder', 98 | name: 'Assets folder', 99 | checked: true 100 | }] 101 | }]; 102 | 103 | this.prompt(prompts, function (props) { 104 | this.addControllerFile = _.contains(props.folders, 'addControllerFile'); 105 | this.addTemplateFile = _.contains(props.folders, 'addTemplateFile'); 106 | this.addAssetsFolder = _.contains(props.folders, 'addAssetsFolder'); 107 | 108 | done(); 109 | }.bind(this)); 110 | }, 111 | 112 | renderModule: function () { 113 | // Create Directive folder 114 | mkdirp('app/modules/shared/directives/'); 115 | 116 | // Render Directive definition 117 | if (this.addControllerFile) { 118 | this.template('_controller.js', 'app/modules/shared/directives/' + this.slugifiedName + '/' + this.slugifiedName + 'Ctrl.js'); 119 | } 120 | if (this.addTemplateFile) { 121 | this.template('_template.html', 'app/modules/shared/directives/' + this.slugifiedName + '/' + this.slugifiedName + '.html'); 122 | } 123 | if (this.addAssetsFolder) { 124 | mkdirp('app/modules/shared/directives/' + this.slugifiedName + '/' + 'assets'); 125 | } 126 | 127 | 128 | this.template('_test.js', 'app/modules/shared/directives/' + this.slugifiedName + '/' + this.slugifiedName + '-test.js'); 129 | 130 | this.template('_directive.js', 'app/modules/shared/directives/' + this.slugifiedName + '/' + this.slugifiedName + 'Directive.js'); 131 | 132 | } 133 | // updateAppFile: function() { 134 | // this.nameApp = this.config.get('appName'); 135 | // 136 | // this.arrayModules = this.config.get('modules'); 137 | // 138 | // this.template('_app.js','app/app.js'); 139 | // 140 | // } 141 | }); 142 | 143 | module.exports = ModuleGenerator; 144 | -------------------------------------------------------------------------------- /angm-directive/templates/_controller.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc function 6 | * @name app.controller:<%= slugifiedName %>Ctrl 7 | * @description 8 | * # <%= slugifiedName %>Ctrl 9 | * Controller of the app 10 | */ 11 | 12 | angular 13 | .module('<%= nameApp %>') 14 | .controller('<%= slugifiedNameCapitalize %>Ctrl', <%= slugifiedNameCapitalize %> ); 15 | 16 | <%= slugifiedNameCapitalize %>.$inject = []; 17 | 18 | /* 19 | * recommend 20 | * Using function declarations 21 | * and bindable members up top. 22 | */ 23 | 24 | function <%= slugifiedNameCapitalize %>() { 25 | /*jshint validthis: true */ 26 | var vm = this; 27 | 28 | } 29 | 30 | })(); 31 | -------------------------------------------------------------------------------- /angm-directive/templates/_directive.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc function 6 | * @name app.controller:<%= slugifiedName %>Directive 7 | * @description 8 | * # <%= slugifiedName %>Directive 9 | * Directive of the app 10 | */ 11 | 12 | angular 13 | .module('<%= nameApp %>') 14 | .directive('<%= slugifiedNameCamelize %>', <%= slugifiedNameCamelize %>); 15 | 16 | function <%= slugifiedNameCamelize %> () { 17 | 18 | var directive = { 19 | link: link, 20 | restrict: 'EA', 21 | controller: '<% if (addControllerFile) { %><%= slugifiedNameCapitalize %>Ctrl<% } %>', 22 | <% if (addTemplateFile) { %> 23 | templateUrl:'app/modules/shared/directives/<%= slugifiedName %>/<%= slugifiedName %>.html', 24 | <% } else { %> 25 | template: '' 26 | <% } %> 27 | } 28 | 29 | return directive; 30 | 31 | function link(scope, element, attrs) { 32 | // write your code here 33 | } 34 | 35 | } 36 | 37 | })(); 38 | -------------------------------------------------------------------------------- /angm-directive/templates/_template.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /angm-directive/templates/_test.js: -------------------------------------------------------------------------------- 1 | // Write your tests here 2 | -------------------------------------------------------------------------------- /angm-module/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var util = require('util'); 3 | var chalk = require('chalk'); 4 | var generators = require('yeoman-generator'); 5 | var yosay = require('yosay'); 6 | var slugify = require("underscore.string/slugify"); 7 | var _ = require('underscore'); 8 | _.mixin(require('underscore.inflections')); 9 | var mkdirp = require('mkdirp'); 10 | 11 | 12 | var ModuleGenerator = generators.Base.extend({ 13 | init: function () { 14 | 15 | // Greetings to the user. 16 | this.log(yosay( 17 | 'Ohhh ' + chalk.yellow('Let\`s create a new module') + ' now!' 18 | )); 19 | 20 | this.slugifiedName = slugify(this.name); 21 | 22 | // Get app name from config. 23 | this.nameApp = this.config.get('appName'); 24 | 25 | // Get app options from config 26 | this.angularCookies = this.config.get('angularCookies'); 27 | this.angularAnimate = this.config.get('angularAnimate'); 28 | this.angularTouch = this.config.get('angularTouch'); 29 | this.angularSanitize = this.config.get('angularSanitize'); 30 | 31 | }, 32 | 33 | askForModuleNames: function () { 34 | var done = this.async(); 35 | 36 | var prompts = [{ 37 | name: 'moduleName', 38 | message: 'What would you like to call the module?', 39 | default: 'module name must be here' 40 | }]; 41 | 42 | this.prompt(prompts, function (props) { 43 | this.moduleName = props.moduleName; 44 | 45 | this.slugifiedName = slugify(this.moduleName); 46 | this.slugifiedNameCapitalize = _.camelize(this.slugifiedName); 47 | 48 | this.modules = this.config.get('modules'); 49 | 50 | if (!this.modules) { 51 | this.modules = []; 52 | } 53 | 54 | for (var i = 0; i < this.modules.length; i++) { 55 | 56 | this.listModules = this.modules[i].name; 57 | 58 | console.log(this.listModules); 59 | 60 | if (this.slugifiedName === this.listModules) { 61 | 62 | return this.log.writeln(chalk.red(' Module name already exists')); 63 | 64 | } 65 | } 66 | 67 | this.modules.push({name: this.slugifiedName}); 68 | 69 | this.config.set('modules', this.modules); 70 | 71 | done(); 72 | }.bind(this)); 73 | }, 74 | 75 | askForModuleFolders: function () { 76 | var done = this.async(); 77 | 78 | var prompts = [{ 79 | type: 'checkbox', 80 | name: 'folders', 81 | message: 'Which files would you like your module to include?', 82 | choices: [{ 83 | value: 'addControllerFile', 84 | name: 'Controller', 85 | checked: true 86 | }, { 87 | value: 'addRouteFile', 88 | name: 'Route', 89 | checked: true 90 | }, { 91 | value: 'addTplFile', 92 | name: 'View (HTML)', 93 | checked: true 94 | }, { 95 | value: 'addServiceFile', 96 | name: 'Service', 97 | checked: true 98 | }] 99 | }]; 100 | 101 | this.prompt(prompts, function (props) { 102 | this.addControllerFile = _.contains(props.folders, 'addControllerFile'); 103 | this.addRouteFile = _.contains(props.folders, 'addRouteFile'); 104 | this.addTplFile = _.contains(props.folders, 'addTplFile'); 105 | this.addServiceFile = _.contains(props.folders, 'addServiceFile'); 106 | 107 | done(); 108 | }.bind(this)); 109 | }, 110 | 111 | renderModule: function () { 112 | // Create module folder 113 | mkdirp('app/modules/' + this.slugifiedName); 114 | 115 | // Render angular module definition 116 | if (this.addControllerFile) this.template('_controller.js', 'app/modules/' + this.slugifiedName + '/' + this.slugifiedName + 'Ctrl.js'); 117 | if (this.addRouteFile) { 118 | this.fs.copyTpl( 119 | this.templatePath('_route.js'), 120 | this.destinationPath('app/modules/' + this.slugifiedName + '/' + this.slugifiedName + 'Route.js'), 121 | { 122 | arrayModules: this.config.get('modules'), 123 | nameApp: this.config.get('appName'), 124 | angularCookies: this.config.get('angularCookies'), 125 | angularAnimate: this.config.get('angularAnimate'), 126 | angularTouch: this.config.get('angularTouch'), 127 | angularSanitize: this.angularSanitize, 128 | _: _, 129 | angularBootstrap: this.config.get('angularBootstrap'), 130 | angularMaterial: this.config.get('angularMaterial'), 131 | slugifiedName: this.slugifiedName, 132 | slugifiedNameCapitalize: this.slugifiedNameCapitalize 133 | 134 | } 135 | ); 136 | } 137 | //this.template('_route.js', 'app/modules/' + this.slugifiedName + '/' + this.slugifiedName + 'Route.js'); 138 | if (this.addServiceFile) this.template('_service.js', 'app/modules/' + this.slugifiedName + '/' + this.slugifiedName + 'Service.js'); 139 | 140 | if (this.addTplFile) { 141 | 142 | var m = this.config.get('angularMaterial'); 143 | 144 | if (m == true) { 145 | 146 | this.template('_template-material.html', 'app/modules/' + this.slugifiedName + '/' + this.slugifiedName + '.html'); 147 | 148 | } else { 149 | 150 | this.template('_template.html', 'app/modules/' + this.slugifiedName + '/' + this.slugifiedName + '.html'); 151 | } 152 | 153 | 154 | } 155 | 156 | this.template('_test.js', 'app/modules/' + this.slugifiedName + '/' + this.slugifiedName + '-test.js'); 157 | this.template('_module.js', 'app/modules/' + this.slugifiedName + '/' + this.slugifiedName + 'Module.js'); 158 | 159 | this.menu = this.config.get('menu'); 160 | 161 | if (!this.menu) { 162 | this.menu = []; 163 | } 164 | 165 | for (var i = 0; i < this.menu.length; i++) { 166 | 167 | this.listMenu = this.menu[i].link; 168 | 169 | console.log(this.listMenu); 170 | 171 | if (this.slugifiedName === this.listMenu) { 172 | 173 | return this.log.writeln(chalk.red(' Menu name already exists')); 174 | 175 | } 176 | } 177 | 178 | this.menu.push({link: this.slugifiedName, title: this.slugifiedNameCapitalize}); 179 | 180 | this.config.set('menu', this.menu); 181 | 182 | //this.template('_navService.js', 'app/modules/shared/navService.js'); 183 | }, 184 | 185 | updateAppFile: function () { 186 | // Get config user data and options and pass to template 187 | 188 | this.fs.copyTpl( 189 | this.templatePath('_app.js'), 190 | this.destinationPath('app/app.js'), 191 | { 192 | arrayModules: this.config.get('modules'), 193 | nameApp: this.config.get('appName'), 194 | angularCookies: this.config.get('angularCookies'), 195 | angularAnimate: this.config.get('angularAnimate'), 196 | angularTouch: this.config.get('angularTouch'), 197 | angularSanitize: this.angularSanitize, 198 | _: _, 199 | angularBootstrap: this.config.get('angularBootstrap'), 200 | angularMaterial: this.config.get('angularMaterial') 201 | 202 | } 203 | ); 204 | 205 | this.fs.copyTpl( 206 | this.templatePath('_karma.conf.js'), 207 | this.destinationPath('karma.conf.js'), 208 | { 209 | arrayModules: this.config.get('modules'), 210 | nameApp: this.config.get('appName'), 211 | angularCookies: this.config.get('angularCookies'), 212 | angularAnimate: this.config.get('angularAnimate'), 213 | angularTouch: this.config.get('angularTouch'), 214 | angularSanitize: this.angularSanitize, 215 | _: _, 216 | angularBootstrap: this.config.get('angularBootstrap'), 217 | angularMaterial: this.config.get('angularMaterial') 218 | 219 | } 220 | ); 221 | 222 | var getUI = this.config.get('angularMaterial'); 223 | 224 | if (getUI == true) { 225 | 226 | this.fs.copyTpl( 227 | 228 | this.templatePath('_navService.js'), 229 | this.destinationPath('app/modules/layouts/side-nav/sidenavService.js'), 230 | { 231 | arrayMenu: this.config.get('menu'), 232 | nameApp: this.config.get('appName'), 233 | _: _, 234 | slugifiedName: this.slugifiedName 235 | 236 | } 237 | ); 238 | } 239 | 240 | this.fs.copyTpl( 241 | 242 | this.templatePath('_navService.js'), 243 | this.destinationPath('app/modules/layouts/nav-bar/navBarService.js'), 244 | { 245 | arrayMenu: this.config.get('menu'), 246 | nameApp: this.config.get('appName'), 247 | _: _, 248 | slugifiedName: this.slugifiedName 249 | 250 | } 251 | ); 252 | 253 | } 254 | }); 255 | 256 | module.exports = ModuleGenerator; 257 | -------------------------------------------------------------------------------- /angm-module/templates/_app.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc index 6 | * @name app 7 | * @description 8 | * # app 9 | * 10 | * Main modules of the application. 11 | */ 12 | 13 | angular.module('<%= nameApp %>', [ 14 | 'ngResource', 15 | 'ngAria', 16 | <% if (angularBootstrap) { %> 'ui.bootstrap', 17 | <% } if (angularMaterial) { %> 'ngMaterial', 18 | 'ngMdIcons',<% } %> 19 | <% if (angularCookies) { %>'ngCookies', 20 | <% } if (angularAnimate) { %>'ngAnimate', 21 | <% } if (angularBootstrap) { %>'ngTouch', 22 | <% } if (angularSanitize) { %>'ngSanitize', 23 | <% } %>'ui.router', 24 | 'home',<% _.each(arrayModules, function(module) { %> 25 | '<%= module.name %>',<% }); %> 26 | ]); 27 | 28 | })(); 29 | -------------------------------------------------------------------------------- /angm-module/templates/_controller.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc function 6 | * @name app.controller:<%= slugifiedName %>Ctrl 7 | * @description 8 | * # <%= slugifiedName %>Ctrl 9 | * Controller of the app 10 | */ 11 | 12 | angular 13 | .module('<%= slugifiedName %>') 14 | .controller('<%= slugifiedNameCapitalize %>Ctrl', <%= slugifiedNameCapitalize %>); 15 | 16 | <%= slugifiedNameCapitalize %>.$inject = []; 17 | 18 | /* 19 | * recommend 20 | * Using function declarations 21 | * and bindable members up top. 22 | */ 23 | 24 | function <%= slugifiedNameCapitalize %>() { 25 | /*jshint validthis: true */ 26 | var vm = this; 27 | 28 | } 29 | 30 | })(); 31 | -------------------------------------------------------------------------------- /angm-module/templates/_karma.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Karma configuration 4 | module.exports = function (config) { 5 | config.set({ 6 | // Frameworks to use 7 | frameworks: ['jasmine'], 8 | 9 | // List of files / patterns to load in the browser 10 | files: [ 11 | 'src/bower_components/jquery/dist/jquery.js', 12 | 'src/bower_components/es5-shim/es5-shim.js', 13 | 'src/bower_components/json3/lib/json3.min.js',<% if (angularBootstrap) { %> 14 | 'src/bower_components/bootstrap/dist/js/bootstrap.js',<% } %> 15 | 'src/bower_components/angular/angular.js', 16 | 'src/bower_components/angular-aria/angular-aria.js', 17 | 'src/bower_components/angular-resource/angular-resource.js', 18 | 'src/bower_components/angular-mocks/angular-mocks.js', 19 | 'src/bower_components/angular-cookies/angular-cookies.js', 20 | 'src/bower_components/angular-sanitize/angular-sanitize.js', 21 | 'src/bower_components/angular-animate/angular-animate.js', 22 | 'src/bower_components/angular-touch/angular-touch.js',<% if (angularBootstrap) { %> 23 | 'src/bower_components/angular-bootstrap/ui-bootstrap-tpls.js',<% } %> 24 | 'src/bower_components/angular-ui-router/release/angular-ui-router.js', 25 | 'src/bower_components/angular-aria/angular-aria.js',<% if (angularMaterial) { %> 26 | 'src/bower_components/angular-material/angular-material.js', 27 | 'src/bower_components/angular-messages/angular-messages.js', 28 | 'src/bower_components/angular-material-icons/angular-material-icons.js',<% } %> 29 | 'app/app.js', 30 | 'app/modules/home/homeModule.js', 31 | 'app/modules/home/homeCtrl.js', 32 | 'app/modules/home/homeRoute.js', 33 | 'app/modules/home/homeService.js', 34 | 'app/modules/home/home-test.js',<% _.each(arrayModules, function(module) { %> 35 | 'app/modules/<%= module.name %>/<%= module.name %>Module.js', 36 | 'app/modules/<%= module.name %>/<%= module.name %>Ctrl.js', 37 | 'app/modules/<%= module.name %>/<%= module.name %>Route.js', 38 | 'app/modules/<%= module.name %>/<%= module.name %>Service.js', 39 | 'app/modules/<%= module.name %>/<%= module.name %>-test.js',<% }); %> 40 | ], 41 | 42 | // Test results reporter to use 43 | // Possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' 44 | //reporters: ['progress'], 45 | reporters: ['spec'], 46 | 47 | plugins : [ 48 | 'karma-jasmine', 49 | 'karma-coverage', 50 | 'karma-chrome-launcher', 51 | 'karma-firefox-launcher', 52 | 'karma-phantomjs-launcher', 53 | 'karma-spec-reporter' 54 | ], 55 | 56 | // Web server port 57 | port: 9876, 58 | 59 | // Enable / disable colors in the output (reporters and logs) 60 | colors: true, 61 | 62 | // Level of logging 63 | // Possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 64 | logLevel: config.LOG_INFO, 65 | 66 | // Enable / disable watching file and executing tests whenever any file changes 67 | autoWatch: true, 68 | 69 | // Start these browsers, currently available: 70 | // - Chrome 71 | // - ChromeCanary 72 | // - Firefox 73 | // - Opera 74 | // - Safari (only Mac) 75 | // - PhantomJS 76 | // - IE (only Windows) 77 | browsers: ['PhantomJS'], 78 | 79 | // If browser does not capture in given timeout [ms], kill it 80 | captureTimeout: 60000, 81 | 82 | // Continuous Integration mode 83 | // If true, it capture browsers, run tests and exit 84 | singleRun: true 85 | }); 86 | }; 87 | -------------------------------------------------------------------------------- /angm-module/templates/_module.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc function 6 | * @name app.module:<%= slugifiedName %>Module 7 | * @description 8 | * # <%= slugifiedName %>Module 9 | * Module of the app 10 | */ 11 | 12 | angular.module('<%= slugifiedName %>', []); 13 | 14 | })(); 15 | -------------------------------------------------------------------------------- /angm-module/templates/_navService.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc function 6 | * @name app.service:menuService 7 | * @description 8 | * # menuService 9 | * Service of the app 10 | */ 11 | 12 | angular 13 | .module('<%= nameApp %>') 14 | .factory('MenuService', Menu); 15 | // Inject your dependencies as .$inject = ['$http', 'someSevide']; 16 | // function Name ($http, someSevide) {...} 17 | 18 | Menu.$inject = ['$http']; 19 | 20 | function Menu ($http) { 21 | 22 | var menu = [ 23 | <% _.each(arrayMenu, function(menu) { %> 24 | { 25 | link: '<%= menu.link %>', 26 | name: '<%= menu.title %>' 27 | }, 28 | <% }); %> 29 | ]; 30 | 31 | return { 32 | listMenu: function () { 33 | return menu; 34 | } 35 | } 36 | 37 | } 38 | 39 | })(); 40 | -------------------------------------------------------------------------------- /angm-module/templates/_route.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc function 5 | * @name app.route:<%= slugifiedName %>Route 6 | * @description 7 | * # <%= slugifiedName %>Route 8 | * Route of the app 9 | */ 10 | 11 | angular.module('<%= slugifiedName %>') 12 | .config(['$stateProvider', function ($stateProvider) { 13 | <% if (angularMaterial) { %> 14 | $stateProvider 15 | .state('home.<%= slugifiedName %>', { 16 | url:'/<%= slugifiedName %>', 17 | templateUrl: 'app/modules/<%= slugifiedName %>/<%= slugifiedName %>.html', 18 | controller: '<%= slugifiedNameCapitalize %>Ctrl', 19 | controllerAs: 'vm' 20 | }); 21 | 22 | <% } else { %> 23 | $stateProvider 24 | .state('<%= slugifiedName %>', { 25 | url:'/<%= slugifiedName %>', 26 | templateUrl: 'app/modules/<%= slugifiedName %>/<%= slugifiedName %>.html', 27 | controller: '<%= slugifiedNameCapitalize %>Ctrl', 28 | controllerAs: 'vm' 29 | }); 30 | <% } %> 31 | }]); 32 | -------------------------------------------------------------------------------- /angm-module/templates/_service.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc function 6 | * @name app.service:<%= slugifiedName %>Service 7 | * @description 8 | * # <%= slugifiedName %>Service 9 | * Service of the app 10 | */ 11 | 12 | angular 13 | .module('<%= slugifiedName %>') 14 | .factory('<%= slugifiedNameCapitalize %>Service', <%= slugifiedNameCapitalize %>); 15 | // Inject your dependencies as .$inject = ['$http', 'someSevide']; 16 | // function Name ($http, someSevide) {...} 17 | 18 | <%= slugifiedNameCapitalize %>.$inject = ['$http']; 19 | 20 | function <%= slugifiedNameCapitalize %> ($http) { 21 | 22 | } 23 | 24 | })(); 25 | -------------------------------------------------------------------------------- /angm-module/templates/_template-material.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 |

Content from: <%= slugifiedName %> page

5 |
6 |
7 |
8 | -------------------------------------------------------------------------------- /angm-module/templates/_template.html: -------------------------------------------------------------------------------- 1 |
2 |

Content from: <%= slugifiedName %> page

3 |
4 | -------------------------------------------------------------------------------- /angm-module/templates/_test.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc function 6 | * @name app.test:<%= slugifiedName %>Test 7 | * @description 8 | * # <%= slugifiedName %>Test 9 | * Test of the app 10 | */ 11 | 12 | describe('<%= slugifiedName %> test', function () { 13 | var controller = null, $scope = null; 14 | 15 | beforeEach(function () { 16 | module('<%= nameApp %>'); 17 | }); 18 | 19 | beforeEach(inject(function ($controller, $rootScope) { 20 | $scope = $rootScope.$new(); 21 | controller = $controller('<%= slugifiedNameCapitalize %>Ctrl', { 22 | $scope: $scope 23 | }); 24 | })); 25 | 26 | it('Should controller must be defined', function () { 27 | expect(controller).toBeDefined(); 28 | }); 29 | 30 | }); 31 | })(); 32 | -------------------------------------------------------------------------------- /app/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var util = require('util'); 3 | var generators = require('yeoman-generator'); 4 | var path = require('path'); 5 | var chalk = require('chalk'); 6 | var yosay = require('yosay'); 7 | var slugify = require("underscore.string/slugify"); 8 | var _ = require('underscore'); 9 | _.mixin(require('underscore.inflections')); 10 | var mkdirp = require('mkdirp'); 11 | 12 | var AngmGenerator = generators.Base.extend({ 13 | 14 | init: function () { 15 | 16 | this.pkg = require('../package.json'); 17 | 18 | // Greetings to the user. 19 | this.log(yosay( 20 | 'Welcome to ' + chalk.red('official Generator Angm Material') + ' generator!' 21 | )); 22 | }, 23 | 24 | askForApplicationDetails: function () { 25 | var done = this.async(); 26 | 27 | var prompts = [{ 28 | name: 'appName', 29 | message: 'What would you like to call your application?', 30 | default: 'Ang-modular' 31 | }, { 32 | name: 'appDescription', 33 | message: 'How would you describe your application?', 34 | default: 'Modular AngularJS with Angm-generator' 35 | }, { 36 | name: 'appKeywords', 37 | message: 'How would you describe your application in comma seperated key words?', 38 | default: 'AngularJS, Yeoman-Generator' 39 | }, { 40 | name: 'appAuthor', 41 | message: 'What is your company/author name?', 42 | default: 'Angmodular' 43 | }]; 44 | 45 | this.prompt(prompts, function (props) { 46 | this.appName = props.appName; 47 | this.appDescription = props.appDescription; 48 | this.appKeywords = props.appKeywords; 49 | this.appAuthor = props.appAuthor; 50 | 51 | this.slugifiedAppName = slugify(this.appName); 52 | this.humanizedAppName = _.titleize(this.appName); 53 | this.capitalizedAppAuthor = _.camelize(this.appAuthor); 54 | 55 | this.config.set('appName', this.slugifiedAppName); 56 | 57 | done(); 58 | }.bind(this)); 59 | }, 60 | 61 | askForAngularApplicationModules: function () { 62 | var done = this.async(); 63 | 64 | var prompts = [{ 65 | type: 'checkbox', 66 | name: 'modules', 67 | message: 'Which AngularJS modules would you like to include?', 68 | choices: [{ 69 | value: 'angularCookies', 70 | name: 'ngCookies', 71 | checked: true 72 | }, { 73 | value: 'angularAnimate', 74 | name: 'ngAnimate', 75 | checked: true 76 | },{ 77 | value: 'angularSanitize', 78 | name: 'ngSanitize', 79 | checked: true 80 | }] 81 | }]; 82 | 83 | this.prompt(prompts, function (props) { 84 | this.angularCookies = _.contains(props.modules, 'angularCookies'); 85 | this.angularAnimate = _.contains(props.modules, 'angularAnimate'); 86 | this.angularSanitize = _.contains(props.modules, 'angularSanitize'); 87 | 88 | this.config.set('angularCookies', this.angularCookies); 89 | this.config.set('angularAnimate', this.angularAnimate); 90 | this.config.set('angularSanitize', this.angularSanitize); 91 | 92 | done(); 93 | }.bind(this)); 94 | }, 95 | 96 | askForUIApplicationModules: function () { 97 | var done = this.async(); 98 | 99 | var prompts = [{ 100 | type: 'checkbox', 101 | name: 'ui', 102 | message: 'Which UI Frameworkwould you like to include?', 103 | choices: [{ 104 | value: 'angularBootstrap', 105 | name: 'Angular UI Bootstrap', 106 | checked: false 107 | }, 108 | { 109 | value: 'angularMaterial', 110 | name: 'Angular Material', 111 | checked: false 112 | }] 113 | }]; 114 | 115 | this.prompt(prompts, function (props) { 116 | this.angularBootstrap = _.contains(props.ui, 'angularBootstrap'); 117 | this.angularMaterial = _.contains(props.ui, 'angularMaterial'); 118 | 119 | 120 | if (this.angularBootstrap) { 121 | this.config.set('angularBootstrap', true); 122 | } 123 | if (this.angularMaterial) { 124 | this.config.set('angularMaterial', true); 125 | } 126 | 127 | 128 | done(); 129 | }.bind(this)); 130 | }, 131 | 132 | createApplicationScaffold: function () { 133 | // Create public folders 134 | mkdirp('app'); 135 | mkdirp('app/modules/home'); 136 | mkdirp('app/modules/layouts'); 137 | mkdirp('app/assets/images'); 138 | mkdirp('app/assets/fonts'); 139 | mkdirp('app/assets/css'); 140 | mkdirp('src/bower_components'); 141 | mkdirp('src/plugins'); 142 | mkdirp('app/modules/shared'); 143 | 144 | //Copy home folder content 145 | this.copy('app/app.js'); 146 | if (this.angularMaterial == true) { 147 | this.template('app/modules/home/home-material.html', 'app/modules/home/home.html'); 148 | this.template('app/modules/home/dashboard.html', 'app/modules/home/dashboard.html'); 149 | } else { 150 | this.copy('app/modules/home/home.html'); 151 | } 152 | this.copy('app/modules/home/homeCtrl.js'); 153 | this.copy('app/modules/home/homeRoute.js'); 154 | this.copy('app/modules/home/homeService.js'); 155 | this.copy('app/modules/home/homeModule.js'); 156 | 157 | 158 | //Copy layouts folder content 159 | if (this.angularMaterial == true) { 160 | 161 | this.copy('app/modules/layouts/main-page/main-page.html'); 162 | this.copy('app/modules/layouts/main-page/mainPageCtrl.js'); 163 | 164 | this.copy('app/modules/layouts/side-nav/sidenav.html'); 165 | this.copy('app/modules/layouts/side-nav/sidenavCtrl.js'); 166 | this.copy('app/modules/layouts/side-nav/sidenavService.js'); 167 | 168 | 169 | } else { 170 | 171 | this.copy('app/modules/layouts/nav-bar/navbar.html'); 172 | this.copy('app/modules/layouts/nav-bar/navbar-tpl.html'); 173 | this.copy('app/modules/layouts/nav-bar/navBarCtrl.js'); 174 | this.copy('app/modules/layouts/nav-bar/navbarDirective.js'); 175 | this.copy('app/modules/layouts/nav-bar/navbarService.js'); 176 | } 177 | 178 | 179 | // Copy project files 180 | //this.copy('Gruntfile.js'); 181 | this.copy('README.md'); 182 | this.copy('LICENSE.md'); 183 | this.copy('karma.conf.js'); 184 | 185 | // Copy project hidden files 186 | this.copy('bowerrc', '.bowerrc'); 187 | this.copy('editorconfig', '.editorconfig'); 188 | this.copy('jshintrc', '.jshintrc'); 189 | }, 190 | 191 | createApplicationTemplateFiles: function () { 192 | this.template('_package.json', 'package.json'); 193 | this.template('_bower.json', 'bower.json'); 194 | if (this.angularMaterial == true) { 195 | this.template('_index-material.html', 'index.html'); 196 | } else { 197 | this.template('_index.html', 'index.html'); 198 | } 199 | 200 | this.template('app/_app.config.js', 'app/app.config.js'); 201 | 202 | this.template('app/modules/home/_home-test.js', 'app/modules/home/home-test.js'); 203 | 204 | this.fs.copy( 205 | this.templatePath('_Gruntfile.js'), 206 | this.destinationPath('Gruntfile.js') 207 | ); 208 | 209 | }, 210 | 211 | install: function () { 212 | 213 | this.installDependencies({ 214 | skipInstall: this.options['skip-install'], 215 | bower: true 216 | }); 217 | } 218 | 219 | }); 220 | 221 | module.exports = AngmGenerator; 222 | -------------------------------------------------------------------------------- /app/templates/LICENSE.md: -------------------------------------------------------------------------------- 1 | # MIT -------------------------------------------------------------------------------- /app/templates/README.md: -------------------------------------------------------------------------------- 1 | # Ang-Generator 2 | -------------------------------------------------------------------------------- /app/templates/_Gruntfile.js: -------------------------------------------------------------------------------- 1 | // Grunt tasks 2 | 3 | module.exports = function (grunt) { 4 | "use strict"; 5 | 6 | // Project configuration. 7 | grunt.initConfig({ 8 | 9 | pkg: grunt.file.readJSON('package.json'), 10 | banner: '/*!\n' + 11 | '* <%= pkg.name %> - v<%= pkg.version %> - MIT LICENSE <%= grunt.template.today("yyyy-mm-dd") %>. \n' + 12 | '* @author <%= pkg.author %>\n' + 13 | '*/\n', 14 | 15 | clean: { 16 | dist: ['src'] 17 | }, 18 | 19 | jshint: { 20 | options: { 21 | jshintrc: '.jshintrc' 22 | }, 23 | gruntfile: { 24 | src: 'Gruntfile.js' 25 | }, 26 | app: { 27 | src: ['app/modules/**/*.js'] 28 | } 29 | }, 30 | 31 | exec: { 32 | bowerInstaller: 'bower-installer' 33 | }, 34 | 35 | concat: { 36 | options: { 37 | banner: '<%= banner %>', 38 | stripBanners: false 39 | }, 40 | base: { 41 | src: [ 42 | // Angular Project Dependencies, 43 | 'app/app.js', 44 | 'app/app.config.js', 45 | 'app/modules/**/*Module.js', 46 | 'app/modules/**/*Route.js', 47 | 'app/modules/**/*Ctrl.js', 48 | 'app/modules/**/*Service.js', 49 | 'app/modules/**/*Directive.js' 50 | ], 51 | dest: 'app/assets/js/<%= pkg.name %>-appbundle.js' 52 | }, 53 | build: { 54 | src: [ 55 | // Angular Project Dependencies, 56 | 'app/assets/libs/angular/angular.js', 57 | 'app/assets/libs/**/*.js' 58 | 59 | ], 60 | dest: 'app/assets/js/<%= pkg.name %>-angularbundle.js' 61 | } 62 | }, 63 | 64 | uglify: { 65 | options: { 66 | banner: '<%= banner %>', 67 | report: 'min' 68 | }, 69 | base: { 70 | src: ['<%= concat.base.dest %>'], 71 | dest: 'app/assets/js/<%= pkg.name %>-angscript.min.js' 72 | }, 73 | basePlugin: { 74 | src: [ 'src/plugins/**/*.js' ], 75 | dest: 'app/assets/js/plugins/', 76 | expand: true, 77 | flatten: true, 78 | ext: '.min.js' 79 | } 80 | }, 81 | 82 | connect: { 83 | server: { 84 | options: { 85 | keepalive: true, 86 | port: 4000, 87 | base: '.', 88 | hostname: 'localhost', 89 | debug: true, 90 | livereload: true, 91 | open: true 92 | } 93 | } 94 | }, 95 | concurrent: { 96 | tasks: ['connect', 'watch'], 97 | options: { 98 | logConcurrentOutput: true 99 | } 100 | }, 101 | 102 | watch: { 103 | app: { 104 | files: '<%= jshint.app.src %>', 105 | tasks: ['jshint:app'], 106 | options: { 107 | livereload: true 108 | } 109 | } 110 | }, 111 | 112 | injector: { 113 | options: {}, 114 | dev: { 115 | files: { 116 | 'index.html': [ 117 | 'bower.json', 118 | 'app/app.js', 119 | 'app/app.config.js', 120 | 'app/**/*Module.js', 121 | 'app/**/*Route.js', 122 | 'app/**/*Ctrl.js', 123 | 'app/**/*Service.js', 124 | 'app/**/*Directive.js' 125 | ] 126 | } 127 | }, 128 | production: { 129 | files: { 130 | 'index.html': [ 131 | 'app/assets/css/**/*.css', 132 | 'app/assets/js/*.js' 133 | ] 134 | 135 | } 136 | } 137 | }, 138 | 139 | ngtemplates: { 140 | app: { 141 | src: 'app/modules/**/*.html', 142 | dest: 'app/assets/js/templates.js', 143 | options: { 144 | module: '<%= pkg.name %>', 145 | root: 'app/', 146 | standAlone: false 147 | } 148 | } 149 | } 150 | 151 | 152 | 153 | }); 154 | 155 | require('time-grunt')(grunt); 156 | require('load-grunt-tasks')(grunt); 157 | 158 | // Making grunt default to force in order not to break the project if something fail. 159 | grunt.option('force', true); 160 | 161 | // Register grunt tasks 162 | grunt.registerTask("build", [ 163 | "jshint", 164 | "exec", 165 | "concat", 166 | "ngtemplates", 167 | "injector:production", 168 | "concurrent", 169 | "clean" 170 | ]); 171 | 172 | // Development task(s). 173 | grunt.registerTask('dev', ['injector:dev', 'concurrent']); 174 | 175 | }; 176 | -------------------------------------------------------------------------------- /app/templates/_bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "<%= slugifiedAppName %>", 3 | "description": "<%= appDescription %>", 4 | "version": "0.0.1", 5 | "install" : { 6 | "path" : { 7 | "js": "app/assets/libs", 8 | "css": "app/assets/css" 9 | } 10 | }, 11 | "dependencies": { 12 | "json3": "3.3.1", 13 | "es5-shim": "3.1.0",<% if (angularBootstrap) { %> 14 | "bootstrap": "3.3.6", 15 | "jquery": "2.2.0", 16 | "angular-touch": ">=1.3.*", 17 | "angular-bootstrap": "~0.14.3",<% } %> 18 | "angular": ">=1.3.*", 19 | "angular-aria": ">=1.3.*", 20 | "angular-mocks": ">=1.3.*",<% if (angularCookies) { %> 21 | "angular-cookies": ">=1.3.*",<% } if (angularAnimate) { %> 22 | "angular-animate": ">=1.3.*",<% } if (angularSanitize) { %> 23 | "angular-sanitize": ">=1.3.*",<% } %> 24 | "angular-resource": ">=1.3.*",<% if (angularMaterial) { %> 25 | "angular-material-icons": "~0.6.0", 26 | "angular-messages": ">=1.3.*", 27 | "angular-material": ">=1.0.1",<% } %> 28 | "angular-ui-router": "~0.2.10" 29 | }, 30 | "resolutions": { 31 | "angular": ">=1.3.*" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/templates/_index-material.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | <%= slugifiedAppName %> 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 59 | 60 | 61 | 62 | 63 | 64 |
65 | 66 | 67 | 68 | 69 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | -------------------------------------------------------------------------------- /app/templates/_index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | <%= slugifiedAppName %> 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 |
25 |
26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/templates/_package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "<%= slugifiedAppName %>", 3 | "description": "<%= appDescription %>", 4 | "version": "0.0.1",<% if (appAuthor) { %> 5 | "author": "<%= capitalizedAppAuthor %>",<% } %> 6 | "engines": { 7 | "node": "0.10.x", 8 | "npm": "1.4.x" 9 | }, 10 | "scripts": { 11 | "start": "grunt", 12 | "test": "karma start karma.conf.js", 13 | "postinstall": "bower install --config.interactive=false" 14 | }, 15 | "dependencies": { 16 | "bower": "~1.3.8", 17 | "grunt-cli": "~0.1.13", 18 | "glob": "~4.0.5", 19 | "async": "~0.9.0", 20 | "chalk": "~0.5" 21 | }, 22 | "devDependencies": { 23 | "grunt": "~0.4.1", 24 | "grunt-contrib-clean": "~0.5.0", 25 | "grunt-contrib-concat": "~0.3.0", 26 | "grunt-contrib-connect": "~0.5.0", 27 | "grunt-concurrent": "^1.0.0", 28 | "grunt-contrib-jshint": "~0.6.4", 29 | "grunt-contrib-uglify": "~0.2.4", 30 | "grunt-contrib-watch": "~0.5.3", 31 | "grunt-exec": "^0.4.6", 32 | "grunt-injector": "^0.5.4", 33 | "grunt-angular-templates": "^1.0.2", 34 | "load-grunt-tasks": "^0.5.0", 35 | "time-grunt": "^0.3.2", 36 | "karma": "~0.12.0", 37 | "karma-chrome-launcher": "~0.1.2", 38 | "karma-coverage": "~0.2.0", 39 | "karma-firefox-launcher": "~0.1.3", 40 | "karma-spec-reporter": "0.0.23", 41 | "karma-jasmine": "~0.2.1", 42 | "karma-phantomjs-launcher": "~0.1.2" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/templates/app/_app.config.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc configuration file 6 | * @name app.config:config 7 | * @description 8 | * # Config and run block 9 | * Configutation of the app 10 | */ 11 | 12 | 13 | angular 14 | .module('<%= slugifiedAppName %>') 15 | .config(configure) 16 | .run(runBlock); 17 | 18 | configure.$inject = ['$stateProvider', '$urlRouterProvider', '$locationProvider', '$httpProvider']; 19 | 20 | function configure($stateProvider, $urlRouterProvider, $locationProvider, $httpProvider) { 21 | 22 | $locationProvider.hashPrefix('!'); 23 | 24 | // This is required for Browser Sync to work poperly 25 | $httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 26 | 27 | <% if (angularMaterial) { %> 28 | $urlRouterProvider 29 | .otherwise('/dashboard'); 30 | <% } else { %> 31 | $urlRouterProvider 32 | .otherwise('/'); 33 | <% } %> 34 | } 35 | 36 | runBlock.$inject = ['$rootScope']; 37 | 38 | function runBlock($rootScope) { 39 | 'use strict'; 40 | 41 | console.log('AngularJS run() function...'); 42 | } 43 | 44 | 45 | })(); 46 | -------------------------------------------------------------------------------- /app/templates/app/app.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc index 6 | * @name app 7 | * @description 8 | * # app 9 | * 10 | * Main module of the application. 11 | */ 12 | 13 | angular.module('<%= slugifiedAppName %>', [ 14 | 'ngResource', 15 | 'ngAria', 16 | <% if (angularBootstrap) { %> 'ui.bootstrap', 17 | <% } if (angularMaterial) { %> 'ngMaterial', 18 | 'ngMdIcons', 19 | 'ngMessages',<% } %> 20 | <% if (angularCookies) { %>'ngCookies', 21 | <% } if (angularAnimate) { %>'ngAnimate', 22 | <% } if (angularBootstrap) { %>'ngTouch', 23 | <% } if (angularSanitize) { %>'ngSanitize', 24 | <% } %>'ui.router', 25 | 'home', 26 | ]); 27 | 28 | })(); 29 | -------------------------------------------------------------------------------- /app/templates/app/modules/home/_home-test.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc function 6 | * @name app.test:homeTest 7 | * @description 8 | * # homeTest 9 | * Test of the app 10 | */ 11 | 12 | describe('homeCtrl', function () { 13 | var controller = null, $scope = null, $location; 14 | 15 | beforeEach(function () { 16 | module('<%= slugifiedAppName %>'); 17 | }); 18 | 19 | beforeEach(inject(function ($controller, $rootScope, _$location_) { 20 | $scope = $rootScope.$new(); 21 | $location = _$location_; 22 | 23 | controller = $controller('HomeCtrl', { 24 | $scope: $scope 25 | }); 26 | })); 27 | 28 | it('Should HomeCtrl must be defined', function () { 29 | expect(controller).toBeDefined(); 30 | }); 31 | 32 | it('Should match the path Module name', function () { 33 | $location.path('/home'); 34 | expect($location.path()).toBe('/home'); 35 | }); 36 | 37 | }); 38 | })(); 39 | -------------------------------------------------------------------------------- /app/templates/app/modules/home/dashboard.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 |

{{ vm.title }}

5 |

{{ vm.version }}

6 |

This is a template for a simple home screen website. Use it as a starting point to create something more unique.

7 | app/modules/home/home.html 8 |
9 |

Learn more »

10 | 11 |

Features

12 |
    13 |
  • 14 |

    {{item.feature}}

    15 |
  • 16 |
17 |
18 |
19 |
20 | -------------------------------------------------------------------------------- /app/templates/app/modules/home/home-material.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
5 |
6 |
7 |
<%= slugifiedAppName %>
8 |
9 |
10 |
11 |
12 | 13 | 14 |
15 | 16 |
17 |

Dashboard

18 |
19 | 20 |
21 | 22 |
23 |

{{ item.name }}

24 |
25 | 26 | Admin 27 | 28 |
29 | 30 |
31 |

{{ item.title }}

32 |
33 |
34 |
35 |
36 | 37 |
38 | 39 |
40 | 41 | 42 | 43 |

<%= slugifiedAppName %>

44 | 45 | 46 | 47 | 48 | 49 | 50 | more_vert 51 | 52 | 53 | 54 | 55 | face 56 | Profile 57 | 58 | 59 | 60 | 61 | lock 62 | Password 63 | 64 | 65 | 66 | 67 | 68 | power_settings_new 69 | Logout 70 | 71 | 72 | 73 | 74 |
75 |
76 | 77 |
78 | 79 | 80 | 81 |

82 | Back 83 |

84 | 85 | 86 | 87 | 88 |
89 |
90 | 91 |
92 |
93 |
94 | -------------------------------------------------------------------------------- /app/templates/app/modules/home/home.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

{{ vm.title }}

5 |

{{ vm.version }}

6 |

This is a template for a simple home screen website. Use it as a starting point to create something more unique.

7 | app/modules/home/home.html 8 |
9 |

Features

10 | 13 |

Learn more »

14 |
15 |
16 | -------------------------------------------------------------------------------- /app/templates/app/modules/home/homeCtrl.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc function 6 | * @name app.controller:HomeCtrl 7 | * @description 8 | * # HomeCtrl 9 | * Controller of the app 10 | */ 11 | 12 | angular 13 | .module('<%= slugifiedAppName %>') 14 | .controller('HomeCtrl', Home); 15 | 16 | Home.$inject = ['homeService']; 17 | 18 | /* 19 | * recommend 20 | * Using function declarations 21 | * and bindable members up top. 22 | */ 23 | 24 | function Home(homeService) { 25 | /*jshint validthis: true */ 26 | var vm = this; 27 | vm.title = "Hello, <%= slugifiedAppName %>!"; 28 | vm.version = "1.0.0"; 29 | vm.listFeatures = homeService.getFeaturesList(); 30 | 31 | } 32 | 33 | })(); 34 | -------------------------------------------------------------------------------- /app/templates/app/modules/home/homeModule.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc function 6 | * @name app.module:homeModule 7 | * @description 8 | * # homeModule 9 | * Module of the app 10 | */ 11 | 12 | angular.module('home', []); 13 | })(); 14 | -------------------------------------------------------------------------------- /app/templates/app/modules/home/homeRoute.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc function 5 | * @name app.route:HomeRoute 6 | * @description 7 | * # HomeRoute 8 | * Route of the app 9 | */ 10 | 11 | angular.module('<%= slugifiedAppName %>') 12 | .config(['$stateProvider', function ($stateProvider) { 13 | $stateProvider 14 | <% if (angularMaterial) { %> 15 | .state('home', { 16 | url: '', 17 | abstract: true, 18 | templateUrl: 'app/modules/home/home.html', 19 | controller: 'HomeCtrl', 20 | controllerAs: 'vm' 21 | }) 22 | .state('home.dashboard', { 23 | url:'/dashboard', 24 | templateUrl: 'app/modules/home/dashboard.html' 25 | }); 26 | <% } else { %> 27 | .state('home', { 28 | url: '/', 29 | templateUrl: 'app/modules/home/home.html', 30 | controller: 'HomeCtrl', 31 | controllerAs: 'vm' 32 | }); 33 | <% } %> 34 | }]); 35 | -------------------------------------------------------------------------------- /app/templates/app/modules/home/homeService.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc function 6 | * @name app.service:homeService 7 | * @description 8 | * # homeService 9 | * Service of the app 10 | */ 11 | 12 | angular.module('<%= slugifiedAppName %>') 13 | .factory('homeService', homeService); 14 | 15 | homeService.$inject = ['$http']; 16 | 17 | function homeService($http) { 18 | 19 | var list = [ 20 | {"feature": "Implemented Best Practices, following: John Papa's Guide"}, 21 | {"feature": "Using Controller AS syntax"}, 22 | {"feature": "Wrap Angular components in an Immediately Invoked Function Expression (IIFE)"}, 23 | {"feature": "Declare modules without a variable using the setter syntax"}, 24 | {"feature": "Using named functions"}, 25 | {"feature": "Including Unit test with Karma"}, 26 | {"feature": "Including UI options for Bootstrap or Angular-Material"}, 27 | {"feature": "Including Angular-Material-Icons for Angular-Material UI"}, 28 | {"feature": "Dynamic Menu generator for both themes"}, 29 | {"feature": "Grunt task for Production and Development"} 30 | ]; 31 | 32 | return { 33 | getFeaturesList: getFeaturesList 34 | }; 35 | 36 | function getFeaturesList() { 37 | return list; 38 | } 39 | 40 | } 41 | 42 | })(); 43 | -------------------------------------------------------------------------------- /app/templates/app/modules/layouts/main-page/main-page.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
5 |
6 |
7 |
<%= slugifiedAppName %>
8 |
9 |
10 |
11 |
12 | 13 | 14 |
15 | 16 |
17 |

Dashboard

18 |
19 | 20 |
21 | 22 |
23 |

{{ item.name }}

24 |
25 | 26 | Admin 27 | 28 |
29 | 30 |
31 |

{{ item.title }}

32 |
33 |
34 |
35 |
36 | 37 |
38 | 39 |
40 | 41 | 42 | 43 |

<%= slugifiedAppName %>

44 | 45 | 46 | 47 | 48 | 49 | 50 | more_vert 51 | 52 | 53 | 54 | 55 | face 56 | Profile 57 | 58 | 59 | 60 | 61 | lock 62 | Password 63 | 64 | 65 | 66 | 67 | 68 | power_settings_new 69 | Logout 70 | 71 | 72 | 73 | 74 |
75 |
76 | 77 |
78 | 79 | 80 | 81 |

82 | Back 83 |

84 | 85 | 86 | 87 | 88 |
89 |
90 | 91 |
92 |
93 |
94 | -------------------------------------------------------------------------------- /app/templates/app/modules/layouts/main-page/main-pageRoute.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc function 5 | * @name app.route:HomeRoute 6 | * @description 7 | * # HomeRoute 8 | * Route of the app 9 | */ 10 | 11 | angular.module('lab') 12 | .config(['$stateProvider', function ($stateProvider) { 13 | $stateProvider 14 | 15 | .state('app', { 16 | url: '', 17 | abstract: true, 18 | templateUrl: 'app/modules/layouts/main-page/main-page.html', 19 | controller: 'LayoutCtrl', 20 | controllerAs: 'vm' 21 | }); 22 | 23 | }]); 24 | -------------------------------------------------------------------------------- /app/templates/app/modules/layouts/main-page/mainPageCtrl.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc function 6 | * @name app.controller:LayoutCtrl 7 | * @description 8 | * # LayoutCtrl 9 | * Controller of the app 10 | */ 11 | 12 | angular 13 | .module('<%= slugifiedAppName %>') 14 | .controller('LayoutCtrl', Layout); 15 | 16 | Layout.$inject = ['$mdSidenav', '$cookies', '$state', '$mdToast', '$mdDialog']; 17 | 18 | /* 19 | * recommend 20 | * Using function declarations 21 | * and bindable members up top. 22 | */ 23 | 24 | function Layout($mdSidenav, $cookies, $state, $mdToast, $mdDialog ) { 25 | /*jshint validthis: true */ 26 | var vm = this; 27 | 28 | vm.toggleSidenav = function (menuId) { 29 | $mdSidenav(menuId).toggle(); 30 | }; 31 | 32 | vm.changePassword = function () { 33 | $mdToast.show( 34 | $mdToast.simple() 35 | .content('Password clicked!') 36 | .position('top right') 37 | .hideDelay(2000) 38 | ); 39 | }; 40 | 41 | vm.changeProfile = function (ev) { 42 | $mdDialog.show({ 43 | controller: DialogController, 44 | templateUrl: 'tabDialog.tmpl.html', 45 | parent: angular.element(document.body), 46 | targetEvent: ev, 47 | clickOutsideToClose:true 48 | }) 49 | .then(function(answer) { 50 | $mdToast.show( 51 | $mdToast.simple() 52 | .content('You said the information was "' + answer + '".') 53 | .position('top right') 54 | .hideDelay(2000) 55 | ); 56 | 57 | }, function() { 58 | $mdToast.show( 59 | $mdToast.simple() 60 | .content('You cancelled the dialog.') 61 | .position('top right') 62 | .hideDelay(2000) 63 | ); 64 | }); 65 | 66 | function DialogController($scope, $mdDialog) { 67 | $scope.hide = function() { 68 | $mdDialog.hide(); 69 | }; 70 | 71 | $scope.cancel = function() { 72 | $mdDialog.cancel(); 73 | }; 74 | 75 | $scope.answer = function(answer) { 76 | $mdDialog.hide(answer); 77 | }; 78 | } 79 | }; 80 | 81 | 82 | vm.logOut = function () { 83 | 84 | alert('Implement your Function Here'); 85 | // $cookies.put('dev_appserver_login', ' '); 86 | //$state.go('out', {}, {reload: true}); 87 | 88 | }; 89 | 90 | var originatorEv; 91 | vm.openMenu = function ($mdOpenMenu, ev) { 92 | originatorEv = ev; 93 | $mdOpenMenu(ev); 94 | }; 95 | 96 | } 97 | 98 | })(); 99 | -------------------------------------------------------------------------------- /app/templates/app/modules/layouts/nav-bar/navBarCtrl.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc function 6 | * @name app.controller:NavBarCtrl 7 | * @description 8 | * # NavBarCtrl 9 | * Controller of the app 10 | */ 11 | 12 | angular 13 | .module('<%= slugifiedAppName %>') 14 | .controller('NavBarCtrl', NavBar); 15 | 16 | NavBar.$inject = ['homeService', 'MenuService']; 17 | 18 | /* 19 | * recommend 20 | * Using function declarations 21 | * and bindable members up top. 22 | */ 23 | 24 | function NavBar(homeService, MenuService) { 25 | /*jshint validthis: true */ 26 | var vm = this; 27 | vm.title = "<%= slugifiedAppName %>"; 28 | 29 | vm.menu = MenuService.listMenu(); 30 | 31 | } 32 | 33 | })(); 34 | -------------------------------------------------------------------------------- /app/templates/app/modules/layouts/nav-bar/navbar-tpl.html: -------------------------------------------------------------------------------- 1 | 21 | -------------------------------------------------------------------------------- /app/templates/app/modules/layouts/nav-bar/navbar.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | -------------------------------------------------------------------------------- /app/templates/app/modules/layouts/nav-bar/navbarDirective.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc function 6 | * @name app.directive:navbarDirective 7 | * @description 8 | * # navbarDirective 9 | * Directive of the app 10 | */ 11 | 12 | angular 13 | .module('<%= slugifiedAppName %>') 14 | .directive('navBar', navBar); 15 | 16 | function navBar() { 17 | 18 | var directive = { 19 | link: link, 20 | restrict: 'EA', 21 | scope: { 22 | menus: '=', 23 | brand: '=' 24 | }, 25 | controller: control, 26 | templateUrl: 'app/modules/layouts/nav-bar/navbar-tpl.html' 27 | 28 | }; 29 | 30 | return directive; 31 | 32 | function link(scope, element, attrs, $location) { 33 | // write your code here 34 | scope.defaults = { 35 | brand: '', 36 | menus: [], 37 | search: { 38 | show: false 39 | } 40 | }; // end defaults 41 | 42 | } 43 | 44 | function control($scope, $location) { 45 | 46 | $scope.isActive = function (path) { 47 | var currentPath = $location.path().split('/')[1]; 48 | if (currentPath.indexOf('?') !== -1) { 49 | currentPath = currentPath.split('?')[0]; 50 | } 51 | return currentPath === path.split('/')[1]; 52 | }; 53 | } 54 | 55 | } 56 | 57 | })(); 58 | -------------------------------------------------------------------------------- /app/templates/app/modules/layouts/nav-bar/navbarService.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | (function () { 4 | 5 | /** 6 | * @ngdoc function 7 | * @name app.service:menuService 8 | * @description 9 | * # menuService 10 | * Service of the app 11 | */ 12 | 13 | angular 14 | .module('<%= slugifiedAppName %>') 15 | .factory('MenuService', Menu); 16 | 17 | // Inject your dependencies as .$inject = ['$http', '$anotherDependency']; 18 | // function Name ($http, $anotherDependency) {...} 19 | 20 | Menu.$inject = ['$http']; 21 | 22 | function Menu($http) { 23 | // Sample code. 24 | 25 | var menu = [ 26 | { 27 | link: '.', 28 | name: 'This is a Placeholder menu. It disappears when the first module has been created.' 29 | } 30 | ]; 31 | 32 | return { 33 | listMenu: function () { 34 | return menu; 35 | } 36 | } 37 | 38 | } 39 | 40 | })(); 41 | -------------------------------------------------------------------------------- /app/templates/app/modules/layouts/side-nav/sidenav.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |
5 |
6 |
7 |
<%= slugifiedAppName %>
8 |
9 |
10 |
11 |
12 | 13 | 14 |
15 | 16 |
17 |

Dashboard

18 |
19 | 20 |
21 | 22 |
23 |

{{ item.name }}

24 |
25 | 26 | Admin 27 | 28 |
29 | 30 |
31 |

{{ item.title }}

32 |
33 |
34 |
35 |
-------------------------------------------------------------------------------- /app/templates/app/modules/layouts/side-nav/sidenavCtrl.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc function 6 | * @name app.controller:SidenavCtrl 7 | * @description 8 | * # SidenavCtrl 9 | * Controller of the app 10 | */ 11 | angular 12 | .module('<%= slugifiedAppName %>') 13 | .controller('SidenavCtrl', SidenavCtrl) 14 | .controller('SettingsCtrl', SettingsCtrl); 15 | 16 | // Injecting Denpendencies 17 | 18 | SidenavCtrl.$inject = ['$mdSidenav', '$state', '$mdBottomSheet', '$mdToast', 'MenuService', '$scope']; 19 | SettingsCtrl.$inject = ['$mdBottomSheet']; 20 | 21 | /* 22 | * recommend 23 | * Using function declarations 24 | * and bindable members up top. 25 | */ 26 | 27 | function SidenavCtrl($mdSidenav, $state, $mdBottomSheet, $mdToast, MenuService, $scope) { 28 | /*jshint validthis: true */ 29 | var vm = this; 30 | 31 | vm.toggleSidenav = function (menuId) { 32 | $mdSidenav(menuId).toggle(); 33 | }; 34 | 35 | vm.closeSidenav = function() { 36 | $mdSidenav('left').close(); 37 | }; 38 | 39 | // Close menu on small screen after click on menu item. 40 | // Only use $scope in controllerAs when necessary; for example, publishing and subscribing events using $emit, $broadcast, $on or $watch. 41 | $scope.$on('$stateChangeSuccess', vm.closeSidenav); 42 | 43 | vm.menu = MenuService.listMenu(); 44 | 45 | vm.admin = [ 46 | { 47 | link: 'showListBottomSheet($event)', 48 | title: 'Settings', 49 | icon: 'settings' 50 | } 51 | ]; 52 | 53 | vm.navigateTo = function (target) { 54 | 55 | var page = target; 56 | 57 | $state.go(page); 58 | 59 | }; 60 | 61 | vm.showSettingsBottom = function ($event) { 62 | vm.alert = ''; 63 | $mdBottomSheet.show({ 64 | template: '

With clickOutsideToClose option, drag down or press ESC to close

{{item.icon}}
{{ item.name }}
', 65 | controller: 'SettingsCtrl', 66 | controllerAs: 'vm', 67 | targetEvent: $event 68 | }).then(function (clickedItem) { 69 | $mdToast.show( 70 | $mdToast.simple() 71 | .content(clickedItem.name + ' clicked!') 72 | .position('top right') 73 | .hideDelay(2000) 74 | ); 75 | }); 76 | }; 77 | 78 | } 79 | 80 | function SettingsCtrl($mdBottomSheet) { 81 | /*jshint validthis: true */ 82 | var vm = this; 83 | 84 | vm.items = [ 85 | {name: 'Roles', icon: 'assignment_ind'}, 86 | {name: 'Notes', icon: 'speaker_notes'}, 87 | {name: 'Tasks', icon: 'view_list'}, 88 | {name: 'Inbox', icon: 'inbox'} 89 | ]; 90 | 91 | vm.listItemClick = function ($index) { 92 | var clickedItem = vm.items[$index]; 93 | $mdBottomSheet.hide(clickedItem); 94 | }; 95 | } 96 | 97 | })(); 98 | -------------------------------------------------------------------------------- /app/templates/app/modules/layouts/side-nav/sidenavService.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | /** 5 | * @ngdoc function 6 | * @name app.service:menuService 7 | * @description 8 | * # menuService 9 | * Service of the app 10 | */ 11 | 12 | angular 13 | .module('<%= slugifiedAppName %>') 14 | .factory('MenuService', Menu); 15 | 16 | // Inject your dependencies as .$inject = ['$http', '$otherDependency']; 17 | // function Name ($http, $otherDependency) {...} 18 | 19 | Menu.$inject = ['$http']; 20 | 21 | function Menu($http) { 22 | // Sample code. 23 | 24 | var menu = [{ 25 | link: '.', 26 | name: 'This is a Placeholder menu. It disappears when the first module has been created.' 27 | }]; 28 | 29 | return { 30 | listMenu: function () { 31 | return menu; 32 | } 33 | }; 34 | 35 | } 36 | 37 | })(); 38 | -------------------------------------------------------------------------------- /app/templates/bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory" : "src/bower_components" 3 | } -------------------------------------------------------------------------------- /app/templates/editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | 10 | # Change these settings to your own preference 11 | indent_style = tab 12 | indent_size = 4 13 | 14 | # We recommend you to keep these unchanged 15 | end_of_line = lf 16 | charset = utf-8 17 | trim_trailing_whitespace = true 18 | insert_final_newline = true 19 | 20 | [*.md] 21 | trim_trailing_whitespace = false 22 | -------------------------------------------------------------------------------- /app/templates/jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "esnext": true, 4 | "bitwise": true, 5 | "camelcase": false, 6 | "curly": true, 7 | "eqeqeq": true, 8 | "immed": true, 9 | "latedef": false, 10 | "newcap": false, 11 | "noarg": true, 12 | "quotmark": false, 13 | "undef": false, 14 | "unused": false, 15 | "strict": true, 16 | "trailing": false, 17 | "smarttabs": true, 18 | "white": false, 19 | "globals": { 20 | "browser": false, 21 | "describe": false, 22 | "beforeEach": false, 23 | "inject": false, 24 | "expect": false, 25 | "it": false, 26 | "angular": false, 27 | "window": false, 28 | "app": false, 29 | "document": false, 30 | "alert": false, 31 | "jasmine": false, 32 | "jquery": false, 33 | "mocha": true 34 | 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/templates/karma.conf.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Karma configuration 4 | module.exports = function (config) { 5 | config.set({ 6 | // Frameworks to use 7 | frameworks: ['jasmine'], 8 | 9 | // List of files / patterns to load in the browser 10 | files: [ 11 | 'src/bower_components/jquery/dist/jquery.js', 12 | 'src/bower_components/es5-shim/es5-shim.js', 13 | 'src/bower_components/json3/lib/json3.min.js', 14 | 'src/bower_components/bootstrap/dist/js/bootstrap.js', 15 | 'src/bower_components/angular/angular.js', 16 | 'src/bower_components/angular-aria/angular-aria.js', 17 | 'src/bower_components/angular-resource/angular-resource.js', 18 | 'src/bower_components/angular-mocks/angular-mocks.js', 19 | 'src/bower_components/angular-cookies/angular-cookies.js', 20 | 'src/bower_components/angular-sanitize/angular-sanitize.js', 21 | 'src/bower_components/angular-animate/angular-animate.js', 22 | 'src/bower_components/angular-touch/angular-touch.js', 23 | 'src/bower_components/angular-ui-router/release/angular-ui-router.js', 24 | 'src/bower_components/angular-bootstrap/ui-bootstrap-tpls.js', 25 | 'src/bower_components/angular-aria/angular-aria.js', 26 | 'src/bower_components/angular-material/angular-material.js', 27 | 'src/bower_components/angular-messages/angular-messages.js', 28 | 'src/bower_components/angular-material-icons/angular-material-icons.js', 29 | 'app/app.js', 30 | 'app/modules/home/homeModule.js', 31 | 'app/modules/home/homeCtrl.js', 32 | 'app/modules/home/homeRoute.js', 33 | 'app/modules/home/homeService.js', 34 | 'app/modules/home/home-test.js' 35 | ], 36 | 37 | // Test results reporter to use 38 | // Possible values: 'dots', 'progress', 'junit', 'growl', 'coverage' 39 | //reporters: ['progress'], 40 | reporters: ['spec'], 41 | 42 | // Web server port 43 | port: 9876, 44 | 45 | // Enable / disable colors in the output (reporters and logs) 46 | colors: true, 47 | 48 | // Level of logging 49 | // Possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG 50 | logLevel: config.LOG_INFO, 51 | 52 | // Enable / disable watching file and executing tests whenever any file changes 53 | autoWatch: true, 54 | 55 | // Start these browsers, currently available: 56 | // - Chrome 57 | // - ChromeCanary 58 | // - Firefox 59 | // - Opera 60 | // - Safari (only Mac) 61 | // - PhantomJS 62 | // - IE (only Windows) 63 | browsers: ['PhantomJS'], 64 | 65 | // If browser does not capture in given timeout [ms], kill it 66 | captureTimeout: 60000, 67 | 68 | // Continuous Integration mode 69 | // If true, it capture browsers, run tests and exit 70 | singleRun: true 71 | }); 72 | }; 73 | -------------------------------------------------------------------------------- /generator-angm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newaeonweb/generator-angm/9716fdd2f4091d7b92da15a9f09a35740e93e83f/generator-angm.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Angm-Generator 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
34 |
35 |
36 |
37 | 38 |
39 | Angm-Generator 40 |
41 | Modular Yeoman Generator to scaffold modular AngularJS applications. 42 |
43 |
44 | Try now! 45 |
46 | 47 |
48 |
49 | 54 |
55 |
56 | 57 |
58 |
59 |
60 |
61 | 62 |
63 |
64 |
65 |
66 |

Getting started videos

67 |
68 |
69 |
70 | 92 |
93 |
94 | 105 |
106 | 107 | 108 | 109 |
110 | 148 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generator-angm", 3 | "version": "1.0.7", 4 | "description": "AngularJS Yeoman Generator to help you getting started with a new project based on AngularJS and Angular Material to build large scale applications.", 5 | "license": "MIT", 6 | "main": "app/index.js", 7 | "repository": "https://github.com/newaeonweb/generator-angm", 8 | "author": { 9 | "name": "Fernando Monteiro", 10 | "url": "https://github.com/newaeonweb/generator-angm" 11 | }, 12 | "engines": { 13 | "node": ">=0.10.0" 14 | }, 15 | "scripts": { 16 | "test": "mocha" 17 | }, 18 | "keywords": [ 19 | "yeoman-generator", 20 | "AngularJS", 21 | "ng", 22 | "Angular Directives", 23 | "AngularJS modular", 24 | "karma", 25 | "Angular Generator" 26 | ], 27 | "dependencies": { 28 | "chalk": "^1.1.1", 29 | "mkdirp": "^0.5.1", 30 | "underscore": "^1.8.3", 31 | "underscore.inflections": "^0.2.1", 32 | "underscore.string": "^3.2.2", 33 | "yeoman-generator": "^0.22.2", 34 | "yo": "^1.6.0", 35 | "yosay": "^1.1.0" 36 | }, 37 | "devDependencies": { 38 | "assert": "~1.1.1", 39 | "async": "~0.9.0", 40 | "fs-extra": "~0.10.0", 41 | "grunt-concurrent": "^1.0.0", 42 | "mocha": "*", 43 | "temp": "~0.8.0", 44 | "yeoman-assert": "^2.1.1", 45 | "yeoman-test": "^1.1.0" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /test/test-app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var path = require('path'); 4 | var assert = require('yeoman-assert'); 5 | var helpers = require('yeoman-test'); 6 | var os = require('os'); 7 | 8 | describe('angm:app', function () { 9 | before(function (done) { 10 | helpers.run(path.join(__dirname, '../app')) 11 | .on('end', done()); 12 | }); 13 | 14 | it('creates root files', function () { 15 | assert.file([ 16 | 'package.json', 17 | 'index.html', 18 | '.editorconfig', 19 | '.jshintrc', 20 | 'README.md' 21 | ]); 22 | }); 23 | }); 24 | --------------------------------------------------------------------------------