├── .editorconfig ├── .gitattributes ├── .gitignore ├── .jshintrc ├── .travis.yml ├── CHANGELOG.md ├── Gruntfile.js ├── app ├── USAGE ├── index.js └── templates │ └── api │ ├── .htaccess │ ├── Makefile │ ├── _gitignore │ ├── composer.json │ ├── config │ ├── .gitignore │ ├── README.md │ └── application.config.php │ ├── index.php │ ├── phpunit.xml │ ├── src │ └── Api │ │ ├── Application.php │ │ └── Model │ │ └── Features.php │ └── tests │ ├── Test │ ├── Functional │ │ ├── ApplicationTest.php │ │ └── FeaturesTest.php │ └── Unit │ │ └── FeaturesTest.php │ └── bootstrap.php ├── common └── index.js ├── constant ├── USAGE └── index.js ├── contributing.md ├── controller ├── USAGE └── index.js ├── decorator ├── USAGE └── index.js ├── directive ├── USAGE └── index.js ├── factory ├── USAGE └── index.js ├── filter ├── USAGE └── index.js ├── main └── index.js ├── package.json ├── provider ├── USAGE └── index.js ├── readme.md ├── route ├── USAGE └── index.js ├── script-base.js ├── service ├── USAGE └── index.js ├── templates ├── coffeescript │ ├── app.coffee │ ├── controller.coffee │ ├── decorator.coffee │ ├── directive.coffee │ ├── filter.coffee │ ├── service │ │ ├── constant.coffee │ │ ├── factory.coffee │ │ ├── provider.coffee │ │ ├── service.coffee │ │ └── value.coffee │ └── spec │ │ ├── controller.coffee │ │ ├── directive.coffee │ │ ├── filter.coffee │ │ └── service.coffee ├── common │ ├── app │ │ ├── .buildignore │ │ ├── .htaccess │ │ ├── 404.html │ │ ├── favicon.ico │ │ ├── images │ │ │ └── yeoman.png │ │ ├── index.html │ │ ├── robots.txt │ │ ├── styles │ │ │ ├── main.css │ │ │ └── main.scss │ │ └── views │ │ │ ├── main.html │ │ │ └── view.html │ └── root │ │ ├── .editorconfig │ │ ├── .gitattributes │ │ ├── .jshintrc │ │ ├── _Gruntfile.js │ │ ├── _bower.json │ │ ├── _bowerrc │ │ ├── _package.json │ │ ├── gitignore │ │ └── test │ │ └── .jshintrc └── javascript │ ├── app.js │ ├── controller.js │ ├── decorator.js │ ├── directive.js │ ├── filter.js │ ├── service │ ├── constant.js │ ├── factory.js │ ├── provider.js │ ├── service.js │ └── value.js │ └── spec │ ├── controller.js │ ├── directive.js │ ├── filter.js │ └── service.js ├── test ├── test-appname-substitution.js ├── test-apppath.js ├── test-file-creation.js ├── test-load.js └── test-route-creation.js ├── util.js ├── value ├── USAGE └── index.js └── view ├── USAGE └── index.js /.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 | # Due to a bug in the EditorConfig for SublimeText, we set tab indentation for 8 | # all files and we set exceptions for all files with an extension 9 | 10 | [*] 11 | indent_style = tab 12 | indent_size = 4 13 | 14 | end_of_line = lf 15 | charset = utf-8 16 | trim_trailing_whitespace = true 17 | insert_final_newline = true 18 | 19 | [*.*] 20 | indent_style = space 21 | indent_size = 2 22 | 23 | [*.php] 24 | indent_size = 4 25 | 26 | [*.md] 27 | trim_trailing_whitespace = false 28 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | test/tmp 4 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "esnext": true, 4 | "bitwise": false, 5 | "curly": false, 6 | "eqeqeq": true, 7 | "eqnull": true, 8 | "immed": true, 9 | "latedef": true, 10 | "newcap": true, 11 | "noarg": true, 12 | "undef": true, 13 | "strict": false, 14 | "globalstrict": true, 15 | "trailing": true, 16 | "smarttabs": true, 17 | "node": true 18 | } 19 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '0.10' 4 | before_install: 5 | - currentfolder=${PWD##*/} 6 | - if [ "$currentfolder" != 'generator-angular-php' ]; then cd .. && eval "mv $currentfolder generator-angular-php" && cd generator-angular-php; fi 7 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | ### 0.9.0-1 (2014-06-20) 3 | 4 | 5 | #### Bug Fixes 6 | 7 | * **app:** 8 | * fix bower path problem ([db4ec0eb](yeoman/generator-angular/commit/db4ec0eb101b221135a353d008ed3c662814ac79), closes [#733](yeoman/generator-angular/issues/733)) 9 | * fix provider CoffeeScript template ([c2572d23](yeoman/generator-angular/commit/c2572d236cce5afe5a66037e558325018153ca97)) 10 | * correct cssmin/concat build-tag paths ([27dd848f](yeoman/generator-angular/commit/27dd848f58c45ba5536da502bfd5a147ced35572)) 11 | * **gen:** fix ref to Karma config for --coffee ([380018f0](yeoman/generator-angular/commit/380018f0bbbb6a59d38ee86f39e3879e05c8b203), closes [#748](yeoman/generator-angular/issues/748)) 12 | * **karma:** use the correct CoffeeScript extension ([ddbab964](yeoman/generator-angular/commit/ddbab9646fcc8883d3850e7e9a02daa32e8ea4d8), closes [#737](yeoman/generator-angular/issues/737)) 13 | * **release:** get rid of circular loop ([293ca6a4](yeoman/generator-angular/commit/293ca6a4a365fdfe2f72fb406bd2f4d8f5b3b797)) 14 | 15 | 16 | 17 | ### 0.9.0-1 (2014-06-10) 18 | 19 | 20 | #### Bug Fixes 21 | 22 | * **gen:** 23 | * update wiredep ignore path ([a9c4e354](yeoman/generator-angular/commit/a9c4e3541b50171868f700a0817a592e203e5410)) 24 | * remove font files ([f27566d5](yeoman/generator-angular/commit/f27566d50c56af8a9f8fa357565fc9810c5a8671)) 25 | 26 | 27 | #### Features 28 | 29 | * **app:** move bower_components to root folder ([396a2c04](yeoman/generator-angular/commit/396a2c04b3aeaaafddf9f68287208cee7e9e74e9)) 30 | 31 | 32 | #### Breaking Changes 33 | 34 | * bower_components is now in the /project_root directory 35 | ([396a2c04](yeoman/generator-angular/commit/396a2c04b3aeaaafddf9f68287208cee7e9e74e9)) 36 | 37 | 38 | 39 | ### 0.9.0-0 (2014-06-05) 40 | 41 | 42 | #### Bug Fixes 43 | 44 | * **Gruntfile:** fix usemin bug when using images in css ([fac3d108](yeoman/generator-angular/commit/fac3d1082a2c2120b9f92b86747c26b1421bd942)) 45 | * **app:** 46 | * app is installed at appPath location ([947b872c](yeoman/generator-angular/commit/947b872c57eaaa3c0829d63ce31dcd355d452a82), closes [#578](yeoman/generator-angular/issues/578)) 47 | * app-suffix should populate to sub-generators ([02654419](yeoman/generator-angular/commit/026544191b4526b43517aad89c4f8a02c0271814), closes [#572](yeoman/generator-angular/issues/572)) 48 | * fix Bootstrap font issues ([0a66f54d](yeoman/generator-angular/commit/0a66f54d14f1ae6533e21153ee9e19b1da6626bc), closes [#552](yeoman/generator-angular/issues/552), [#638](yeoman/generator-angular/issues/638), [#645](yeoman/generator-angular/issues/645), [#661](yeoman/generator-angular/issues/661), [#662](yeoman/generator-angular/issues/662), [#665](yeoman/generator-angular/issues/665), [#667](yeoman/generator-angular/issues/667)) 49 | * prevent faulty bowerInstall ignorePath ([fa2e36b8](yeoman/generator-angular/commit/fa2e36b8874cc21c74dc0a740d6ece580c4f0f1f)) 50 | * Remove redundant bootstrap-sass import ([229e58ae](yeoman/generator-angular/commit/229e58aeca71a077f71ac60ae4eebd3b04b30889)) 51 | * **build:** 52 | * update karma.conf.js file location in Gruntfile ([29b2d4d3](yeoman/generator-angular/commit/29b2d4d3db549183e101719290e01488a8e7d10e), closes [#706](yeoman/generator-angular/issues/706)) 53 | * use conservativeCollapse for htmlmin ([06a34d08](yeoman/generator-angular/commit/06a34d0815c3cc31d191f31ee2ef8ecd637142bc)) 54 | * clean subfolders of dist as well ([9db87bf6](yeoman/generator-angular/commit/9db87bf6f61252db604e9ae4e9b13360f8b96eef)) 55 | * change livereload to use connect options ([0f549060](yeoman/generator-angular/commit/0f5490600c1b4bb91a19958986aea63700035ac2), closes [#569](yeoman/generator-angular/issues/569), [#674](yeoman/generator-angular/issues/674)) 56 | * grunt-newer requires a src attribute ([6165b810](yeoman/generator-angular/commit/6165b8101f11ef37811305e6e5dd269da52a3ef2), closes [#620](yeoman/generator-angular/issues/620)) 57 | * add src property to jshint task ([4668e702](yeoman/generator-angular/commit/4668e7028c803da8ae4cdfadce5d7ec99f51843b), closes [#620](yeoman/generator-angular/issues/620)) 58 | * **dep:** update and correct Bower dependencies ([9b592ca4](yeoman/generator-angular/commit/9b592ca4ff72f1c6f515fe63ee1088ac53049afc)) 59 | * **docs:** add info about route generator uri option ([fc4bdc5f](yeoman/generator-angular/commit/fc4bdc5fa46677d381aaabacbd1c76f38153cdba), closes [#650](yeoman/generator-angular/issues/650)) 60 | * **gen:** 61 | * update gen-karma and use its new options ([0f768f1d](yeoman/generator-angular/commit/0f768f1d7515b3d884555a8c5c8e3f01d117cf18), closes [#629](yeoman/generator-angular/issues/629)) 62 | * skip adding route to app file ([7a768583](yeoman/generator-angular/commit/7a7685833baf7be7d18c8fc9afedf76098ff64ba), closes [#694](yeoman/generator-angular/issues/694)) 63 | * fix more appPath, other changes ([36317404](yeoman/generator-angular/commit/36317404bee8edece2247ffc99b2f97e2a34ada5)) 64 | * move test into root folder ([53035aa1](yeoman/generator-angular/commit/53035aa18a26393f72769222f82fc7d0f315e46f)) 65 | * update color logging ([6aba417e](yeoman/generator-angular/commit/6aba417e3d7f00e5560142972a56d8211af7a499)) 66 | * move images to common generator ([cf3b6352](yeoman/generator-angular/commit/cf3b63525bb74e7faed36f45af02fc1d276ad7de)) 67 | * consolidate template files ([22f2f2c3](yeoman/generator-angular/commit/22f2f2c3abf3df58a37daec95e6c0e62b9120057)) 68 | * do not use console to display messages ([9f9831f5](yeoman/generator-angular/commit/9f9831f58e849a33d34e62c6f9bedec4d9896616)) 69 | * **misc:** correct typo in readme ([7200ffcf](yeoman/generator-angular/commit/7200ffcf62827a732cd079eb39e22484eeabc139)) 70 | * **test:** 71 | * remove console.log statement ([096efbae](yeoman/generator-angular/commit/096efbae4bb3cddf0eff6e484734d6b8e6867389)) 72 | * remove old Karma testrunner ([bb5b5859](yeoman/generator-angular/commit/bb5b58592100e62588f705a1978f5f40a9d4c141)) 73 | * add test for testing loading ([f9085968](yeoman/generator-angular/commit/f90859684f3cb211508bf05f8d0ca21c9547f5f6)) 74 | * add test for eventual appPath option ([dd155b1f](yeoman/generator-angular/commit/dd155b1fea1a5dd87107e3439398c717a5ece8b5), closes [#630](yeoman/generator-angular/issues/630)) 75 | * **tests:** 76 | * DRY up more code and update test folders ([ea33f7c1](yeoman/generator-angular/commit/ea33f7c169cf2f4b382d3cf34e1b9a463605478e)) 77 | * style and generator updates ([f8b31572](yeoman/generator-angular/commit/f8b31572c1e4a5700d9c81083899eac44ce14f96)) 78 | 79 | 80 | #### Features 81 | 82 | * **app:** 83 | * add ngAnimate and ngTouch options ([0659621b](yeoman/generator-angular/commit/0659621bc7f810a0f128f71d6873550cb01d22f6), closes [#510](yeoman/generator-angular/issues/510)) 84 | * add a second route if ngRoute is chosen ([0d045f52](yeoman/generator-angular/commit/0d045f523880a55fe75cd237972249902c3e0166)) 85 | * specify uri while generating routes ([d3cea019](yeoman/generator-angular/commit/d3cea019117d975194c36c46c0489ea5e97b81dd), closes [#639](yeoman/generator-angular/issues/639)) 86 | * **build:** 87 | * replace grunt-bower-install with grunt-wiredep ([60ef8d18](yeoman/generator-angular/commit/60ef8d18716a549b4204a471903bea9e87be70e8)) 88 | * replace grunt-rev with grunt-filerev ([149f1625](yeoman/generator-angular/commit/149f1625587dbf7ec68050262d1de17ce671e6e2), closes [#564](yeoman/generator-angular/issues/564)) 89 | * open browser when runnning `serve:dist` ([e9239e72](yeoman/generator-angular/commit/e9239e72d489448c71842df26ee3645f483b56e7)) 90 | * **gen:** 91 | * allow --appPath option for all generators ([d3dd42e3](yeoman/generator-angular/commit/d3dd42e3bae58f74b634920992a08bb2f3e28848)) 92 | * add grunt-ngdoc comments ([11edb9b3](yeoman/generator-angular/commit/11edb9b3841f561b6d1afeed1721f4df11fea0cb)) 93 | 94 | 95 | 96 | ## 0.8.0 (2014-03-27) 97 | 98 | 99 | #### Bug Fixes 100 | 101 | * **app:** 102 | * correct adding scripts path to index.html ([5533ad86](http://github.com/yeoman/generator-angular/commit/5533ad86676dab3e165c4a298f7e6428759e7c18)) 103 | * change "Twitter Bootstrap" to "Bootstrap" ([55a79718](http://github.com/yeoman/generator-angular/commit/55a797182cea37501bcdb1622ebb3cf4b578534b)) 104 | * change the script src to lowercase ([c884c91d](http://github.com/yeoman/generator-angular/commit/c884c91d1dba8e47d27a80857ad33bdd33ca7a7f), closes [#557](http://github.com/yeoman/generator-angular/issues/557)) 105 | * **build:** 106 | * don't copy the bower_components folder in build ([4c53ea97](http://github.com/yeoman/generator-angular/commit/4c53ea975d3a776c416e078389a2657ec4e56ac0), closes [#590](http://github.com/yeoman/generator-angular/issues/590)) 107 | * rewrite relative CSS URLs ([996eff82](http://github.com/yeoman/generator-angular/commit/996eff82b0bd11976daf997c69e12dcdcd643683)) 108 | * **generator:** 109 | * require compass only when enabled ([d4630c33](http://github.com/yeoman/generator-angular/commit/d4630c3307df2f55d21753c3e8ed1fe6d232b44b)) 110 | * list coffee dep only when selected ([c9a69807](http://github.com/yeoman/generator-angular/commit/c9a69807ee18517f973161d3902421b2bee4782e)) 111 | * add closing template tag ([3522514f](http://github.com/yeoman/generator-angular/commit/3522514f999c791e2114483cd8a39a172c794a74)) 112 | * add closing template tag ([0f57d2c4](http://github.com/yeoman/generator-angular/commit/0f57d2c4b8a9686d836faeee08ee7caa7f05a507)) 113 | * **template:** remove IE edge header ([01738116](http://github.com/yeoman/generator-angular/commit/017381168132c8d560a3976c0b97b15a4f120727)) 114 | * **test:** update assertFile syntax ([51e46455](http://github.com/yeoman/generator-angular/commit/51e4645524684e7220ccece1800899d2b87a45e6), closes [#554](http://github.com/yeoman/generator-angular/issues/554)) 115 | 116 | 117 | #### Features 118 | 119 | * **app:** 120 | * add glyphicon to test bootstrap fonts ([953a93b6](http://github.com/yeoman/generator-angular/commit/953a93b6dbbfc25f1b5f536e5ddaeeb8b1a24759)) 121 | * remove minsafe options ([c24e2509](http://github.com/yeoman/generator-angular/commit/c24e25097acb109240f687ace7c214b095d3ee77), closes [#452](http://github.com/yeoman/generator-angular/issues/452)) 122 | * **build:** use bowerInstall on `watch` task ([6fbebb05](http://github.com/yeoman/generator-angular/commit/6fbebb057962edc8daf421c858f82f33abe66125)) 123 | * **deps:** 124 | * upgrade AngularJS version ([6c540961](http://github.com/yeoman/generator-angular/commit/6c5409613b30dc37d845cb8aa040760f885f34af)) 125 | * use official Sass version of Bootstrap ([66829f45](http://github.com/yeoman/generator-angular/commit/66829f453ec5fe48dbf4e75f5bc312bb06bc9ace), closes [#607](http://github.com/yeoman/generator-angular/issues/607)) 126 | * upgrade AngularJS + addons to 1.2.14 ([b4d026f3](http://github.com/yeoman/generator-angular/commit/b4d026f350ba1e8ce087fff66d476c72dd505b60)) 127 | * upgrade to grunt-bower-install 1.0 ([6a167895](http://github.com/yeoman/generator-angular/commit/6a1678953bce069b4ac79f68e0959e80cbdbaa3f)) 128 | * upgrade to Angular 1.2.10 ([023da9d2](http://github.com/yeoman/generator-angular/commit/023da9d2327f90e3128e1e7aecf73d0bc1e2660d)) 129 | 130 | 131 | #### Breaking Changes 132 | 133 | * bower_components is no longer copied into the /dist 134 | folder. 135 | ([4c53ea97](http://github.com/yeoman/generator-angular/commit/4c53ea975d3a776c416e078389a2657ec4e56ac0)) 136 | * Removes the --minsafe from the generator. See the 137 | readme for more information about this change 138 | ([c24e2509](http://github.com/yeoman/generator-angular/commit/c24e25097acb109240f687ace7c214b095d3ee77)) 139 | 140 | 141 | 142 | ### v0.7.1 (2013-12-22) 143 | 144 | 145 | #### Bug Fixes 146 | 147 | * **Gruntfile:** correct attribute quoting ([ca765509](http://github.com/yeoman/generator-angular/commit/ca765509b4bf3d827ac40206ea9bb84936b806cc), closes [#521](http://github.com/yeoman/generator-angular/issues/521)) 148 | 149 | 150 | #### Features 151 | 152 | * **app:** upgrade to AngularJS 1.2.6 ([2f7fa90c](http://github.com/yeoman/generator-angular/commit/2f7fa90cc698edb565926fcf6cce77c52f5785ae)) 153 | 154 | 155 | ## v0.7.0 (2013-12-20) 156 | 157 | 158 | #### Bug Fixes 159 | 160 | * **app:** 161 | * copy view files to dist folder ([8a52a265](http://github.com/yeoman/generator-angular/commit/8a52a265aa15a0f589109d6cd1dac4ae7dc5a3e9)) 162 | * only copy CSS if Compass is not installed ([7e586745](http://github.com/yeoman/generator-angular/commit/7e58674585e138c0f2eb81f46ef2cc4f1b9a3bf8)) 163 | * services use classified names ([56a71a83](http://github.com/yeoman/generator-angular/commit/56a71a83cdf90f81bb37b422ba4d40e75d28e1fe), closes [#484](http://github.com/yeoman/generator-angular/issues/484)) 164 | * reload JS files in watch ([d20f5bd2](http://github.com/yeoman/generator-angular/commit/d20f5bd20ba95d47447f8acceee491a0a0ba9724)) 165 | * **build:** deselecting ngRoute does remove route stuff ([a358c1ae](http://github.com/yeoman/generator-angular/commit/a358c1ae69bff6a7708ea0a77248698f931f2e4d), closes [#486](http://github.com/yeoman/generator-angular/issues/486)) 166 | * **deps:** hard-pin angular 1.2.5 ([49c7f980](http://github.com/yeoman/generator-angular/commit/49c7f9802c6d7e9347c73ffe018c36b750342cb1)) 167 | * **gen:** fix bower install prompt during project gen ([706f1336](http://github.com/yeoman/generator-angular/commit/706f1336852923e409d669ae6fc6faeda7bbb017), closes [#505](http://github.com/yeoman/generator-angular/issues/505)) 168 | 169 | 170 | #### Features 171 | 172 | * **app:** 173 | * add jasmine browser global to test jshintrc ([11b6ed42](http://github.com/yeoman/generator-angular/commit/11b6ed42b5e941f25cc305eb5c4e8ba49586cf64)) 174 | * use lowercase file names ([23e5d772](http://github.com/yeoman/generator-angular/commit/23e5d7724e7e02e4b974f4e804f35eca33a53aea), closes [#463](http://github.com/yeoman/generator-angular/issues/463)) 175 | * use htmlmin for smaller HTML files ([2b85a52a](http://github.com/yeoman/generator-angular/commit/2b85a52a054ac8cf1ab86ce1cd3de7819d30ea52), closes [#469](http://github.com/yeoman/generator-angular/issues/469)) 176 | * use grunt-bower-install for dep management ([ba7b5051](http://github.com/yeoman/generator-angular/commit/ba7b505117307059a6d013d838c8aeff6db0e452), closes [#497](http://github.com/yeoman/generator-angular/issues/497)) 177 | * **gen:** 178 | * additional work for compass support ([11cb9943](http://github.com/yeoman/generator-angular/commit/11cb99437271b6e8f6cdaee8fd5fc9cda7a20d1d)) 179 | * add Compass support to the initialization process ([7fac1194](http://github.com/yeoman/generator-angular/commit/7fac1194179df3181f52258b0aa7333799fec253)) 180 | 181 | 182 | #### Breaking Changes 183 | 184 | * Deselecting ngRoute adds controller and ng-include to index.html 185 | ([a358c1ae](http://github.com/yeoman/generator-angular/commit/a358c1ae69bff6a7708ea0a77248698f931f2e4d)) 186 | * `--minsafe` flag is now deprecated. ([f0bb8da2](http://github.com/yeoman/generator-angular/commit/f0bb8da2d67c3f627bf775e2d4f53340b5c980c4), closes [#452](http://github.com/yeoman/generator-angular/issues/452)) 187 | * `grunt server` is now deprecated. Use `grunt serve` instead 188 | ([ef056319](http://github.com/yeoman/generator-angular/commit/ef0563192a9e3fc834ae97e7ec68470bcfdf56eb)) 189 | 190 | 191 | ## v0.6.0 (2013-12-05) 192 | 193 | #### Breaking Changes 194 | 195 | * `grunt server` is being deprecated 196 | ([ef056319](http://github.com/yeoman/generator-angular/commit/ef0563192a9e3fc834ae97e7ec68470bcfdf56eb)) 197 | 198 | #### Bug Fixes 199 | 200 | * **app:** 201 | * use test-specifc jshintrc ([c00c091b](http://github.com/yeoman/generator-angular/commit/c00c091bdca2b55685d81a2b84b002d73aacbdcc)) 202 | * add webapp upstream features and better coffee ([c23acebb](http://github.com/yeoman/generator-angular/commit/c23acebbd8fabd391bfeee0d424f26e59f756a03)) 203 | * use grunt-newer for styles and jshint ([b1eeb68a](http://github.com/yeoman/generator-angular/commit/b1eeb68a8290aee930887fc473034ee7f8e2ccc3)) 204 | * standardize comments and comment out uglify:dist ([d5d3e458](http://github.com/yeoman/generator-angular/commit/d5d3e458e70d054707c70d058454fdd3d94070fe), closes [#455](http://github.com/yeoman/generator-angular/issues/455)) 205 | * only include sass if sass is selected ([597b8b5c](http://github.com/yeoman/generator-angular/commit/597b8b5cfab77b78e7f6091140beda2eeee0ed54), closes [#449](http://github.com/yeoman/generator-angular/issues/449)) 206 | 207 | * **deps:** upgrade dependencies ([3a57216f](http://github.com/yeoman/generator-angular/commit/3a57216ff9e3192db3804634f360253e9fcce69d)) 208 | 209 | * **gen:** 210 | * script paths use forward slashes ([40aa61dc](http://github.com/yeoman/generator-angular/commit/40aa61dcc1bf31918bea3d2ce9a84c93554aa64a), closes [#410](http://github.com/yeoman/generator-angular/issues/410)) 211 | * remove extra "App" from service spec files ([4053f11f](http://github.com/yeoman/generator-angular/commit/4053f11f800280569f5b7396ad015f0a6bcc7b49)) 212 | * options should have descriptions ([da001832](http://github.com/yeoman/generator-angular/commit/da001832dbdb268b3bf38f359c72b40c401273e4)) 213 | 214 | * **template:** remove redundant closing tag ([d1e560e0](http://github.com/yeoman/generator-angular/commit/d1e560e0675ecb70e6c4b59cf4de9df461434a31), closes [#441](http://github.com/yeoman/generator-angular/issues/441)) 215 | * **bootstrap:** some plugins have ordering dependencies ([3da4a130](http://github.com/yeoman/generator-angular/commit/3da4a1301e0b744c7a6054fafff26fff16b6442b)) 216 | * **docs:** Add coffeescript=false to readme ([abd7dc38](http://github.com/yeoman/generator-angular/commit/abd7dc38be0cf511307c784f30d59c9fdcaea3e2)) 217 | * **styles:** update path to icon images ([8daad4f2](http://github.com/yeoman/generator-angular/commit/8daad4f2de9dbde4fcc810527da7c9607e1db8d4)) 218 | 219 | #### Features 220 | 221 | * **app:** 222 | * imagemin handles gifs ([9341eb9b](http://github.com/yeoman/generator-angular/commit/9341eb9b710b95c95407dc54ed4af6aa4a496426)) 223 | * run unit tests when test scripts are changed ([94af0b51](http://github.com/yeoman/generator-angular/commit/94af0b510982b05c5a1939966e96aeccce087500)) 224 | * reload grunt server when gruntfile is updated ([50c6abb9](http://github.com/yeoman/generator-angular/commit/50c6abb9cce09a149253ceb8496feca813a71136)) 225 | * update to angular 1.2.0 ([77082c6b](http://github.com/yeoman/generator-angular/commit/77082c6b8d1dda76579f1970a270dffc359f027f)) 226 | * upgrade to Bootstrap 3.0.1 ([59f4b1ba](http://github.com/yeoman/generator-angular/commit/59f4b1ba73842b758174ad44a7da60af4f4db63f)) 227 | 228 | * **build:** 229 | * compile only changed coffeescript files in watch task ([4196e379](http://github.com/yeoman/generator-angular/commit/4196e37912993ae37812fa19d9378d8b8d2cc9da), closes [#425](http://github.com/yeoman/generator-angular/issues/425)) 230 | * deprecate server in favor of serve ([ef056319](http://github.com/yeoman/generator-angular/commit/ef0563192a9e3fc834ae97e7ec68470bcfdf56eb)) 231 | 232 | * **gen:** 233 | * add image file as example ([b161c298](http://github.com/yeoman/generator-angular/commit/b161c2982d86df1bb3de44cd9fa8aee05fc66ff3)) 234 | * allow app names to have custom suffix ([09f0f7b3](http://github.com/yeoman/generator-angular/commit/09f0f7b3a8c3264b7527bc9fed8c709becec99eb)) 235 | * add option to not add to index ([486ee146](http://github.com/yeoman/generator-angular/commit/486ee14660ac51b7cfcb4b7de50135833954f193)) 236 | 237 | 238 | 239 | ### v0.5.1 (2013-10-22) 240 | 241 | 242 | #### Bug Fixes 243 | 244 | * **app:** test setup in default configuration ([2bebccbd](http://github.com/yeoman/generator-angular/commit/2bebccbdd15d177805440b6d1ec84cc38a2b4678)) 245 | 246 | 247 | ## v0.5.0 (2013-10-17) 248 | 249 | 250 | #### Bug Fixes 251 | 252 | * **app:** 253 | * serve files from correct place ([fe2bad04](http://github.com/yeoman/generator-angular/commit/fe2bad0417b3138fa2788c17abcf7eb5be5f3e91)) 254 | * include bootstrap images for css/scss ([e88dba43](http://github.com/yeoman/generator-angular/commit/e88dba43f2e714d69bca366cade453f49a24b62c), closes [#196](http://github.com/yeoman/generator-angular/issues/196)) 255 | * allow normal javascript to be created ([c8190b55](http://github.com/yeoman/generator-angular/commit/c8190b55284e8c1570cc8fafdc8723250f43829b), closes [#329](http://github.com/yeoman/generator-angular/issues/329), [#316](http://github.com/yeoman/generator-angular/issues/316)) 256 | * conditional include of jquery ([bc1e68e3](http://github.com/yeoman/generator-angular/commit/bc1e68e30450edc16145b934487f6df5eaaddcd8), closes [#362](http://github.com/yeoman/generator-angular/issues/362)) 257 | * **build:** 258 | * remove references to global yeomanConfig ([a0f16e26](http://github.com/yeoman/generator-angular/commit/a0f16e265729586802121c0fe3111f974e5145ec)) 259 | * update to grunt-contrib-connect 0.5.0 ([67c0ebf0](http://github.com/yeoman/generator-angular/commit/67c0ebf081889658a33bc690c530c3c8bc8a2c12)) 260 | * update to grunt-contrib-connect 0.4.0 ([368ad7f9](http://github.com/yeoman/generator-angular/commit/368ad7f9a16be0ee67e5182be581669017788f16)) 261 | * **docs:** fixed typo in readme ([a967907c](http://github.com/yeoman/generator-angular/commit/a967907cf523bac752b3fa9ea6363767d8855162)) 262 | * **generator:** add app modules dependency to app ([a45b71c9](http://github.com/yeoman/generator-angular/commit/a45b71c95c18deb85ff7a1538c0b0744e4faa508), closes [#230](http://github.com/yeoman/generator-angular/issues/230)) 263 | * **templates:** 264 | * Gruntfile indentation ([6f7d17e2](http://github.com/yeoman/generator-angular/commit/6f7d17e2a0f1f7f9f8cac3157beb07b82e8cf400)) 265 | * take out semicolons in coffeescript ([e38124ee](http://github.com/yeoman/generator-angular/commit/e38124eeb369b7741adc263f1763c618a918ee65)) 266 | * correct coffee provider template ([86aefe5d](http://github.com/yeoman/generator-angular/commit/86aefe5da49abe82e054666641f8ee4bdc8d555e)) 267 | * value generator should use value template ([67d0c5ad](http://github.com/yeoman/generator-angular/commit/67d0c5ad5cbc58a2dfcfd8f3db1f45be21afe357)) 268 | * **test:** update tests to match service files ([c30464c3](http://github.com/yeoman/generator-angular/commit/c30464c3a5216169026c23a6fea23d273bd0b948), closes [#338](http://github.com/yeoman/generator-angular/issues/338), [#354](http://github.com/yeoman/generator-angular/issues/354)) 269 | * **views:** correct path for sub views ([0568e744](http://github.com/yeoman/generator-angular/commit/0568e74446c5a8e28d2cea1a9a9a5886be190d7d), closes [#359](http://github.com/yeoman/generator-angular/issues/359)) 270 | 271 | 272 | ## v0.4.0 (2013-08-21) 273 | 274 | 275 | #### Bug Fixes 276 | 277 | * **cli:** fix typo in angular:view generator usage ([d62c2e34](http://github.com/yeoman/generator-angular/commit/d62c2e348bcc61a6794ca23df02b6cce3c79d993)) 278 | * **coffee:** 279 | * remove extraneous commas and returns ([6df875cd](http://github.com/yeoman/generator-angular/commit/6df875cd7167aa4a4e9f98a82d2f7fba98a20b0b)) 280 | * remove the semi-colon from the coffee script templates ([cd46aa88](http://github.com/yeoman/generator-angular/commit/cd46aa88953e60d81dfef64b999f751dc4468ab7)) 281 | * **docs:** 282 | * add decorator generator description ([85f07648](http://github.com/yeoman/generator-angular/commit/85f076485ffabf790fe0b7d55b7e3def3a041a6d)) 283 | * add contributing info to contributing file ([2461aad0](http://github.com/yeoman/generator-angular/commit/2461aad08afe186995d737a1d3dd595c20ec3fb3)) 284 | * **readme:** Remove `yo` installation step ([21f00e50](http://github.com/yeoman/generator-angular/commit/21f00e50571d272d19aea1431177f2d7157ee7be)) 285 | * **templates:** 286 | * removed grunt-karma from deps ([19a796f7](http://github.com/yeoman/generator-angular/commit/19a796f71925b6b33232d8a9a8b4f712de80ec40)) 287 | * classify services registered with .service ([8e1d6fdf](http://github.com/yeoman/generator-angular/commit/8e1d6fdf0d3ef23cf0670512295e03cc0f4516d6)) 288 | * new scope for directive spec ([2753c990](http://github.com/yeoman/generator-angular/commit/2753c990dbdc8efc7a5f245868cd10f15080c140)) 289 | * **test:** Add correct paths to generated files ([1d6f3fbf](http://github.com/yeoman/generator-angular/commit/1d6f3fbfcc315316a44b468418918afaad871f57)) 290 | * **wording:** clarify compass/scss feature prompt ([5521fd73](http://github.com/yeoman/generator-angular/commit/5521fd73d396763568b5e7c08043a82a4e8864a9)) 291 | 292 | 293 | #### Features 294 | 295 | * **build:** 296 | * generate karma 0.10 config ([e1cb2067](http://github.com/yeoman/generator-angular/commit/e1cb206710f54c8bea6ed8870566ac4c3e248b40)) 297 | * add autoprefixer support ([c4dfd61d](http://github.com/yeoman/generator-angular/commit/c4dfd61d860f86a97026d1e5188ab78a87f4e6a1), closes [#317](http://github.com/yeoman/generator-angular/issues/317)) 298 | * switch to use load-grunt-tasks ([4e030c78](http://github.com/yeoman/generator-angular/commit/4e030c78387ec2a60581ff6346b707c98ddb2508)) 299 | * show elapsed time for grunt tasks ([cacdd0fb](http://github.com/yeoman/generator-angular/commit/cacdd0fb5815355f6e35343c53e876352e622180)) 300 | * **coffee:** generate source maps for coffeescript ([38a872b3](http://github.com/yeoman/generator-angular/commit/38a872b31e9ccef1aac76bec330c3490303abdac)) 301 | * **gen:** Change ga.js to analytics.js ([17ae9e63](http://github.com/yeoman/generator-angular/commit/17ae9e63b2d11d271b36282bb34567b716099cb9)) 302 | 303 | 304 | ## v0.3.1 (2013-07-24) 305 | 306 | 307 | #* **Bug Fixes:** 308 | 309 | * **app:** 310 | * order of script inclusions ([9919b2d0](http://github.com/yeoman/generator-angular/commit/9919b2d0bb749cbe5e795608c2b93c3504e3298b), closes [#278](http://github.com/yeoman/generator-angular/issues/278)) 311 | * copy glyphicons for sass ([2c458009](http://github.com/yeoman/generator-angular/commit/2c4580096572678de6212c8592fb553c10b3a4c0), closes [#269](http://github.com/yeoman/generator-angular/issues/269)) 312 | * add jQuery \' 98 | ] 99 | }); 100 | } catch (e) { 101 | this.log.error(chalk.yellow( 102 | '\nUnable to find ' + fullPath + '. Reference to ' + script + '.js ' + 'not added.\n' 103 | )); 104 | } 105 | }; 106 | 107 | Generator.prototype.generateSourceAndTest = function (appTemplate, testTemplate, targetDirectory, skipAdd) { 108 | // Services use classified names 109 | if (this.generatorName.toLowerCase() === 'service') { 110 | this.cameledName = this.classedName; 111 | } 112 | 113 | this.appTemplate(appTemplate, path.join('scripts', targetDirectory, this.name)); 114 | this.testTemplate(testTemplate, path.join(targetDirectory, this.name)); 115 | if (!skipAdd) { 116 | this.addScriptToIndex(path.join(targetDirectory, this.name)); 117 | } 118 | }; 119 | -------------------------------------------------------------------------------- /service/USAGE: -------------------------------------------------------------------------------- 1 | Description: 2 | Creates a new AngularJS service. 3 | Docs: http://docs.angularjs.org/guide/dev_guide.services.creating_services 4 | 5 | Example: 6 | yo angular-php:service thing [--coffee] 7 | 8 | This will create: 9 | app/scripts/services/thing.js 10 | -------------------------------------------------------------------------------- /service/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var util = require('util'); 3 | var ScriptBase = require('../script-base.js'); 4 | 5 | 6 | var Generator = module.exports = function Generator() { 7 | ScriptBase.apply(this, arguments); 8 | }; 9 | 10 | util.inherits(Generator, ScriptBase); 11 | 12 | Generator.prototype.createServiceFiles = function createServiceFiles() { 13 | this.generateSourceAndTest( 14 | 'service/service', 15 | 'spec/service', 16 | 'services', 17 | this.options['skip-add'] || false 18 | ); 19 | }; 20 | -------------------------------------------------------------------------------- /templates/coffeescript/app.coffee: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | ###* 4 | # @ngdoc overview 5 | # @name <%= scriptAppName %> 6 | # @description 7 | # # <%= scriptAppName %> 8 | # 9 | # Main module of the application. 10 | ### 11 | angular 12 | .module('<%= scriptAppName %>', [<%= angularModules %>])<% if (ngRoute) { %> 13 | .config ($routeProvider) -> 14 | $routeProvider 15 | .when '/', 16 | templateUrl: 'views/main.html' 17 | controller: 'MainCtrl' 18 | .otherwise 19 | redirectTo: '/' 20 | <% } %> 21 | -------------------------------------------------------------------------------- /templates/coffeescript/controller.coffee: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | ###* 4 | # @ngdoc function 5 | # @name <%= scriptAppName %>.controller:<%= classedName %>Ctrl 6 | # @description 7 | # # <%= classedName %>Ctrl 8 | # Controller of the <%= scriptAppName %> 9 | ### 10 | angular.module('<%= scriptAppName %>') 11 | .controller '<%= classedName %>Ctrl', ($scope) -> 12 | $scope.awesomeThings = [ 13 | 'HTML5 Boilerplate' 14 | 'AngularJS' 15 | 'Karma' 16 | ] 17 | -------------------------------------------------------------------------------- /templates/coffeescript/decorator.coffee: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | ###* 4 | # @ngdoc function 5 | # @name <%= scriptAppName %>.decorator:<%= classedName %> 6 | # @description 7 | # # <%= classedName %> 8 | # Decorator of the <%= scriptAppName %> 9 | ### 10 | angular.module("<%= scriptAppName %>").config ($provide) -> 11 | $provide.decorator "<%= cameledName %>", ($delegate) -> 12 | # decorate the $delegate 13 | $delegate 14 | -------------------------------------------------------------------------------- /templates/coffeescript/directive.coffee: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | ###* 4 | # @ngdoc directive 5 | # @name <%= scriptAppName %>.directive:<%= cameledName %> 6 | # @description 7 | # # <%= cameledName %> 8 | ### 9 | angular.module('<%= scriptAppName %>') 10 | .directive('<%= cameledName %>', -> 11 | template: '
' 12 | restrict: 'E' 13 | link: (scope, element, attrs) -> 14 | element.text 'this is the <%= cameledName %> directive' 15 | ) 16 | -------------------------------------------------------------------------------- /templates/coffeescript/filter.coffee: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | ###* 4 | # @ngdoc filter 5 | # @name <%= scriptAppName %>.filter:<%= cameledName %> 6 | # @function 7 | # @description 8 | # # <%= cameledName %> 9 | # Filter in the <%= scriptAppName %>. 10 | ### 11 | angular.module('<%= scriptAppName %>') 12 | .filter '<%= cameledName %>', -> 13 | (input) -> 14 | '<%= cameledName %> filter: ' + input 15 | -------------------------------------------------------------------------------- /templates/coffeescript/service/constant.coffee: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | ###* 4 | # @ngdoc service 5 | # @name <%= scriptAppName %>.<%= cameledName %> 6 | # @description 7 | # # <%= cameledName %> 8 | # Constant in the <%= scriptAppName %>. 9 | ### 10 | angular.module('<%= scriptAppName %>') 11 | .constant '<%= cameledName %>', 42 12 | -------------------------------------------------------------------------------- /templates/coffeescript/service/factory.coffee: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | ###* 4 | # @ngdoc service 5 | # @name <%= scriptAppName %>.<%= cameledName %> 6 | # @description 7 | # # <%= cameledName %> 8 | # Factory in the <%= scriptAppName %>. 9 | ### 10 | angular.module('<%= scriptAppName %>') 11 | .factory '<%= cameledName %>', -> 12 | # Service logic 13 | # ... 14 | 15 | meaningOfLife = 42 16 | 17 | # Public API here 18 | { 19 | someMethod: -> 20 | meaningOfLife 21 | } 22 | -------------------------------------------------------------------------------- /templates/coffeescript/service/provider.coffee: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | ###* 4 | # @ngdoc service 5 | # @name <%= scriptAppName %>.<%= cameledName %> 6 | # @description 7 | # # <%= cameledName %> 8 | # Provider in the <%= scriptAppName %>. 9 | ### 10 | angular.module('<%= scriptAppName %>') 11 | .provider '<%= cameledName %>', -> 12 | 13 | # Private variables 14 | salutation = 'Hello' 15 | 16 | # Private constructor 17 | class Greeter 18 | @greet = -> 19 | salutation 20 | 21 | # Public API for configuration 22 | @setSalutation = (s) -> 23 | salutation = s 24 | 25 | # Method for instantiating 26 | @$get = -> 27 | new Greeter() 28 | 29 | return 30 | -------------------------------------------------------------------------------- /templates/coffeescript/service/service.coffee: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | ###* 4 | # @ngdoc service 5 | # @name <%= scriptAppName %>.<%= cameledName %> 6 | # @description 7 | # # <%= cameledName %> 8 | # Service in the <%= scriptAppName %>. 9 | ### 10 | angular.module('<%= scriptAppName %>') 11 | .service '<%= classedName %>', -> 12 | # AngularJS will instantiate a singleton by calling "new" on this function 13 | -------------------------------------------------------------------------------- /templates/coffeescript/service/value.coffee: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | ###* 4 | # @ngdoc service 5 | # @name <%= scriptAppName %>.<%= cameledName %> 6 | # @description 7 | # # <%= cameledName %> 8 | # Value in the <%= scriptAppName %>. 9 | ### 10 | angular.module('<%= scriptAppName %>') 11 | .value '<%= cameledName %>', 42 12 | -------------------------------------------------------------------------------- /templates/coffeescript/spec/controller.coffee: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | describe 'Controller: <%= classedName %>Ctrl', -> 4 | 5 | # load the controller's module 6 | beforeEach module '<%= scriptAppName %>' 7 | 8 | <%= classedName %>Ctrl = {} 9 | scope = {} 10 | 11 | # Initialize the controller and a mock scope 12 | beforeEach inject ($controller, $rootScope) -> 13 | scope = $rootScope.$new() 14 | <%= classedName %>Ctrl = $controller '<%= classedName %>Ctrl', { 15 | $scope: scope 16 | } 17 | 18 | it 'should attach a list of awesomeThings to the scope', -> 19 | expect(scope.awesomeThings.length).toBe 3 20 | -------------------------------------------------------------------------------- /templates/coffeescript/spec/directive.coffee: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | describe 'Directive: <%= cameledName %>', -> 4 | 5 | # load the directive's module 6 | beforeEach module '<%= scriptAppName %>' 7 | 8 | scope = {} 9 | 10 | beforeEach inject ($controller, $rootScope) -> 11 | scope = $rootScope.$new() 12 | 13 | it 'should make hidden element visible', inject ($compile) -> 14 | element = angular.element '<<%= _.dasherize(name) %>><%= _.dasherize(name) %>>' 15 | element = $compile(element) scope 16 | expect(element.text()).toBe 'this is the <%= cameledName %> directive' 17 | -------------------------------------------------------------------------------- /templates/coffeescript/spec/filter.coffee: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | describe 'Filter: <%= cameledName %>', -> 4 | 5 | # load the filter's module 6 | beforeEach module '<%= scriptAppName %>' 7 | 8 | # initialize a new instance of the filter before each test 9 | <%= cameledName %> = {} 10 | beforeEach inject ($filter) -> 11 | <%= cameledName %> = $filter '<%= cameledName %>' 12 | 13 | it 'should return the input prefixed with "<%= cameledName %> filter:"', -> 14 | text = 'angularjs' 15 | expect(<%= cameledName %> text).toBe ('<%= cameledName %> filter: ' + text) 16 | -------------------------------------------------------------------------------- /templates/coffeescript/spec/service.coffee: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | describe 'Service: <%= cameledName %>', -> 4 | 5 | # load the service's module 6 | beforeEach module '<%= scriptAppName %>' 7 | 8 | # instantiate service 9 | <%= cameledName %> = {} 10 | beforeEach inject (_<%= cameledName %>_) -> 11 | <%= cameledName %> = _<%= cameledName %>_ 12 | 13 | it 'should do something', -> 14 | expect(!!<%= cameledName %>).toBe true 15 | -------------------------------------------------------------------------------- /templates/common/app/.buildignore: -------------------------------------------------------------------------------- 1 | *.coffee -------------------------------------------------------------------------------- /templates/common/app/.htaccess: -------------------------------------------------------------------------------- 1 | # Apache Configuration File 2 | 3 | # (!) Using `.htaccess` files slows down Apache, therefore, if you have access 4 | # to the main server config file (usually called `httpd.conf`), you should add 5 | # this logic there: http://httpd.apache.org/docs/current/howto/htaccess.html. 6 | 7 | # ############################################################################## 8 | # # CROSS-ORIGIN RESOURCE SHARING (CORS) # 9 | # ############################################################################## 10 | 11 | # ------------------------------------------------------------------------------ 12 | # | Cross-domain AJAX requests | 13 | # ------------------------------------------------------------------------------ 14 | 15 | # Enable cross-origin AJAX requests. 16 | # http://code.google.com/p/html5security/wiki/CrossOriginRequestSecurity 17 | # http://enable-cors.org/ 18 | 19 | #Sorry, but the page you were trying to view does not exist.
146 |It looks like this was the result of either:
147 |Loading...
13 | 14 |{{thing.description}}
17 |Loading...
18 |{{thing.error.description}}
22 |{{error.description}}
29 |This is the <%= name %> view.
2 | -------------------------------------------------------------------------------- /templates/common/root/.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 | # Due to a bug in the EditorConfig for SublimeText, we set tab indentation for 8 | # all files and we set exceptions for all files with an extension 9 | 10 | [*] 11 | indent_style = tab 12 | indent_size = 4 13 | 14 | end_of_line = lf 15 | charset = utf-8 16 | trim_trailing_whitespace = true 17 | insert_final_newline = true 18 | 19 | [*.*] 20 | indent_style = space 21 | indent_size = 2 22 | 23 | [*.php] 24 | indent_size = 4 25 | 26 | [*.md] 27 | trim_trailing_whitespace = false 28 | -------------------------------------------------------------------------------- /templates/common/root/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto -------------------------------------------------------------------------------- /templates/common/root/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "browser": true, 4 | "esnext": true, 5 | "bitwise": true, 6 | "camelcase": true, 7 | "curly": true, 8 | "eqeqeq": true, 9 | "immed": true, 10 | "indent": 2, 11 | "latedef": true, 12 | "newcap": true, 13 | "noarg": true, 14 | "quotmark": "single", 15 | "regexp": true, 16 | "undef": true, 17 | "unused": true, 18 | "strict": true, 19 | "trailing": true, 20 | "smarttabs": true, 21 | "globals": { 22 | "angular": false 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /templates/common/root/_Gruntfile.js: -------------------------------------------------------------------------------- 1 | // Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %> 2 | 'use strict'; 3 | 4 | // # Globbing 5 | // for performance reasons we're only matching one level down: 6 | // 'test/spec/{,*/}*.js' 7 | // use this if you want to recursively match all subfolders: 8 | // 'test/spec/**/*.js' 9 | 10 | module.exports = function (grunt) { 11 | 12 | // Load grunt tasks automatically 13 | require('load-grunt-tasks')(grunt); 14 | 15 | // Time how long tasks take. Can help when optimizing build times 16 | require('time-grunt')(grunt); 17 | 18 | // grunt-connect-proxy middleware to serve PHP 19 | var proxyMiddleware = function (connect, options) { 20 | var middlewares = []; 21 | var directory = options.directory || options.base[options.base.length - 1]; 22 | if (!Array.isArray(options.base)) { 23 | options.base = [options.base]; 24 | } 25 | 26 | // Setup the proxy 27 | middlewares.push(require('grunt-connect-proxy/lib/utils').proxyRequest); 28 | 29 | options.base.forEach(function(base) { 30 | // Serve static files. 31 | middlewares.push(connect.static(base)); 32 | }); 33 | 34 | // Make directory browse-able. 35 | middlewares.push(connect.directory(directory)); 36 | 37 | return middlewares; 38 | }; 39 | 40 | // Configurable paths for the application 41 | var appConfig = { 42 | app: require('./bower.json').appPath || 'app', 43 | dist: 'dist' 44 | }; 45 | 46 | // Define the configuration for all the tasks 47 | grunt.initConfig({ 48 | 49 | // Project settings 50 | yeoman: appConfig, 51 | 52 | // Watches files for changes and runs tasks based on the changed files 53 | watch: { 54 | bower: { 55 | files: ['bower.json'], 56 | tasks: ['wiredep'] 57 | },<% if (coffee) { %> 58 | coffee: { 59 | files: ['<%%= yeoman.app %>/scripts/{,*/}*.{coffee,litcoffee,coffee.md}'], 60 | tasks: ['newer:coffee:dist'] 61 | }, 62 | coffeeTest: { 63 | files: ['test/spec/{,*/}*.{coffee,litcoffee,coffee.md}'], 64 | tasks: ['newer:coffee:test', 'karma'] 65 | },<% } else { %> 66 | js: { 67 | files: ['<%%= yeoman.app %>/scripts/{,*/}*.js'], 68 | tasks: ['newer:jshint:all'], 69 | options: { 70 | livereload: '<%%= connect.options.livereload %>' 71 | } 72 | }, 73 | jsTest: { 74 | files: ['test/spec/{,*/}*.js'], 75 | tasks: ['newer:jshint:test', 'karma'] 76 | },<% } %><% if (compass) { %> 77 | compass: { 78 | files: ['<%%= yeoman.app %>/styles/{,*/}*.{scss,sass}'], 79 | tasks: ['compass:server', 'autoprefixer'] 80 | },<% } else { %> 81 | styles: { 82 | files: ['<%%= yeoman.app %>/styles/{,*/}*.css'], 83 | tasks: ['newer:copy:styles', 'autoprefixer'] 84 | },<% } %> 85 | gruntfile: { 86 | files: ['Gruntfile.js'] 87 | }, 88 | livereload: { 89 | options: { 90 | livereload: '<%%= connect.options.livereload %>' 91 | }, 92 | files: [ 93 | '<%%= yeoman.app %>/api/{,{config,src,tests}/**/}/*', 94 | '<%%= yeoman.app %>/{,*/}*.html', 95 | '.tmp/styles/{,*/}*.css',<% if (coffee) { %> 96 | '.tmp/scripts/{,*/}*.js',<% } %> 97 | '<%%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}' 98 | ] 99 | }, 100 | phpTest: { 101 | files: ['<%%= yeoman.app %>/api/{,{config,src,tests}/**/}/*'], 102 | tasks: ['shell:phpTest'] 103 | } 104 | }, 105 | 106 | // The actual grunt server settings 107 | connect: { 108 | options: { 109 | port: 9000, 110 | // Change this to '0.0.0.0' to access the server from outside. 111 | hostname: 'localhost', 112 | livereload: 35729 113 | }, 114 | proxies: [ 115 | { 116 | context: '/api', 117 | host: 'localhost', 118 | port: '<%%= php.options.port %>' 119 | } 120 | ], 121 | livereload: { 122 | options: { 123 | open: true, 124 | middleware: function (connect, options) { 125 | return [ 126 | connect.static('.tmp'), 127 | connect().use( 128 | '/bower_components', 129 | connect.static('./bower_components') 130 | ), 131 | connect.static(appConfig.app) 132 | ].concat(proxyMiddleware(connect, options)); 133 | } 134 | } 135 | }, 136 | test: { 137 | options: { 138 | port: 9001, 139 | middleware: function (connect, options) { 140 | return [ 141 | connect.static('.tmp'), 142 | connect.static('test'), 143 | connect().use( 144 | '/bower_components', 145 | connect.static('./bower_components') 146 | ), 147 | connect.static(appConfig.app) 148 | ].concat(proxyMiddleware(connect, options)); 149 | } 150 | } 151 | }, 152 | dist: { 153 | options: { 154 | open: true, 155 | base: '<%%= yeoman.dist %>', 156 | middleware: proxyMiddleware 157 | } 158 | } 159 | }, 160 | 161 | // PHP built-in server 162 | php: { 163 | options: { 164 | port: 8000, 165 | // Change this to '0.0.0.0' to access the server from outside. 166 | hostname: '127.0.0.1', 167 | router: 'api/index.php' 168 | }, 169 | server: { 170 | options: { 171 | base: '<%%= yeoman.app %>', 172 | } 173 | }, 174 | dist: { 175 | options: { 176 | base: '<%%= yeoman.dist %>', 177 | } 178 | } 179 | }, 180 | 181 | // Make sure code styles are up to par and there are no obvious mistakes 182 | jshint: { 183 | options: { 184 | jshintrc: '.jshintrc', 185 | reporter: require('jshint-stylish') 186 | }, 187 | all: { 188 | src: [ 189 | 'Gruntfile.js'<% if (!coffee) { %>, 190 | '<%%= yeoman.app %>/scripts/{,*/}*.js'<% } %> 191 | ] 192 | }<% if (!coffee) { %>, 193 | test: { 194 | options: { 195 | jshintrc: 'test/.jshintrc' 196 | }, 197 | src: ['test/spec/{,*/}*.js'] 198 | }<% } %> 199 | }, 200 | 201 | // Empties folders to start fresh 202 | clean: { 203 | dist: { 204 | files: [{ 205 | dot: true, 206 | src: [ 207 | '.tmp', 208 | '<%%= yeoman.dist %>/{,*/}*', 209 | '!<%%= yeoman.dist %>/.git*' 210 | ] 211 | }] 212 | }, 213 | server: '.tmp' 214 | }, 215 | 216 | // Add vendor prefixed styles 217 | autoprefixer: { 218 | options: { 219 | browsers: ['last 1 version'] 220 | }, 221 | dist: { 222 | files: [{ 223 | expand: true, 224 | cwd: '.tmp/styles/', 225 | src: '{,*/}*.css', 226 | dest: '.tmp/styles/' 227 | }] 228 | } 229 | }, 230 | 231 | // Automatically inject Bower components into the app 232 | wiredep: { 233 | options: { 234 | cwd: '<%= yeoman.app %>' 235 | }, 236 | app: { 237 | src: ['<%%= yeoman.app %>/index.html'], 238 | ignorePath: /..\// 239 | }<% if (compass) { %>, 240 | sass: { 241 | src: ['<%%= yeoman.app %>/styles/{,*/}*.{scss,sass}'], 242 | ignorePath: /(\.\.\/){1,2}bower_components\// 243 | }<% } %> 244 | },<% if (coffee) { %> 245 | 246 | // Compiles CoffeeScript to JavaScript 247 | coffee: { 248 | options: { 249 | sourceMap: true, 250 | sourceRoot: '' 251 | }, 252 | dist: { 253 | files: [{ 254 | expand: true, 255 | cwd: '<%%= yeoman.app %>/scripts', 256 | src: '{,*/}*.coffee', 257 | dest: '.tmp/scripts', 258 | ext: '.js' 259 | }] 260 | }, 261 | test: { 262 | files: [{ 263 | expand: true, 264 | cwd: 'test/spec', 265 | src: '{,*/}*.coffee', 266 | dest: '.tmp/spec', 267 | ext: '.js' 268 | }] 269 | } 270 | },<% } %><% if (compass) { %> 271 | 272 | // Compiles Sass to CSS and generates necessary files if requested 273 | compass: { 274 | options: { 275 | sassDir: '<%%= yeoman.app %>/styles', 276 | cssDir: '.tmp/styles', 277 | generatedImagesDir: '.tmp/images/generated', 278 | imagesDir: '<%%= yeoman.app %>/images', 279 | javascriptsDir: '<%%= yeoman.app %>/scripts', 280 | fontsDir: '<%%= yeoman.app %>/styles/fonts', 281 | importPath: './bower_components', 282 | httpImagesPath: '/images', 283 | httpGeneratedImagesPath: '/images/generated', 284 | httpFontsPath: '/styles/fonts', 285 | relativeAssets: false, 286 | assetCacheBuster: false, 287 | raw: 'Sass::Script::Number.precision = 10\n' 288 | }, 289 | dist: { 290 | options: { 291 | generatedImagesDir: '<%%= yeoman.dist %>/images/generated' 292 | } 293 | }, 294 | server: { 295 | options: { 296 | debugInfo: true 297 | } 298 | } 299 | },<% } %> 300 | 301 | // Renames files for browser caching purposes 302 | filerev: { 303 | dist: { 304 | src: [ 305 | '<%%= yeoman.dist %>/scripts/{,*/}*.js', 306 | '<%%= yeoman.dist %>/styles/{,*/}*.css', 307 | '<%%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}', 308 | '<%%= yeoman.dist %>/styles/fonts/*' 309 | ] 310 | } 311 | }, 312 | 313 | // Reads HTML for usemin blocks to enable smart builds that automatically 314 | // concat, minify and revision files. Creates configurations in memory so 315 | // additional tasks can operate on them 316 | useminPrepare: { 317 | html: '<%%= yeoman.app %>/index.html', 318 | options: { 319 | dest: '<%%= yeoman.dist %>', 320 | flow: { 321 | html: { 322 | steps: { 323 | js: ['concat', 'uglifyjs'], 324 | css: ['cssmin'] 325 | }, 326 | post: {} 327 | } 328 | } 329 | } 330 | }, 331 | 332 | // Performs rewrites based on filerev and the useminPrepare configuration 333 | usemin: { 334 | html: ['<%%= yeoman.dist %>/{,*/}*.html'], 335 | css: ['<%%= yeoman.dist %>/styles/{,*/}*.css'], 336 | options: { 337 | assetsDirs: ['<%%= yeoman.dist %>','<%%= yeoman.dist %>/images'] 338 | } 339 | }, 340 | 341 | // The following *-min tasks will produce minified files in the dist folder 342 | // By default, your `index.html`'s will take care of 343 | // minification. These next options are pre-configured if you do not wish 344 | // to use the Usemin blocks. 345 | // cssmin: { 346 | // dist: { 347 | // files: { 348 | // '<%%= yeoman.dist %>/styles/main.css': [ 349 | // '.tmp/styles/{,*/}*.css' 350 | // ] 351 | // } 352 | // } 353 | // }, 354 | // uglify: { 355 | // dist: { 356 | // files: { 357 | // '<%%= yeoman.dist %>/scripts/scripts.js': [ 358 | // '<%%= yeoman.dist %>/scripts/scripts.js' 359 | // ] 360 | // } 361 | // } 362 | // }, 363 | // concat: { 364 | // dist: {} 365 | // }, 366 | 367 | imagemin: { 368 | dist: { 369 | files: [{ 370 | expand: true, 371 | cwd: '<%%= yeoman.app %>/images', 372 | src: '{,*/}*.{png,jpg,jpeg,gif}', 373 | dest: '<%%= yeoman.dist %>/images' 374 | }] 375 | } 376 | }, 377 | 378 | svgmin: { 379 | dist: { 380 | files: [{ 381 | expand: true, 382 | cwd: '<%%= yeoman.app %>/images', 383 | src: '{,*/}*.svg', 384 | dest: '<%%= yeoman.dist %>/images' 385 | }] 386 | } 387 | }, 388 | 389 | htmlmin: { 390 | dist: { 391 | options: { 392 | collapseWhitespace: true, 393 | conservativeCollapse: true, 394 | collapseBooleanAttributes: true, 395 | removeCommentsFromCDATA: true, 396 | removeOptionalTags: true 397 | }, 398 | files: [{ 399 | expand: true, 400 | cwd: '<%%= yeoman.dist %>', 401 | src: ['*.html', 'views/{,*/}*.html'], 402 | dest: '<%%= yeoman.dist %>' 403 | }] 404 | } 405 | }, 406 | 407 | // ngmin tries to make the code safe for minification automatically by 408 | // using the Angular long form for dependency injection. It doesn't work on 409 | // things like resolve or inject so those have to be done manually. 410 | ngmin: { 411 | dist: { 412 | files: [{ 413 | expand: true, 414 | cwd: '.tmp/concat/scripts', 415 | src: '*.js', 416 | dest: '.tmp/concat/scripts' 417 | }] 418 | } 419 | }, 420 | 421 | // Replace Google CDN references 422 | cdnify: { 423 | dist: { 424 | html: ['<%%= yeoman.dist %>/*.html'] 425 | } 426 | }, 427 | 428 | // Copies remaining files to places other tasks can use 429 | copy: { 430 | dist: { 431 | files: [{ 432 | expand: true, 433 | dot: true, 434 | cwd: '<%%= yeoman.app %>', 435 | dest: '<%%= yeoman.dist %>', 436 | src: [ 437 | 'api/{{config,src,vendor}/**,index.php,.htaccess}', 438 | '*.{ico,png,txt}', 439 | '.htaccess', 440 | '*.html', 441 | 'views/{,*/}*.html', 442 | 'images/{,*/}*.{webp}', 443 | 'fonts/*' 444 | ] 445 | }, { 446 | expand: true, 447 | cwd: '.tmp/images', 448 | dest: '<%%= yeoman.dist %>/images', 449 | src: ['generated/*'] 450 | }<% if (bootstrap) { %>, { 451 | expand: true, 452 | cwd: '<% if (!compassBootstrap) { 453 | %>bower_components/bootstrap/dist<% 454 | } else { 455 | %>.<% 456 | } %>', 457 | src: '<% if (compassBootstrap) { 458 | %>bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap<% 459 | } else { %>fonts<% } 460 | %>/*', 461 | dest: '<%%= yeoman.dist %>' 462 | }<% } %>] 463 | }, 464 | styles: { 465 | expand: true, 466 | cwd: '<%%= yeoman.app %>/styles', 467 | dest: '.tmp/styles/', 468 | src: '{,*/}*.css' 469 | } 470 | }, 471 | 472 | // Run some tasks in parallel to speed up the build process 473 | concurrent: { 474 | server: [<% if (coffee) { %> 475 | 'coffee:dist',<% } %><% if (compass) { %> 476 | 'compass:server'<% } else { %> 477 | 'copy:styles'<% } %> 478 | ], 479 | test: [<% if (coffee) { %> 480 | 'coffee',<% } %><% if (compass) { %> 481 | 'compass'<% } else { %> 482 | 'copy:styles'<% } %> 483 | ], 484 | dist: [<% if (coffee) { %> 485 | 'coffee',<% } %><% if (compass) { %> 486 | 'compass:dist',<% } else { %> 487 | 'copy:styles',<% } %> 488 | 'imagemin', 489 | 'svgmin' 490 | ] 491 | }, 492 | 493 | shell: { 494 | options: { 495 | stdout: true, 496 | stderr: true, 497 | failOnError: true 498 | }, 499 | phpTest: { 500 | command: 'make --directory <%%= yeoman.app %>/api test' 501 | }, 502 | phpUpdate: { 503 | command: 'make --directory <%%= yeoman.app %>/api update' 504 | } 505 | }, 506 | 507 | // Test settings 508 | karma: { 509 | unit: { 510 | configFile: 'test/karma.conf.<% if (coffee) { 511 | %>coffee<% } else { 512 | %>js<% } 513 | %>', 514 | singleRun: true 515 | } 516 | } 517 | }); 518 | 519 | 520 | grunt.registerTask('serve', 'Compile then start a connect web server', function (target) { 521 | if (target === 'dist') { 522 | return grunt.task.run([ 523 | 'build', 524 | 'configureProxies', 525 | 'php:dist', 526 | 'connect:dist:keepalive' 527 | ]); 528 | } 529 | 530 | grunt.task.run([ 531 | 'clean:server', 532 | 'wiredep', 533 | 'concurrent:server', 534 | 'autoprefixer', 535 | 'configureProxies', 536 | 'php:server', 537 | 'connect:livereload', 538 | 'watch' 539 | ]); 540 | }); 541 | 542 | grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) { 543 | grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.'); 544 | grunt.task.run(['serve:' + target]); 545 | }); 546 | 547 | grunt.registerTask('test', [ 548 | 'clean:server', 549 | 'shell:phpTest', 550 | 'concurrent:test', 551 | 'autoprefixer', 552 | 'connect:test', 553 | 'karma' 554 | ]); 555 | 556 | grunt.registerTask('build', [ 557 | 'clean:dist', 558 | 'shell:phpUpdate', 559 | 'wiredep', 560 | 'useminPrepare', 561 | 'concurrent:dist', 562 | 'autoprefixer', 563 | 'concat', 564 | 'ngmin', 565 | 'copy:dist', 566 | 'cdnify', 567 | 'cssmin', 568 | 'uglify', 569 | 'filerev', 570 | 'usemin', 571 | 'htmlmin' 572 | ]); 573 | 574 | grunt.registerTask('default', [ 575 | 'newer:jshint', 576 | 'test', 577 | 'build' 578 | ]); 579 | }; 580 | -------------------------------------------------------------------------------- /templates/common/root/_bower.json: -------------------------------------------------------------------------------- 1 | {<% var ngVer = "1.2.16" %> 2 | "name": "<%= _.slugify(_.humanize(appname)) %>", 3 | "version": "0.0.0", 4 | "dependencies": { 5 | "angular": "<%= ngVer %>", 6 | "json3": "~3.3.1", 7 | "es5-shim": "~3.1.0"<% if (bootstrap) { %>,<% if (!compassBootstrap) { %> 8 | "bootstrap": "~3.1.1"<% } else { %> 9 | "jquery": "~1.11.1", 10 | "bootstrap-sass-official": "~3.1.1"<% } } %><% if (resourceModule) { %>, 11 | "angular-resource": "<%= ngVer %>"<% } %><% if (cookiesModule) { %>, 12 | "angular-cookies": "<%= ngVer %>"<% } %><% if (sanitizeModule) { %>, 13 | "angular-sanitize": "<%= ngVer %>"<% } %><% if (animateModule) { %>, 14 | "angular-animate": "<%= ngVer %>"<% } %><% if (touchModule) { %>, 15 | "angular-touch": "<%= ngVer %>"<% } %><% if (routeModule) { %>, 16 | "angular-route": "<%= ngVer %>"<% } %> 17 | }, 18 | "devDependencies": { 19 | "angular-mocks": "<%= ngVer %>", 20 | "angular-scenario": "<%= ngVer %>" 21 | }<% if (appPath) { %>, 22 | "appPath": "<%= appPath %>"<% } %> 23 | } 24 | -------------------------------------------------------------------------------- /templates/common/root/_bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "bower_components" 3 | } 4 | -------------------------------------------------------------------------------- /templates/common/root/_package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "<%= _.slugify(appname) %>", 3 | "version": "0.0.0", 4 | "dependencies": {}, 5 | "devDependencies": { 6 | "grunt": "^0.4.1", 7 | "grunt-autoprefixer": "^0.7.3", 8 | "grunt-concurrent": "^0.5.0", 9 | "grunt-connect-proxy": "^0.1.10", 10 | "grunt-contrib-clean": "^0.5.0",<% if (coffee) { %> 11 | "grunt-contrib-coffee": "^0.10.1",<% } %><% if (compass) { %> 12 | "grunt-contrib-compass": "^0.7.2",<% } %> 13 | "grunt-contrib-concat": "^0.4.0", 14 | "grunt-contrib-connect": "^0.7.1", 15 | "grunt-contrib-copy": "^0.5.0", 16 | "grunt-contrib-cssmin": "^0.9.0", 17 | "grunt-contrib-htmlmin": "^0.3.0", 18 | "grunt-contrib-imagemin": "^0.7.0", 19 | "grunt-contrib-jshint": "^0.10.0", 20 | "grunt-contrib-uglify": "^0.4.0", 21 | "grunt-contrib-watch": "^0.6.1", 22 | "grunt-filerev": "^0.2.1", 23 | "grunt-google-cdn": "^0.4.0", 24 | "grunt-newer": "^0.7.0", 25 | "grunt-php": "^0.4.0", 26 | "grunt-ngmin": "^0.0.3", 27 | "grunt-shell": "^0.7.0", 28 | "grunt-svgmin": "^0.4.0", 29 | "grunt-usemin": "^2.1.1", 30 | "grunt-wiredep": "^1.7.0", 31 | "jshint-stylish": "^0.2.0", 32 | "load-grunt-tasks": "^0.4.0", 33 | "time-grunt": "^0.3.1" 34 | }, 35 | "engines": { 36 | "node": ">=0.10.0" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /templates/common/root/gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | .tmp 4 | .sass-cache 5 | bower_components 6 | -------------------------------------------------------------------------------- /templates/common/root/test/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "browser": true, 4 | "esnext": true, 5 | "bitwise": true, 6 | "camelcase": true, 7 | "curly": true, 8 | "eqeqeq": true, 9 | "immed": true, 10 | "indent": 2, 11 | "latedef": true, 12 | "newcap": true, 13 | "noarg": true, 14 | "quotmark": "single", 15 | "regexp": true, 16 | "undef": true, 17 | "unused": true, 18 | "strict": true, 19 | "trailing": true, 20 | "smarttabs": true, 21 | "globals": { 22 | "after": false, 23 | "afterEach": false, 24 | "angular": false, 25 | "before": false, 26 | "beforeEach": false, 27 | "browser": false, 28 | "describe": false, 29 | "expect": false, 30 | "inject": false, 31 | "it": false, 32 | "jasmine": false, 33 | "spyOn": false 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /templates/javascript/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc overview 5 | * @name <%= scriptAppName %> 6 | * @description 7 | * # <%= scriptAppName %> 8 | * 9 | * Main module of the application. 10 | */ 11 | angular 12 | .module('<%= scriptAppName %>', [<%= angularModules %>])<% if (ngRoute) { %> 13 | .config(function ($routeProvider) { 14 | $routeProvider 15 | .when('/', { 16 | templateUrl: 'views/main.html', 17 | controller: 'MainCtrl' 18 | }) 19 | .otherwise({ 20 | redirectTo: '/' 21 | }); 22 | })<% } %>; 23 | -------------------------------------------------------------------------------- /templates/javascript/controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc function 5 | * @name <%= scriptAppName %>.controller:<%= classedName %>Ctrl 6 | * @description 7 | * # <%= classedName %>Ctrl 8 | * Controller of the <%= scriptAppName %> 9 | */ 10 | angular.module('<%= scriptAppName %>') 11 | .controller('<%= classedName %>Ctrl', function ($scope, $http) { 12 | 13 | function createUnknownError(status) { 14 | return { 15 | status: status, 16 | statusText: 'Internal Server Error', 17 | description: 'No details available' 18 | }; 19 | } 20 | 21 | $scope.awesomeThings = []; 22 | $scope.loading = true; 23 | 24 | // Get awesome things list 25 | $http({method: 'GET', url: '/api/features'}). 26 | 27 | success(function (data) { 28 | $scope.loading = false; 29 | $scope.awesomeThings = data; 30 | 31 | // Get description of each thing 32 | $scope.awesomeThings.forEach(function (thing) { 33 | thing.loading = true; 34 | 35 | $http({method: 'GET', url: thing.href}). 36 | success(function (data) { 37 | thing.loading = false; 38 | thing.description = data.description; 39 | }). 40 | error(function (data, status) { 41 | thing.loading = false; 42 | thing.error = data && data.description ? data : createUnknownError(status); 43 | }); 44 | }); 45 | }). 46 | 47 | error(function (data, status) { 48 | $scope.loading = false; 49 | $scope.error = data && data.description ? data : createUnknownError(status); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /templates/javascript/decorator.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc function 5 | * @name <%= scriptAppName %>.decorator:<%= classedName %> 6 | * @description 7 | * # <%= classedName %> 8 | * Decorator of the <%= scriptAppName %> 9 | */ 10 | angular.module('<%= scriptAppName %>') 11 | .config(function ($provide) { 12 | $provide.decorator('<%= cameledName %>', function ($delegate) { 13 | // decorate the $delegate 14 | return $delegate; 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /templates/javascript/directive.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc directive 5 | * @name <%= scriptAppName %>.directive:<%= cameledName %> 6 | * @description 7 | * # <%= cameledName %> 8 | */ 9 | angular.module('<%= scriptAppName %>') 10 | .directive('<%= cameledName %>', function () { 11 | return { 12 | template: '', 13 | restrict: 'E', 14 | link: function postLink(scope, element, attrs) { 15 | element.text('this is the <%= cameledName %> directive'); 16 | } 17 | }; 18 | }); 19 | -------------------------------------------------------------------------------- /templates/javascript/filter.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc filter 5 | * @name <%= scriptAppName %>.filter:<%= cameledName %> 6 | * @function 7 | * @description 8 | * # <%= cameledName %> 9 | * Filter in the <%= scriptAppName %>. 10 | */ 11 | angular.module('<%= scriptAppName %>') 12 | .filter('<%= cameledName %>', function () { 13 | return function (input) { 14 | return '<%= cameledName %> filter: ' + input; 15 | }; 16 | }); 17 | -------------------------------------------------------------------------------- /templates/javascript/service/constant.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc service 5 | * @name <%= scriptAppName %>.<%= cameledName %> 6 | * @description 7 | * # <%= cameledName %> 8 | * Constant in the <%= scriptAppName %>. 9 | */ 10 | angular.module('<%= scriptAppName %>') 11 | .constant('<%= cameledName %>', 42); 12 | -------------------------------------------------------------------------------- /templates/javascript/service/factory.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc service 5 | * @name <%= scriptAppName %>.<%= cameledName %> 6 | * @description 7 | * # <%= cameledName %> 8 | * Factory in the <%= scriptAppName %>. 9 | */ 10 | angular.module('<%= scriptAppName %>') 11 | .factory('<%= cameledName %>', function () { 12 | // Service logic 13 | // ... 14 | 15 | var meaningOfLife = 42; 16 | 17 | // Public API here 18 | return { 19 | someMethod: function () { 20 | return meaningOfLife; 21 | } 22 | }; 23 | }); 24 | -------------------------------------------------------------------------------- /templates/javascript/service/provider.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc service 5 | * @name <%= scriptAppName %>.<%= cameledName %> 6 | * @description 7 | * # <%= cameledName %> 8 | * Provider in the <%= scriptAppName %>. 9 | */ 10 | angular.module('<%= scriptAppName %>') 11 | .provider('<%= cameledName %>', function () { 12 | 13 | // Private variables 14 | var salutation = 'Hello'; 15 | 16 | // Private constructor 17 | function Greeter() { 18 | this.greet = function () { 19 | return salutation; 20 | }; 21 | } 22 | 23 | // Public API for configuration 24 | this.setSalutation = function (s) { 25 | salutation = s; 26 | }; 27 | 28 | // Method for instantiating 29 | this.$get = function () { 30 | return new Greeter(); 31 | }; 32 | }); 33 | -------------------------------------------------------------------------------- /templates/javascript/service/service.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc service 5 | * @name <%= scriptAppName %>.<%= cameledName %> 6 | * @description 7 | * # <%= cameledName %> 8 | * Service in the <%= scriptAppName %>. 9 | */ 10 | angular.module('<%= scriptAppName %>') 11 | .service('<%= classedName %>', function <%= classedName %>() { 12 | // AngularJS will instantiate a singleton by calling "new" on this function 13 | }); 14 | -------------------------------------------------------------------------------- /templates/javascript/service/value.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc service 5 | * @name <%= scriptAppName %>.<%= cameledName %> 6 | * @description 7 | * # <%= cameledName %> 8 | * Value in the <%= scriptAppName %>. 9 | */ 10 | angular.module('<%= scriptAppName %>') 11 | .value('<%= cameledName %>', 42); 12 | -------------------------------------------------------------------------------- /templates/javascript/spec/controller.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('Controller: <%= classedName %>Ctrl', function () { 4 | 5 | // load the controller's module 6 | beforeEach(module('<%= scriptAppName %>')); 7 | 8 | var <%= classedName %>Ctrl, 9 | scope; 10 | 11 | // Initialize the controller and a mock scope 12 | beforeEach(inject(function ($controller, $rootScope) { 13 | scope = $rootScope.$new(); 14 | $controller('<%= classedName %>Ctrl', { 15 | $scope: scope 16 | }); 17 | })); 18 | 19 | it('should attach a list of awesomeThings to the scope', inject(function ($httpBackend) { 20 | 21 | $httpBackend.whenGET('/api/features').respond([ 22 | { 23 | id: 'html5-boilerplate', 24 | name: 'HTML5 Boilerplate', 25 | href: '/api/features/html5-boilerplate' 26 | }, 27 | { 28 | id: 'angular', 29 | name: 'Angular', 30 | href: '/api/features/angular' 31 | }, 32 | { 33 | id: 'karma', 34 | name: 'Karma', 35 | href: '/api/features/karma' 36 | } 37 | ]); 38 | 39 | var resources = { 40 | 'html5-boilerplate': { 41 | name: 'HTML5 Boilerplate', 42 | description: 'HTML5 Boilerplate is a professional front-end template' + 43 | ' for building fast, robust, and adaptable web apps or sites.' 44 | }, 45 | angular: { 46 | name: 'Angular', 47 | description: 'AngularJS is a toolset for building the framework most' + 48 | ' suited to your application development.' 49 | }, 50 | karma: { 51 | name: 'Karma', 52 | description: 'Spectacular Test Runner for JavaScript.' 53 | } 54 | }; 55 | $httpBackend.whenGET('/api/features/html5-boilerplate').respond(resources['html5-boilerplate']); 56 | $httpBackend.whenGET('/api/features/angular').respond(resources.angular); 57 | $httpBackend.whenGET('/api/features/karma').respond(resources.karma); 58 | 59 | $httpBackend.flush(); 60 | 61 | expect(scope.awesomeThings.length).toBe(3); 62 | })); 63 | }); 64 | -------------------------------------------------------------------------------- /templates/javascript/spec/directive.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('Directive: <%= cameledName %>', function () { 4 | 5 | // load the directive's module 6 | beforeEach(module('<%= scriptAppName %>')); 7 | 8 | var element, 9 | scope; 10 | 11 | beforeEach(inject(function ($rootScope) { 12 | scope = $rootScope.$new(); 13 | })); 14 | 15 | it('should make hidden element visible', inject(function ($compile) { 16 | element = angular.element('<<%= _.dasherize(name) %>><%= _.dasherize(name) %>>'); 17 | element = $compile(element)(scope); 18 | expect(element.text()).toBe('this is the <%= cameledName %> directive'); 19 | })); 20 | }); 21 | -------------------------------------------------------------------------------- /templates/javascript/spec/filter.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('Filter: <%= cameledName %>', function () { 4 | 5 | // load the filter's module 6 | beforeEach(module('<%= scriptAppName %>')); 7 | 8 | // initialize a new instance of the filter before each test 9 | var <%= cameledName %>; 10 | beforeEach(inject(function ($filter) { 11 | <%= cameledName %> = $filter('<%= cameledName %>'); 12 | })); 13 | 14 | it('should return the input prefixed with "<%= cameledName %> filter:"', function () { 15 | var text = 'angularjs'; 16 | expect(<%= cameledName %>(text)).toBe('<%= cameledName %> filter: ' + text); 17 | }); 18 | 19 | }); 20 | -------------------------------------------------------------------------------- /templates/javascript/spec/service.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('Service: <%= cameledName %>', function () { 4 | 5 | // load the service's module 6 | beforeEach(module('<%= scriptAppName %>')); 7 | 8 | // instantiate service 9 | var <%= cameledName %>; 10 | beforeEach(inject(function (_<%= cameledName %>_) { 11 | <%= cameledName %> = _<%= cameledName %>_; 12 | })); 13 | 14 | it('should do something', function () { 15 | expect(!!<%= cameledName %>).toBe(true); 16 | }); 17 | 18 | }); 19 | -------------------------------------------------------------------------------- /test/test-appname-substitution.js: -------------------------------------------------------------------------------- 1 | /*global describe, before, it, beforeEach */ 2 | 'use strict'; 3 | 4 | var path = require('path'); 5 | var helpers = require('yeoman-generator').test; 6 | 7 | describe('Angular generator template mechanism', function () { 8 | var angular; 9 | var appName = 'upperCaseBug'; 10 | 11 | beforeEach(function (done) { 12 | var deps = [ 13 | '../../../app', 14 | '../../../common', 15 | '../../../controller', 16 | '../../../main', [ 17 | helpers.createDummyGenerator(), 18 | 'karma:app' 19 | ] 20 | ]; 21 | helpers.testDirectory(path.join(__dirname, 'tmp', appName), function (err) { 22 | if (err) { 23 | done(err); 24 | } 25 | 26 | angular = helpers.createGenerator('angular-php:app', deps, [appName], { 27 | 'appPath': 'app', 28 | 'skip-welcome-message': true, 29 | 'skip-install': true, 30 | 'skip-message': true 31 | }); 32 | 33 | helpers.mockPrompt(angular, { 34 | compass: true, 35 | bootstrap: true, 36 | compassBootstrap: true, 37 | modules: [] 38 | }); 39 | 40 | done(); 41 | }); 42 | }); 43 | 44 | it('should generate the same appName in every file', function (done) { 45 | angular.run({}, function () { 46 | helpers.assertFile([ 47 | 'app/scripts/app.js', 48 | 'app/scripts/controllers/main.js', 49 | 'app/index.html', 50 | 'test/spec/controllers/main.js' 51 | ]); 52 | 53 | helpers.assertFileContent( 54 | 'app/scripts/app.js', 55 | new RegExp('module\\(\'' + appName + 'App\'') 56 | ); 57 | helpers.assertFileContent( 58 | 'app/scripts/controllers/main.js', 59 | new RegExp('module\\(\'' + appName + 'App\'') 60 | ); 61 | helpers.assertFileContent( 62 | 'test/spec/controllers/main.js', 63 | new RegExp('module\\(\'' + appName + 'App\'') 64 | ); 65 | 66 | helpers.assertFileContent( 67 | 'app/index.html', 68 | new RegExp('ng-app=\"' + appName + 'App\"') 69 | ); 70 | done(); 71 | }); 72 | }); 73 | }); 74 | -------------------------------------------------------------------------------- /test/test-apppath.js: -------------------------------------------------------------------------------- 1 | /*global describe, before, it, beforeEach */ 2 | 'use strict'; 3 | 4 | var path = require('path'); 5 | var helpers = require('yeoman-generator').test; 6 | var _ = require('underscore.string'); 7 | 8 | describe('Angular generator appPath option', function () { 9 | var angular; 10 | var appPath = 'customAppPath'; 11 | var expected = [ 12 | appPath + '/.htaccess', 13 | appPath + '/404.html', 14 | appPath + '/favicon.ico', 15 | appPath + '/robots.txt', 16 | appPath + '/styles/main.scss', 17 | appPath + '/views/main.html', 18 | appPath + '/index.html', 19 | '.bowerrc', 20 | '.editorconfig', 21 | '.gitignore', 22 | '.jshintrc', 23 | 'Gruntfile.js', 24 | 'package.json', 25 | 'bower.json' 26 | ]; 27 | var mockPrompts = { 28 | compass: true, 29 | bootstrap: true, 30 | compassBootstrap: true, 31 | modules: [] 32 | }; 33 | var genOptions = { 34 | 'appPath': appPath, 35 | 'skip-install': true, 36 | 'skip-welcome-message': true, 37 | 'skip-message': true 38 | }; 39 | 40 | beforeEach(function (done) { 41 | helpers.testDirectory(path.join(__dirname, 'tmp'), function (err) { 42 | if (err) { 43 | done(err); 44 | } 45 | 46 | angular = helpers.createGenerator( 47 | 'angular-php:app', 48 | [ 49 | '../../app', 50 | '../../common', 51 | '../../controller', 52 | '../../main', [ 53 | helpers.createDummyGenerator(), 54 | 'karma:app' 55 | ] 56 | ], 57 | false, 58 | genOptions 59 | ); 60 | helpers.mockPrompt(angular, mockPrompts); 61 | 62 | done(); 63 | }); 64 | }); 65 | 66 | describe('App files', function () { 67 | it('should generate dotfiles for apppath', function (done) { 68 | angular.run({}, function () { 69 | helpers.assertFile(expected); 70 | done(); 71 | }); 72 | }); 73 | 74 | it('creates expected JS files', function (done) { 75 | angular.run({}, function() { 76 | helpers.assertFile([].concat(expected, [ 77 | appPath + '/scripts/app.js', 78 | appPath + '/scripts/controllers/main.js', 79 | 'test/spec/controllers/main.js' 80 | ])); 81 | done(); 82 | }); 83 | }); 84 | 85 | it('creates CoffeeScript files', function (done) { 86 | angular.env.options.coffee = true; 87 | angular.run([], function () { 88 | helpers.assertFile([].concat(expected, [ 89 | appPath + '/scripts/app.coffee', 90 | appPath + '/scripts/controllers/main.coffee', 91 | 'test/spec/controllers/main.coffee' 92 | ])); 93 | done(); 94 | }); 95 | }); 96 | }); 97 | 98 | describe('Service Subgenerators', function () { 99 | var generatorTest = function (generatorType, specType, targetDirectory, scriptNameFn, specNameFn, suffix, done) { 100 | var angularGenerator; 101 | var name = 'foo'; 102 | var deps = [path.join('../..', generatorType)]; 103 | angularGenerator = helpers.createGenerator('angular-php:' + generatorType, deps, [name], genOptions); 104 | 105 | angular.run([], function () { 106 | angularGenerator.run([], function () { 107 | helpers.assertFileContent([ 108 | [ 109 | path.join(appPath + '/scripts', targetDirectory, name + '.js'), 110 | new RegExp( 111 | generatorType + '\\(\'' + scriptNameFn(name) + suffix + '\'', 112 | 'g' 113 | ) 114 | ] 115 | ]); 116 | done(); 117 | }); 118 | }); 119 | }; 120 | 121 | it('should generate a new controller', function (done) { 122 | generatorTest('controller', 'controller', 'controllers', _.classify, _.classify, 'Ctrl', done); 123 | }); 124 | 125 | it('should generate a new directive', function (done) { 126 | generatorTest('directive', 'directive', 'directives', _.camelize, _.camelize, '', done); 127 | }); 128 | 129 | it('should generate a new filter', function (done) { 130 | generatorTest('filter', 'filter', 'filters', _.camelize, _.camelize, '', done); 131 | }); 132 | 133 | ['constant', 'factory', 'provider', 'value'].forEach(function(t) { 134 | it('should generate a new ' + t, function (done) { 135 | generatorTest(t, 'service', 'services', _.camelize, _.camelize, '', done); 136 | }); 137 | }); 138 | 139 | it('should generate a new service', function (done) { 140 | generatorTest('service', 'service', 'services', _.capitalize, _.capitalize, '', done); 141 | }); 142 | }); 143 | 144 | describe('View', function () { 145 | it('should generate a new view', function (done) { 146 | var angularView; 147 | var deps = ['../../view']; 148 | angularView = helpers.createGenerator('angular-php:view', deps, ['foo'], genOptions); 149 | 150 | helpers.mockPrompt(angular, mockPrompts); 151 | angular.run([], function () { 152 | angularView.run([], function () { 153 | helpers.assertFile([appPath + '/views/foo.html']); 154 | done(); 155 | }); 156 | }); 157 | }); 158 | 159 | it('should generate a new view in subdirectories', function (done) { 160 | var angularView; 161 | var deps = ['../../view']; 162 | angularView = helpers.createGenerator('angular-php:view', deps, ['foo/bar'], genOptions); 163 | 164 | helpers.mockPrompt(angular, mockPrompts); 165 | angular.run([], function () { 166 | angularView.run([], function () { 167 | helpers.assertFile([appPath + '/views/foo/bar.html']); 168 | done(); 169 | }); 170 | }); 171 | }); 172 | }); 173 | }); 174 | -------------------------------------------------------------------------------- /test/test-file-creation.js: -------------------------------------------------------------------------------- 1 | /*global describe, before, it, beforeEach */ 2 | 'use strict'; 3 | 4 | var path = require('path'); 5 | var helpers = require('yeoman-generator').test; 6 | var _ = require('underscore.string'); 7 | 8 | describe('Angular generator', function () { 9 | var angular; 10 | var expected = [ 11 | 'app/.htaccess', 12 | 'app/404.html', 13 | 'app/favicon.ico', 14 | 'app/robots.txt', 15 | 'app/styles/main.scss', 16 | 'app/views/main.html', 17 | 'app/index.html', 18 | '.bowerrc', 19 | '.editorconfig', 20 | '.gitignore', 21 | '.jshintrc', 22 | 'Gruntfile.js', 23 | 'package.json', 24 | 'bower.json' 25 | ]; 26 | var mockPrompts = { 27 | compass: true, 28 | bootstrap: true, 29 | compassBootstrap: true, 30 | modules: [] 31 | }; 32 | var genOptions = { 33 | 'appPath': 'app', 34 | 'skip-install': true, 35 | 'skip-welcome-message': true, 36 | 'skip-message': true 37 | }; 38 | 39 | beforeEach(function (done) { 40 | helpers.testDirectory(path.join(__dirname, 'tmp'), function (err) { 41 | if (err) { 42 | done(err); 43 | } 44 | angular = helpers.createGenerator( 45 | 'angular-php:app', 46 | [ 47 | '../../app', 48 | '../../common', 49 | '../../controller', 50 | '../../main', [ 51 | helpers.createDummyGenerator(), 52 | 'karma:app' 53 | ] 54 | ], 55 | false, 56 | genOptions 57 | ); 58 | helpers.mockPrompt(angular, mockPrompts); 59 | 60 | done(); 61 | }); 62 | }); 63 | 64 | describe('App files', function () { 65 | it('should generate dotfiles', function (done) { 66 | angular.run({}, function () { 67 | helpers.assertFile(expected); 68 | done(); 69 | }); 70 | }); 71 | 72 | it('creates expected JS files', function (done) { 73 | angular.run({}, function() { 74 | helpers.assertFile([].concat(expected, [ 75 | 'app/scripts/app.js', 76 | 'app/scripts/controllers/main.js', 77 | 'test/spec/controllers/main.js' 78 | ])); 79 | done(); 80 | }); 81 | }); 82 | 83 | it('creates CoffeeScript files', function (done) { 84 | angular.env.options.coffee = true; 85 | angular.run([], function () { 86 | helpers.assertFile([].concat(expected, [ 87 | 'app/scripts/app.coffee', 88 | 'app/scripts/controllers/main.coffee', 89 | 'test/spec/controllers/main.coffee' 90 | ])); 91 | done(); 92 | }); 93 | }); 94 | }); 95 | 96 | describe('Service Subgenerators', function () { 97 | var generatorTest = function (generatorType, specType, targetDirectory, scriptNameFn, specNameFn, suffix, done) { 98 | var name = 'foo'; 99 | var deps = [path.join('../..', generatorType)]; 100 | var genTester = helpers.createGenerator('angular-php:' + generatorType, deps, [name], genOptions); 101 | 102 | angular.run([], function () { 103 | genTester.run([], function () { 104 | helpers.assertFileContent([ 105 | [ 106 | path.join('app/scripts', targetDirectory, name + '.js'), 107 | new RegExp( 108 | generatorType + '\\(\'' + scriptNameFn(name) + suffix + '\'', 109 | 'g' 110 | ) 111 | ], 112 | [ 113 | path.join('test/spec', targetDirectory, name + '.js'), 114 | new RegExp( 115 | 'describe\\(\'' + _.classify(specType) + ': ' + specNameFn(name) + suffix + '\'', 116 | 'g' 117 | ) 118 | ] 119 | ]); 120 | done(); 121 | }); 122 | }); 123 | }; 124 | 125 | it('should generate a new controller', function (done) { 126 | generatorTest('controller', 'controller', 'controllers', _.classify, _.classify, 'Ctrl', done); 127 | }); 128 | 129 | it('should generate a new directive', function (done) { 130 | generatorTest('directive', 'directive', 'directives', _.camelize, _.camelize, '', done); 131 | }); 132 | 133 | it('should generate a new filter', function (done) { 134 | generatorTest('filter', 'filter', 'filters', _.camelize, _.camelize, '', done); 135 | }); 136 | 137 | ['constant', 'factory', 'provider', 'value'].forEach(function(t) { 138 | it('should generate a new ' + t, function (done) { 139 | generatorTest(t, 'service', 'services', _.camelize, _.camelize, '', done); 140 | }); 141 | }); 142 | 143 | it('should generate a new service', function (done) { 144 | generatorTest('service', 'service', 'services', _.capitalize, _.capitalize, '', done); 145 | }); 146 | }); 147 | 148 | describe('View', function () { 149 | it('should generate a new view', function (done) { 150 | var angularView; 151 | var deps = ['../../view']; 152 | angularView = helpers.createGenerator('angular-php:view', deps, ['foo'], genOptions); 153 | 154 | helpers.mockPrompt(angularView, mockPrompts); 155 | angularView.run([], function () { 156 | helpers.assertFile(['app/views/foo.html']); 157 | done(); 158 | }); 159 | }); 160 | 161 | it('should generate a new view in subdirectories', function (done) { 162 | var angularView; 163 | var deps = ['../../view']; 164 | angularView = helpers.createGenerator('angular-php:view', deps, ['foo/bar'], genOptions); 165 | 166 | helpers.mockPrompt(angularView, mockPrompts); 167 | angularView.run([], function () { 168 | helpers.assertFile(['app/views/foo/bar.html']); 169 | done(); 170 | }); 171 | }); 172 | }); 173 | }); 174 | -------------------------------------------------------------------------------- /test/test-load.js: -------------------------------------------------------------------------------- 1 | /*global describe, beforeEach, it*/ 2 | 'use strict'; 3 | 4 | var assert = require('yeoman-generator').assert; 5 | 6 | describe('Angular-Module generator load test', function () { 7 | it('can be imported without blowing up', function () { 8 | assert(require('../app') !== undefined); 9 | assert(require('../common') !== undefined); 10 | assert(require('../constant') !== undefined); 11 | assert(require('../controller') !== undefined); 12 | assert(require('../decorator') !== undefined); 13 | assert(require('../directive') !== undefined); 14 | assert(require('../factory') !== undefined); 15 | assert(require('../filter') !== undefined); 16 | assert(require('../main') !== undefined); 17 | assert(require('../provider') !== undefined); 18 | assert(require('../route') !== undefined); 19 | assert(require('../service') !== undefined); 20 | assert(require('../value') !== undefined); 21 | assert(require('../view') !== undefined); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /test/test-route-creation.js: -------------------------------------------------------------------------------- 1 | /*global describe, before, it, beforeEach */ 2 | 'use strict'; 3 | 4 | var path = require('path'); 5 | var helpers = require('yeoman-generator').test; 6 | 7 | describe('Angular generator route mechanism', function () { 8 | var angular; 9 | var route = 'simpleroute'; 10 | var expected = [ 11 | 'app/scripts/controllers/' + route + '.js', 12 | 'test/spec/controllers/' + route + '.js', 13 | 'app/views/' + route + '.html' 14 | ]; 15 | var genOptions = { 16 | 'appPath': 'app', 17 | 'skip-install': true, 18 | 'skip-welcome-message': true, 19 | 'skip-message': true 20 | }; 21 | var mockPrompts = { 22 | compass: true, 23 | bootstrap: true, 24 | compassBootstrap: true, 25 | modules: ['routeModule'] 26 | }; 27 | 28 | beforeEach(function (done) { 29 | helpers.testDirectory(path.join(__dirname, 'tmp'), function (err) { 30 | if (err) { 31 | done(err); 32 | } 33 | angular = helpers.createGenerator( 34 | 'angular-php:app', 35 | [ 36 | '../../app', 37 | '../../common', 38 | '../../controller', 39 | '../../main', 40 | '../../route', 41 | '../../view', [ 42 | helpers.createDummyGenerator(), 43 | 'karma:app' 44 | ] 45 | ], 46 | false, 47 | genOptions 48 | ); 49 | helpers.mockPrompt(angular, mockPrompts); 50 | angular.run({}, function () { 51 | angular = helpers.createGenerator( 52 | 'angular-php:route', 53 | [ 54 | '../../controller', 55 | '../../route', 56 | '../../view' 57 | ], 58 | [route], 59 | genOptions 60 | ); 61 | helpers.mockPrompt(angular, mockPrompts); 62 | done(); 63 | }); 64 | }); 65 | }); 66 | 67 | describe('create routes', function () { 68 | it('should generate default route items', function(done){ 69 | angular.run({}, function(e) { 70 | helpers.assertFile(expected); 71 | helpers.assertFileContent( 72 | 'app/scripts/app.js', 73 | new RegExp('when\\(\'/' + route + '\'') 74 | ); 75 | 76 | done(); 77 | }); 78 | }); 79 | 80 | // Test with URI specified explicitly 81 | it('should generate route items with the route uri given', function(done){ 82 | var uri = 'segment1/segment2/:parameter'; 83 | 84 | angular.options.uri = uri; 85 | angular.run({}, function() { 86 | helpers.assertFile(expected); 87 | helpers.assertFileContent( 88 | 'app/scripts/app.js', 89 | new RegExp('when\\(\'/' + uri + '\'') 90 | ); 91 | 92 | done(); 93 | }); 94 | }); 95 | }); 96 | }); 97 | -------------------------------------------------------------------------------- /util.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var path = require('path'); 3 | var fs = require('fs'); 4 | 5 | function escapeRegExp (str) { 6 | return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); 7 | } 8 | 9 | function rewrite (args) { 10 | /* jshint -W044 */ 11 | // check if splicable is already in the body text 12 | var re = new RegExp(args.splicable.map(function (line) { 13 | return '\s*' + escapeRegExp(line); 14 | }).join('\n')); 15 | 16 | if (re.test(args.haystack)) { 17 | return args.haystack; 18 | } 19 | 20 | var lines = args.haystack.split('\n'); 21 | 22 | var otherwiseLineIndex = 0; 23 | lines.forEach(function (line, i) { 24 | if (line.indexOf(args.needle) !== -1) { 25 | otherwiseLineIndex = i; 26 | } 27 | }); 28 | 29 | var spaces = 0; 30 | while (lines[otherwiseLineIndex].charAt(spaces) === ' ') { 31 | spaces += 1; 32 | } 33 | 34 | var spaceStr = ''; 35 | while ((spaces -= 1) >= 0) { 36 | spaceStr += ' '; 37 | } 38 | 39 | lines.splice(otherwiseLineIndex, 0, args.splicable.map(function (line) { 40 | return spaceStr + line; 41 | }).join('\n')); 42 | 43 | return lines.join('\n'); 44 | } 45 | 46 | function rewriteFile (args) { 47 | args.path = args.path || process.cwd(); 48 | var fullPath = path.join(args.path, args.file); 49 | 50 | args.haystack = fs.readFileSync(fullPath, 'utf8'); 51 | var body = rewrite(args); 52 | 53 | fs.writeFileSync(fullPath, body); 54 | } 55 | 56 | function appName (self) { 57 | var counter = 0, suffix = self.options['app-suffix']; 58 | // Have to check this because of generator bug #386 59 | process.argv.forEach(function(val) { 60 | if (val.indexOf('--app-suffix') > -1) { 61 | counter++; 62 | } 63 | }); 64 | if (counter === 0 || (typeof suffix === 'boolean' && suffix)) { 65 | suffix = 'App'; 66 | } 67 | return suffix ? self._.classify(suffix) : ''; 68 | } 69 | 70 | 71 | module.exports = { 72 | rewrite: rewrite, 73 | rewriteFile: rewriteFile, 74 | appName: appName 75 | }; 76 | -------------------------------------------------------------------------------- /value/USAGE: -------------------------------------------------------------------------------- 1 | Description: 2 | Creates a new AngularJS service. 3 | Docs: http://docs.angularjs.org/guide/dev_guide.services.creating_services 4 | 5 | Example: 6 | yo angular-php:value thing [--coffee] 7 | 8 | This will create: 9 | app/scripts/services/thing.js 10 | -------------------------------------------------------------------------------- /value/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var util = require('util'); 3 | var ScriptBase = require('../script-base.js'); 4 | 5 | 6 | var Generator = module.exports = function Generator() { 7 | ScriptBase.apply(this, arguments); 8 | }; 9 | 10 | util.inherits(Generator, ScriptBase); 11 | 12 | Generator.prototype.createServiceFiles = function createServiceFiles() { 13 | this.generateSourceAndTest( 14 | 'service/value', 15 | 'spec/service', 16 | 'services', 17 | this.options['skip-add'] || false 18 | ); 19 | }; 20 | -------------------------------------------------------------------------------- /view/USAGE: -------------------------------------------------------------------------------- 1 | Description: 2 | Creates a new AngularJS view 3 | 4 | Example: 5 | yo angular-php:view thing 6 | 7 | This will create: 8 | app/views/thing.html 9 | -------------------------------------------------------------------------------- /view/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var path = require('path'); 3 | var util = require('util'); 4 | var yeoman = require('yeoman-generator'); 5 | 6 | var Generator = module.exports = function Generator() { 7 | yeoman.generators.NamedBase.apply(this, arguments); 8 | 9 | this.sourceRoot(path.join(__dirname, '../templates/common')); 10 | 11 | if (typeof this.env.options.appPath === 'undefined') { 12 | this.env.options.appPath = this.options.appPath; 13 | 14 | if (!this.env.options.appPath) { 15 | try { 16 | this.env.options.appPath = require(path.join(process.cwd(), 'bower.json')).appPath; 17 | } catch (e) {} 18 | } 19 | this.env.options.appPath = this.env.options.appPath || 'app'; 20 | this.options.appPath = this.env.options.appPath; 21 | } 22 | }; 23 | 24 | util.inherits(Generator, yeoman.generators.NamedBase); 25 | 26 | Generator.prototype.createViewFiles = function createViewFiles() { 27 | this.template( 28 | 'app/views/view.html', 29 | path.join( 30 | this.env.options.appPath, 31 | 'views', 32 | this.name.toLowerCase() + '.html' 33 | ) 34 | ); 35 | }; 36 | --------------------------------------------------------------------------------