diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5100940c2..000000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: node_js -node_js: - - '0.12' -before_install: - - gem update --system - - gem install sass --version "=3.3.7" - - npm install -g bower grunt-cli -services: mongodb -notifications: - webhooks: - urls: - - https://webhooks.gitter.im/e/911ed472ef19bcb27858 - on_success: change # options: [always|never|change] default: always - on_failure: always # options: [always|never|change] default: always - on_start: false # default: false diff --git a/CHANGELOG.md b/CHANGELOG.md index ebbf89c3a..516ea22aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,577 +1,6 @@ - -## v2.1.0 (2015-07-15) - - -#### Bug Fixes - -* **app:** missing event.preventDefault ([c90d7621](http://github.com/DaftMonk/generator-angular-fullstack/commit/c90d7621b8f17f6e74f8a59f02fd78a8fcf628aa)) -* **demo:** include bootstrap in demo ([19e21331](http://github.com/DaftMonk/generator-angular-fullstack/commit/19e213319ecdf27041948133fe4c9642184133d8)) -* **express:** support new options of updated connect-mongo ([727d6616](http://github.com/DaftMonk/generator-angular-fullstack/commit/727d661642441d5ee76e4fba9ebcbba134e43058)) -* **jshint:** Removed 'regexp' from server and client jshintrc (I couldn't find it in the docs ([e02f0940](http://github.com/DaftMonk/generator-angular-fullstack/commit/e02f09405de2423d7be92e5ca0f9be740becb693)) -* **travis:** - * Remove unicode stuff from file creation test expectations, and add nodejs 0.12 t ([bf9a9737](http://github.com/DaftMonk/generator-angular-fullstack/commit/bf9a9737721d1ea72f3f7b9689d6781e78b4c606)) - * Add nodejs 12 to travis.yml ([acecde9d](http://github.com/DaftMonk/generator-angular-fullstack/commit/acecde9d0e02b579d4b0a2a33d7c0f24067258ec)) - - -#### Features - -* **app:** - * additional app generator option for ES6 preprocessing using babel ([cbb06a48](http://github.com/DaftMonk/generator-angular-fullstack/commit/cbb06a48e28c594a53f61e49857cbb711bd74ce9)) - * additional app generator option for ES6 preprocessing using babel ([bc03aba9](http://github.com/DaftMonk/generator-angular-fullstack/commit/bc03aba9ee82812f29f4ec9f86daf3b8d1c531b8)) - * add mongodb error handling to quit app if unable to connect with mongodb server ([31bee73c](http://github.com/DaftMonk/generator-angular-fullstack/commit/31bee73c1085c3a3f3c8e4e6f1f45db28fa9f94b)) -* **build:** add gitter webhook for travis ([6b88efdf](http://github.com/DaftMonk/generator-angular-fullstack/commit/6b88efdfb1d6b3b2dcbf47e0517bfc5117247d12)) -* **gen:** Remove global jQuery dependency ([a9230ca2](http://github.com/DaftMonk/generator-angular-fullstack/commit/a9230ca2ba1b2727abdc466a11096ec513fd7085)) -* **readme:** add david-dm badge & move badges to new line ([f8f32f4f](http://github.com/DaftMonk/generator-angular-fullstack/commit/f8f32f4f67938a5f7416e2a07d7b24d71a12585f)) - - -### v2.0.13 (2014-08-29) - - -#### Bug Fixes - -* **gen:** - * use bool for bootstrap filters ([a5decbc3](http://github.com/DaftMonk/generator-angular-fullstack/commit/a5decbc36e933f94c69d9e9bb58bd8e07148c34d), closes [#496](http://github.com/DaftMonk/generator-angular-fullstack/issues/496)) - * fix build when not selecting socket.io ([fdf063c6](http://github.com/DaftMonk/generator-angular-fullstack/commit/fdf063c6cc2ec4eeef252f13b2e0d301931fa83c)) - - -### v2.0.12 (2014-08-25) - -#### Bug Fixes - -* revert multiple strategies per account, which shouldn't go in a patch release - - -### v2.0.11 (2014-08-25) - - -#### Bug Fixes - -* **app:** Use parentheses to fix string concat in config ([c6a50ce7](http://github.com/DaftMonk/generator-angular-fullstack/commit/c6a50ce791ab633a17654ce9b0090007d7152463), closes [#466](http://github.com/DaftMonk/generator-angular-fullstack/issues/466)) - * improve jshint usage ([35fcf490](http://github.com/DaftMonk/generator-angular-fullstack/commit/35fcf4902dbbdab2ca6b394ab87ef8e3cc3d052b), closes [#463](http://github.com/DaftMonk/generator-angular-fullstack/issues/463), [#486](http://github.com/DaftMonk/generator-angular-fullstack/issues/486)) -* **gen:** use more restrictive version range for ng-component ([19698973](http://github.com/DaftMonk/generator-angular-fullstack/commit/196989730c8922fa5e1dc9caa45eb85052535e30)) - - -#### Features - -* **socket.io:** build socket.io into vendor.js ([06f2e46e](http://github.com/DaftMonk/generator-angular-fullstack/commit/06f2e46ef382b5af1691f34b6cf504f1e5640b86)) -* **docs:** Inform users/developers of the `canary` branch ([74693623](http://github.com/DaftMonk/generator-angular-fullstack/commit/74693623eb23c9399495a3baff7e3479a1d9f3ba)) -* **gen:** make generator tests faster, and easier to run ([84acb744](http://github.com/DaftMonk/generator-angular-fullstack/commit/84acb7448ccc7c55b72bdd19bfae50c33d527296)) -* **app:** add additional node version to travis.yml ([e4f00b08](http://github.com/DaftMonk/generator-angular-fullstack/commit/e4f00b083a880713ca563e3447b9fb3f56a54ebc)) -* **uibootstrap:** add basic modal service and template when using uibootstrap ([7c14bed4](http://github.com/DaftMonk/generator-angular-fullstack/commit/7c14bed4873b92124bcbe422fed918836b8f5df5)) - - -### v2.0.10 (2014-08-16) - - -#### Bug Fixes - -* **server:** undefined domain env variable causing issues ([cb683dde](http://github.com/DaftMonk/generator-angular-fullstack/commit/cb683dde6814959328a58267215ce477aa723e35)) - - -### v2.0.9 (2014-08-15) - - -#### Bug Fixes - -* **app:** - * add .idea folder to gitignore ([2e1f1182](http://github.com/DaftMonk/generator-angular-fullstack/commit/2e1f1182684594300ac5ca85ffab175bfcafd3ec)) - * Missing user response code ([c1766604](http://github.com/DaftMonk/generator-angular-fullstack/commit/c1766604d7ae7ab1eb8713f37285d13341dc8ae1)) - * use `''` instead `null` as URL to open ioSocket ([0f0d0fdc](http://github.com/DaftMonk/generator-angular-fullstack/commit/0f0d0fdce38d42f04f71d9e1174400adfb699061)) - * save the version of the generator that was used ([2b76b17b](http://github.com/DaftMonk/generator-angular-fullstack/commit/2b76b17bb5fa1980b449498beec87ab58ceee012)) -* **gruntfile:** incorrect path to index.html for cdnify ([0ad646cb](http://github.com/DaftMonk/generator-angular-fullstack/commit/0ad646cbd48dbb2f65fc00b930a9f243174611be)) -* **openshift:** fix issues with openshift deployment ([ace07238](http://github.com/DaftMonk/generator-angular-fullstack/commit/ace07238e3299d6002337ba12f7862ce84beafd8)) - - -#### Features - -* **gen:** add automatic demo releases with grunt task ([44852233](http://github.com/DaftMonk/generator-angular-fullstack/commit/44852233fcf28d5ff8681fcabc3bfb4130778a22)) -* **gruntfile:** add grunt buildcontrol tasks to app, for easier deployment ([036478df](http://github.com/DaftMonk/generator-angular-fullstack/commit/036478dfd7067d38ab19ca86c0c5196678412799)) -* **heroku:** provide prompt to set the deployment region ([13cd5e7d](http://github.com/DaftMonk/generator-angular-fullstack/commit/13cd5e7d42f2845268f38ba19e0d253ae675c594)) -* **server:** add sample env config file that can be tracked by git ([c9f80bcd](http://github.com/DaftMonk/generator-angular-fullstack/commit/c9f80bcd67d6e3eef2c78ccbceff78f763ae88d1)) - - -### v2.0.8 (2014-07-31) - - -#### Bug Fixes - -* **coffee:** update socket service to match javascript version ([c27cefe2](http://github.com/DaftMonk/generator-angular-fullstack/commit/c27cefe24d8ec64d905f908c66a56bf602303dce)) -* **gen:** Fixed missing `oauth` property in `.yo-rc.json` after 2.0.5 update ([11d324b9](http://github.com/DaftMonk/generator-angular-fullstack/commit/11d324b95992b68bd19f402401e98f5936cdb343)) -* **travis:** install sass gem if sass is enabled ([ceeac27b](http://github.com/DaftMonk/generator-angular-fullstack/commit/ceeac27b8f912aa6dec2caf3bf20dd7551f2d754)) -* **twitter:** revert mongoose connection change ([8675a002](http://github.com/DaftMonk/generator-angular-fullstack/commit/8675a002e301957569374fdcad87aab0bff6b3b4)) - - -#### Features - -* **user-management:** use the User $resource to populate users for the admin page ([708f0729](http://github.com/DaftMonk/generator-angular-fullstack/commit/708f07290d98d6bd73723f9db49cce7758c3d12b)) - - -### v2.0.7 (2014-07-27) - - -#### Bug Fixes - -* **gruntfile:** grunt tasks should run if no local config exists ([422d6bca](http://github.com/DaftMonk/generator-angular-fullstack/commit/422d6bca07283057b0fa275dba0de447c9f4f167)) -* **server:** fix setting TTL index on collection : sessions error ([0581ed09](http://github.com/DaftMonk/generator-angular-fullstack/commit/0581ed094b2c6141ab9e0c016eda22aa49e1d075)) - - -### v2.0.6 (2014-07-27) - - -#### Bug Fixes - -* **app:** - * `things` made a little bit more responsive ([58aa7a48](http://github.com/DaftMonk/generator-angular-fullstack/commit/58aa7a489ae28c22be59b3a61db027ccf2f1ae46)) -* **dependencies:** change ngmin to ng-annotate ([dd023fa5](http://github.com/DaftMonk/generator-angular-fullstack/commit/dd023fa5fd90b8b541b8cc60c87186ee619e4844)) -* **bootstrap:** removed styles breaking responsiveness for high-res screens ([053fedb8](http://github.com/DaftMonk/generator-angular-fullstack/commit/053fedb89f64294a55538ad9b806b2d7de4d1c7f)) -* **socketio:** fallback for servers where `socket.handshake.address` is not provided ([f6a19348](http://github.com/DaftMonk/generator-angular-fullstack/commit/f6a19348ad404aa72c31eef8dc84aac8db0e904a)) -* **stylus:** remove bootstrap css import in stylus when bootstrap is not selected ([f7c3d0ad](http://github.com/DaftMonk/generator-angular-fullstack/commit/f7c3d0ad41da5f0072c2cf64ff5c9a894052d194), closes [#368](http://github.com/DaftMonk/generator-angular-fullstack/issues/368)) - - -#### Features - -* **oauth:** remove code according to user prompts ([316bd9dd](http://github.com/DaftMonk/generator-angular-fullstack/commit/316bd9dd3632622b0fb434cacfc4150f01d18e4c)) - - -### v2.0.5 (2014-07-17) - -#### Bug Fixes - -* **account:** add authentication requirement for settings view ([9105c0fd](http://github.com/DaftMonk/generator-angular-fullstack/commit/9105c0fdbabdbde68fb6cf0fe0d6993ead6e7095), closes [#327](http://github.com/DaftMonk/generator-angular-fullstack/issues/327)) -* **app:** - * use correct path for font awesome and glyphicons ([1917ba31](http://github.com/DaftMonk/generator-angular-fullstack/commit/1917ba31264fc90bea0fce36b8d144f897e8bf08)) - * wait for currentUser to resolve before checking if logged in on route changes ([6d6090d9](http://github.com/DaftMonk/generator-angular-fullstack/commit/6d6090d9c4dcd5d8a1f6ecb2cf5dc0bb4c8598fe)) - * bootstrap glyphicons not correctly linked on grunt build ([53d193d0](http://github.com/DaftMonk/generator-angular-fullstack/commit/53d193d011c7c1ea8c9477e8f17ad56cc4214362)) -* **dependencies:** include certain dependencies only when answering yes to their respective prompts ([040c57de](http://github.com/DaftMonk/generator-angular-fullstack/commit/040c57de8689f2e0fc35410d0b6935363aaa8458)) -* **server:** - * fix seeding of db in test mode causing tests to randomly fail ([05f7f433](http://github.com/DaftMonk/generator-angular-fullstack/commit/05f7f43372bc3bd54bead811952b775adeec1f05)) - * make user tests run more consistently ([addb5061](http://github.com/DaftMonk/generator-angular-fullstack/commit/addb5061f62696c7a0078a8d2c7443d428e69376)) - * warnings that express was using deprecated features ([8dc2f1e4](http://github.com/DaftMonk/generator-angular-fullstack/commit/8dc2f1e48503c27cbd2aac3c455adac7781a6539)) - * missing `res` param for handleError ([eb7d50c8](http://github.com/DaftMonk/generator-angular-fullstack/commit/eb7d50c8d27820a6b26caf2a1aaa0e4fa8eee367)) - -#### Features - -* **app:** - * added oath buttons to signup page ([a408f58e](http://github.com/DaftMonk/generator-angular-fullstack/commit/a408f58edb923cd14bf7c7b3411b874dce5f0724)) - * upgrade socket.io to use v1.0.6 -* **gen:** - * add option for Stylus as a preprocessor ([1b90c448](http://github.com/DaftMonk/generator-angular-fullstack/commit/1b90c448fbf374287fe07f782f9788dfb9a23613)) - * make bootstrap and bootstrap ui optional ([f50d0942](http://github.com/DaftMonk/generator-angular-fullstack/commit/f50d094226fdbf6a7e65ba3783a26efc8544ba08)) - - -### v2.0.4 (2014-07-08) - - -#### Bug Fixes - -* **app:** fix dependency injection minsafe problem in auth service coffeescript. ([03742a80](http://github.com/DaftMonk/generator-angular-fullstack/commit/03742a8000f19efdf14791ff1aae52a90e86c149)) -* **gen:** heroku and openshift generators requiring .yo-rc file to work ([88ebfc8c](http://github.com/DaftMonk/generator-angular-fullstack/commit/88ebfc8c835ac6ec04b6d42fcf9357cfb0bcc47d)) - - -### v2.0.3 (2014-07-04) - - -#### Bug Fixes - -* **server:** only enable sessions if twitter oauth was selected ([bcd00dc0](http://github.com/DaftMonk/generator-angular-fullstack/commit/bcd00dc02d270486adafe6dbf973a4ec25499a5e)) - - -### v2.0.2 (2014-07-02) - -#### Bug Fixes - -* **gen:endpoint** - * fix endpoint spec not properly adjusting to users route url - * fix some valid route urls causing failing tests - - -## v2.0.0 (2014-07-02) - -#### Features - -* **app:** - * Follow googles AngularJS project recommendations to make a very modular app structure. - * New look for generated app - * Add basic crud interface to app - * Support for UI Router - * Support for LESS - * Built in support for protractor e2e tests - * Add angular-bootstrap and lodash to default app - * More consistent and understandable naming conventions for files -* **server:** - * Modular project structure for express server - * Support for social auths with facebook/twitter/google - * Role based authentication - * Replace session based authentication with JWT authentication - * Optional integration with socket.io - * Added config file, ignored by git, for setting local environment variables, api keys, secrets.. etc. -* **gruntfile:** - * Optimizations to the gruntfile - * Automate injection of new scripts into index file with grunt - * Use ng-templates to concatenate all the html/jade views into the javascript payload -* **gen:** - * Abstract client-side generators into generator-ng-component, use new composition feature of yeoman to keep them available in the generator. - * Add useful tests to the generator, start using travis CI - * use .yo-rc file to keep track of generated configurations - * Add endpoint generator to angular-fullstack, generates model / route / controller / test / socket updates - -#### Breaking Changes - * New project structure - * Deprecated value and constant sub generators - * Sub-generators generate components in a single directory and don't inject themselves into the index file (this is done by a grunt task now) - - -### v1.4.3 (2014-05-25) - - -#### Bug Fixes - -* **config:** fix issue where `config.ip` is undefined in non-production environments ([087f5bca](http://github.com/DaftMonk/generator-angular-fullstack/commit/087f5bca1610e8250de50ce11a16e879908e3177)) -* **package:** update connect-mongo to correct version -* **app:** add require attribute to login.html inputs so it validates on client side -* **gen:** use lowercase filenames for scripts - - -### v1.4.2 (2014-04-16) - - -#### Bug Fixes - -* **gen:** typo in heroku generator was preventing it from working on unix based systems ([9d3b5738](http://github.com/DaftMonk/generator-angular-fullstack/commit/9d3b5738528497f74d37d22c304b0d46cd5007fa)) - - -### v1.4.1 (2014-04-15) - - -#### Bug Fixes - -* **server:** - * grunt test was incorrectly using dev config, fixes #179 ([62d8492f](http://github.com/DaftMonk/generator-angular-fullstack/commit/62d8492fd9fcfde653bab0f65b46f9961b8016bc)) - * emails are no longer case sensitive ([dafd8db1](https://github.com/DaftMonk/generator-angular-fullstack/commit/dafd8db1f529b86322ef60f65897761cef92841a)) - - -## v1.4.0 (2014-04-13) - -#### Features - -* **server:** updated Express to v4.x -* **app:** matching angular dependencies to the latest verison, now that bower excludes pre-releases ([94c0c636](http://github.com/DaftMonk/generator-angular-fullstack/commit/94c0c63691976eaf7136c33365f611b465ba7f61)) -* **gen:** - * Added `angular-fullstack:openshift` generator, for deploying your app to OpenShift - * Added `angular-fullstack:heroku` generator, which improves upon the former `:deploy` generator for deploying to Heroku - -#### Bug Fixes - -* **server:** fixed possible DB flushing when mochaTest is called by watch, first call 'env:test' task before 'mochaTest' -([2f0320fe](http://github.com/DaftMonk/generator-angular-fullstack/commit/2f0320feb89f3a5f1757f8adcae4b8c0d5599c95)) - -#### Breaking Changes - -* The `angular-fullstack:deploy` generator is deprecated. Instead use `angular-fullstack:heroku` or `angular-fullstack:openshift`. - - -### v1.3.3 (2014-03-29) - -#### Features - -* **server:** enable response compression ([1547ac6f](http://github.com/DaftMonk/generator-angular-fullstack/commit/1547ac6f794ce06d2a9329531bec5dae73441f04)) - -#### Bug Fixes - -* **config:** change default port in config to 9000 ([480515f6](http://github.com/DaftMonk/generator-angular-fullstack/commit/480515f6cc8d7600003a570f9b1f0530fd178ac5)) -* **gruntfile:** - * update gruntfile to use port from config ([c8aa2d5f](http://github.com/DaftMonk/generator-angular-fullstack/commit/c8aa2d5feda90a2c1e7528165b1bd22e9eab5e77)) - * workaround imagemin bug by disabling caching ([3e435fa7](http://github.com/DaftMonk/generator-angular-fullstack/commit/3e435fa74b1574223f129867621a9a800cea2af9)) -* **package:** update required generator-karma dependency to the correct version ([0c0e8a52](http://github.com/DaftMonk/generator-angular-fullstack/commit/0c0e8a522ffa94ea0bd9c0df9994c23340a957f7)) - - -### v1.3.2 (2014-03-01) - - -#### Bug Fixes - -* **package.json:** updated dependencies that were causing issues with npm install ([1874cdf1](http://github.com/DaftMonk/generator-angular-fullstack/commit/1874cdf16c9d1670d0492db8db1be77e43222de4)) - - -### v1.3.1 (2014-03-01) - - -#### Bug Fixes - -* **gruntfile:** configured jshint for client tests ([4ee92b9a](http://github.com/DaftMonk/generator-angular-fullstack/commit/4ee92b9a4c466982b171bc777c3ba6ba5a477633)) - - -## v1.3.0 (2014-02-27) - - -#### Bug Fixes - -* **grunt:** - * fixed clean:dist task ([e390cac0](http://github.com/DaftMonk/generator-angular-fullstack/commit/e390cac015974f691ab51261128b4215e878b25f)) -* **server:** - * config all and env specific are now correctly deep merged ([31039872](http://github.com/DaftMonk/generator-angular-fullstack/commit/31039872caec541847cb80da8edf3c7ffd83ef48)) - * fix configuration so that (express) errorHandler works ([0116cb35](http://github.com/DaftMonk/generator-angular-fullstack/commit/0116cb35524afb2ee5b8a599f6bc76dbe04febc5)) - - -#### Features - -* **app:** - * added `grunt serve:debug` task that launches the server with a node-inspector tab ([de3e7a8b](http://github.com/DaftMonk/generator-angular-fullstack/commit/de3e7a8b7e63c54090c8fbc2f51998965b2e274f)) - * update to bootstrap sass official ([3799c13c](http://github.com/DaftMonk/generator-angular-fullstack/commit/3799c13c3b65fcc2abfbacb5292b192543558d52)) -* **server:** - * added tests for user model ([4c894b65](http://github.com/DaftMonk/generator-angular-fullstack/commit/4c894b65ec6a6d8de2b7290521f25b134ac30f40)) - * added mocha test configuration ([458a2f6a](http://github.com/DaftMonk/generator-angular-fullstack/commit/458a2f6a28485a8791815f8795e726af3c308efe)) - - -### v1.2.7 (2014-02-15) - - -#### Features - -* **server:** undefined api routes now return a 404 ([ec829fe2](http://github.com/DaftMonk/generator-angular-fullstack/commit/ec829fe2221dbe001c12983c95576c20f0e63a30)) - - -### v1.2.6 (2014-02-14) - - -#### Bug Fixes - -* **app:** - * redirect to login only on 401s ([64b7bace](http://github.com/DaftMonk/generator-angular-fullstack/commit/64b7bacea98e59cb72a44627b57ca331d9bf051d)) - * fixed incorrect css path for usemin in gruntfile ([46fca240](http://github.com/DaftMonk/generator-angular-fullstack/commit/46fca240009d2c61aa07b5cef2275e4095033a10)) -* **grunt:** include partial sub-directories in htmlmin ([77564ba3](http://github.com/DaftMonk/generator-angular-fullstack/commit/77564ba3b59baa52546f3b1170ee9cad16b7d413)) -* **server:** - * fixed connect-mongo error ([c12db5b3](http://github.com/DaftMonk/generator-angular-fullstack/commit/c12db5b3e9b7475ba4581f23f9c20e4ce701b855)) - * livereload now waits for server to finish restarting ([71d63f0a](http://github.com/DaftMonk/generator-angular-fullstack/commit/71d63f0a704a2773cee368b1af24c188e04d0ae3)) - * exposed configured passport from passport module ([772133de](http://github.com/DaftMonk/generator-angular-fullstack/commit/772133de1f86c8a6a8c93179673deb4359e30c94)) - * only require models if they are coffescript or js files ([ce2ee236](http://github.com/DaftMonk/generator-angular-fullstack/commit/ce2ee2369ff0c4aedc1a13d04359d918ea1b3d8d)) - - -#### Features - -* **deps:** upgrade angular to 1.2.11, and jquery to 1.11.0 ([cd5c3030](http://github.com/DaftMonk/generator-angular-fullstack/commit/cd5c303023f57de423ca69067b1105db17d066e3)) -* **app:** switched sass-bootstrap to offical bootstrap-sass ([024fee88](http://github.com/DaftMonk/generator-angular-fullstack/commit/024fee8831c4a32962283878b6b9dbd444874ec0)) - - -### v1.2.5 (2014-01-27) - - -#### Bug Fixes - -* **app:** - * fixed coffee service so it's min-safe ([c18c9da4](http://github.com/DaftMonk/generator-angular-fullstack/commit/c18c9da4475e8e48507746f441186edf9fde18b1)) - * fixed bootstrap css being imported rather than compass bootstrap ([f2739987](http://github.com/DaftMonk/generator-angular-fullstack/commit/f27399879e84daf7230d9cd953c19e93bcd22746)) -* **server:** - * replaced deprecated bodyparser ([788fda04](http://github.com/DaftMonk/generator-angular-fullstack/commit/788fda04ebd1ed7d24190aacda44c252fd1ae002)) - * updated node version dependency ([b19a0997](http://github.com/DaftMonk/generator-angular-fullstack/commit/b19a0997c6db08a47a56069621756129e07c5915)) -* **gen:** updated generator dependencies ([115008d3](http://github.com/DaftMonk/generator-angular-fullstack/commit/115008d378a9fd9cc47561f451cd9153f4f2c566)) - - -### v1.2.4 (2014-01-16) - - -#### Bug Fixes - -* **grunt:** fixed incorrect templating expression ([2a59e070](http://github.com/DaftMonk/generator-angular-fullstack/commit/2a59e070bb89abb4ea83e165f8a29b8de94621f1)) - - -### v1.2.3 (2014-01-16) - - -#### Bug Fixes - -* **app:** fixed jshint warning in user model ([f668fdc7](http://github.com/DaftMonk/generator-angular-fullstack/commit/f668fdc7f798e2656a9576f249836f7c91d27f1a)) - - -### v1.2.2 (2014-01-16) - - -#### Bug Fixes - -* **app:** - * replaced bcrypt with crypto for windows users ([af20c3ab](http://github.com/DaftMonk/generator-angular-fullstack/commit/af20c3ab6fd63e41475175e333810d09b3e9c3ea)) - * added karma dependencies directly to package template ([13ea60e7](http://github.com/DaftMonk/generator-angular-fullstack/commit/13ea60e7ec5763fb7f96900464df1bf26ee6912c)) - - -### v1.2.1 (2014-01-12) - - -## v1.2.0 (2014-01-11) - -#### Features - -* **app:** - * restructured project for easier configuration ([0a2bf2ab](http://github.com/DaftMonk/generator-angular-fullstack/commit/0a2bf2abe04de834c786402b8945d247b4f951aa)) - * grunt build now moves all files into dist folder ([e6eff5d5](http://github.com/DaftMonk/generator-angular-fullstack/commit/e6eff5d56bf2a784feb3de6218e74b5390df319f)) -* **server:** added jshint error checking before livereload occurs ([7e001d31](http://github.com/DaftMonk/generator-angular-fullstack/commit/7e001d3156d778022e7b6847cc65934432fb9200)) -* **gen:** added passport question for scaffolding out user account creation ([87841064](http://github.com/DaftMonk/generator-angular-fullstack/commit/8784106409e51cddf8fcdc6ab52b1e81137cda19)) - -#### Bug Fixes - -* **app:** removed async dependency ([d5636d71](http://github.com/DaftMonk/generator-angular-fullstack/commit/d5636d712a984948fb92b82794681c07d43d830d)) -* **gitignore:** fix app/views being ignored by git ([7fa82ff9](http://github.com/DaftMonk/generator-angular-fullstack/commit/7fa82ff953e9f1368b8f9d6c3dadb5fe83bec002)) -* **server:** - * config wasn't added to default project ([79c5e027](http://github.com/DaftMonk/generator-angular-fullstack/commit/79c5e027719507a74497c2f6be77375a513316c4)) - * removed typo and cleaned up extra whitespace ([1a132c28](http://github.com/DaftMonk/generator-angular-fullstack/commit/1a132c2822fd4973068b8beae075d0c8ec3efd42)) - * fixed style issues that were tripping up jshint - -#### Breaking Changes - -* `grunt heroku` is deprecated. Use `grunt build` instead. - - -### v1.1.1 (2013-12-25) - -#### Bug Fixes - -* **views:** - * Replaced deprecated jade tags. - -#### Features - -* **app:** - * Updgrade to AngularJS 1.2.6 - - -## v1.1.0 (2013-12-22) - - -#### Bug Fixes - -* **app:** - * only copy CSS if Compass is not installed ([7e586745](http://github.com/DaftMonk/generator-angular-fullstack/commit/7e58674585e138c0f2eb81f46ef2cc4f1b9a3bf8)) - * services use classified names ([56a71a83](http://github.com/DaftMonk/generator-angular-fullstack/commit/56a71a83cdf90f81bb37b422ba4d40e75d28e1fe), closes [#484](http://github.com/DaftMonk/generator-angular-fullstack/issues/484)) - * reload JS files in watch ([d20f5bd2](http://github.com/DaftMonk/generator-angular-fullstack/commit/d20f5bd20ba95d47447f8acceee491a0a0ba9724)) -* **build:** deselecting ngRoute does remove route stuff ([a358c1ae](http://github.com/DaftMonk/generator-angular-fullstack/commit/a358c1ae69bff6a7708ea0a77248698f931f2e4d), closes [#486](http://github.com/DaftMonk/generator-angular-fullstack/issues/486)) -* **gen:** - * updated all conflicts, and fixed some bugs, from merging with upstream ([d07c829d](http://github.com/DaftMonk/generator-angular-fullstack/commit/d07c829db283eaa4986774f9664243b50b3b5171)) - * fix bower install prompt during project gen ([706f1336](http://github.com/DaftMonk/generator-angular-fullstack/commit/706f1336852923e409d669ae6fc6faeda7bbb017), closes [#505](http://github.com/DaftMonk/generator-angular-fullstack/issues/505)) -* **package:** fix imagemin for windows users ([b3cec228](http://github.com/DaftMonk/generator-angular-fullstack/commit/b3cec228b4354343929ca07fd7225526cdab74d9)) -* **views:** - * fix ng includes ([598c69a5](http://github.com/DaftMonk/generator-angular-fullstack/commit/598c69a594e00f598e0cbd435444bc8abaa0d4ee)) - * add compiled views to gitignore ([087ede5f](http://github.com/DaftMonk/generator-angular-fullstack/commit/087ede5f8e2cef4c49f940ef922d71a51d110d51)) - * fix incorrect build path for vendor css ([0ed2a200](http://github.com/DaftMonk/generator-angular-fullstack/commit/0ed2a20018086fa514846ad2503841f6d5b23e16)) - - -#### Features - -* **app:** - * add jasmine browser global to test jshintrc ([11b6ed42](http://github.com/DaftMonk/generator-angular-fullstack/commit/11b6ed42b5e941f25cc305eb5c4e8ba49586cf64)) - * use lowercase file names ([23e5d772](http://github.com/DaftMonk/generator-angular-fullstack/commit/23e5d7724e7e02e4b974f4e804f35eca33a53aea), closes [#463](http://github.com/DaftMonk/generator-angular-fullstack/issues/463)) - * use htmlmin for smaller HTML files ([2b85a52a](http://github.com/DaftMonk/generator-angular-fullstack/commit/2b85a52a054ac8cf1ab86ce1cd3de7819d30ea52), closes [#469](http://github.com/DaftMonk/generator-angular-fullstack/issues/469)) - * use grunt-bower-install for dep management ([ba7b5051](http://github.com/DaftMonk/generator-angular-fullstack/commit/ba7b505117307059a6d013d838c8aeff6db0e452), closes [#497](http://github.com/DaftMonk/generator-angular-fullstack/issues/497)) - * Enable Node debug mode ([83ae4a9e](http://github.com/DaftMonk/generator-angular-fullstack/commit/83ae4a9e328a388dd61414634ca5e10c8a0c819b)) -* **gen:** - * Added navbar to starting template ([b5e94749](http://github.com/DaftMonk/generator-angular-fullstack/commit/b5e94749384ab9a3305991df62d7ed9856bded83)) - * additional work for compass support ([11cb9943](http://github.com/DaftMonk/generator-angular-fullstack/commit/11cb99437271b6e8f6cdaee8fd5fc9cda7a20d1d)) - * add Compass support to the initialization process ([7fac1194](http://github.com/DaftMonk/generator-angular-fullstack/commit/7fac1194179df3181f52258b0aa7333799fec253)) - * add welcome message and dep notice for minsafe ([f0bb8da2](http://github.com/DaftMonk/generator-angular-fullstack/commit/f0bb8da2d67c3f627bf775e2d4f53340b5c980c4), closes [#452](http://github.com/DaftMonk/generator-angular-fullstack/issues/452)) -* **server:** - * Added middleware for development mode that disables caching of script files ([c082c81c](http://github.com/DaftMonk/generator-angular-fullstack/commit/c082c81c21a9d8d6fd9fccd5001270759fb2a30f)) - * Moved express configuration code out of server.js and into config folder to make it a more high level bootstrap. - - -#### Breaking Changes - -* Deselecting ngRoute adds controller and -ng-include to index.html - ([a358c1ae](http://github.com/DaftMonk/generator-angular-fullstack/commit/a358c1ae69bff6a7708ea0a77248698f931f2e4d)) -* `--minsafe` flag is now deprecated. -* `grunt server` is now deprecated. Use `grunt serve` instead - - -### v1.0.1 (2013-11-27) - - -#### Bug Fixes - -* **coffee:** updated coffescript templates to point to partials ([f98e84ef](http://github.com/DaftMonk/generator-angular-fullstack/commit/f98e84efdd88243cff1ea449dc3a8e9dbebb7ccc)) - - -## v1.0.0 (2013-11-26) - - -#### Bug Fixes - -* **build:** - * use test-specifc jshintrc ([c00c091b](http://github.com/DaftMonk/generator-angular-fullstack/commit/c00c091bdca2b55685d81a2b84b002d73aacbdcc)) - * add webapp upstream features and better coffee ([c23acebb](http://github.com/DaftMonk/generator-angular-fullstack/commit/c23acebbd8fabd391bfeee0d424f26e59f756a03)) - * use grunt-newer for styles and jshint ([b1eeb68a](http://github.com/DaftMonk/generator-angular-fullstack/commit/b1eeb68a8290aee930887fc473034ee7f8e2ccc3)) - * standardize comments and comment out uglify:dist ([d5d3e458](http://github.com/DaftMonk/generator-angular-fullstack/commit/d5d3e458e70d054707c70d058454fdd3d94070fe), closes [#455](http://github.com/DaftMonk/generator-angular-fullstack/issues/455)) -* **deps:** upgrade dependencies ([3a57216f](http://github.com/DaftMonk/generator-angular-fullstack/commit/3a57216ff9e3192db3804634f360253e9fcce69d)) -* **gen:** - * Fixed jshint errors that were breaking grunt task ([c6ae81c8](http://github.com/DaftMonk/generator-angular-fullstack/commit/c6ae81c8110ee59c9099740ea2f90b0d08b810d3)) - -#### Features - -* **app:** - * Separate client and server watchers ([0ff8ffb1](http://github.com/DaftMonk/generator-angular-fullstack/commit/0ff8ffb105a2eb1cd079fabafc5a6517d62e861d)) - * imagemin handles gifs ([9341eb9b](http://github.com/DaftMonk/generator-angular-fullstack/commit/9341eb9b710b95c95407dc54ed4af6aa4a496426)) -* **gen:** - * added support for jade templates ([24a13bfe](http://github.com/DaftMonk/generator-angular-fullstack/commit/24a13bfea0e4a9633f33e37df4a4710fecdea937)) - * Support for server rendering and Angular's HTML5 mode ([5ccdeb7a](http://github.com/DaftMonk/generator-angular-fullstack/commit/5ccdeb7a5543e35c000a54dfc15289004e406866), closes [#18](http://github.com/DaftMonk/generator-angular-fullstack/issues/18), [#17](http://github.com/DaftMonk/generator-angular-fullstack/issues/17)) - * add image file as example ([b161c298](http://github.com/DaftMonk/generator-angular-fullstack/commit/b161c2982d86df1bb3de44cd9fa8aee05fc66ff3)) -* **build:** - * compile only changed coffeescript files in watch task ([4196e379](http://github.com/DaftMonk/generator-angular-fullstack/commit/4196e37912993ae37812fa19d9378d8b8d2cc9da), closes [#425](http://github.com/DaftMonk/generator-angular-fullstack/issues/425)) - * deprecate server in favor of serve ([ef056319](http://github.com/DaftMonk/generator-angular-fullstack/commit/ef0563192a9e3fc834ae97e7ec68470bcfdf56eb)) - -#### Breaking Changes - -* `angular-fullstack:route` -* `angular-fullstack:view` - -Will now generate views and routes in the views/partials folder. - -**For existing projects:** - -For generating routes and views, install generator-angular and use it's sub-generators. - -They are exactly the same as the generators that you have been using. Example usage: `yo angular:route helloworld`. - -**For New projects:** - -Continue to use angular-fullstack route and view sub-generators. - -The reason for this change in folder structure was to support server page rendering. - - -Closes #18, #17 - ([5ccdeb7a](http://github.com/DaftMonk/generator-angular-fullstack/commit/5ccdeb7a5543e35c000a54dfc15289004e406866)) - -* `grunt server` is being deprecated - ([ef056319](http://github.com/DaftMonk/generator-angular-fullstack/commit/ef0563192a9e3fc834ae97e7ec68470bcfdf56eb)) - - -## v0.2.0 (2013-11-13) - - -#### Bug Fixes - -* **bootstrap:** some plugins have ordering dependencies ([3da4a130](http://github.com/DaftMonk/generator-angular-fullstack/commit/3da4a1301e0b744c7a6054fafff26fff16b6442b)) -* **build:** only include sass if sass is selected ([597b8b5c](http://github.com/DaftMonk/generator-angular-fullstack/commit/597b8b5cfab77b78e7f6091140beda2eeee0ed54), closes [#449](http://github.com/DaftMonk/generator-angular-fullstack/issues/449)) -* **css:** remove merge conflicts ([d558af35](http://github.com/DaftMonk/generator-angular-fullstack/commit/d558af351c8a531132ce064a461bc038e0710b25)) -* **gen:** - * script paths use forward slashes ([40aa61dc](http://github.com/DaftMonk/generator-angular-fullstack/commit/40aa61dcc1bf31918bea3d2ce9a84c93554aa64a), closes [#410](http://github.com/DaftMonk/generator-angular-fullstack/issues/410)) - * remove extra "App" from service spec files ([4053f11f](http://github.com/DaftMonk/generator-angular-fullstack/commit/4053f11f800280569f5b7396ad015f0a6bcc7b49)) - * options should have descriptions ([da001832](http://github.com/DaftMonk/generator-angular-fullstack/commit/da001832dbdb268b3bf38f359c72b40c401273e4)) -* **styles:** update path to icon images ([8daad4f2](http://github.com/DaftMonk/generator-angular-fullstack/commit/8daad4f2de9dbde4fcc810527da7c9607e1db8d4)) -* **template:** remove redundant closing tag ([d1e560e0](http://github.com/DaftMonk/generator-angular-fullstack/commit/d1e560e0675ecb70e6c4b59cf4de9df461434a31), closes [#441](http://github.com/DaftMonk/generator-angular-fullstack/issues/441)) - - -#### Features - -* **app:** - * run unit tests when test scripts are changed ([94af0b51](http://github.com/DaftMonk/generator-angular-fullstack/commit/94af0b510982b05c5a1939966e96aeccce087500)) - * update to angular 1.2.0 ([77082c6b](http://github.com/DaftMonk/generator-angular-fullstack/commit/77082c6b8d1dda76579f1970a270dffc359f027f)) - * reload grunt server when gruntfile is updated ([50c6abb9](http://github.com/DaftMonk/generator-angular-fullstack/commit/50c6abb9cce09a149253ceb8496feca813a71136)) - * upgrade to Bootstrap 3.0.1 ([59f4b1ba](http://github.com/DaftMonk/generator-angular-fullstack/commit/59f4b1ba73842b758174ad44a7da60af4f4db63f)) -* **gen:** - * allow app names to have custom suffix ([09f0f7b3](http://github.com/DaftMonk/generator-angular-fullstack/commit/09f0f7b3a8c3264b7527bc9fed8c709becec99eb)) - - -## v0.1.0 (2013-11-12) +## v0.1.0 (2015-07-19) + +Forked from [AngularJS Full-Stack generator](https://github.com/DaftMonk/generator-angular-fullstack) -#### Features -* **gen:** include MongoDB as an option When selected, sets up database with Mongoose. Repl ([280cc84d](http://github.com/DaftMonk/generator-angular-fullstack/commit/280cc84d735c60b1c261540dceda34dd7f91c93c), closes [#2](http://github.com/DaftMonk/generator-angular-fullstack/issues/2)) \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 9819a4041..39826d2f1 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -137,11 +137,7 @@ module.exports = function (grunt) { stylesheet: 'sass', router: 'uirouter', bootstrap: true, - uibootstrap: true, - mongoose: true, - auth: true, - oauth: ['googleAuth', 'twitterAuth'], - socketio: true + uibootstrap: true }; var deps = [ @@ -152,7 +148,7 @@ module.exports = function (grunt) { ] ]; - var gen = helpers.createGenerator('angular-fullstack:app', deps); + var gen = helpers.createGenerator('angular-arduino:app', deps); helpers.mockPrompt(gen, options); gen.run({}, function () { @@ -163,44 +159,6 @@ module.exports = function (grunt) { } }); - grunt.registerTask('releaseDemoBuild', 'builds and releases demo', function () { - var done = this.async(); - - shell.cd(grunt.config('config').demo); - - Q() - .then(gruntBuild) - .then(gruntRelease) - .then(function() { - shell.cd('../'); - }) - .catch(function(msg){ - grunt.fail.warn(msg || 'failed to release demo') - }) - .finally(done); - - function run(cmd) { - var deferred = Q.defer(); - var generator = shell.exec(cmd, {async:true}); - generator.stdout.on('data', function (data) { - grunt.verbose.writeln(data); - }); - generator.on('exit', function (code) { - deferred.resolve(); - }); - - return deferred.promise; - } - - function gruntBuild() { - return run('grunt'); - } - - function gruntRelease() { - return run('grunt buildcontrol:heroku'); - } - }); - grunt.registerTask('updateFixtures', 'updates package and bower fixtures', function() { var done = this.async(); var packageJson = fs.readFileSync(path.resolve('app/templates/_package.json'), 'utf8'); @@ -248,11 +206,5 @@ module.exports = function (grunt) { 'generateDemo' ]); - grunt.registerTask('releaseDemo', [ - 'demo', - 'releaseDemoBuild', - 'buildcontrol:release' - ]); - //grunt.registerTask('default', ['bump', 'changelog', 'stage', 'release']); }; diff --git a/app/USAGE b/app/USAGE index 721ce199b..35475dbab 100644 --- a/app/USAGE +++ b/app/USAGE @@ -2,4 +2,4 @@ Description: Creates an full-stack AngularJS + Node app Example: - yo angular-fullstack + yo angular-arduino diff --git a/app/index.js b/app/index.js index 194b337a6..e3883b367 100644 --- a/app/index.js +++ b/app/index.js @@ -6,6 +6,7 @@ var genUtils = require('../util.js'); var yeoman = require('yeoman-generator'); var chalk = require('chalk'); var wiredep = require('wiredep'); +var serialPort = require("serialport"); var AngularFullstackGenerator = yeoman.generators.Base.extend({ @@ -28,7 +29,7 @@ var AngularFullstackGenerator = yeoman.generators.Base.extend({ info: function () { this.log(this.yeoman); - this.log('Out of the box I create an AngularJS app with an Express server.\n'); + this.log('Out of the box I create an AngularJS app with an aWOT server.\n'); }, checkForConfig: function() { @@ -39,19 +40,9 @@ var AngularFullstackGenerator = yeoman.generators.Base.extend({ type: "confirm", name: "skipConfig", message: "Existing .yo-rc configuration found, would you like to use it?", - default: true, + default: true }], function (answers) { this.skipConfig = answers.skipConfig; - - // NOTE: temp(?) fix for #403 - if(typeof this.oauth==='undefined') { - var strategies = Object.keys(this.filters).filter(function(key) { - return key.match(/Auth$/) && key; - }); - - if(strategies.length) this.config.set('oauth', true); - } - cb(); }.bind(this)); } else { @@ -129,87 +120,150 @@ var AngularFullstackGenerator = yeoman.generators.Base.extend({ cb(); }.bind(this)); }, + idePath: function() { + if(this.skipConfig) return; + var cb = this.async(); + var self = this; - serverPrompts: function() { + this.log('\n# Arduino IDE\n'); + + self.prompt({ + type: "input", + name: "idePath", + message: "Path to Arduino IDE", + default: "/Applications/Arduino.app/Contents/MacOS/arduino" + }, function (answer) { + self.idePath = answer.idePath; + cb(); + }); + }, + serialPrompt: function() { if(this.skipConfig) return; var cb = this.async(); var self = this; - this.log('\n# Server\n'); + this.log('\n# Serial port\n'); - this.prompt([{ - type: "confirm", - name: "mongoose", - message: "Would you like to use mongoDB with Mongoose for data modeling?" - }, { - type: "confirm", - name: "auth", - message: "Would you scaffold out an authentication boilerplate?", - when: function (answers) { - return answers.mongoose; - } - }, { - type: 'checkbox', - name: 'oauth', - message: 'Would you like to include additional oAuth strategies?', - when: function (answers) { - return answers.auth; - }, - choices: [ - { - value: 'googleAuth', - name: 'Google', - checked: false - }, - { - value: 'facebookAuth', - name: 'Facebook', - checked: false - }, - { - value: 'twitterAuth', - name: 'Twitter', - checked: false + serialPort.list(function (err, ports) { + var portChoices = ports.map(function(port) { + return port.comName; + }); + + portChoices.push("custom"); + + self.prompt({ + type: "list", + name: "port", + message: "Please select serial port", + choices: portChoices + }, function (answer) { + + if (answer.port === 'custom'){ + self.prompt({ + type: "input", + name: "port", + message: "Port" + }, function (answer) { + self.serialPort = answer.port; + cb(); + }); + } else { + self.serialPort = answer.port; + cb(); } - ] - }, { - type: "confirm", - name: "socketio", - message: "Would you like to use socket.io?", - // to-do: should not be dependent on mongoose - when: function (answers) { - return answers.mongoose; - }, - default: true - }], function (answers) { - if(answers.socketio) this.filters.socketio = true; - if(answers.mongoose) this.filters.mongoose = true; - if(answers.auth) this.filters.auth = true; - if(answers.oauth) { - if(answers.oauth.length) this.filters.oauth = true; - answers.oauth.forEach(function(oauthStrategy) { - this.filters[oauthStrategy] = true; - }.bind(this)); - } + }); + }); + }, + platformPrompts: function() { + if(this.skipConfig) return; + var cb = this.async(); + var self = this; - cb(); - }.bind(this)); + this.log('\n# Target platform\n'); + + serialPort.list(function (err, ports) { + self.prompt({ + type: "list", + name: "platform", + default: 4, + message: "What is your target platform?", + choices: [ "Uno", "Mega", "Due (Programming Port)", "Teensy3", "ESP8266", "custom"], + filter: function( val ) { console.log(val); return val.toLowerCase(); } + }, function (answer) { + + if (answer.platform === 'custom'){ + self.prompt([{ + type: "input", + name: "package", + message: "Package", + default: "arduino" + }, { + type: "input", + name: "arch", + message: "Architecture", + default: "avr" + },{ + type: "input", + name: "board", + message: "Board", + default: "uno" + },{ + type: "input", + name: "parameters", + message: "Comma-separated list of boards specific parameters" + }], function (answers) { + self.package = answers.package; + self.arch = answers.arch; + self.board = answers.board; + cb(); + }); + } else { + if (answer.platform === 'uno'){ + self.package = 'arduino'; + self.arch = 'avr'; + self.board = 'uno'; + } else if (answer.platform === 'mega'){ + self.package = 'arduino'; + self.arch = 'avr'; + self.board = 'mega'; + } else if (answer.platform === 'due'){ + self.package = 'arduino'; + self.arch = 'sam'; + self.board = 'arduino_due_x_dbg'; + } else if (answer.platform === 'teensy3'){ + self.package = 'teensy'; + self.arch = 'avr'; + self.board = 'teensy3'; + } else if (answer.platform === 'esp8266'){ + self.package = 'esp8266'; + self.arch = 'esp8266'; + self.board = 'esp8266'; + } + cb(); + } + }); + }); }, saveSettings: function() { if(this.skipConfig) return; this.config.set('insertRoutes', true); - this.config.set('registerRoutesFile', 'server/routes.js'); - this.config.set('routesNeedle', '// Insert routes below'); + this.config.set('registerRoutesFile', 'server/server.ino'); + this.config.set('routesNeedle', '// other routers'); this.config.set('routesBase', '/api/'); this.config.set('pluralizeRoutes', true); - this.config.set('insertSockets', true); - this.config.set('registerSocketsFile', 'server/config/socketio.js'); - this.config.set('socketsNeedle', '// Insert sockets below'); - this.config.set('filters', this.filters); + + this.config.set('package', this.package); + this.config.set('arch', this.arch); + this.config.set('board', this.board); + + this.config.set('serialPort', this.serialPort); + + this.config.set('idePath', this.idePath); + this.config.forceSave(); }, @@ -250,13 +304,19 @@ var AngularFullstackGenerator = yeoman.generators.Base.extend({ uibootstrap: true }); + this.package = this.config.get('package'); + this.arch = this.config.get('arch'); + this.board = this.config.get('board'); + + this.serialPort = this.config.get('serialPort'); + + this.idePath = this.config.get('idePath'); + var angModules = [ - "'ngCookies'", "'ngResource'", "'ngSanitize'" ]; if(this.filters.ngroute) angModules.push("'ngRoute'"); - if(this.filters.socketio) angModules.push("'btford.socket-io'"); if(this.filters.uirouter) angModules.push("'ui.router'"); if(this.filters.uibootstrap) angModules.push("'ui.bootstrap'"); diff --git a/app/templates/.travis.yml b/app/templates/.travis.yml deleted file mode 100644 index 5112a8e88..000000000 --- a/app/templates/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: node_js -node_js: - - '0.10' - - '0.11' -before_script: - - npm install -g bower grunt-cli<% if (filters.sass) { %> - - gem install sass<% } %> - - bower install -services: mongodb \ No newline at end of file diff --git a/app/templates/Gruntfile.js b/app/templates/Gruntfile.js index 6685f5108..d5c6d69be 100644 --- a/app/templates/Gruntfile.js +++ b/app/templates/Gruntfile.js @@ -11,12 +11,8 @@ module.exports = function (grunt) { // Load grunt tasks automatically, when needed require('jit-grunt')(grunt, { - express: 'grunt-express-server', useminPrepare: 'grunt-usemin', - ngtemplates: 'grunt-angular-templates', - cdnify: 'grunt-google-cdn', - protractor: 'grunt-protractor-runner', - buildcontrol: 'grunt-build-control' + ngtemplates: 'grunt-angular-templates' }); // Time how long tasks take. Can help when optimizing build times @@ -32,27 +28,6 @@ module.exports = function (grunt) { client: require('./bower.json').appPath || 'client', dist: 'dist' }, - express: { - options: { - port: process.env.PORT || 9000 - }, - dev: { - options: { - script: 'server/app.js', - debug: true - } - }, - prod: { - options: { - script: 'dist/server/app.js' - } - } - }, - open: { - server: { - url: 'http://localhost:<%%= express.options.port %>' - } - }, watch: { injectJS: { files: [ @@ -68,10 +43,6 @@ module.exports = function (grunt) { ], tasks: ['injector:css'] }, - mochaTest: { - files: ['server/**/*.spec.js'], - tasks: ['env:test', 'mochaTest'] - }, jsTest: { files: [ '<%%= yeoman.client %>/{app,components}/**/*.spec.js', @@ -154,16 +125,6 @@ module.exports = function (grunt) { options: { livereload: true } - }, - express: { - files: [ - 'server/**/*.{js,json}' - ], - tasks: ['express:dev', 'wait'], - options: { - livereload: true, - nospawn: true //Without this option specified express won't be reloaded - } } }, @@ -173,21 +134,6 @@ module.exports = function (grunt) { jshintrc: '<%%= yeoman.client %>/.jshintrc', reporter: require('jshint-stylish') }, - server: { - options: { - jshintrc: 'server/.jshintrc' - }, - src: [ - 'server/**/*.js', - '!server/**/*.spec.js' - ] - }, - serverTest: { - options: { - jshintrc: 'server/.jshintrc-spec' - }, - src: ['server/**/*.spec.js'] - }, all: [ '<%%= yeoman.client %>/{app,components}/**/*.js', '!<%%= yeoman.client %>/{app,components}/**/*.spec.js', @@ -233,40 +179,6 @@ module.exports = function (grunt) { } }, - // Debugging with node inspector - 'node-inspector': { - custom: { - options: { - 'web-host': 'localhost' - } - } - }, - - // Use nodemon to run server in debug mode with an initial breakpoint - nodemon: { - debug: { - script: 'server/app.js', - options: { - nodeArgs: ['--debug-brk'], - env: { - PORT: process.env.PORT || 9000 - }, - callback: function (nodemon) { - nodemon.on('log', function (event) { - console.log(event.colour); - }); - - // opens browser on initial server start - nodemon.on('config:update', function () { - setTimeout(function () { - require('open')('http://localhost:8080/debug?port=5858'); - }, 500); - }); - } - } - } - }, - // Automatically inject Bower components into the app wiredep: { target: { @@ -276,20 +188,6 @@ module.exports = function (grunt) { } }, - // Renames files for browser caching purposes - rev: { - dist: { - files: { - src: [ - '<%%= yeoman.dist %>/public/{,*/}*.js', - '<%%= yeoman.dist %>/public/{,*/}*.css', - '<%%= yeoman.dist %>/public/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}', - '<%%= yeoman.dist %>/public/assets/fonts/*' - ] - } - } - }, - // Reads HTML for usemin blocks to enable smart builds that automatically // concat, minify and revision files. Creates configurations in memory so // additional tasks can operate on them @@ -383,13 +281,6 @@ module.exports = function (grunt) { } }, - // Replace Google CDN references - cdnify: { - dist: { - html: ['<%%= yeoman.dist %>/public/*.html'] - } - }, - // Copies remaining files to places other tasks can use copy: { dist: { @@ -400,10 +291,7 @@ module.exports = function (grunt) { dest: '<%%= yeoman.dist %>/public', src: [ '*.{ico,png,txt}', - '.htaccess', - 'bower_components/**/*', 'assets/images/{,*/}*.{webp}', - 'assets/fonts/**/*', 'index.html' ] }, { @@ -415,7 +303,6 @@ module.exports = function (grunt) { expand: true, dest: '<%%= yeoman.dist %>', src: [ - 'package.json', 'server/**/*' ] }] @@ -428,28 +315,6 @@ module.exports = function (grunt) { } }, - buildcontrol: { - options: { - dir: 'dist', - commit: true, - push: true, - connectCommits: false, - message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%' - }, - heroku: { - options: { - remote: 'heroku', - branch: 'master' - } - }, - openshift: { - options: { - remote: 'openshift', - branch: 'master' - } - } - }, - // Run some tasks in parallel to speed up the build process concurrent: { server: [<% if(filters.coffee) { %> @@ -468,15 +333,6 @@ module.exports = function (grunt) { 'sass',<% } %><% if(filters.less) { %> 'less',<% } %> ], - debug: { - tasks: [ - 'nodemon', - 'node-inspector' - ], - options: { - logConcurrentOutput: true - } - }, dist: [<% if(filters.coffee) { %> 'coffee',<% } %><% if(filters.babel) { %> 'babel',<% } %><% if(filters.jade) { %> @@ -495,36 +351,6 @@ module.exports = function (grunt) { configFile: 'karma.conf.js', singleRun: true } - }, - - mochaTest: { - options: { - reporter: 'spec' - }, - src: ['server/**/*.spec.js'] - }, - - protractor: { - options: { - configFile: 'protractor.conf.js' - }, - chrome: { - options: { - args: { - browser: 'chrome' - } - } - } - }, - - env: { - test: { - NODE_ENV: 'test' - }, - prod: { - NODE_ENV: 'production' - }, - all: localConfig },<% if(filters.jade) { %> // Compiles Jade to html @@ -741,111 +567,79 @@ module.exports = function (grunt) { } } }, - }); - - // Used for delaying livereload until after server has restarted - grunt.registerTask('wait', function () { - grunt.log.ok('Waiting for server reload...'); - - var done = this.async(); - - setTimeout(function () { - grunt.log.writeln('Done waiting!'); - done(); - }, 1500); - }); - - grunt.registerTask('express-keepalive', 'Keep grunt running', function() { - this.async(); - }); - - grunt.registerTask('serve', function (target) { - if (target === 'dist') { - return grunt.task.run(['build', 'env:all', 'env:prod', 'express:prod', 'wait', 'open', 'express-keepalive']); - } - - if (target === 'debug') { - return grunt.task.run([ - 'clean:server', - 'env:all',<% if(filters.stylus) { %> - 'injector:stylus', <% } %><% if(filters.less) { %> - 'injector:less', <% } %><% if(filters.sass) { %> - 'injector:sass', <% } %> - 'concurrent:server', - 'injector', - 'wiredep', - 'autoprefixer', - 'concurrent:debug' - ]); + arduino: { + options: { + sketch: 'dist/server/server.ino', + idePath: '<%= idePath %>' + }, + settings: { + options: { + savePrefs: true, + port: '<%= serialPort %>', + board: { + package: '<%= package %>', + arch: '<%= arch %>', + board: '<%= board %>' + } + } + }, + verify: { + options: { + action: 'verify' + } + }, + upload: { + options: {<% if(board === 'teensy3') { %> + preserveTempFiles: true,<% } %> + action: 'upload' + } + } + }, + awot: { + options: { + sketch: 'dist/server/server.ino' + }, + files: { + expand: true, + src: '**/*.*', + cwd: 'dist/public' + } + }, + connect: { + options: { + port: 9000, + // Change this to '0.0.0.0' to access the server from outside. + hostname: 'localhost', + livereload: 35729 + }, + livereload: { + options: { + open: true, + middleware: function (connect) { + return [ + connect.static('.tmp'), + connect.static('client') + ]; + } + } + } } + }); - grunt.task.run([ - 'clean:server', - 'env:all',<% if(filters.stylus) { %> + grunt.registerTask('test', function(target) { + return grunt.task.run([ + 'clean:server',<% if(filters.stylus) { %> 'injector:stylus', <% } %><% if(filters.less) { %> 'injector:less', <% } %><% if(filters.sass) { %> 'injector:sass', <% } %> - 'concurrent:server', + 'concurrent:test', 'injector', 'wiredep', 'autoprefixer', - 'express:dev', - 'wait', - 'open', - 'watch' + 'karma' ]); }); - grunt.registerTask('server', function () { - grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.'); - grunt.task.run(['serve']); - }); - - grunt.registerTask('test', function(target) { - if (target === 'server') { - return grunt.task.run([ - 'env:all', - 'env:test', - 'mochaTest' - ]); - } - - else if (target === 'client') { - return grunt.task.run([ - 'clean:server', - 'env:all',<% if(filters.stylus) { %> - 'injector:stylus', <% } %><% if(filters.less) { %> - 'injector:less', <% } %><% if(filters.sass) { %> - 'injector:sass', <% } %> - 'concurrent:test', - 'injector', - 'autoprefixer', - 'karma' - ]); - } - - else if (target === 'e2e') { - return grunt.task.run([ - 'clean:server', - 'env:all', - 'env:test',<% if(filters.stylus) { %> - 'injector:stylus', <% } %><% if(filters.less) { %> - 'injector:less', <% } %><% if(filters.sass) { %> - 'injector:sass', <% } %> - 'concurrent:test', - 'injector', - 'wiredep', - 'autoprefixer', - 'express:dev', - 'protractor' - ]); - } - - else grunt.task.run([ - 'test:server', - 'test:client' - ]); - }); grunt.registerTask('build', [ 'clean:dist',<% if(filters.stylus) { %> @@ -861,16 +655,32 @@ module.exports = function (grunt) { 'concat', 'ngAnnotate', 'copy:dist', - 'cdnify', 'cssmin', 'uglify', - 'rev', - 'usemin' + 'usemin', + 'awot' + ]); + + grunt.registerTask('verify', [ + 'arduino:settings', + 'arduino:verify' + ]); + + grunt.registerTask('upload', [ + 'arduino:settings', + 'arduino:upload' + ]); + + grunt.registerTask('serve', [ + 'build', + 'connect', + 'watch' ]); grunt.registerTask('default', [ 'newer:jshint', 'test', - 'build' + 'build', + 'upload' ]); }; diff --git a/app/templates/_.gitignore b/app/templates/_.gitignore index a5f8174b5..cacca418d 100644 --- a/app/templates/_.gitignore +++ b/app/templates/_.gitignore @@ -5,5 +5,5 @@ public .idea client/bower_components dist -/server/config/local.env.js +.DS_Store npm-debug.log diff --git a/app/templates/_bower.json b/app/templates/_bower.json index 156d04b32..04877f56e 100644 --- a/app/templates/_bower.json +++ b/app/templates/_bower.json @@ -1,24 +1,18 @@ { "name": "<%= _.slugify(_.humanize(appname)) %>", "version": "0.0.0", - "dependencies": { - "angular": ">=1.2.*", - "json3": "~3.3.1", - "es5-shim": "~3.0.1",<% if(filters.bootstrap) { %><% if (filters.sass) { %> - "bootstrap-sass-official": "~3.1.1",<% } %> - "bootstrap": "~3.1.1",<% } %> - "angular-resource": ">=1.2.*", - "angular-cookies": ">=1.2.*", - "angular-sanitize": ">=1.2.*",<% if(filters.ngroute) { %> - "angular-route": ">=1.2.*",<% } %><% if(filters.uibootstrap) { %> - "angular-bootstrap": "~0.11.0",<% } %> - "font-awesome": ">=4.1.0", - "lodash": "~2.4.1"<% if(filters.socketio) { %>, - "angular-socket-io": "~0.6.0"<% } %><% if(filters.uirouter) { %>, - "angular-ui-router": "~0.2.15"<% } %> - }, "devDependencies": { - "angular-mocks": ">=1.2.*", - "angular-scenario": ">=1.2.*" + "angular": "1.4.2",<% if(filters.bootstrap) { %><% if (filters.sass) { %> + "bootstrap-sass-official": "3.3.5",<% } %> + "bootstrap": "3.3.5",<% } %> + "angular-resource": "1.4.2", + "angular-cookies": "1.4.2", + "angular-sanitize": "1.4.2",<% if(filters.ngroute) { %> + "angular-route": "1.4.2",<% } %><% if(filters.uibootstrap) { %> + "angular-bootstrap": "0.13.0",<% } %> + "lodash": "3.10.0",<% if(filters.uirouter) { %> + "angular-ui-router": "0.2.15",<% } %> + "angular-mocks": "1.4.2", + "angular-scenario": "1.4.2" } } diff --git a/app/templates/_package.json b/app/templates/_package.json index 88541b924..246271489 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -1,41 +1,18 @@ { "name": "<%= _.slugify(_.humanize(appname)) %>", "version": "0.0.0", - "main": "server/app.js", - "dependencies": { - "express": "~4.9.0", - "morgan": "~1.0.0", - "body-parser": "~1.5.0", - "method-override": "~1.0.0", - "serve-favicon": "~2.0.1", - "cookie-parser": "~1.0.1", - "express-session": "~1.0.2", - "errorhandler": "~1.0.0", - "compression": "~1.0.1", - "lodash": "~2.4.1",<% if(filters.jade) { %> - "jade": "~1.2.0",<% } %><% if(filters.html) { %> - "ejs": "~0.8.4",<% } %><% if(filters.mongoose) { %> - "mongoose": "~4.0.3",<% } %><% if(filters.auth) { %> - "jsonwebtoken": "^5.0.0", - "express-jwt": "^3.0.0", - "passport": "~0.2.0", - "passport-local": "~0.1.6",<% } %><% if(filters.facebookAuth) { %> - "passport-facebook": "latest",<% } %><% if(filters.twitterAuth) { %> - "passport-twitter": "latest",<% } %><% if(filters.googleAuth) { %> - "passport-google-oauth": "latest",<% } %> - "composable-middleware": "^0.3.0", - "connect-mongo": "^0.8.1"<% if(filters.socketio) { %>, - "socket.io": "^1.0.6", - "socket.io-client": "^1.0.6", - "socketio-jwt": "^3.0.0"<% } %> - }, + "dependencies": {}, "devDependencies": { + "connect-livereload": "~0.5.3", "grunt": "~0.4.4", + "grunt-arduino": "~0.1.0", "grunt-autoprefixer": "~0.7.2", + "grunt-awot": "~0.1.0", "grunt-wiredep": "~1.8.0", "grunt-concurrent": "~0.5.0", "grunt-contrib-clean": "~0.5.0", "grunt-contrib-concat": "~0.4.0", + "grunt-contrib-connect": "~0.10.1", "grunt-contrib-copy": "~0.5.0", "grunt-contrib-cssmin": "~0.9.0", "grunt-contrib-htmlmin": "~0.2.0", @@ -48,31 +25,20 @@ "grunt-contrib-less": "^0.11.0",<% } %><% if(filters.babel) { %> "karma-babel-preprocessor": "^5.2.1", "grunt-babel": "~5.0.0",<% } %> - "grunt-google-cdn": "~0.4.0", "grunt-newer": "~0.7.0", "grunt-ng-annotate": "^0.2.3", - "grunt-rev": "~0.1.0", "grunt-svgmin": "~0.4.0", "grunt-usemin": "~2.1.1", - "grunt-env": "~0.4.1", - "grunt-node-inspector": "~0.1.5", - "grunt-nodemon": "~0.2.0", "grunt-angular-templates": "^0.5.4", "grunt-dom-munger": "^3.4.0", - "grunt-protractor-runner": "^1.1.0", "grunt-injector": "~0.5.4", "grunt-karma": "~0.8.2", - "grunt-build-control": "~0.4.0", "grunt-mocha-test": "~0.10.2",<% if(filters.sass) { %> "grunt-contrib-sass": "^0.7.3",<% } %><% if(filters.stylus) { %> "grunt-contrib-stylus": "latest",<% } %> "jit-grunt": "^0.5.0", "time-grunt": "~0.3.1", - "grunt-express-server": "~0.4.17", - "grunt-open": "~0.2.3", - "open": "~0.0.4", "jshint-stylish": "~0.1.5", - "connect-livereload": "~0.4.0", "karma-ng-scenario": "~0.1.0", "karma-firefox-launcher": "~0.1.3", "karma-script-launcher": "~0.1.0", @@ -87,16 +53,13 @@ "karma-phantomjs-launcher": "~0.1.4", "karma": "~0.12.9", "karma-ng-html2js-preprocessor": "~0.1.0", - "supertest": "~0.11.0", "should": "~3.3.1" }, "engines": { "node": ">=0.10.0" }, "scripts": { - "start": "node server/app.js", - "test": "grunt test", - "update-webdriver": "node node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager update" - }, + "test": "grunt test" + }, "private": true } diff --git a/app/templates/client/.htaccess b/app/templates/client/.htaccess deleted file mode 100644 index cb84cb918..000000000 --- a/app/templates/client/.htaccess +++ /dev/null @@ -1,543 +0,0 @@ -# Apache Configuration File - -# (!) Using `.htaccess` files slows down Apache, therefore, if you have access -# to the main server config file (usually called `httpd.conf`), you should add -# this logic there: http://httpd.apache.org/docs/current/howto/htaccess.html. - -# ############################################################################## -# # CROSS-ORIGIN RESOURCE SHARING (CORS) # -# ############################################################################## - -# ------------------------------------------------------------------------------ -# | Cross-domain AJAX requests | -# ------------------------------------------------------------------------------ - -# Enable cross-origin AJAX requests. -# http://code.google.com/p/html5security/wiki/CrossOriginRequestSecurity -# http://enable-cors.org/ - -# -# Header set Access-Control-Allow-Origin "*" -# - -# ------------------------------------------------------------------------------ -# | CORS-enabled images | -# ------------------------------------------------------------------------------ - -# Send the CORS header for images when browsers request it. -# https://developer.mozilla.org/en/CORS_Enabled_Image -# http://blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html -# http://hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/ - - - - - SetEnvIf Origin ":" IS_CORS - Header set Access-Control-Allow-Origin "*" env=IS_CORS - - - - -# ------------------------------------------------------------------------------ -# | Web fonts access | -# ------------------------------------------------------------------------------ - -# Allow access from all domains for web fonts - - - - Header set Access-Control-Allow-Origin "*" - - - - -# ############################################################################## -# # ERRORS # -# ############################################################################## - -# ------------------------------------------------------------------------------ -# | 404 error prevention for non-existing redirected folders | -# ------------------------------------------------------------------------------ - -# Prevent Apache from returning a 404 error for a rewrite if a directory -# with the same name does not exist. -# http://httpd.apache.org/docs/current/content-negotiation.html#multiviews -# http://www.webmasterworld.com/apache/3808792.htm - -Options -MultiViews - -# ------------------------------------------------------------------------------ -# | Custom error messages / pages | -# ------------------------------------------------------------------------------ - -# You can customize what Apache returns to the client in case of an error (see -# http://httpd.apache.org/docs/current/mod/core.html#errordocument), e.g.: - -ErrorDocument 404 /404.html - - -# ############################################################################## -# # INTERNET EXPLORER # -# ############################################################################## - -# ------------------------------------------------------------------------------ -# | Better website experience | -# ------------------------------------------------------------------------------ - -# Force IE to render pages in the highest available mode in the various -# cases when it may not: http://hsivonen.iki.fi/doctype/ie-mode.pdf. - - - Header set X-UA-Compatible "IE=edge" - # `mod_headers` can't match based on the content-type, however, we only - # want to send this header for HTML pages and not for the other resources - - Header unset X-UA-Compatible - - - -# ------------------------------------------------------------------------------ -# | Cookie setting from iframes | -# ------------------------------------------------------------------------------ - -# Allow cookies to be set from iframes in IE. - -# -# Header set P3P "policyref=\"/w3c/p3p.xml\", CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"" -# - -# ------------------------------------------------------------------------------ -# | Screen flicker | -# ------------------------------------------------------------------------------ - -# Stop screen flicker in IE on CSS rollovers (this only works in -# combination with the `ExpiresByType` directives for images from below). - -# BrowserMatch "MSIE" brokenvary=1 -# BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1 -# BrowserMatch "Opera" !brokenvary -# SetEnvIf brokenvary 1 force-no-vary - - -# ############################################################################## -# # MIME TYPES AND ENCODING # -# ############################################################################## - -# ------------------------------------------------------------------------------ -# | Proper MIME types for all files | -# ------------------------------------------------------------------------------ - - - - # Audio - AddType audio/mp4 m4a f4a f4b - AddType audio/ogg oga ogg - - # JavaScript - # Normalize to standard type (it's sniffed in IE anyways): - # http://tools.ietf.org/html/rfc4329#section-7.2 - AddType application/javascript js jsonp - AddType application/json json - - # Video - AddType video/mp4 mp4 m4v f4v f4p - AddType video/ogg ogv - AddType video/webm webm - AddType video/x-flv flv - - # Web fonts - AddType application/font-woff woff - AddType application/vnd.ms-fontobject eot - - # Browsers usually ignore the font MIME types and sniff the content, - # however, Chrome shows a warning if other MIME types are used for the - # following fonts. - AddType application/x-font-ttf ttc ttf - AddType font/opentype otf - - # Make SVGZ fonts work on iPad: - # https://twitter.com/FontSquirrel/status/14855840545 - AddType image/svg+xml svg svgz - AddEncoding gzip svgz - - # Other - AddType application/octet-stream safariextz - AddType application/x-chrome-extension crx - AddType application/x-opera-extension oex - AddType application/x-shockwave-flash swf - AddType application/x-web-app-manifest+json webapp - AddType application/x-xpinstall xpi - AddType application/xml atom rdf rss xml - AddType image/webp webp - AddType image/x-icon ico - AddType text/cache-manifest appcache manifest - AddType text/vtt vtt - AddType text/x-component htc - AddType text/x-vcard vcf - - - -# ------------------------------------------------------------------------------ -# | UTF-8 encoding | -# ------------------------------------------------------------------------------ - -# Use UTF-8 encoding for anything served as `text/html` or `text/plain`. -AddDefaultCharset utf-8 - -# Force UTF-8 for certain file formats. - - AddCharset utf-8 .atom .css .js .json .rss .vtt .webapp .xml - - - -# ############################################################################## -# # URL REWRITES # -# ############################################################################## - -# ------------------------------------------------------------------------------ -# | Rewrite engine | -# ------------------------------------------------------------------------------ - -# Turning on the rewrite engine and enabling the `FollowSymLinks` option is -# necessary for the following directives to work. - -# If your web host doesn't allow the `FollowSymlinks` option, you may need to -# comment it out and use `Options +SymLinksIfOwnerMatch` but, be aware of the -# performance impact: http://httpd.apache.org/docs/current/misc/perf-tuning.html#symlinks - -# Also, some cloud hosting services require `RewriteBase` to be set: -# http://www.rackspace.com/knowledge_center/frequently-asked-question/why-is-mod-rewrite-not-working-on-my-site - - - Options +FollowSymlinks - # Options +SymLinksIfOwnerMatch - RewriteEngine On - # RewriteBase / - - -# ------------------------------------------------------------------------------ -# | Suppressing / Forcing the "www." at the beginning of URLs | -# ------------------------------------------------------------------------------ - -# The same content should never be available under two different URLs especially -# not with and without "www." at the beginning. This can cause SEO problems -# (duplicate content), therefore, you should choose one of the alternatives and -# redirect the other one. - -# By default option 1 (no "www.") is activated: -# http://no-www.org/faq.php?q=class_b - -# If you'd prefer to use option 2, just comment out all the lines from option 1 -# and uncomment the ones from option 2. - -# IMPORTANT: NEVER USE BOTH RULES AT THE SAME TIME! - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Option 1: rewrite www.example.com → example.com - - - RewriteCond %{HTTPS} !=on - RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] - RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L] - - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Option 2: rewrite example.com → www.example.com - -# Be aware that the following might not be a good idea if you use "real" -# subdomains for certain parts of your website. - -# -# RewriteCond %{HTTPS} !=on -# RewriteCond %{HTTP_HOST} !^www\..+$ [NC] -# RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] -# - - -# ############################################################################## -# # SECURITY # -# ############################################################################## - -# ------------------------------------------------------------------------------ -# | Content Security Policy (CSP) | -# ------------------------------------------------------------------------------ - -# You can mitigate the risk of cross-site scripting and other content-injection -# attacks by setting a Content Security Policy which whitelists trusted sources -# of content for your site. - -# The example header below allows ONLY scripts that are loaded from the current -# site's origin (no inline scripts, no CDN, etc). This almost certainly won't -# work as-is for your site! - -# To get all the details you'll need to craft a reasonable policy for your site, -# read: http://html5rocks.com/en/tutorials/security/content-security-policy (or -# see the specification: http://w3.org/TR/CSP). - -# -# Header set Content-Security-Policy "script-src 'self'; object-src 'self'" -# -# Header unset Content-Security-Policy -# -# - -# ------------------------------------------------------------------------------ -# | File access | -# ------------------------------------------------------------------------------ - -# Block access to directories without a default document. -# Usually you should leave this uncommented because you shouldn't allow anyone -# to surf through every directory on your server (which may includes rather -# private places like the CMS's directories). - - - Options -Indexes - - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Block access to hidden files and directories. -# This includes directories used by version control systems such as Git and SVN. - - - RewriteCond %{SCRIPT_FILENAME} -d [OR] - RewriteCond %{SCRIPT_FILENAME} -f - RewriteRule "(^|/)\." - [F] - - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Block access to backup and source files. -# These files may be left by some text editors and can pose a great security -# danger when anyone has access to them. - - - Order allow,deny - Deny from all - Satisfy All - - -# ------------------------------------------------------------------------------ -# | Secure Sockets Layer (SSL) | -# ------------------------------------------------------------------------------ - -# Rewrite secure requests properly to prevent SSL certificate warnings, e.g.: -# prevent `https://www.example.com` when your certificate only allows -# `https://secure.example.com`. - -# -# RewriteCond %{SERVER_PORT} !^443 -# RewriteRule ^ https://example-domain-please-change-me.com%{REQUEST_URI} [R=301,L] -# - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Force client-side SSL redirection. - -# If a user types "example.com" in his browser, the above rule will redirect him -# to the secure version of the site. That still leaves a window of opportunity -# (the initial HTTP connection) for an attacker to downgrade or redirect the -# request. The following header ensures that browser will ONLY connect to your -# server via HTTPS, regardless of what the users type in the address bar. -# http://www.html5rocks.com/en/tutorials/security/transport-layer-security/ - -# -# Header set Strict-Transport-Security max-age=16070400; -# - -# ------------------------------------------------------------------------------ -# | Server software information | -# ------------------------------------------------------------------------------ - -# Avoid displaying the exact Apache version number, the description of the -# generic OS-type and the information about Apache's compiled-in modules. - -# ADD THIS DIRECTIVE IN THE `httpd.conf` AS IT WILL NOT WORK IN THE `.htaccess`! - -# ServerTokens Prod - - -# ############################################################################## -# # WEB PERFORMANCE # -# ############################################################################## - -# ------------------------------------------------------------------------------ -# | Compression | -# ------------------------------------------------------------------------------ - - - - # Force compression for mangled headers. - # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping - - - SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding - RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding - - - - # Compress all output labeled with one of the following MIME-types - # (for Apache versions below 2.3.7, you don't need to enable `mod_filter` - # and can remove the `` and `` lines - # as `AddOutputFilterByType` is still in the core directives). - - AddOutputFilterByType DEFLATE application/atom+xml \ - application/javascript \ - application/json \ - application/rss+xml \ - application/vnd.ms-fontobject \ - application/x-font-ttf \ - application/x-web-app-manifest+json \ - application/xhtml+xml \ - application/xml \ - font/opentype \ - image/svg+xml \ - image/x-icon \ - text/css \ - text/html \ - text/plain \ - text/x-component \ - text/xml - - - - -# ------------------------------------------------------------------------------ -# | Content transformations | -# ------------------------------------------------------------------------------ - -# Prevent some of the mobile network providers from modifying the content of -# your site: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.5. - -# -# Header set Cache-Control "no-transform" -# - -# ------------------------------------------------------------------------------ -# | ETag removal | -# ------------------------------------------------------------------------------ - -# Since we're sending far-future expires headers (see below), ETags can -# be removed: http://developer.yahoo.com/performance/rules.html#etags. - -# `FileETag None` is not enough for every server. - - Header unset ETag - - -FileETag None - -# ------------------------------------------------------------------------------ -# | Expires headers (for better cache control) | -# ------------------------------------------------------------------------------ - -# The following expires headers are set pretty far in the future. If you don't -# control versioning with filename-based cache busting, consider lowering the -# cache time for resources like CSS and JS to something like 1 week. - - - - ExpiresActive on - ExpiresDefault "access plus 1 month" - - # CSS - ExpiresByType text/css "access plus 1 year" - - # Data interchange - ExpiresByType application/json "access plus 0 seconds" - ExpiresByType application/xml "access plus 0 seconds" - ExpiresByType text/xml "access plus 0 seconds" - - # Favicon (cannot be renamed!) - ExpiresByType image/x-icon "access plus 1 week" - - # HTML components (HTCs) - ExpiresByType text/x-component "access plus 1 month" - - # HTML - ExpiresByType text/html "access plus 0 seconds" - - # JavaScript - ExpiresByType application/javascript "access plus 1 year" - - # Manifest files - ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds" - ExpiresByType text/cache-manifest "access plus 0 seconds" - - # Media - ExpiresByType audio/ogg "access plus 1 month" - ExpiresByType image/gif "access plus 1 month" - ExpiresByType image/jpeg "access plus 1 month" - ExpiresByType image/png "access plus 1 month" - ExpiresByType video/mp4 "access plus 1 month" - ExpiresByType video/ogg "access plus 1 month" - ExpiresByType video/webm "access plus 1 month" - - # Web feeds - ExpiresByType application/atom+xml "access plus 1 hour" - ExpiresByType application/rss+xml "access plus 1 hour" - - # Web fonts - ExpiresByType application/font-woff "access plus 1 month" - ExpiresByType application/vnd.ms-fontobject "access plus 1 month" - ExpiresByType application/x-font-ttf "access plus 1 month" - ExpiresByType font/opentype "access plus 1 month" - ExpiresByType image/svg+xml "access plus 1 month" - - - -# ------------------------------------------------------------------------------ -# | Filename-based cache busting | -# ------------------------------------------------------------------------------ - -# If you're not using a build process to manage your filename version revving, -# you might want to consider enabling the following directives to route all -# requests such as `/css/style.12345.css` to `/css/style.css`. - -# To understand why this is important and a better idea than `*.css?v231`, read: -# http://stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring - -# -# RewriteCond %{REQUEST_FILENAME} !-f -# RewriteCond %{REQUEST_FILENAME} !-d -# RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L] -# - -# ------------------------------------------------------------------------------ -# | File concatenation | -# ------------------------------------------------------------------------------ - -# Allow concatenation from within specific CSS and JS files, e.g.: -# Inside of `script.combined.js` you could have -# -# -# and they would be included into this single file. - -# -# -# Options +Includes -# AddOutputFilterByType INCLUDES application/javascript application/json -# SetOutputFilter INCLUDES -# -# -# Options +Includes -# AddOutputFilterByType INCLUDES text/css -# SetOutputFilter INCLUDES -# -# - -# ------------------------------------------------------------------------------ -# | Persistent connections | -# ------------------------------------------------------------------------------ - -# Allow multiple requests to be sent over the same TCP connection: -# http://httpd.apache.org/docs/current/en/mod/core.html#keepalive. - -# Enable if you serve a lot of static content but, be aware of the -# possible disadvantages! - -# -# Header set Connection Keep-Alive -# diff --git a/app/templates/client/app/account(auth)/account(coffee).coffee b/app/templates/client/app/account(auth)/account(coffee).coffee deleted file mode 100644 index 2b7b8b23b..000000000 --- a/app/templates/client/app/account(auth)/account(coffee).coffee +++ /dev/null @@ -1,35 +0,0 @@ -'use strict' - -angular.module '<%= scriptAppName %>' -<% if(filters.ngroute) { %>.config ($routeProvider) -> - $routeProvider - .when '/login', - templateUrl: 'app/account/login/login.html' - controller: 'LoginCtrl' - - .when '/signup', - templateUrl: 'app/account/signup/signup.html' - controller: 'SignupCtrl' - - .when '/settings', - templateUrl: 'app/account/settings/settings.html' - controller: 'SettingsCtrl' - authenticate: true -<% } %><% if(filters.uirouter) { %>.config ($stateProvider) -> - $stateProvider - .state 'login', - url: '/login' - templateUrl: 'app/account/login/login.html' - controller: 'LoginCtrl' - - .state 'signup', - url: '/signup' - templateUrl: 'app/account/signup/signup.html' - controller: 'SignupCtrl' - - .state 'settings', - url: '/settings' - templateUrl: 'app/account/settings/settings.html' - controller: 'SettingsCtrl' - authenticate: true -<% } %> \ No newline at end of file diff --git a/app/templates/client/app/account(auth)/account(js).js b/app/templates/client/app/account(auth)/account(js).js deleted file mode 100644 index 0e30543a5..000000000 --- a/app/templates/client/app/account(auth)/account(js).js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; - -angular.module('<%= scriptAppName %>') - <% if(filters.ngroute) { %>.config(function ($routeProvider) { - $routeProvider - .when('/login', { - templateUrl: 'app/account/login/login.html', - controller: 'LoginCtrl' - }) - .when('/signup', { - templateUrl: 'app/account/signup/signup.html', - controller: 'SignupCtrl' - }) - .when('/settings', { - templateUrl: 'app/account/settings/settings.html', - controller: 'SettingsCtrl', - authenticate: true - }); - });<% } %><% if(filters.uirouter) { %>.config(function ($stateProvider) { - $stateProvider - .state('login', { - url: '/login', - templateUrl: 'app/account/login/login.html', - controller: 'LoginCtrl' - }) - .state('signup', { - url: '/signup', - templateUrl: 'app/account/signup/signup.html', - controller: 'SignupCtrl' - }) - .state('settings', { - url: '/settings', - templateUrl: 'app/account/settings/settings.html', - controller: 'SettingsCtrl', - authenticate: true - }); - });<% } %> \ No newline at end of file diff --git a/app/templates/client/app/account(auth)/login/login(css).css b/app/templates/client/app/account(auth)/login/login(css).css deleted file mode 100644 index 7c865ffc6..000000000 --- a/app/templates/client/app/account(auth)/login/login(css).css +++ /dev/null @@ -1,23 +0,0 @@ -<% if (filters.oauth) { %><% if (filters.facebookAuth) { %>.btn-facebook { - color: #fff; - background-color: #3B5998; - border-color: #133783; -} -<% } if (filters.twitterAuth) { %> -.btn-twitter { - color: #fff; - background-color: #2daddc; - border-color: #0271bf; -} -<% } if (filters.googleAuth) { %> -.btn-google-plus { - color: #fff; - background-color: #dd4b39; - border-color: #c53727; -} -<% } %> -.btn-github { - color: #fff; - background-color: #fafafa; - border-color: #ccc; -}<% } %> diff --git a/app/templates/client/app/account(auth)/login/login(html).html b/app/templates/client/app/account(auth)/login/login(html).html deleted file mode 100644 index 572f2e144..000000000 --- a/app/templates/client/app/account(auth)/login/login(html).html +++ /dev/null @@ -1,61 +0,0 @@ -
- -
-
-
-

Login

-

Accounts are reset on server restart from server/config/seed.js. Default account is test@test.com / test

-

Admin account is admin@admin.com / admin

-
-
-
- -
- - - -
- -
- - - -
- -
-

- Please enter your email and password. -

-

- Please enter a valid email. -

- -

{{ errors.other }}

-
- -
- - - Register - -
-<% if(filters.oauth) {%> -
-
<% if(filters.facebookAuth) {%> - - Connect with Facebook - <% } %><% if(filters.googleAuth) {%> - - Connect with Google+ - <% } %><% if(filters.twitterAuth) {%> - - Connect with Twitter - <% } %> -
<% } %> -
-
-
-
-
diff --git a/app/templates/client/app/account(auth)/login/login(jade).jade b/app/templates/client/app/account(auth)/login/login(jade).jade deleted file mode 100644 index 4b13c0b13..000000000 --- a/app/templates/client/app/account(auth)/login/login(jade).jade +++ /dev/null @@ -1,54 +0,0 @@ -div(ng-include='"components/navbar/navbar.html"') -.container - .row - .col-sm-12 - h1 Login - p - | Accounts are reset on server restart from - code server/config/seed.js - | . Default account is - code test@test.com - | / - code test - p - | Admin account is - code admin@admin.com - | / - code admin - - .col-sm-12 - form.form(name='form', ng-submit='login(form)', novalidate='') - .form-group - label Email - input.form-control(type='text', name='email', ng-model='user.email') - .form-group - label Password - input.form-control(type='password', name='password', ng-model='user.password') - - .form-group.has-error - p.help-block(ng-show='form.email.$error.required && form.password.$error.required && submitted') - | Please enter your email and password. - p.help-block {{ errors.other }} - - div - button.btn.btn-inverse.btn-lg.btn-login(type='submit') - | Login - = ' ' - a.btn.btn-default.btn-lg.btn-register(href='https://github.com/signup') - | Register -<% if(filters.oauth) {%> - hr - - div<% if(filters.facebookAuth) {%> - a.btn.btn-facebook(href='', ng-click='loginOauth("facebook")') - i.fa.fa-facebook - | Connect with Facebook - = ' '<% } %><% if(filters.googleAuth) {%> - a.btn.btn-google-plus(href='', ng-click='loginOauth("google")') - i.fa.fa-google-plus - | Connect with Google+ - = ' '<% } %><% if(filters.twitterAuth) {%> - a.btn.btn-twitter(href='', ng-click='loginOauth("twitter")') - i.fa.fa-twitter - | Connect with Twitter<% } %><% } %> - hr diff --git a/app/templates/client/app/account(auth)/login/login(less).less b/app/templates/client/app/account(auth)/login/login(less).less deleted file mode 100644 index bd01a056e..000000000 --- a/app/templates/client/app/account(auth)/login/login(less).less +++ /dev/null @@ -1,30 +0,0 @@ -<% if(filters.bootstrap) { %>// Colors -// -------------------------------------------------- - -@btnText: #fff; -@btnTextAlt: #000;<% if (filters.oauth) { %> -<% if (filters.facebookAuth) { %> -@btnFacebookBackground: #3B5998; -@btnFacebookBackgroundHighlight: #133783;<% } if (filters.twitterAuth) { %> -@btnTwitterBackground: #2daddc; -@btnTwitterBackgroundHighlight: #0271bf;<% } if (filters.googleAuth) { %> -@btnGooglePlusBackground: #dd4b39; -@btnGooglePlusBackgroundHighlight: #c53727;<% } %> -@btnGithubBackground: #fafafa; -@btnGithubBackgroundHighlight: #ccc; - -// Social buttons -// -------------------------------------------------- -<% if (filters.facebookAuth) { %> -.btn-facebook { - .button-variant(@btnText; @btnFacebookBackgroundHighlight; @btnFacebookBackgroundHighlight); -}<% } if (filters.twitterAuth) { %> -.btn-twitter { - .button-variant(@btnText; @btnTwitterBackground; @btnTwitterBackgroundHighlight); -}<% } if (filters.googleAuth) { %> -.btn-google-plus { - .button-variant(@btnText; @btnGooglePlusBackground; @btnGooglePlusBackgroundHighlight); -}<% } %> -.btn-github { - .button-variant(@btnTextAlt; @btnGithubBackground; @btnGithubBackgroundHighlight); -}<% } %><% } %> diff --git a/app/templates/client/app/account(auth)/login/login(sass).scss b/app/templates/client/app/account(auth)/login/login(sass).scss deleted file mode 100644 index eb214a8ca..000000000 --- a/app/templates/client/app/account(auth)/login/login(sass).scss +++ /dev/null @@ -1,30 +0,0 @@ -<% if(filters.bootstrap) { %>// Colors -// -------------------------------------------------- - -$btnText: #fff; -$btnTextAlt: #000;<% if (filters.oauth) { %> -<% if (filters.facebookAuth) { %> -$btnFacebookBackground: #3B5998; -$btnFacebookBackgroundHighlight: #133783;<% } if (filters.twitterAuth) { %> -$btnTwitterBackground: #2daddc; -$btnTwitterBackgroundHighlight: #0271bf;<% } if (filters.googleAuth) { %> -$btnGooglePlusBackground: #dd4b39; -$btnGooglePlusBackgroundHighlight: #c53727;<% } %> -$btnGithubBackground: #fafafa; -$btnGithubBackgroundHighlight: #ccc; - -// Social buttons -// -------------------------------------------------- -<% if (filters.facebookAuth) { %> -.btn-facebook { - @include button-variant($btnText, $btnFacebookBackgroundHighlight, $btnFacebookBackgroundHighlight); -}<% } if (filters.twitterAuth) { %> -.btn-twitter { - @include button-variant($btnText, $btnTwitterBackground, $btnTwitterBackgroundHighlight); -}<% } if (filters.googleAuth) { %> -.btn-google-plus { - @include button-variant($btnText, $btnGooglePlusBackground, $btnGooglePlusBackgroundHighlight); -}<% } %> -.btn-github { - @include button-variant($btnTextAlt, $btnGithubBackground, $btnGithubBackgroundHighlight); -}<% } %><% } %> diff --git a/app/templates/client/app/account(auth)/login/login(stylus).styl b/app/templates/client/app/account(auth)/login/login(stylus).styl deleted file mode 100644 index 3dc78ee9d..000000000 --- a/app/templates/client/app/account(auth)/login/login(stylus).styl +++ /dev/null @@ -1,22 +0,0 @@ -<% if (filters.oauth) { %>// Social buttons -// -------------------------------------------------- -<% if (filters.facebookAuth) { %> -.btn-facebook - color: #fff; - background-color: #3B5998; - border-color: #133783; -<% } if (filters.twitterAuth) { %> -.btn-twitter - color: #fff; - background-color: #2daddc; - border-color: #0271bf; -<% } if (filters.googleAuth) { %> -.btn-google-plus - color: #fff; - background-color: #dd4b39; - border-color: #c53727; -<% } %> -.btn-github - color: #fff; - background-color: #fafafa; - border-color: #ccc;<% } %> diff --git a/app/templates/client/app/account(auth)/login/login.controller(coffee).coffee b/app/templates/client/app/account(auth)/login/login.controller(coffee).coffee deleted file mode 100644 index 3f90c25d7..000000000 --- a/app/templates/client/app/account(auth)/login/login.controller(coffee).coffee +++ /dev/null @@ -1,23 +0,0 @@ -'use strict' - -angular.module '<%= scriptAppName %>' -.controller 'LoginCtrl', ($scope, Auth, $location<% if(filters.oauth) {%>, $window<% } %>) -> - $scope.user = {} - $scope.errors = {} - $scope.login = (form) -> - $scope.submitted = true - - if form.$valid - # Logged in, redirect to home - Auth.login - email: $scope.user.email - password: $scope.user.password - - .then -> - $location.path '/' - - .catch (err) -> - $scope.errors.other = err.message -<% if(filters.oauth) {%> - $scope.loginOauth = (provider) -> - $window.location.href = '/auth/' + provider<% } %> diff --git a/app/templates/client/app/account(auth)/login/login.controller(js).js b/app/templates/client/app/account(auth)/login/login.controller(js).js deleted file mode 100644 index 7b13da384..000000000 --- a/app/templates/client/app/account(auth)/login/login.controller(js).js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -angular.module('<%= scriptAppName %>') - .controller('LoginCtrl', function ($scope, Auth, $location<% if (filters.oauth) { %>, $window<% } %>) { - $scope.user = {}; - $scope.errors = {}; - - $scope.login = function(form) { - $scope.submitted = true; - - if(form.$valid) { - Auth.login({ - email: $scope.user.email, - password: $scope.user.password - }) - .then( function() { - // Logged in, redirect to home - $location.path('/'); - }) - .catch( function(err) { - $scope.errors.other = err.message; - }); - } - }; -<% if(filters.oauth) {%> - $scope.loginOauth = function(provider) { - $window.location.href = '/auth/' + provider; - };<% } %> - }); diff --git a/app/templates/client/app/account(auth)/settings/settings(html).html b/app/templates/client/app/account(auth)/settings/settings(html).html deleted file mode 100644 index bb5d8ded0..000000000 --- a/app/templates/client/app/account(auth)/settings/settings(html).html +++ /dev/null @@ -1,39 +0,0 @@ -
- -
-
-
-

Change Password

-
-
-
- -
- - - -

- {{ errors.other }} -

-
- -
- - - -

- Password must be at least 3 characters. -

-
- -

{{ message }}

- - -
-
-
-
\ No newline at end of file diff --git a/app/templates/client/app/account(auth)/settings/settings(jade).jade b/app/templates/client/app/account(auth)/settings/settings(jade).jade deleted file mode 100644 index 2dc55d402..000000000 --- a/app/templates/client/app/account(auth)/settings/settings(jade).jade +++ /dev/null @@ -1,21 +0,0 @@ -div(ng-include='"components/navbar/navbar.html"') -.container - .row - .col-sm-12 - h1 Change Password - .col-sm-12 - form.form(name='form', ng-submit='changePassword(form)', novalidate='') - .form-group - label Current Password - input.form-control(type='password', name='password', ng-model='user.oldPassword', mongoose-error='') - p.help-block(ng-show='form.password.$error.mongoose') - | {{ errors.other }} - .form-group - label New Password - input.form-control(type='password', name='newPassword', ng-model='user.newPassword', ng-minlength='3', required='') - p.help-block(ng-show='(form.newPassword.$error.minlength || form.newPassword.$error.required) && (form.newPassword.$dirty || submitted)') - | Password must be at least 3 characters. - - p.help-block {{ message }} - - button.btn.btn-lg.btn-primary(type='submit') Save changes diff --git a/app/templates/client/app/account(auth)/settings/settings.controller(coffee).coffee b/app/templates/client/app/account(auth)/settings/settings.controller(coffee).coffee deleted file mode 100644 index e058f167e..000000000 --- a/app/templates/client/app/account(auth)/settings/settings.controller(coffee).coffee +++ /dev/null @@ -1,17 +0,0 @@ -'use strict' - -angular.module '<%= scriptAppName %>' -.controller 'SettingsCtrl', ($scope, User, Auth) -> - $scope.errors = {} - $scope.changePassword = (form) -> - $scope.submitted = true - - if form.$valid - Auth.changePassword $scope.user.oldPassword, $scope.user.newPassword - .then -> - $scope.message = 'Password successfully changed.' - - .catch -> - form.password.$setValidity 'mongoose', false - $scope.errors.other = 'Incorrect password' - $scope.message = '' diff --git a/app/templates/client/app/account(auth)/settings/settings.controller(js).js b/app/templates/client/app/account(auth)/settings/settings.controller(js).js deleted file mode 100644 index 829bd8248..000000000 --- a/app/templates/client/app/account(auth)/settings/settings.controller(js).js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -angular.module('<%= scriptAppName %>') - .controller('SettingsCtrl', function ($scope, User, Auth) { - $scope.errors = {}; - - $scope.changePassword = function(form) { - $scope.submitted = true; - if(form.$valid) { - Auth.changePassword( $scope.user.oldPassword, $scope.user.newPassword ) - .then( function() { - $scope.message = 'Password successfully changed.'; - }) - .catch( function() { - form.password.$setValidity('mongoose', false); - $scope.errors.other = 'Incorrect password'; - $scope.message = ''; - }); - } - }; - }); diff --git a/app/templates/client/app/account(auth)/signup/signup(html).html b/app/templates/client/app/account(auth)/signup/signup(html).html deleted file mode 100644 index 59faed568..000000000 --- a/app/templates/client/app/account(auth)/signup/signup(html).html +++ /dev/null @@ -1,82 +0,0 @@ -
- -
-
-
-

Sign up

-
-
-
- -
- - - -

- A name is required -

-
- -
- - - -

- Doesn't look like a valid email. -

-

- What's your email address? -

-

- {{ errors.email }} -

-
- -
- - - -

- Password must be at least 3 characters. -

-

- {{ errors.password }} -

-
- -
- - - Login - -
-<% if(filters.oauth) {%> -
-
<% if(filters.facebookAuth) {%> - - Connect with Facebook - <% } %><% if(filters.googleAuth) {%> - - Connect with Google+ - <% } %><% if(filters.twitterAuth) {%> - - Connect with Twitter - <% } %> -
<% } %> -
-
-
-
-
diff --git a/app/templates/client/app/account(auth)/signup/signup(jade).jade b/app/templates/client/app/account(auth)/signup/signup(jade).jade deleted file mode 100644 index 43815a21c..000000000 --- a/app/templates/client/app/account(auth)/signup/signup(jade).jade +++ /dev/null @@ -1,57 +0,0 @@ -div(ng-include='"components/navbar/navbar.html"') -.container - .row - .col-sm-12 - h1 Sign up - .col-sm-12 - form.form(name='form', ng-submit='register(form)', novalidate='') - .form-group(ng-class='{ "has-success": form.name.$valid && submitted,\ - "has-error": form.name.$invalid && submitted }') - label Name - input.form-control(type='text', name='name', ng-model='user.name', required='') - p.help-block(ng-show='form.name.$error.required && submitted') - | A name is required - - .form-group(ng-class='{ "has-success": form.email.$valid && submitted,\ - "has-error": form.email.$invalid && submitted }') - label Email - input.form-control(type='email', name='email', ng-model='user.email', required='', mongoose-error='') - p.help-block(ng-show='form.email.$error.email && submitted') - | Doesn't look like a valid email. - p.help-block(ng-show='form.email.$error.required && submitted') - | What's your email address? - p.help-block(ng-show='form.email.$error.mongoose') - | {{ errors.email }} - - .form-group(ng-class='{ "has-success": form.password.$valid && submitted,\ - "has-error": form.password.$invalid && submitted }') - label Password - input.form-control(type='password', name='password', ng-model='user.password', ng-minlength='3', required='', mongoose-error='') - p.help-block(ng-show='(form.password.$error.minlength || form.password.$error.required) && submitted') - | Password must be at least 3 characters. - p.help-block(ng-show='form.password.$error.mongoose') - | {{ errors.password }} - - div - button.btn.btn-inverse.btn-lg.btn-login(type='submit') - | Sign up - = ' ' - a.btn.btn-default.btn-lg.btn-register(href='https://github.com/login') - | Login - -<% if(filters.oauth) {%> - hr - - div<% if(filters.facebookAuth) {%> - a.btn.btn-facebook(href='', ng-click='loginOauth("facebook")') - i.fa.fa-facebook - | Connect with Facebook - = ' '<% } %><% if(filters.googleAuth) {%> - a.btn.btn-google-plus(href='', ng-click='loginOauth("google")') - i.fa.fa-google-plus - | Connect with Google+ - = ' '<% } %><% if(filters.twitterAuth) {%> - a.btn.btn-twitter(href='', ng-click='loginOauth("twitter")') - i.fa.fa-twitter - | Connect with Twitter<% } %><% } %> - hr diff --git a/app/templates/client/app/account(auth)/signup/signup.controller(coffee).coffee b/app/templates/client/app/account(auth)/signup/signup.controller(coffee).coffee deleted file mode 100644 index 1b9c9696f..000000000 --- a/app/templates/client/app/account(auth)/signup/signup.controller(coffee).coffee +++ /dev/null @@ -1,30 +0,0 @@ -'use strict' - -angular.module '<%= scriptAppName %>' -.controller 'SignupCtrl', ($scope, Auth, $location<% if(filters.oauth) {%>, $window<% } %>) -> - $scope.user = {} - $scope.errors = {} - $scope.register = (form) -> - $scope.submitted = true - - if form.$valid - # Account created, redirect to home - Auth.createUser - name: $scope.user.name - email: $scope.user.email - password: $scope.user.password - - .then -> - $location.path '/' - - .catch (err) -> - err = err.data - $scope.errors = {} - - # Update validity of form fields that match the mongoose errors - angular.forEach err.errors, (error, field) -> - form[field].$setValidity 'mongoose', false - $scope.errors[field] = error.message -<% if(filters.oauth) {%> - $scope.loginOauth = (provider) -> - $window.location.href = '/auth/' + provider<% } %> diff --git a/app/templates/client/app/account(auth)/signup/signup.controller(js).js b/app/templates/client/app/account(auth)/signup/signup.controller(js).js deleted file mode 100644 index 7d6ba3d38..000000000 --- a/app/templates/client/app/account(auth)/signup/signup.controller(js).js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; - -angular.module('<%= scriptAppName %>') - .controller('SignupCtrl', function ($scope, Auth, $location<% if (filters.oauth) { %>, $window<% } %>) { - $scope.user = {}; - $scope.errors = {}; - - $scope.register = function(form) { - $scope.submitted = true; - - if(form.$valid) { - Auth.createUser({ - name: $scope.user.name, - email: $scope.user.email, - password: $scope.user.password - }) - .then( function() { - // Account created, redirect to home - $location.path('/'); - }) - .catch( function(err) { - err = err.data; - $scope.errors = {}; - - // Update validity of form fields that match the mongoose errors - angular.forEach(err.errors, function(error, field) { - form[field].$setValidity('mongoose', false); - $scope.errors[field] = error.message; - }); - }); - } - }; -<% if(filters.oauth) {%> - $scope.loginOauth = function(provider) { - $window.location.href = '/auth/' + provider; - };<% } %> - }); diff --git a/app/templates/client/app/admin(auth)/admin(coffee).coffee b/app/templates/client/app/admin(auth)/admin(coffee).coffee deleted file mode 100644 index a0497445e..000000000 --- a/app/templates/client/app/admin(auth)/admin(coffee).coffee +++ /dev/null @@ -1,15 +0,0 @@ -'use strict' - -angular.module '<%= scriptAppName %>' -<% if(filters.ngroute) { %>.config ($routeProvider) -> - $routeProvider - .when '/admin', - templateUrl: 'app/admin/admin.html' - controller: 'AdminCtrl' -<% } %><% if(filters.uirouter) { %>.config ($stateProvider) -> - $stateProvider - .state 'admin', - url: '/admin' - templateUrl: 'app/admin/admin.html' - controller: 'AdminCtrl' -<% } %> \ No newline at end of file diff --git a/app/templates/client/app/admin(auth)/admin(css).css b/app/templates/client/app/admin(auth)/admin(css).css deleted file mode 100644 index a6f536dc5..000000000 --- a/app/templates/client/app/admin(auth)/admin(css).css +++ /dev/null @@ -1 +0,0 @@ -.trash { color:rgb(209, 91, 71); } diff --git a/app/templates/client/app/admin(auth)/admin(html).html b/app/templates/client/app/admin(auth)/admin(html).html deleted file mode 100644 index 5c27c7af2..000000000 --- a/app/templates/client/app/admin(auth)/admin(html).html +++ /dev/null @@ -1,12 +0,0 @@ -
- -
-

The delete user and user index api routes are restricted to users with the 'admin' role.

- -
\ No newline at end of file diff --git a/app/templates/client/app/admin(auth)/admin(jade).jade b/app/templates/client/app/admin(auth)/admin(jade).jade deleted file mode 100644 index fd80a0bb6..000000000 --- a/app/templates/client/app/admin(auth)/admin(jade).jade +++ /dev/null @@ -1,11 +0,0 @@ -div(ng-include='"components/navbar/navbar.html"') -.container - p - | The delete user and user index api routes are restricted to users with the 'admin' role. - ul.list-group - li.list-group-item(ng-repeat='user in users') - strong {{user.name}} - br - span.text-muted {{user.email}} - a.trash(ng-click='delete(user)') - span.glyphicon.glyphicon-trash.pull-right \ No newline at end of file diff --git a/app/templates/client/app/admin(auth)/admin(js).js b/app/templates/client/app/admin(auth)/admin(js).js deleted file mode 100644 index 270e8a974..000000000 --- a/app/templates/client/app/admin(auth)/admin(js).js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -angular.module('<%= scriptAppName %>') - <% if(filters.ngroute) { %>.config(function ($routeProvider) { - $routeProvider - .when('/admin', { - templateUrl: 'app/admin/admin.html', - controller: 'AdminCtrl' - }); - });<% } %><% if(filters.uirouter) { %>.config(function ($stateProvider) { - $stateProvider - .state('admin', { - url: '/admin', - templateUrl: 'app/admin/admin.html', - controller: 'AdminCtrl' - }); - });<% } %> \ No newline at end of file diff --git a/app/templates/client/app/admin(auth)/admin(less).less b/app/templates/client/app/admin(auth)/admin(less).less deleted file mode 100644 index ad8202750..000000000 --- a/app/templates/client/app/admin(auth)/admin(less).less +++ /dev/null @@ -1 +0,0 @@ -.trash { color:rgb(209, 91, 71); } \ No newline at end of file diff --git a/app/templates/client/app/admin(auth)/admin(sass).scss b/app/templates/client/app/admin(auth)/admin(sass).scss deleted file mode 100644 index a6f536dc5..000000000 --- a/app/templates/client/app/admin(auth)/admin(sass).scss +++ /dev/null @@ -1 +0,0 @@ -.trash { color:rgb(209, 91, 71); } diff --git a/app/templates/client/app/admin(auth)/admin(stylus).styl b/app/templates/client/app/admin(auth)/admin(stylus).styl deleted file mode 100644 index d57e50db5..000000000 --- a/app/templates/client/app/admin(auth)/admin(stylus).styl +++ /dev/null @@ -1,2 +0,0 @@ -.trash - color rgb(209, 91, 71) \ No newline at end of file diff --git a/app/templates/client/app/admin(auth)/admin.controller(coffee).coffee b/app/templates/client/app/admin(auth)/admin.controller(coffee).coffee deleted file mode 100644 index 7a16032da..000000000 --- a/app/templates/client/app/admin(auth)/admin.controller(coffee).coffee +++ /dev/null @@ -1,12 +0,0 @@ -'use strict' - -angular.module '<%= scriptAppName %>' -.controller 'AdminCtrl', ($scope, $http, Auth, User) -> - - $http.get '/api/users' - .success (users) -> - $scope.users = users - - $scope.delete = (user) -> - User.remove id: user._id - _.remove $scope.users, user \ No newline at end of file diff --git a/app/templates/client/app/admin(auth)/admin.controller(js).js b/app/templates/client/app/admin(auth)/admin.controller(js).js deleted file mode 100644 index dd6b09405..000000000 --- a/app/templates/client/app/admin(auth)/admin.controller(js).js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -angular.module('<%= scriptAppName %>') - .controller('AdminCtrl', function ($scope, $http, Auth, User) { - - // Use the User $resource to fetch all users - $scope.users = User.query(); - - $scope.delete = function(user) { - User.remove({ id: user._id }); - angular.forEach($scope.users, function(u, i) { - if (u === user) { - $scope.users.splice(i, 1); - } - }); - }; - }); diff --git a/app/templates/client/app/app(coffee).coffee b/app/templates/client/app/app(coffee).coffee index ea9ae3c95..e04f2f4e4 100644 --- a/app/templates/client/app/app(coffee).coffee +++ b/app/templates/client/app/app(coffee).coffee @@ -1,39 +1,15 @@ 'use strict' angular.module '<%= scriptAppName %>', [<%= angularModules %>] -<% if(filters.ngroute) { %>.config ($routeProvider, $locationProvider<% if(filters.auth) { %>, $httpProvider<% } %>) -> +<% if(filters.ngroute) { %>.config ($routeProvider, $locationProvider) -> $routeProvider .otherwise redirectTo: '/' - $locationProvider.html5Mode true<% if(filters.auth) { %> - $httpProvider.interceptors.push 'authInterceptor'<% } %> -<% } %><% if(filters.uirouter) { %>.config ($stateProvider, $urlRouterProvider, $locationProvider<% if(filters.auth) { %>, $httpProvider<% } %>) -> + $locationProvider.html5Mode true +<% } %><% if(filters.uirouter) { %>.config ($stateProvider, $urlRouterProvider, $locationProvider) -> $urlRouterProvider .otherwise '/' - $locationProvider.html5Mode true<% if(filters.auth) { %> - $httpProvider.interceptors.push 'authInterceptor'<% } %> -<% } %><% if(filters.auth) { %> -.factory 'authInterceptor', ($rootScope, $q, $cookieStore, $location) -> - # Add authorization token to headers - request: (config) -> - config.headers = config.headers or {} - config.headers.Authorization = 'Bearer ' + $cookieStore.get 'token' if $cookieStore.get 'token' - config - - # Intercept 401s and redirect you to login - responseError: (response) -> - if response.status is 401 - $location.path '/login' - # remove any stale tokens - $cookieStore.remove 'token' - - $q.reject response - -.run ($rootScope, $location, Auth) -> - # Redirect to login if route requires auth and you're not logged in - $rootScope.$on <% if(filters.ngroute) { %>'$routeChangeStart'<% } %><% if(filters.uirouter) { %>'$stateChangeStart'<% } %>, (event, next) -> - Auth.isLoggedInAsync (loggedIn) -> - $location.path "/login" if next.authenticate and not loggedIn + $locationProvider.html5Mode true <% } %> \ No newline at end of file diff --git a/app/templates/client/app/app(css).css b/app/templates/client/app/app(css).css index f1a61a918..2093b3c72 100644 --- a/app/templates/client/app/app(css).css +++ b/app/templates/client/app/app(css).css @@ -1,46 +1,11 @@ -<% if(filters.bootstrap) { %> -/** - * Bootstrap Fonts - */ - -@font-face { - font-family: 'Glyphicons Halflings'; - src: url('https://github.com/bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot'); - src: url('https://github.com/bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), - url('https://github.com/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff') format('woff'), - url('https://github.com/bower_components/bootstrap/fonts/glyphicons-halflings-regular.ttf') format('truetype'), - url('https://github.com/bower_components/bootstrap/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); -}<% } %> - -/** - *Font Awesome Fonts - */ - -@font-face { - font-family: 'FontAwesome'; - src: url('https://github.com/bower_components/font-awesome/fonts/fontawesome-webfont.eot?v=4.1.0'); - src: url('https://github.com/bower_components/font-awesome/fonts/fontawesome-webfont.eot?#iefix&v=4.1.0') format('embedded-opentype'), - url('https://github.com/bower_components/font-awesome/fonts/fontawesome-webfont.woff?v=4.1.0') format('woff'), - url('https://github.com/bower_components/font-awesome/fonts/fontawesome-webfont.ttf?v=4.1.0') format('truetype'), - url('https://github.com/bower_components/font-awesome/fonts/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular') format('svg'); - font-weight: normal; - font-style: normal; -} - /** * App-wide Styles */ -.browsehappy { - margin: 0.2em 0; - background: #ccc; - color: #000; - padding: 0.2em 0; -} <% if (!filters.bootstrap) { %> /* Responsive: Portrait tablets and up */ @media screen and (min-width: 768px) { .container { max-width: 730px; } -}<% } %> \ No newline at end of file +}<% } %> diff --git a/app/templates/client/app/app(js).js b/app/templates/client/app/app(js).js index c8850ed07..1ef0011cc 100644 --- a/app/templates/client/app/app(js).js +++ b/app/templates/client/app/app(js).js @@ -1,56 +1,16 @@ 'use strict'; angular.module('<%= scriptAppName %>', [<%= angularModules %>]) - <% if(filters.ngroute) { %>.config(function ($routeProvider, $locationProvider<% if(filters.auth) { %>, $httpProvider<% } %>) { + <% if(filters.ngroute) { %>.config(function ($routeProvider, $locationProvider) { $routeProvider .otherwise({ redirectTo: '/' }); - $locationProvider.html5Mode(true);<% if(filters.auth) { %> - $httpProvider.interceptors.push('authInterceptor');<% } %> - })<% } %><% if(filters.uirouter) { %>.config(function ($stateProvider, $urlRouterProvider, $locationProvider<% if(filters.auth) { %>, $httpProvider<% } %>) { + $locationProvider.html5Mode(true); + })<% } %><% if(filters.uirouter) { %>.config(function ($stateProvider, $urlRouterProvider, $locationProvider) { $urlRouterProvider .otherwise('/'); - $locationProvider.html5Mode(true);<% if(filters.auth) { %> - $httpProvider.interceptors.push('authInterceptor');<% } %> - })<% } %><% if(filters.auth) { %> - - .factory('authInterceptor', function ($rootScope, $q, $cookieStore, $location) { - return { - // Add authorization token to headers - request: function (config) { - config.headers = config.headers || {}; - if ($cookieStore.get('token')) { - config.headers.Authorization = 'Bearer ' + $cookieStore.get('token'); - } - return config; - }, - - // Intercept 401s and redirect you to login - responseError: function(response) { - if(response.status === 401) { - $location.path('/login'); - // remove any stale tokens - $cookieStore.remove('token'); - return $q.reject(response); - } - else { - return $q.reject(response); - } - } - }; - }) - - .run(function ($rootScope, $location, Auth) { - // Redirect to login if route requires auth and you're not logged in - $rootScope.$on(<% if(filters.ngroute) { %>'$routeChangeStart'<% } %><% if(filters.uirouter) { %>'$stateChangeStart'<% } %>, function (event, next) { - Auth.isLoggedInAsync(function(loggedIn) { - if (next.authenticate && !loggedIn) { - event.preventDefault(); - $location.path('/login'); - } - }); - }); + $locationProvider.html5Mode(true); })<% } %>; diff --git a/app/templates/client/app/app(less).less b/app/templates/client/app/app(less).less index 30639f539..87c13e43d 100644 --- a/app/templates/client/app/app(less).less +++ b/app/templates/client/app/app(less).less @@ -1,19 +1,7 @@ -<% if(filters.bootstrap) { %>@import 'https://github.com/bootstrap/less/bootstrap.less';<% } %> -@import 'https://github.com/font-awesome/less/font-awesome.less'; - -<% if(filters.bootstrap) { %>@icon-font-path: '/bower_components/bootstrap/fonts/';<% } %> -@fa-font-path: '/bower_components/font-awesome/fonts'; - /** * App-wide Styles */ -.browsehappy { - margin: 0.2em 0; - background: #ccc; - color: #000; - padding: 0.2em 0; -} <% if (!filters.bootstrap) { %> /* Responsive: Portrait tablets and up */ @media screen and (min-width: 768px) { @@ -22,8 +10,7 @@ } } <% } %> +// Component styles are injected through grunt // injector -@import 'https://github.com/account/login/login.less'; -@import 'https://github.com/admin/admin.less'; @import 'https://github.com/main/main.less'; // endinjector \ No newline at end of file diff --git a/app/templates/client/app/app(sass).scss b/app/templates/client/app/app(sass).scss index 4b8ae7a04..c199be769 100644 --- a/app/templates/client/app/app(sass).scss +++ b/app/templates/client/app/app(sass).scss @@ -1,19 +1,7 @@ -<% if(filters.bootstrap) { %>$icon-font-path: "/bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap/";<% } %> -$fa-font-path: "/bower_components/font-awesome/fonts"; -<% if(filters.bootstrap) { %> -@import 'https://github.com/bootstrap-sass-official/vendor/assets/stylesheets/bootstrap';<% } %> -@import 'https://github.com/font-awesome/scss/font-awesome'; - /** * App-wide Styles */ -.browsehappy { - margin: 0.2em 0; - background: #ccc; - color: #000; - padding: 0.2em 0; -} <% if (!filters.bootstrap) { %> /* Responsive: Portrait tablets and up */ @media screen and (min-width: 768px) { @@ -24,7 +12,5 @@ $fa-font-path: "/bower_components/font-awesome/fonts"; <% } %> // Component styles are injected through grunt // injector -@import 'https://github.com/account/login/login.scss'; -@import 'https://github.com/admin/admin.scss'; @import 'https://github.com/main/main.scss'; // endinjector \ No newline at end of file diff --git a/app/templates/client/app/app(stylus).styl b/app/templates/client/app/app(stylus).styl index b7e4bb9c1..ed1d02f50 100644 --- a/app/templates/client/app/app(stylus).styl +++ b/app/templates/client/app/app(stylus).styl @@ -1,41 +1,7 @@ -@import "https://github.com/font-awesome/css/font-awesome.css" -<% if(filters.bootstrap) { %>@import "https://github.com/bootstrap/dist/css/bootstrap.css" +/** + * App-wide Styles + */ -// -// Bootstrap Fonts -// - -@font-face - font-family: 'Glyphicons Halflings' - src: url('https://github.com/bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot') - src: url('https://github.com/bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), - url('https://github.com/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff') format('woff'), - url('https://github.com/bower_components/bootstrap/fonts/glyphicons-halflings-regular.ttf') format('truetype'), - url('https://github.com/bower_components/bootstrap/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); -<% } %> -// -// Font Awesome Fonts -// - -@font-face - font-family: 'FontAwesome' - src: url('https://github.com/bower_components/font-awesome/fonts/fontawesome-webfont.eot?v=4.1.0') - src: url('https://github.com/bower_components/font-awesome/fonts/fontawesome-webfont.eot?#iefix&v=4.1.0') format('embedded-opentype'), - url('https://github.com/bower_components/font-awesome/fonts/fontawesome-webfont.woff?v=4.1.0') format('woff'), - url('https://github.com/bower_components/font-awesome/fonts/fontawesome-webfont.ttf?v=4.1.0') format('truetype'), - url('https://github.com/bower_components/font-awesome/fonts/fontawesome-webfont.svg?v=4.1.0#fontawesomeregular') format('svg'); - font-weight: normal - font-style: normal - -// -// App-wide Styles -// - -.browsehappy - background #ccc - color #000 - margin 0.2em 0 - padding 0.2em 0 <% if (!filters.bootstrap) { %> // Responsive: Portrait tablets and up @media screen and (min-width: 768px) @@ -44,7 +10,5 @@ <% } %> // Component styles are injected through grunt // injector -@import "https://github.com/account/login/login" -@import "https://github.com/admin/admin" @import "https://github.com/main/main" // endinjector \ No newline at end of file diff --git a/app/templates/client/app/main/main(html).html b/app/templates/client/app/main/main(html).html index cd0f185b2..c79bced9c 100644 --- a/app/templates/client/app/main/main(html).html +++ b/app/templates/client/app/main/main(html).html @@ -3,8 +3,8 @@ @@ -13,26 +13,16 @@

'Allo, 'Allo!

Features:

- <% if(filters.socketio) { %> - -
- -

- - - - -

-
<% } %> + diff --git a/app/templates/client/app/main/main(jade).jade b/app/templates/client/app/main/main(jade).jade index 76784c855..d59d9a128 100644 --- a/app/templates/client/app/main/main(jade).jade +++ b/app/templates/client/app/main/main(jade).jade @@ -3,8 +3,8 @@ div(ng-include='"components/navbar/navbar.html"') header#banner.hero-unit .container h1 'Allo, 'Allo! - p.lead Kick-start your next web app with Angular Fullstack - img(src='https://github.com/assets/images/yeoman.png', alt='I\'m Yeoman') + p.lead Kick-start your next Web of Things app with Angular Arduino + img(src='https://github.com/assets/images/yeoman.jpg', alt='I\'m Yeoman') .container .row @@ -13,21 +13,13 @@ header#banner.hero-unit ul.nav.nav-tabs.nav-stacked.col-md-4.col-lg-4.col-sm-6(ng-repeat='thing in awesomeThings') li a(href='#', tooltip='{{thing.info}}') - | {{thing.name}}<% if(filters.socketio) { %> - button.close(type='button', ng-click='deleteThing(thing)') ×<% } %><% if(filters.socketio) { %> - - form.thing-form - label Syncs in realtime across clients - p.input-group - input.form-control(type='text', placeholder='Add a new thing here.', ng-model='newThing') - span.input-group-btn - button.btn.btn-primary(type='submit', ng-click='addThing()') Add New<% } %> + | {{thing.name}} footer.footer .container p - | Angular Fullstack v<%= pkg.version %> + | Angular Arduino v<%= pkg.version %> = ' | ' a(href='https://twitter.com/tyhenkel') @tyhenkel = ' | ' - a(href='https://github.com/DaftMonk/generator-angular-fullstack/issues?state=open') Issues \ No newline at end of file + a(href='https://github.com/lasselukkari/generator-angular-arduino/issues?state=open') Issues \ No newline at end of file diff --git a/app/templates/client/app/main/main.controller(coffee).coffee b/app/templates/client/app/main/main.controller(coffee).coffee index 143e7f387..dc1d60aed 100644 --- a/app/templates/client/app/main/main.controller(coffee).coffee +++ b/app/templates/client/app/main/main.controller(coffee).coffee @@ -1,22 +1,8 @@ 'use strict' angular.module '<%= scriptAppName %>' -.controller 'MainCtrl', ($scope, $http<% if(filters.socketio) { %>, socket<% } %>) -> +.controller 'MainCtrl', ($scope, $http) -> $scope.awesomeThings = [] $http.get('/api/things').success (awesomeThings) -> $scope.awesomeThings = awesomeThings - <% if(filters.socketio) { %>socket.syncUpdates 'thing', $scope.awesomeThings<% } %> -<% if(filters.mongoose) { %> - $scope.addThing = -> - return if $scope.newThing is '' - $http.post '/api/things', - name: $scope.newThing - - $scope.newThing = '' - - $scope.deleteThing = (thing) -> - $http.delete '/api/things/' + thing._id<% } %><% if(filters.socketio) { %> - - $scope.$on '$destroy', -> - socket.unsyncUpdates 'thing'<% } %> diff --git a/app/templates/client/app/main/main.controller(js).js b/app/templates/client/app/main/main.controller(js).js index 433a10fe4..9730fcfde 100644 --- a/app/templates/client/app/main/main.controller(js).js +++ b/app/templates/client/app/main/main.controller(js).js @@ -1,27 +1,10 @@ 'use strict'; angular.module('<%= scriptAppName %>') - .controller('MainCtrl', function ($scope, $http<% if(filters.socketio) { %>, socket<% } %>) { + .controller('MainCtrl', function ($scope, $http) { $scope.awesomeThings = []; $http.get('/api/things').success(function(awesomeThings) { - $scope.awesomeThings = awesomeThings;<% if(filters.socketio) { %> - socket.syncUpdates('thing', $scope.awesomeThings);<% } %> + $scope.awesomeThings = awesomeThings; }); -<% if(filters.mongoose) { %> - $scope.addThing = function() { - if($scope.newThing === '') { - return; - } - $http.post('/api/things', { name: $scope.newThing }); - $scope.newThing = ''; - }; - - $scope.deleteThing = function(thing) { - $http.delete('/api/things/' + thing._id); - };<% } %><% if(filters.socketio) { %> - - $scope.$on('$destroy', function () { - socket.unsyncUpdates('thing'); - });<% } %> }); diff --git a/app/templates/client/app/main/main.controller.spec(coffee).coffee b/app/templates/client/app/main/main.controller.spec(coffee).coffee index efe9b39a6..484ed6839 100644 --- a/app/templates/client/app/main/main.controller.spec(coffee).coffee +++ b/app/templates/client/app/main/main.controller.spec(coffee).coffee @@ -3,8 +3,7 @@ describe 'Controller: MainCtrl', -> # load the controller's module - beforeEach module '<%= scriptAppName %>' <% if(filters.socketio) {%> - beforeEach module 'socketMock' <% } %> + beforeEach module '<%= scriptAppName %>' MainCtrl = undefined scope = undefined @@ -25,4 +24,4 @@ describe 'Controller: MainCtrl', -> it 'should attach a list of things to the scope', -> $httpBackend.flush() - expect(scope.awesomeThings.length).toBe 4 \ No newline at end of file + expect(scope.awesomeThings.length).toBe 4 diff --git a/app/templates/client/app/main/main.controller.spec(js).js b/app/templates/client/app/main/main.controller.spec(js).js index 373e9db08..f41239e6b 100644 --- a/app/templates/client/app/main/main.controller.spec(js).js +++ b/app/templates/client/app/main/main.controller.spec(js).js @@ -3,8 +3,7 @@ describe('Controller: MainCtrl', function () { // load the controller's module - beforeEach(module('<%= scriptAppName %>'));<% if(filters.socketio) {%> - beforeEach(module('socketMock'));<% } %> + beforeEach(module('<%= scriptAppName %>')); var MainCtrl, scope, diff --git a/app/templates/client/assets/images/!yeoman.jpg b/app/templates/client/assets/images/!yeoman.jpg new file mode 100644 index 000000000..eb7349a49 Binary files /dev/null and b/app/templates/client/assets/images/!yeoman.jpg differ diff --git a/app/templates/client/assets/images/!yeoman.png b/app/templates/client/assets/images/!yeoman.png deleted file mode 100644 index 7d0a1ac71..000000000 Binary files a/app/templates/client/assets/images/!yeoman.png and /dev/null differ diff --git a/app/templates/client/components/auth(auth)/auth.service(coffee).coffee b/app/templates/client/components/auth(auth)/auth.service(coffee).coffee deleted file mode 100644 index ac503ed0b..000000000 --- a/app/templates/client/components/auth(auth)/auth.service(coffee).coffee +++ /dev/null @@ -1,136 +0,0 @@ -'use strict' - -angular.module '<%= scriptAppName %>' -.factory 'Auth', ($location, $rootScope, $http, User, $cookieStore, $q) -> - currentUser = if $cookieStore.get 'token' then User.get() else {} - - ### - Authenticate user and save token - - @param {Object} user - login info - @param {Function} callback - optional - @return {Promise} - ### - login: (user, callback) -> - deferred = $q.defer() - $http.post '/auth/local', - email: user.email - password: user.password - - .success (data) -> - $cookieStore.put 'token', data.token - currentUser = User.get() - deferred.resolve data - callback?() - - .error (err) => - @logout() - deferred.reject err - callback? err - - deferred.promise - - - ### - Delete access token and user info - - @param {Function} - ### - logout: -> - $cookieStore.remove 'token' - currentUser = {} - return - - - ### - Create a new user - - @param {Object} user - user info - @param {Function} callback - optional - @return {Promise} - ### - createUser: (user, callback) -> - User.save user, - (data) -> - $cookieStore.put 'token', data.token - currentUser = User.get() - callback? user - - , (err) => - @logout() - callback? err - - .$promise - - - ### - Change password - - @param {String} oldPassword - @param {String} newPassword - @param {Function} callback - optional - @return {Promise} - ### - changePassword: (oldPassword, newPassword, callback) -> - User.changePassword - id: currentUser._id - , - oldPassword: oldPassword - newPassword: newPassword - - , (user) -> - callback? user - - , (err) -> - callback? err - - .$promise - - - ### - Gets all available info on authenticated user - - @return {Object} user - ### - getCurrentUser: -> - currentUser - - - ### - Check if a user is logged in synchronously - - @return {Boolean} - ### - isLoggedIn: -> - currentUser.hasOwnProperty 'role' - - - ### - Waits for currentUser to resolve before checking if user is logged in - ### - isLoggedInAsync: (callback) -> - if currentUser.hasOwnProperty '$promise' - currentUser.$promise.then -> - callback? true - return - .catch -> - callback? false - return - - else - callback? currentUser.hasOwnProperty 'role' - - ### - Check if a user is an admin - - @return {Boolean} - ### - isAdmin: -> - currentUser.role is 'admin' - - - ### - Get auth token - ### - getToken: -> - $cookieStore.get 'token' diff --git a/app/templates/client/components/auth(auth)/auth.service(js).js b/app/templates/client/components/auth(auth)/auth.service(js).js deleted file mode 100644 index 9afb12da9..000000000 --- a/app/templates/client/components/auth(auth)/auth.service(js).js +++ /dev/null @@ -1,146 +0,0 @@ -'use strict'; - -angular.module('<%= scriptAppName %>') - .factory('Auth', function Auth($location, $rootScope, $http, User, $cookieStore, $q) { - var currentUser = {}; - if($cookieStore.get('token')) { - currentUser = User.get(); - } - - return { - - /** - * Authenticate user and save token - * - * @param {Object} user - login info - * @param {Function} callback - optional - * @return {Promise} - */ - login: function(user, callback) { - var cb = callback || angular.noop; - var deferred = $q.defer(); - - $http.post('/auth/local', { - email: user.email, - password: user.password - }). - success(function(data) { - $cookieStore.put('token', data.token); - currentUser = User.get(); - deferred.resolve(data); - return cb(); - }). - error(function(err) { - this.logout(); - deferred.reject(err); - return cb(err); - }.bind(this)); - - return deferred.promise; - }, - - /** - * Delete access token and user info - * - * @param {Function} - */ - logout: function() { - $cookieStore.remove('token'); - currentUser = {}; - }, - - /** - * Create a new user - * - * @param {Object} user - user info - * @param {Function} callback - optional - * @return {Promise} - */ - createUser: function(user, callback) { - var cb = callback || angular.noop; - - return User.save(user, - function(data) { - $cookieStore.put('token', data.token); - currentUser = User.get(); - return cb(user); - }, - function(err) { - this.logout(); - return cb(err); - }.bind(this)).$promise; - }, - - /** - * Change password - * - * @param {String} oldPassword - * @param {String} newPassword - * @param {Function} callback - optional - * @return {Promise} - */ - changePassword: function(oldPassword, newPassword, callback) { - var cb = callback || angular.noop; - - return User.changePassword({ id: currentUser._id }, { - oldPassword: oldPassword, - newPassword: newPassword - }, function(user) { - return cb(user); - }, function(err) { - return cb(err); - }).$promise; - }, - - /** - * Gets all available info on authenticated user - * - * @return {Object} user - */ - getCurrentUser: function() { - return currentUser; - }, - - /** - * Check if a user is logged in - * - * @return {Boolean} - */ - isLoggedIn: function() { - return currentUser.hasOwnProperty('role'); - }, - - /** - * Waits for currentUser to resolve before checking if user is logged in - */ - isLoggedInAsync: function(cb) { - if(currentUser.hasOwnProperty('$promise')) { - currentUser.$promise.then(function() { - cb(true); - }).catch(function() { - cb(false); - }); - } else if(currentUser.hasOwnProperty('role')) { - cb(true); - } else { - cb(false); - } - }, - - /** - * Check if a user is an admin - * - * @return {Boolean} - */ - isAdmin: function() { - return currentUser.role === 'admin'; - }, - - /** - * Get auth token - */ - getToken: function() { - return $cookieStore.get('token'); - } - }; - }); diff --git a/app/templates/client/components/auth(auth)/user.service(coffee).coffee b/app/templates/client/components/auth(auth)/user.service(coffee).coffee deleted file mode 100644 index e0dc2e839..000000000 --- a/app/templates/client/components/auth(auth)/user.service(coffee).coffee +++ /dev/null @@ -1,17 +0,0 @@ -'use strict' - -angular.module '<%= scriptAppName %>' -.factory 'User', ($resource) -> - $resource '/api/users/:id/:controller', - id: '@_id' - , - changePassword: - method: 'PUT' - params: - controller: 'password' - - get: - method: 'GET' - params: - id: 'me' - diff --git a/app/templates/client/components/auth(auth)/user.service(js).js b/app/templates/client/components/auth(auth)/user.service(js).js deleted file mode 100644 index c41fe8312..000000000 --- a/app/templates/client/components/auth(auth)/user.service(js).js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -angular.module('<%= scriptAppName %>') - .factory('User', function ($resource) { - return $resource('/api/users/:id/:controller', { - id: '@_id' - }, - { - changePassword: { - method: 'PUT', - params: { - controller:'password' - } - }, - get: { - method: 'GET', - params: { - id:'me' - } - } - }); - }); diff --git a/app/templates/client/components/modal(uibootstrap)/modal(less).less b/app/templates/client/components/modal(uibootstrap)/modal(less).less index dd1357d2c..2f1c6d80e 100644 --- a/app/templates/client/components/modal(uibootstrap)/modal(less).less +++ b/app/templates/client/components/modal(uibootstrap)/modal(less).less @@ -9,17 +9,17 @@ } } .modal-primary .modal-header { - background: @brand-primary; + background: #428bca; } .modal-info .modal-header { - background: @brand-info; + background: #5bc0de; } .modal-success .modal-header { - background: @brand-success; + background: #5cb85c; } .modal-warning .modal-header { - background: @brand-warning; + background: #f0ad4e; } .modal-danger .modal-header { - background: @brand-danger; -} + background: #d9534f; +} \ No newline at end of file diff --git a/app/templates/client/components/modal(uibootstrap)/modal(sass).scss b/app/templates/client/components/modal(uibootstrap)/modal(sass).scss index 3b0b9d96a..a2d38b265 100644 --- a/app/templates/client/components/modal(uibootstrap)/modal(sass).scss +++ b/app/templates/client/components/modal(uibootstrap)/modal(sass).scss @@ -9,17 +9,17 @@ } } .modal-primary .modal-header { - background: $brand-primary; + background: #428bca; } .modal-info .modal-header { - background: $brand-info; + background: #5bc0de; } .modal-success .modal-header { - background: $brand-success; + background: #5cb85c; } .modal-warning .modal-header { - background: $brand-warning; + background: #f0ad4e; } .modal-danger .modal-header { - background: $brand-danger; + background: #d9534f; } diff --git a/app/templates/client/components/mongoose-error(auth)/mongoose-error.directive(coffee).coffee b/app/templates/client/components/mongoose-error(auth)/mongoose-error.directive(coffee).coffee deleted file mode 100644 index d255f614d..000000000 --- a/app/templates/client/components/mongoose-error(auth)/mongoose-error.directive(coffee).coffee +++ /dev/null @@ -1,12 +0,0 @@ -'use strict' - -### -Removes server error when user updates input -### -angular.module '<%= scriptAppName %>' -.directive 'mongooseError', -> - restrict: 'A' - require: 'ngModel' - link: (scope, element, attrs, ngModel) -> - element.on 'keydown', -> - ngModel.$setValidity 'mongoose', true \ No newline at end of file diff --git a/app/templates/client/components/mongoose-error(auth)/mongoose-error.directive(js).js b/app/templates/client/components/mongoose-error(auth)/mongoose-error.directive(js).js deleted file mode 100644 index 8a331009b..000000000 --- a/app/templates/client/components/mongoose-error(auth)/mongoose-error.directive(js).js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -/** - * Removes server error when user updates input - */ -angular.module('<%= scriptAppName %>') - .directive('mongooseError', function () { - return { - restrict: 'A', - require: 'ngModel', - link: function(scope, element, attrs, ngModel) { - element.on('keydown', function() { - return ngModel.$setValidity('mongoose', true); - }); - } - }; - }); \ No newline at end of file diff --git a/app/templates/client/components/navbar/navbar(html).html b/app/templates/client/components/navbar/navbar(html).html index 71f8606dd..021e99583 100644 --- a/app/templates/client/components/navbar/navbar(html).html +++ b/app/templates/client/components/navbar/navbar(html).html @@ -13,17 +13,8 @@ <% if(filters.auth) { %> - - <% } %> + + diff --git a/app/templates/client/components/navbar/navbar(jade).jade b/app/templates/client/components/navbar/navbar(jade).jade index 2b17f29c3..f282918fe 100644 --- a/app/templates/client/components/navbar/navbar(jade).jade +++ b/app/templates/client/components/navbar/navbar(jade).jade @@ -11,24 +11,4 @@ div.navbar.navbar-default.navbar-static-top(ng-controller='NavbarCtrl') div#navbar-main.navbar-collapse.collapse(collapse='isCollapsed') ul.nav.navbar-nav li(ng-repeat='item in menu', ng-class='{active: isActive(item.link)}') - a(ng-href='https://github.com/%7B%7Bitem.link%7D%7D') {{item.title}}<% if(filters.auth) { %> - - li(ng-show='isAdmin()', ng-class='{active: isActive("/admin")}') - a(href='https://github.com/admin') Admin<% } %><% if(filters.auth) { %> - - ul.nav.navbar-nav.navbar-right - li(ng-hide='isLoggedIn()', ng-class='{active: isActive("/signup")}') - a(href='https://github.com/signup') Sign up - - li(ng-hide='isLoggedIn()', ng-class='{active: isActive("/login")}') - a(href='https://github.com/login') Login - - li(ng-show='isLoggedIn()') - p.navbar-text Hello {{ getCurrentUser().name }} - - li(ng-show='isLoggedIn()', ng-class='{active: isActive("/settings")}') - a(href='https://github.com/settings') - span.glyphicon.glyphicon-cog - - li(ng-show='isLoggedIn()', ng-class='{active: isActive("/logout")}') - a(href='', ng-click='logout()') Logout<% } %> \ No newline at end of file + a(ng-href='https://github.com/%7B%7Bitem.link%7D%7D') {{item.title}} \ No newline at end of file diff --git a/app/templates/client/components/navbar/navbar.controller(coffee).coffee b/app/templates/client/components/navbar/navbar.controller(coffee).coffee index d3804c5eb..394581493 100644 --- a/app/templates/client/components/navbar/navbar.controller(coffee).coffee +++ b/app/templates/client/components/navbar/navbar.controller(coffee).coffee @@ -1,19 +1,12 @@ 'use strict' angular.module '<%= scriptAppName %>' -.controller 'NavbarCtrl', ($scope, $location<% if(filters.auth) {%>, Auth<% } %>) -> +.controller 'NavbarCtrl', ($scope, $location) -> $scope.menu = [ title: 'Home' link: '/' ] - $scope.isCollapsed = true<% if(filters.auth) {%> - $scope.isLoggedIn = Auth.isLoggedIn - $scope.isAdmin = Auth.isAdmin - $scope.getCurrentUser = Auth.getCurrentUser - - $scope.logout = -> - Auth.logout() - $location.path '/login'<% } %> + $scope.isCollapsed = true $scope.isActive = (route) -> route is $location.path() \ No newline at end of file diff --git a/app/templates/client/components/navbar/navbar.controller(js).js b/app/templates/client/components/navbar/navbar.controller(js).js index 4ce9dbcb5..92ecfa99b 100644 --- a/app/templates/client/components/navbar/navbar.controller(js).js +++ b/app/templates/client/components/navbar/navbar.controller(js).js @@ -1,21 +1,13 @@ 'use strict'; angular.module('<%= scriptAppName %>') - .controller('NavbarCtrl', function ($scope, $location<% if(filters.auth) {%>, Auth<% } %>) { + .controller('NavbarCtrl', function ($scope, $location) { $scope.menu = [{ 'title': 'Home', 'link': '/' }]; - $scope.isCollapsed = true;<% if(filters.auth) {%> - $scope.isLoggedIn = Auth.isLoggedIn; - $scope.isAdmin = Auth.isAdmin; - $scope.getCurrentUser = Auth.getCurrentUser; - - $scope.logout = function() { - Auth.logout(); - $location.path('/login'); - };<% } %> + $scope.isCollapsed = true; $scope.isActive = function(route) { return route === $location.path(); diff --git a/app/templates/client/components/socket(socketio)/socket.mock(coffee).coffee b/app/templates/client/components/socket(socketio)/socket.mock(coffee).coffee deleted file mode 100644 index 6f565bbc2..000000000 --- a/app/templates/client/components/socket(socketio)/socket.mock(coffee).coffee +++ /dev/null @@ -1,15 +0,0 @@ -'use strict' - -angular.module 'socketMock', [] -.factory 'socket', -> - socket: - connect: -> - - on: -> - - emit: -> - - receive: -> - - syncUpdates: -> - unsyncUpdates: -> diff --git a/app/templates/client/components/socket(socketio)/socket.mock.js b/app/templates/client/components/socket(socketio)/socket.mock.js deleted file mode 100644 index 84a2e0c36..000000000 --- a/app/templates/client/components/socket(socketio)/socket.mock.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -angular.module('socketMock', []) - .factory('socket', function() { - return { - socket: { - connect: function() {}, - on: function() {}, - emit: function() {}, - receive: function() {} - }, - - syncUpdates: function() {}, - unsyncUpdates: function() {} - }; - }); \ No newline at end of file diff --git a/app/templates/client/components/socket(socketio)/socket.service(coffee).coffee b/app/templates/client/components/socket(socketio)/socket.service(coffee).coffee deleted file mode 100644 index 3fef1c00e..000000000 --- a/app/templates/client/components/socket(socketio)/socket.service(coffee).coffee +++ /dev/null @@ -1,67 +0,0 @@ -# global io - -'use strict' - -angular.module '<%= scriptAppName %>' -.factory 'socket', (socketFactory) -> - - # socket.io now auto-configures its connection when we omit a connection url - ioSocket = io '', - # Send auth token on connection, you will need to DI the Auth service above - # 'query': 'token=' + Auth.getToken() - path: '/socket.io-client' - - socket = socketFactory ioSocket: ioSocket - - socket: socket - - ### - Register listeners to sync an array with updates on a model - - Takes the array we want to sync, the model name that socket updates are sent from, - and an optional callback function after new items are updated. - - @param {String} modelName - @param {Array} array - @param {Function} callback - ### - syncUpdates: (modelName, array, callback) -> - - ### - Syncs item creation/updates on 'model:save' - ### - socket.on modelName + ':save', (item) -> - oldItem = _.find array, - _id: item._id - - index = array.indexOf oldItem - event = 'created' - - # replace oldItem if it exists - # otherwise just add item to the collection - if oldItem - array.splice index, 1, item - event = 'updated' - else - array.push item - - callback? event, item, array - - ### - Syncs removed items on 'model:remove' - ### - socket.on modelName + ':remove', (item) -> - event = 'deleted' - _.remove array, - _id: item._id - - callback? event, item, array - - ### - Removes listeners for a models updates on the socket - - @param modelName - ### - unsyncUpdates: (modelName) -> - socket.removeAllListeners modelName + ':save' - socket.removeAllListeners modelName + ':remove' diff --git a/app/templates/client/components/socket(socketio)/socket.service.js b/app/templates/client/components/socket(socketio)/socket.service.js deleted file mode 100644 index 549f2d764..000000000 --- a/app/templates/client/components/socket(socketio)/socket.service.js +++ /dev/null @@ -1,74 +0,0 @@ -/* global io */ -'use strict'; - -angular.module('<%= scriptAppName %>') - .factory('socket', function(socketFactory) { - - // socket.io now auto-configures its connection when we ommit a connection url - var ioSocket = io('', { - // Send auth token on connection, you will need to DI the Auth service above - // 'query': 'token=' + Auth.getToken() - path: '/socket.io-client' - }); - - var socket = socketFactory({ - ioSocket: ioSocket - }); - - return { - socket: socket, - - /** - * Register listeners to sync an array with updates on a model - * - * Takes the array we want to sync, the model name that socket updates are sent from, - * and an optional callback function after new items are updated. - * - * @param {String} modelName - * @param {Array} array - * @param {Function} cb - */ - syncUpdates: function (modelName, array, cb) { - cb = cb || angular.noop; - - /** - * Syncs item creation/updates on 'model:save' - */ - socket.on(modelName + ':save', function (item) { - var oldItem = _.find(array, {_id: item._id}); - var index = array.indexOf(oldItem); - var event = 'created'; - - // replace oldItem if it exists - // otherwise just add item to the collection - if (oldItem) { - array.splice(index, 1, item); - event = 'updated'; - } else { - array.push(item); - } - - cb(event, item, array); - }); - - /** - * Syncs removed items on 'model:remove' - */ - socket.on(modelName + ':remove', function (item) { - var event = 'deleted'; - _.remove(array, {_id: item._id}); - cb(event, item, array); - }); - }, - - /** - * Removes listeners for a models updates on the socket - * - * @param modelName - */ - unsyncUpdates: function (modelName) { - socket.removeAllListeners(modelName + ':save'); - socket.removeAllListeners(modelName + ':remove'); - } - }; - }); diff --git a/app/templates/client/favicon.ico b/app/templates/client/favicon.ico index 652790530..ae249a50c 100644 Binary files a/app/templates/client/favicon.ico and b/app/templates/client/favicon.ico differ diff --git a/app/templates/client/index.html b/app/templates/client/index.html index e9dcd5729..54295aef8 100644 --- a/app/templates/client/index.html +++ b/app/templates/client/index.html @@ -1,63 +1,46 @@ - - - - + - + <% if(filters.bootstrap) { %> + <% } %> - - + + - - + + - - <% if(filters.ngroute) { %>
<% } %><% if(filters.uirouter) { %>
<% } %> - - - - - + + + + <% if(filters.ngroute) { %> + <% } %><% if(filters.uirouter) { %> + <% } %><% if(filters.uibootstrap) { %> + <% } %> - - <% if(filters.socketio) { %> - <% } %> + + - - <% if(filters.babel) { %> - - <% } else { %> - - <% } %> - - - - - + <% if(filters.babel) { %> + + <% } else { %> + + <% } %> + + + + + diff --git a/app/templates/e2e/main/main.po.js b/app/templates/e2e/main/main.po.js deleted file mode 100644 index 6718608c7..000000000 --- a/app/templates/e2e/main/main.po.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * This file uses the Page Object pattern to define the main page for tests - * https://docs.google.com/presentation/d/1B6manhG0zEXkC-H-tPo2vwU06JhL8w9-XCF9oehXzAQ - */ - -'use strict'; - -var MainPage = function() { - this.heroEl = element(by.css('.hero-unit')); - this.h1El = this.heroEl.element(by.css('h1')); - this.imgEl = this.heroEl.element(by.css('img')); -}; - -module.exports = new MainPage(); - diff --git a/app/templates/e2e/main/main.spec.js b/app/templates/e2e/main/main.spec.js deleted file mode 100644 index 61745a8de..000000000 --- a/app/templates/e2e/main/main.spec.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -describe('Main View', function() { - var page; - - beforeEach(function() { - browser.get('/'); - page = require('./main.po'); - }); - - it('should include jumbotron with correct data', function() { - expect(page.h1El.getText()).toBe('\'Allo, \'Allo!'); - expect(page.imgEl.getAttribute('src')).toMatch(/assets\/images\/yeoman.png$/); - expect(page.imgEl.getAttribute('alt')).toBe('I\'m Yeoman'); - }); -}); diff --git a/app/templates/karma.conf.js b/app/templates/karma.conf.js index e7307a90a..1f40b2602 100644 --- a/app/templates/karma.conf.js +++ b/app/templates/karma.conf.js @@ -16,11 +16,10 @@ module.exports = function(config) { 'client/bower_components/angular-mocks/angular-mocks.js', 'client/bower_components/angular-resource/angular-resource.js', 'client/bower_components/angular-cookies/angular-cookies.js', - 'client/bower_components/angular-sanitize/angular-sanitize.js', - 'client/bower_components/angular-route/angular-route.js',<% if(filters.uibootstrap) { %> + 'client/bower_components/angular-sanitize/angular-sanitize.js',<% if(filters.ngroute) { %> + 'client/bower_components/angular-route/angular-route.js',<% } if(filters.uibootstrap) { %> 'client/bower_components/angular-bootstrap/ui-bootstrap-tpls.js',<% } %> - 'client/bower_components/lodash/dist/lodash.compat.js',<% if(filters.socketio) { %> - 'client/bower_components/angular-socket-io/socket.js',<% } %><% if(filters.uirouter) { %> + 'client/bower_components/lodash/lodash.js',<% if(filters.uirouter) { %> 'client/bower_components/angular-ui-router/release/angular-ui-router.js',<% } %> 'client/app/app.js', 'client/app/app.coffee', diff --git a/app/templates/protractor.conf.js b/app/templates/protractor.conf.js deleted file mode 100644 index cb66c67c1..000000000 --- a/app/templates/protractor.conf.js +++ /dev/null @@ -1,50 +0,0 @@ -// Protractor configuration -// https://github.com/angular/protractor/blob/master/referenceConf.js - -'use strict'; - -exports.config = { - // The timeout for each script run on the browser. This should be longer - // than the maximum time your application needs to stabilize between tasks. - allScriptsTimeout: 110000, - - // A base URL for your application under test. Calls to protractor.get() - // with relative paths will be prepended with this. - baseUrl: 'http://localhost/' + (process.env.PORT || '9000'), - - // If true, only chromedriver will be started, not a standalone selenium. - // Tests for browsers other than chrome will not run. - chromeOnly: true, - - // list of files / patterns to load in the browser - specs: [ - 'e2e/**/*.spec.js' - ], - - // Patterns to exclude. - exclude: [], - - // ----- Capabilities to be passed to the webdriver instance ---- - // - // For a full list of available capabilities, see - // https://code.google.com/p/selenium/wiki/DesiredCapabilities - // and - // https://code.google.com/p/selenium/source/browse/javascript/webdriver/capabilities.js - capabilities: { - 'browserName': 'chrome' - }, - - // ----- The test framework ----- - // - // Jasmine and Cucumber are fully supported as a test and assertion framework. - // Mocha has limited beta support. You will need to include your own - // assertion framework if working with mocha. - framework: 'jasmine', - - // ----- Options to be passed to minijasminenode ----- - // - // See the full list at https://github.com/juliemr/minijasminenode - jasmineNodeOpts: { - defaultTimeoutInterval: 30000 - } -}; diff --git a/app/templates/server/.jshintrc b/app/templates/server/.jshintrc deleted file mode 100644 index 66d1af7c9..000000000 --- a/app/templates/server/.jshintrc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "node": true, - "esnext": true, - "bitwise": true, - "eqeqeq": true, - "immed": true, - "latedef": "nofunc", - "newcap": true, - "noarg": true, - "undef": true, - "smarttabs": true, - "asi": true, - "debug": true -} diff --git a/app/templates/server/.jshintrc-spec b/app/templates/server/.jshintrc-spec deleted file mode 100644 index b6b55cbf9..000000000 --- a/app/templates/server/.jshintrc-spec +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": ".jshintrc", - "globals": { - "describe": true, - "it": true, - "before": true, - "beforeEach": true, - "after": true, - "afterEach": true - } -} diff --git a/app/templates/server/api/thing/index.js b/app/templates/server/api/thing/index.js deleted file mode 100644 index 242ed5901..000000000 --- a/app/templates/server/api/thing/index.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -var express = require('express'); -var controller = require('./thing.controller'); - -var router = express.Router(); - -router.get('/', controller.index);<% if(filters.mongoose) { %> -router.get('/:id', controller.show); -router.post('/', controller.create); -router.put('/:id', controller.update); -router.patch('/:id', controller.update); -router.delete('/:id', controller.destroy);<% } %> - -module.exports = router; \ No newline at end of file diff --git a/app/templates/server/api/thing/thing.controller.js b/app/templates/server/api/thing/thing.controller.js deleted file mode 100644 index 0adc6211c..000000000 --- a/app/templates/server/api/thing/thing.controller.js +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Using Rails-like standard naming convention for endpoints. - * GET /things -> index - * POST /things -> create - * GET /things/:id -> show - * PUT /things/:id -> update - * DELETE /things/:id -> destroy - */ - -'use strict'; - -var _ = require('lodash');<% if (filters.mongoose) { %> -var Thing = require('./thing.model');<% } %> - -// Get list of things -exports.index = function(req, res) {<% if (!filters.mongoose) { %> - res.json([ - { - name : 'Development Tools', - info : 'Integration with popular tools such as Bower, Grunt, Karma, Mocha, JSHint, Node Inspector, Livereload, Protractor, Jade, Stylus, Sass, CoffeeScript, and Less.' - }, { - name : 'Server and Client integration', - info : 'Built with a powerful and fun stack: MongoDB, Express, AngularJS, and Node.' - }, { - name : 'Smart Build System', - info : 'Build system ignores `spec` files, allowing you to keep tests alongside code. Automatic injection of scripts and styles into your index.html' - }, { - name : 'Modular Structure', - info : 'Best practice client and server structures allow for more code reusability and maximum scalability' - }, { - name : 'Optimized Build', - info : 'Build process packs up your templates as a single JavaScript payload, minifies your scripts/css/images, and rewrites asset names for caching.' - },{ - name : 'Deployment Ready', - info : 'Easily deploy your app to Heroku or Openshift with the heroku and openshift subgenerators' - } - ]);<% } %><% if (filters.mongoose) { %> - Thing.find(function (err, things) { - if(err) { return handleError(res, err); } - return res.status(200).json(things); - });<% } %> -};<% if (filters.mongoose) { %> - -// Get a single thing -exports.show = function(req, res) { - Thing.findById(req.params.id, function (err, thing) { - if(err) { return handleError(res, err); } - if(!thing) { return res.status(404).send('Not Found'); } - return res.json(thing); - }); -}; - -// Creates a new thing in the DB. -exports.create = function(req, res) { - Thing.create(req.body, function(err, thing) { - if(err) { return handleError(res, err); } - return res.status(201).json(thing); - }); -}; - -// Updates an existing thing in the DB. -exports.update = function(req, res) { - if(req.body._id) { delete req.body._id; } - Thing.findById(req.params.id, function (err, thing) { - if (err) { return handleError(res, err); } - if(!thing) { return res.status(404).send('Not Found'); } - var updated = _.merge(thing, req.body); - updated.save(function (err) { - if (err) { return handleError(res, err); } - return res.status(200).json(thing); - }); - }); -}; - -// Deletes a thing from the DB. -exports.destroy = function(req, res) { - Thing.findById(req.params.id, function (err, thing) { - if(err) { return handleError(res, err); } - if(!thing) { return res.status(404).send('Not Found'); } - thing.remove(function(err) { - if(err) { return handleError(res, err); } - return res.status(204).send('No Content'); - }); - }); -}; - -function handleError(res, err) { - return res.status(500).send(err); -}<% } %> \ No newline at end of file diff --git a/app/templates/server/api/thing/thing.model(mongoose).js b/app/templates/server/api/thing/thing.model(mongoose).js deleted file mode 100644 index ed857cd3b..000000000 --- a/app/templates/server/api/thing/thing.model(mongoose).js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -var mongoose = require('mongoose'), - Schema = mongoose.Schema; - -var ThingSchema = new Schema({ - name: String, - info: String, - active: Boolean -}); - -module.exports = mongoose.model('Thing', ThingSchema); \ No newline at end of file diff --git a/app/templates/server/api/thing/thing.socket(socketio).js b/app/templates/server/api/thing/thing.socket(socketio).js deleted file mode 100644 index 79d327695..000000000 --- a/app/templates/server/api/thing/thing.socket(socketio).js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Broadcast updates to client when the model changes - */ - -'use strict'; - -var thing = require('./thing.model'); - -exports.register = function(socket) { - thing.schema.post('save', function (doc) { - onSave(socket, doc); - }); - thing.schema.post('remove', function (doc) { - onRemove(socket, doc); - }); -} - -function onSave(socket, doc, cb) { - socket.emit('thing:save', doc); -} - -function onRemove(socket, doc, cb) { - socket.emit('thing:remove', doc); -} \ No newline at end of file diff --git a/app/templates/server/api/thing/thing.spec.js b/app/templates/server/api/thing/thing.spec.js deleted file mode 100644 index 17c8c6cd0..000000000 --- a/app/templates/server/api/thing/thing.spec.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -var should = require('should'); -var app = require('../../app'); -var request = require('supertest'); - -describe('GET /api/things', function() { - - it('should respond with JSON array', function(done) { - request(app) - .get('/api/things') - .expect(200) - .expect('Content-Type', /json/) - .end(function(err, res) { - if (err) return done(err); - res.body.should.be.instanceof(Array); - done(); - }); - }); -}); diff --git a/app/templates/server/api/user(auth)/index.js b/app/templates/server/api/user(auth)/index.js deleted file mode 100644 index 48567e485..000000000 --- a/app/templates/server/api/user(auth)/index.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -var express = require('express'); -var controller = require('./user.controller'); -var config = require('../../config/environment'); -var auth = require('../../auth/auth.service'); - -var router = express.Router(); - -router.get('/', auth.hasRole('admin'), controller.index); -router.delete('/:id', auth.hasRole('admin'), controller.destroy); -router.get('/me', auth.isAuthenticated(), controller.me); -router.put('/:id/password', auth.isAuthenticated(), controller.changePassword); -router.get('/:id', auth.isAuthenticated(), controller.show); -router.post('/', controller.create); - -module.exports = router; diff --git a/app/templates/server/api/user(auth)/user.controller.js b/app/templates/server/api/user(auth)/user.controller.js deleted file mode 100644 index 585e47b67..000000000 --- a/app/templates/server/api/user(auth)/user.controller.js +++ /dev/null @@ -1,101 +0,0 @@ -'use strict'; - -var User = require('./user.model'); -var passport = require('passport'); -var config = require('../../config/environment'); -var jwt = require('jsonwebtoken'); - -var validationError = function(res, err) { - return res.status(422).json(err); -}; - -/** - * Get list of users - * restriction: 'admin' - */ -exports.index = function(req, res) { - User.find({}, '-salt -hashedPassword', function (err, users) { - if(err) return res.status(500).send(err); - res.status(200).json(users); - }); -}; - -/** - * Creates a new user - */ -exports.create = function (req, res, next) { - var newUser = new User(req.body); - newUser.provider = 'local'; - newUser.role = 'user'; - newUser.save(function(err, user) { - if (err) return validationError(res, err); - var token = jwt.sign({_id: user._id }, config.secrets.session, { expiresInMinutes: 60*5 }); - res.json({ token: token }); - }); -}; - -/** - * Get a single user - */ -exports.show = function (req, res, next) { - var userId = req.params.id; - - User.findById(userId, function (err, user) { - if (err) return next(err); - if (!user) return res.status(401).send('Unauthorized'); - res.json(user.profile); - }); -}; - -/** - * Deletes a user - * restriction: 'admin' - */ -exports.destroy = function(req, res) { - User.findByIdAndRemove(req.params.id, function(err, user) { - if(err) return res.status(500).send(err); - return res.status(204).send('No Content'); - }); -}; - -/** - * Change a users password - */ -exports.changePassword = function(req, res, next) { - var userId = req.user._id; - var oldPass = String(req.body.oldPassword); - var newPass = String(req.body.newPassword); - - User.findById(userId, function (err, user) { - if(user.authenticate(oldPass)) { - user.password = newPass; - user.save(function(err) { - if (err) return validationError(res, err); - res.status(200).send('OK'); - }); - } else { - res.status(403).send('Forbidden'); - } - }); -}; - -/** - * Get my info - */ -exports.me = function(req, res, next) { - var userId = req.user._id; - User.findOne({ - _id: userId - }, '-salt -hashedPassword', function(err, user) { // don't ever give out the password or salt - if (err) return next(err); - if (!user) return res.status(401).send('Unauthorized'); - res.json(user); - }); -}; - -/** - * Authentication callback - */ -exports.authCallback = function(req, res, next) { - res.redirect('/'); -}; diff --git a/app/templates/server/api/user(auth)/user.model.js b/app/templates/server/api/user(auth)/user.model.js deleted file mode 100644 index cc8d59263..000000000 --- a/app/templates/server/api/user(auth)/user.model.js +++ /dev/null @@ -1,149 +0,0 @@ -'use strict'; - -var mongoose = require('mongoose'); -var Schema = mongoose.Schema; -var crypto = require('crypto');<% if(filters.oauth) { %> -var authTypes = ['github', 'twitter', 'facebook', 'google'];<% } %> - -var UserSchema = new Schema({ - name: String, - email: { type: String, lowercase: true }, - role: { - type: String, - default: 'user' - }, - hashedPassword: String, - provider: String, - salt: String<% if (filters.oauth) { %>,<% if (filters.facebookAuth) { %> - facebook: {},<% } %><% if (filters.twitterAuth) { %> - twitter: {},<% } %><% if (filters.googleAuth) { %> - google: {},<% } %> - github: {}<% } %> -}); - -/** - * Virtuals - */ -UserSchema - .virtual('password') - .set(function(password) { - this._password = password; - this.salt = this.makeSalt(); - this.hashedPassword = this.encryptPassword(password); - }) - .get(function() { - return this._password; - }); - -// Public profile information -UserSchema - .virtual('profile') - .get(function() { - return { - 'name': this.name, - 'role': this.role - }; - }); - -// Non-sensitive info we'll be putting in the token -UserSchema - .virtual('token') - .get(function() { - return { - '_id': this._id, - 'role': this.role - }; - }); - -/** - * Validations - */ - -// Validate empty email -UserSchema - .path('email') - .validate(function(email) {<% if (filters.oauth) { %> - if (authTypes.indexOf(this.provider) !== -1) return true;<% } %> - return email.length; - }, 'Email cannot be blank'); - -// Validate empty password -UserSchema - .path('hashedPassword') - .validate(function(hashedPassword) {<% if (filters.oauth) { %> - if (authTypes.indexOf(this.provider) !== -1) return true;<% } %> - return hashedPassword.length; - }, 'Password cannot be blank'); - -// Validate email is not taken -UserSchema - .path('email') - .validate(function(value, respond) { - var self = this; - this.constructor.findOne({email: value}, function(err, user) { - if(err) throw err; - if(user) { - if(self.id === user.id) return respond(true); - return respond(false); - } - respond(true); - }); -}, 'The specified email address is already in use.'); - -var validatePresenceOf = function(value) { - return value && value.length; -}; - -/** - * Pre-save hook - */ -UserSchema - .pre('save', function(next) { - if (!this.isNew) return next(); - - if (!validatePresenceOf(this.hashedPassword)<% if (filters.oauth) { %> && authTypes.indexOf(this.provider) === -1<% } %>) - next(new Error('Invalid password')); - else - next(); - }); - -/** - * Methods - */ -UserSchema.methods = { - /** - * Authenticate - check if the passwords are the same - * - * @param {String} plainText - * @return {Boolean} - * @api public - */ - authenticate: function(plainText) { - return this.encryptPassword(plainText) === this.hashedPassword; - }, - - /** - * Make salt - * - * @return {String} - * @api public - */ - makeSalt: function() { - return crypto.randomBytes(16).toString('base64'); - }, - - /** - * Encrypt password - * - * @param {String} password - * @return {String} - * @api public - */ - encryptPassword: function(password) { - if (!password || !this.salt) return ''; - var salt = new Buffer(this.salt, 'base64'); - return crypto.pbkdf2Sync(password, salt, 10000, 64).toString('base64'); - } -}; - -module.exports = mongoose.model('User', UserSchema); diff --git a/app/templates/server/api/user(auth)/user.model.spec.js b/app/templates/server/api/user(auth)/user.model.spec.js deleted file mode 100644 index 257c95b7c..000000000 --- a/app/templates/server/api/user(auth)/user.model.spec.js +++ /dev/null @@ -1,60 +0,0 @@ -'use strict'; - -var should = require('should'); -var app = require('../../app'); -var User = require('./user.model'); - -var user = new User({ - provider: 'local', - name: 'Fake User', - email: 'test@test.com', - password: 'password' -}); - -describe('User Model', function() { - before(function(done) { - // Clear users before testing - User.remove().exec().then(function() { - done(); - }); - }); - - afterEach(function(done) { - User.remove().exec().then(function() { - done(); - }); - }); - - it('should begin with no users', function(done) { - User.find({}, function(err, users) { - users.should.have.length(0); - done(); - }); - }); - - it('should fail when saving a duplicate user', function(done) { - user.save(function() { - var userDup = new User(user); - userDup.save(function(err) { - should.exist(err); - done(); - }); - }); - }); - - it('should fail when saving without an email', function(done) { - user.email = ''; - user.save(function(err) { - should.exist(err); - done(); - }); - }); - - it("should authenticate user if password is valid", function() { - return user.authenticate('password').should.be.true; - }); - - it("should not authenticate user if password is invalid", function() { - return user.authenticate('blah').should.not.be.true; - }); -}); diff --git a/app/templates/server/app.js b/app/templates/server/app.js deleted file mode 100644 index f677d7a43..000000000 --- a/app/templates/server/app.js +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Main application file - */ - -'use strict'; - -// Set default node environment to development -process.env.NODE_ENV = process.env.NODE_ENV || 'development'; - -var express = require('express');<% if (filters.mongoose) { %> -var mongoose = require('mongoose');<% } %> -var config = require('./config/environment'); -<% if (filters.mongoose) { %> -// Connect to database -mongoose.connect(config.mongo.uri, config.mongo.options); -mongoose.connection.on('error', function(err) { - console.error('MongoDB connection error: ' + err); - process.exit(-1); - } -); -// Populate DB with sample data -if(config.seedDB) { require('./config/seed'); } - -<% } %>// Setup server -var app = express(); -var server = require('http').createServer(app);<% if (filters.socketio) { %> -var socketio = require('socket.io')(server, { - serveClient: config.env !== 'production', - path: '/socket.io-client' -}); -require('./config/socketio')(socketio);<% } %> -require('./config/express')(app); -require('./routes')(app); - -// Start server -server.listen(config.port, config.ip, function () { - console.log('Express server listening on %d, in %s mode', config.port, app.get('env')); -}); - -// Expose app -exports = module.exports = app; diff --git a/app/templates/server/auth(auth)/auth.service.js b/app/templates/server/auth(auth)/auth.service.js deleted file mode 100644 index 370dac51e..000000000 --- a/app/templates/server/auth(auth)/auth.service.js +++ /dev/null @@ -1,76 +0,0 @@ -'use strict'; - -var mongoose = require('mongoose'); -var passport = require('passport'); -var config = require('../config/environment'); -var jwt = require('jsonwebtoken'); -var expressJwt = require('express-jwt'); -var compose = require('composable-middleware'); -var User = require('../api/user/user.model'); -var validateJwt = expressJwt({ secret: config.secrets.session }); - -/** - * Attaches the user object to the request if authenticated - * Otherwise returns 403 - */ -function isAuthenticated() { - return compose() - // Validate jwt - .use(function(req, res, next) { - // allow access_token to be passed through query parameter as well - if(req.query && req.query.hasOwnProperty('access_token')) { - req.headers.authorization = 'Bearer ' + req.query.access_token; - } - validateJwt(req, res, next); - }) - // Attach user to request - .use(function(req, res, next) { - User.findById(req.user._id, function (err, user) { - if (err) return next(err); - if (!user) return res.status(401).send('Unauthorized'); - - req.user = user; - next(); - }); - }); -} - -/** - * Checks if the user role meets the minimum requirements of the route - */ -function hasRole(roleRequired) { - if (!roleRequired) throw new Error('Required role needs to be set'); - - return compose() - .use(isAuthenticated()) - .use(function meetsRequirements(req, res, next) { - if (config.userRoles.indexOf(req.user.role) >= config.userRoles.indexOf(roleRequired)) { - next(); - } - else { - res.status(403).send('Forbidden'); - } - }); -} - -/** - * Returns a jwt token signed by the app secret - */ -function signToken(id) { - return jwt.sign({ _id: id }, config.secrets.session, { expiresInMinutes: 60*5 }); -} - -/** - * Set token cookie directly for oAuth strategies - */ -function setTokenCookie(req, res) { - if (!req.user) return res.status(404).json({ message: 'Something went wrong, please try again.'}); - var token = signToken(req.user._id, req.user.role); - res.cookie('token', JSON.stringify(token)); - res.redirect('/'); -} - -exports.isAuthenticated = isAuthenticated; -exports.hasRole = hasRole; -exports.signToken = signToken; -exports.setTokenCookie = setTokenCookie; \ No newline at end of file diff --git a/app/templates/server/auth(auth)/facebook(facebookAuth)/index.js b/app/templates/server/auth(auth)/facebook(facebookAuth)/index.js deleted file mode 100644 index 4a6f87886..000000000 --- a/app/templates/server/auth(auth)/facebook(facebookAuth)/index.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -var express = require('express'); -var passport = require('passport'); -var auth = require('../auth.service'); - -var router = express.Router(); - -router - .get('/', passport.authenticate('facebook', { - scope: ['email', 'user_about_me'], - failureRedirect: '/signup', - session: false - })) - - .get('/callback', passport.authenticate('facebook', { - failureRedirect: '/signup', - session: false - }), auth.setTokenCookie); - -module.exports = router; \ No newline at end of file diff --git a/app/templates/server/auth(auth)/facebook(facebookAuth)/passport.js b/app/templates/server/auth(auth)/facebook(facebookAuth)/passport.js deleted file mode 100644 index 54574efb6..000000000 --- a/app/templates/server/auth(auth)/facebook(facebookAuth)/passport.js +++ /dev/null @@ -1,37 +0,0 @@ -var passport = require('passport'); -var FacebookStrategy = require('passport-facebook').Strategy; - -exports.setup = function (User, config) { - passport.use(new FacebookStrategy({ - clientID: config.facebook.clientID, - clientSecret: config.facebook.clientSecret, - callbackURL: config.facebook.callbackURL - }, - function(accessToken, refreshToken, profile, done) { - User.findOne({ - 'facebook.id': profile.id - }, - function(err, user) { - if (err) { - return done(err); - } - if (!user) { - user = new User({ - name: profile.displayName, - email: profile.emails[0].value, - role: 'user', - username: profile.username, - provider: 'facebook', - facebook: profile._json - }); - user.save(function(err) { - if (err) return done(err); - done(err, user); - }); - } else { - return done(err, user); - } - }) - } - )); -}; diff --git a/app/templates/server/auth(auth)/google(googleAuth)/index.js b/app/templates/server/auth(auth)/google(googleAuth)/index.js deleted file mode 100644 index 9b1ce39fe..000000000 --- a/app/templates/server/auth(auth)/google(googleAuth)/index.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -var express = require('express'); -var passport = require('passport'); -var auth = require('../auth.service'); - -var router = express.Router(); - -router - .get('/', passport.authenticate('google', { - failureRedirect: '/signup', - scope: [ - 'https://www.googleapis.com/auth/userinfo.profile', - 'https://www.googleapis.com/auth/userinfo.email' - ], - session: false - })) - - .get('/callback', passport.authenticate('google', { - failureRedirect: '/signup', - session: false - }), auth.setTokenCookie); - -module.exports = router; \ No newline at end of file diff --git a/app/templates/server/auth(auth)/google(googleAuth)/passport.js b/app/templates/server/auth(auth)/google(googleAuth)/passport.js deleted file mode 100644 index c9754c83a..000000000 --- a/app/templates/server/auth(auth)/google(googleAuth)/passport.js +++ /dev/null @@ -1,33 +0,0 @@ -var passport = require('passport'); -var GoogleStrategy = require('passport-google-oauth').OAuth2Strategy; - -exports.setup = function (User, config) { - passport.use(new GoogleStrategy({ - clientID: config.google.clientID, - clientSecret: config.google.clientSecret, - callbackURL: config.google.callbackURL - }, - function(accessToken, refreshToken, profile, done) { - User.findOne({ - 'google.id': profile.id - }, function(err, user) { - if (!user) { - user = new User({ - name: profile.displayName, - email: profile.emails[0].value, - role: 'user', - username: profile.username, - provider: 'google', - google: profile._json - }); - user.save(function(err) { - if (err) return done(err); - done(err, user); - }); - } else { - return done(err, user); - } - }); - } - )); -}; diff --git a/app/templates/server/auth(auth)/index.js b/app/templates/server/auth(auth)/index.js deleted file mode 100644 index e3e6c87ad..000000000 --- a/app/templates/server/auth(auth)/index.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -var express = require('express'); -var passport = require('passport'); -var config = require('../config/environment'); -var User = require('../api/user/user.model'); - -// Passport Configuration -require('./local/passport').setup(User, config);<% if (filters.facebookAuth) { %> -require('./facebook/passport').setup(User, config);<% } %><% if (filters.googleAuth) { %> -require('./google/passport').setup(User, config);<% } %><% if (filters.twitterAuth) { %> -require('./twitter/passport').setup(User, config);<% } %> - -var router = express.Router(); - -router.use('/local', require('./local'));<% if (filters.facebookAuth) { %> -router.use('/facebook', require('./facebook'));<% } %><% if (filters.twitterAuth) { %> -router.use('/twitter', require('./twitter'));<% } %><% if (filters.googleAuth) { %> -router.use('/google', require('./google'));<% } %> - -module.exports = router; \ No newline at end of file diff --git a/app/templates/server/auth(auth)/local/index.js b/app/templates/server/auth(auth)/local/index.js deleted file mode 100644 index 2e761a52d..000000000 --- a/app/templates/server/auth(auth)/local/index.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -var express = require('express'); -var passport = require('passport'); -var auth = require('../auth.service'); - -var router = express.Router(); - -router.post('/', function(req, res, next) { - passport.authenticate('local', function (err, user, info) { - var error = err || info; - if (error) return res.status(401).json(error); - if (!user) return res.status(404).json({message: 'Something went wrong, please try again.'}); - - var token = auth.signToken(user._id, user.role); - res.json({token: token}); - })(req, res, next) -}); - -module.exports = router; \ No newline at end of file diff --git a/app/templates/server/auth(auth)/local/passport.js b/app/templates/server/auth(auth)/local/passport.js deleted file mode 100644 index ac82b42a2..000000000 --- a/app/templates/server/auth(auth)/local/passport.js +++ /dev/null @@ -1,25 +0,0 @@ -var passport = require('passport'); -var LocalStrategy = require('passport-local').Strategy; - -exports.setup = function (User, config) { - passport.use(new LocalStrategy({ - usernameField: 'email', - passwordField: 'password' // this is the virtual field on the model - }, - function(email, password, done) { - User.findOne({ - email: email.toLowerCase() - }, function(err, user) { - if (err) return done(err); - - if (!user) { - return done(null, false, { message: 'This email is not registered.' }); - } - if (!user.authenticate(password)) { - return done(null, false, { message: 'This password is not correct.' }); - } - return done(null, user); - }); - } - )); -}; \ No newline at end of file diff --git a/app/templates/server/auth(auth)/twitter(twitterAuth)/index.js b/app/templates/server/auth(auth)/twitter(twitterAuth)/index.js deleted file mode 100644 index 8360247b8..000000000 --- a/app/templates/server/auth(auth)/twitter(twitterAuth)/index.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -var express = require('express'); -var passport = require('passport'); -var auth = require('../auth.service'); - -var router = express.Router(); - -router - .get('/', passport.authenticate('twitter', { - failureRedirect: '/signup', - session: false - })) - - .get('/callback', passport.authenticate('twitter', { - failureRedirect: '/signup', - session: false - }), auth.setTokenCookie); - -module.exports = router; \ No newline at end of file diff --git a/app/templates/server/auth(auth)/twitter(twitterAuth)/passport.js b/app/templates/server/auth(auth)/twitter(twitterAuth)/passport.js deleted file mode 100644 index 4544ce186..000000000 --- a/app/templates/server/auth(auth)/twitter(twitterAuth)/passport.js +++ /dev/null @@ -1,35 +0,0 @@ -exports.setup = function (User, config) { - var passport = require('passport'); - var TwitterStrategy = require('passport-twitter').Strategy; - - passport.use(new TwitterStrategy({ - consumerKey: config.twitter.clientID, - consumerSecret: config.twitter.clientSecret, - callbackURL: config.twitter.callbackURL - }, - function(token, tokenSecret, profile, done) { - User.findOne({ - 'twitter.id_str': profile.id - }, function(err, user) { - if (err) { - return done(err); - } - if (!user) { - user = new User({ - name: profile.displayName, - username: profile.username, - role: 'user', - provider: 'twitter', - twitter: profile._json - }); - user.save(function(err) { - if (err) return done(err); - done(err, user); - }); - } else { - return done(err, user); - } - }); - } - )); -}; diff --git a/app/templates/server/components/errors/index.js b/app/templates/server/components/errors/index.js deleted file mode 100644 index 4c5a57c99..000000000 --- a/app/templates/server/components/errors/index.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Error responses - */ - -'use strict'; - -module.exports[404] = function pageNotFound(req, res) { - var viewFilePath = '404'; - var statusCode = 404; - var result = { - status: statusCode - }; - - res.status(result.status); - res.render(viewFilePath, function (err) { - if (err) { return res.json(result, result.status); } - - res.render(viewFilePath); - }); -}; diff --git a/app/templates/server/config/_local.env.js b/app/templates/server/config/_local.env.js deleted file mode 100644 index c24fffd3a..000000000 --- a/app/templates/server/config/_local.env.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -// Use local.env.js for environment variables that grunt will set when the server starts locally. -// Use for your api keys, secrets, etc. This file should not be tracked by git. -// -// You will need to set these on the server you deploy to. - -module.exports = { - DOMAIN: 'http://localhost:9000/', - SESSION_SECRET: "<%= _.slugify(appname) + '-secret' %>",<% if (filters.facebookAuth) { %> - - FACEBOOK_ID: 'app-id', - FACEBOOK_SECRET: 'secret',<% } if (filters.twitterAuth) { %> - - TWITTER_ID: 'app-id', - TWITTER_SECRET: 'secret',<% } if (filters.googleAuth) { %> - - GOOGLE_ID: 'app-id', - GOOGLE_SECRET: 'secret', -<% } %> - // Control debug level for modules using visionmedia/debug - DEBUG: '' -}; diff --git a/app/templates/server/config/_local.env.sample.js b/app/templates/server/config/_local.env.sample.js deleted file mode 100644 index ac5a52a2e..000000000 --- a/app/templates/server/config/_local.env.sample.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -// Use local.env.js for environment variables that grunt will set when the server starts locally. -// Use for your api keys, secrets, etc. This file should not be tracked by git. -// -// You will need to set these on the server you deploy to. - -module.exports = { - DOMAIN: 'http://localhost:9000/', - SESSION_SECRET: '<%= _.slugify(appname) + "-secret" %>',<% if (filters.facebookAuth) { %> - - FACEBOOK_ID: 'app-id', - FACEBOOK_SECRET: 'secret',<% } if (filters.twitterAuth) { %> - - TWITTER_ID: 'app-id', - TWITTER_SECRET: 'secret',<% } if (filters.googleAuth) { %> - - GOOGLE_ID: 'app-id', - GOOGLE_SECRET: 'secret',<% } %> - - // Control debug level for modules using visionmedia/debug - DEBUG: '' -}; diff --git a/app/templates/server/config/environment/development.js b/app/templates/server/config/environment/development.js deleted file mode 100644 index fb33d6eab..000000000 --- a/app/templates/server/config/environment/development.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -// Development specific configuration -// ================================== -module.exports = { - // MongoDB connection options - mongo: { - uri: 'mongodb://localhost/<%= _.slugify(appname) %>-dev' - }, - - seedDB: true -}; diff --git a/app/templates/server/config/environment/index.js b/app/templates/server/config/environment/index.js deleted file mode 100644 index 895d91534..000000000 --- a/app/templates/server/config/environment/index.js +++ /dev/null @@ -1,70 +0,0 @@ -'use strict'; - -var path = require('path'); -var _ = require('lodash'); - -function requiredProcessEnv(name) { - if(!process.env[name]) { - throw new Error('You must set the ' + name + ' environment variable'); - } - return process.env[name]; -} - -// All configurations will extend these options -// ============================================ -var all = { - env: process.env.NODE_ENV, - - // Root path of server - root: path.normalize(__dirname + '/../../..'), - - // Server port - port: process.env.PORT || 9000, - - // Server IP - ip: process.env.IP || 'localhost', - - // Should we populate the DB with sample data? - seedDB: false, - - // Secret for session, you will want to change this and make it an environment variable - secrets: { - session: '<%= _.slugify(_.humanize(appname)) + '-secret' %>' - }, - - // List of user roles - userRoles: ['guest', 'user', 'admin'], - - // MongoDB connection options - mongo: { - options: { - db: { - safe: true - } - } - }, -<% if(filters.facebookAuth) { %> - facebook: { - clientID: process.env.FACEBOOK_ID || 'id', - clientSecret: process.env.FACEBOOK_SECRET || 'secret', - callbackURL: (process.env.DOMAIN || '') + '/auth/facebook/callback' - }, -<% } %><% if(filters.twitterAuth) { %> - twitter: { - clientID: process.env.TWITTER_ID || 'id', - clientSecret: process.env.TWITTER_SECRET || 'secret', - callbackURL: (process.env.DOMAIN || '') + '/auth/twitter/callback' - }, -<% } %><% if(filters.googleAuth) { %> - google: { - clientID: process.env.GOOGLE_ID || 'id', - clientSecret: process.env.GOOGLE_SECRET || 'secret', - callbackURL: (process.env.DOMAIN || '') + '/auth/google/callback' - }<% } %> -}; - -// Export the config object based on the NODE_ENV -// ============================================== -module.exports = _.merge( - all, - require('./' + process.env.NODE_ENV + '.js') || {}); \ No newline at end of file diff --git a/app/templates/server/config/environment/production.js b/app/templates/server/config/environment/production.js deleted file mode 100644 index 1704df619..000000000 --- a/app/templates/server/config/environment/production.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -// Production specific configuration -// ================================= -module.exports = { - // Server IP - ip: process.env.OPENSHIFT_NODEJS_IP || - process.env.IP || - undefined, - - // Server port - port: process.env.OPENSHIFT_NODEJS_PORT || - process.env.PORT || - 8080, - - // MongoDB connection options - mongo: { - uri: process.env.MONGOLAB_URI || - process.env.MONGOHQ_URL || - process.env.OPENSHIFT_MONGODB_DB_URL+process.env.OPENSHIFT_APP_NAME || - 'mongodb://localhost/<%= _.slugify(appname) %>' - } -}; \ No newline at end of file diff --git a/app/templates/server/config/environment/test.js b/app/templates/server/config/environment/test.js deleted file mode 100644 index 711c98660..000000000 --- a/app/templates/server/config/environment/test.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -// Test specific configuration -// =========================== -module.exports = { - // MongoDB connection options - mongo: { - uri: 'mongodb://localhost/<%= _.slugify(appname) %>-test' - } -}; \ No newline at end of file diff --git a/app/templates/server/config/express.js b/app/templates/server/config/express.js deleted file mode 100644 index f04098387..000000000 --- a/app/templates/server/config/express.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Express configuration - */ - -'use strict'; - -var express = require('express'); -var favicon = require('serve-favicon'); -var morgan = require('morgan'); -var compression = require('compression'); -var bodyParser = require('body-parser'); -var methodOverride = require('method-override'); -var cookieParser = require('cookie-parser'); -var errorHandler = require('errorhandler'); -var path = require('path'); -var config = require('./environment');<% if (filters.auth) { %> -var passport = require('passport');<% } %><% if (filters.twitterAuth) { %> -var session = require('express-session'); -var mongoStore = require('connect-mongo')(session); -var mongoose = require('mongoose');<% } %> - -module.exports = function(app) { - var env = app.get('env'); - - app.set('views', config.root + '/server/views');<% if (filters.html) { %> - app.engine('html', require('ejs').renderFile); - app.set('view engine', 'html');<% } %><% if (filters.jade) { %> - app.set('view engine', 'jade');<% } %> - app.use(compression()); - app.use(bodyParser.urlencoded({ extended: false })); - app.use(bodyParser.json()); - app.use(methodOverride()); - app.use(cookieParser()); - <% if (filters.auth) { %>app.use(passport.initialize());<% } %><% if (filters.twitterAuth) { %> - - // Persist sessions with mongoStore - // We need to enable sessions for passport twitter because its an oauth 1.0 strategy - app.use(session({ - secret: config.secrets.session, - resave: true, - saveUninitialized: true, - store: new mongoStore({ - mongooseConnection: mongoose.connection, - db: '<%= _.slugify(_.humanize(appname)) %>' - }) - })); - <% } %> - if ('production' === env) { - app.use(favicon(path.join(config.root, 'public', 'favicon.ico'))); - app.use(express.static(path.join(config.root, 'public'))); - app.set('appPath', path.join(config.root, 'public')); - app.use(morgan('dev')); - } - - if ('development' === env || 'test' === env) { - app.use(require('connect-livereload')()); - app.use(express.static(path.join(config.root, '.tmp'))); - app.use(express.static(path.join(config.root, 'client'))); - app.set('appPath', path.join(config.root, 'client')); - app.use(morgan('dev')); - app.use(errorHandler()); // Error handler - has to be last - } -}; \ No newline at end of file diff --git a/app/templates/server/config/seed(mongoose).js b/app/templates/server/config/seed(mongoose).js deleted file mode 100644 index 27ab19417..000000000 --- a/app/templates/server/config/seed(mongoose).js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Populate DB with sample data on server start - * to disable, edit config/environment/index.js, and set `seedDB: false` - */ - -'use strict'; - -var Thing = require('../api/thing/thing.model'); -<% if (filters.auth) { %>var User = require('../api/user/user.model');<% } %> - -Thing.find({}).remove(function() { - Thing.create({ - name : 'Development Tools', - info : 'Integration with popular tools such as Bower, Grunt, Karma, Mocha, JSHint, Node Inspector, Livereload, Protractor, Jade, Stylus, Sass, CoffeeScript, and Less.' - }, { - name : 'Server and Client integration', - info : 'Built with a powerful and fun stack: MongoDB, Express, AngularJS, and Node.' - }, { - name : 'Smart Build System', - info : 'Build system ignores `spec` files, allowing you to keep tests alongside code. Automatic injection of scripts and styles into your index.html' - }, { - name : 'Modular Structure', - info : 'Best practice client and server structures allow for more code reusability and maximum scalability' - }, { - name : 'Optimized Build', - info : 'Build process packs up your templates as a single JavaScript payload, minifies your scripts/css/images, and rewrites asset names for caching.' - },{ - name : 'Deployment Ready', - info : 'Easily deploy your app to Heroku or Openshift with the heroku and openshift subgenerators' - }); -});<% if (filters.auth) { %> - -User.find({}).remove(function() { - User.create({ - provider: 'local', - name: 'Test User', - email: 'test@test.com', - password: 'test' - }, { - provider: 'local', - role: 'admin', - name: 'Admin', - email: 'admin@admin.com', - password: 'admin' - }, function() { - console.log('finished populating users'); - } - ); -});<% } %> \ No newline at end of file diff --git a/app/templates/server/config/socketio(socketio).js b/app/templates/server/config/socketio(socketio).js deleted file mode 100644 index 2fbbc07d6..000000000 --- a/app/templates/server/config/socketio(socketio).js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Socket.io configuration - */ - -'use strict'; - -var config = require('./environment'); - -// When the user disconnects.. perform this -function onDisconnect(socket) { -} - -// When the user connects.. perform this -function onConnect(socket) { - // When the client emits 'info', this listens and executes - socket.on('info', function (data) { - console.info('[%s] %s', socket.address, JSON.stringify(data, null, 2)); - }); - - // Insert sockets below - require('../api/thing/thing.socket').register(socket); -} - -module.exports = function (socketio) { - // socket.io (v1.x.x) is powered by debug. - // In order to see all the debug output, set DEBUG (in server/config/local.env.js) to including the desired scope. - // - // ex: DEBUG: "http*,socket.io:socket" - - // We can authenticate socket.io users and access their token through socket.handshake.decoded_token - // - // 1. You will need to send the token in `client/components/socket/socket.service.js` - // - // 2. Require authentication here: - // socketio.use(require('socketio-jwt').authorize({ - // secret: config.secrets.session, - // handshake: true - // })); - - socketio.on('connection', function (socket) { - socket.address = socket.handshake.address !== null ? - socket.handshake.address.address + ':' + socket.handshake.address.port : - process.env.DOMAIN; - - socket.connectedAt = new Date(); - - // Call onDisconnect. - socket.on('disconnect', function () { - onDisconnect(socket); - console.info('[%s] DISCONNECTED', socket.address); - }); - - // Call onConnect. - onConnect(socket); - console.info('[%s] CONNECTED', socket.address); - }); -}; \ No newline at end of file diff --git a/app/templates/server/routes.js b/app/templates/server/routes.js deleted file mode 100644 index ebcd79dc6..000000000 --- a/app/templates/server/routes.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Main application routes - */ - -'use strict'; - -var errors = require('./components/errors'); -var path = require('path'); - -module.exports = function(app) { - - // Insert routes below - app.use('/api/things', require('./api/thing')); - <% if (filters.auth) { %>app.use('/api/users', require('./api/user')); - - app.use('/auth', require('./auth')); - <% } %> - // All undefined asset or api routes should return a 404 - app.route('/:url(https://github.com/api|auth|components|app|bower_components|assets)/*') - .get(errors[404]); - - // All other routes should redirect to the index.html - app.route('/*') - .get(function(req, res) { - res.sendFile(path.resolve(app.get('appPath') + '/index.html')); - }); -}; diff --git a/app/templates/server/server.ino b/app/templates/server/server.ino new file mode 100644 index 000000000..060dce129 --- /dev/null +++ b/app/templates/server/server.ino @@ -0,0 +1,57 @@ +<% if( package === 'esp8266') { %>#include <% } else { %>#include +#include <% } %> +#include +<% if( package === 'esp8266') { %> +const char* ssid = "ssid"; +const char* password = "lolcat"; +<% } else { %> +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +<% } %> +<% if( package === 'esp8266') { %>WiFiServer server(80);<% } else { %>EthernetServer server(80);<% } %> + +WebApp app; + +void setup() { + Serial.begin(115200); + Serial.println("Connecting..."); + <% if( package === 'esp8266') { %> + WiFi.begin(ssid, password); + + while (WiFi.status() != WL_CONNECTED) { + delay(500); + Serial.print("."); + } + + Serial.println(); + Serial.println("WiFi connected"); + + // Print the IP address + Serial.println(WiFi.localIP()); + <% } else { %> + if (Ethernet.begin(mac)) { + Serial.println(Ethernet.localIP()); + } else{ + Serial.println("Ethernet failed"); + }<% } %> + // Start the server + server.begin(); + Serial.println("Server started"); + + // do not remove the comment below + // asset router + AssetRouter(app); + + // do not remove the comment below + // other routers + ThingRouter(app); +} + +void loop(){ + <% if( package === 'esp8266') { %>WiFiClient<% } else { %>EthernetClient<% } %> client = server.available(); + + if (client.available()){ + app.process(&client); + } + <% if( package === 'esp8266') { %> + delay(20);<% } %> +} diff --git a/app/templates/server/thing.controller.ino b/app/templates/server/thing.controller.ino new file mode 100644 index 000000000..1fb1ddeca --- /dev/null +++ b/app/templates/server/thing.controller.ino @@ -0,0 +1,16 @@ +void readThings(Request &req, Response &res) { + + // P macro for printing strings from program memory + P(things) = + "[" + " {\"name\":\"Multiple platforms\",\"info\":\"Compatible with the Arduino family of development boards.\"}," + " {\"name\":\"Development Tools\",\"info\":\"Integration with popular tools such as Bower, Grunt, Karma, Mocha, JSHint, Node Inspector, Livereload, Protractor, Jade, Stylus, Sass, CoffeeScript, and Less.\"}," + " {\"name\":\"Server and Client integration\",\"info\":\"Built with a powerful and fun stack: MongoDB, Express, AngularJS, and Node.\"}," + " {\"name\":\"Smart Build System\",\"info\":\"Build system ignores `spec` files, allowing you to keep tests alongside code. Automatic injection of scripts and styles into your index.html\"}," + " {\"name\":\"Modular Structure\",\"info\":\"Best practice client and server structures allow for more code reusability and maximum scalability\"}," + " {\"name\":\"Optimized Build\",\"info\":\"Build process packs up your templates as a single JavaScript payload, minifies your scripts/css/images, and rewrites asset names for caching.\"}" + "]"; + + res.success(); + res.printP(things); +} \ No newline at end of file diff --git a/app/templates/server/thing.router.ino b/app/templates/server/thing.router.ino new file mode 100644 index 000000000..dc7aacbb8 --- /dev/null +++ b/app/templates/server/thing.router.ino @@ -0,0 +1,7 @@ +Router thingRouter("/api/things"); + +void ThingRouter(WebApp &app) { + thingRouter.get("/", &readThings); + + app.use(&thingRouter); +} diff --git a/app/templates/server/views/404(html).html b/app/templates/server/views/404(html).html deleted file mode 100644 index ec98e3c26..000000000 --- a/app/templates/server/views/404(html).html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - Page Not Found :( - - - -
-

Not found :(

-

Sorry, but the page you were trying to view does not exist.

-

It looks like this was the result of either:

-
    -
  • a mistyped address
  • -
  • an out-of-date link
  • -
- - -
- - diff --git a/app/templates/server/views/404(jade).jade b/app/templates/server/views/404(jade).jade deleted file mode 100644 index b5735b4f6..000000000 --- a/app/templates/server/views/404(jade).jade +++ /dev/null @@ -1,133 +0,0 @@ -doctype html -html(lang='en') -head - meta(charset='utf-8') - title Page Not Found :( - style. - ::-moz-selection { - background: #b3d4fc; - text-shadow: none; - } - ::selection { - background: #b3d4fc; - text-shadow: none; - } - html { - padding: 30px 10px; - font-size: 20px; - line-height: 1.4; - color: #737373; - background: #f0f0f0; - -webkit-text-size-adjust: 100%; - -ms-text-size-adjust: 100%; - } - html, - input { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - } - body { - max-width: 500px; - _width: 500px; - padding: 30px 20px 50px; - border: 1px solid #b3b3b3; - border-radius: 4px; - margin: 0 auto; - box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff; - background: #fcfcfc; - } - h1 { - margin: 0 10px; - font-size: 50px; - text-align: center; - } - h1 span { - color: #bbb; - } - h3 { - margin: 1.5em 0 0.5em; - } - p { - margin: 1em 0; - } - ul { - padding: 0 0 0 40px; - margin: 1em 0; - } - .container { - max-width: 380px; - _width: 380px; - margin: 0 auto; - } - /* google search */ - #goog-fixurl ul { - list-style: none; - padding: 0; - margin: 0; - } - #goog-fixurl form { - margin: 0; - } - #goog-wm-qt, - #goog-wm-sb { - border: 1px solid #bbb; - font-size: 16px; - line-height: normal; - vertical-align: top; - color: #444; - border-radius: 2px; - } - #goog-wm-qt { - width: 220px; - height: 20px; - padding: 5px; - margin: 5px 10px 0 0; - box-shadow: inset 0 1px 1px #ccc; - } - #goog-wm-sb { - display: inline-block; - height: 32px; - padding: 0 10px; - margin: 5px 0 0; - white-space: nowrap; - cursor: pointer; - background-color: #f5f5f5; - background-image: -webkit-linear-gradient(rgba(255,255,255,0), #f1f1f1); - background-image: -moz-linear-gradient(rgba(255,255,255,0), #f1f1f1); - background-image: -ms-linear-gradient(rgba(255,255,255,0), #f1f1f1); - background-image: -o-linear-gradient(rgba(255,255,255,0), #f1f1f1); - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - *overflow: visible; - *display: inline; - *zoom: 1; - } - #goog-wm-sb:hover, - #goog-wm-sb:focus { - border-color: #aaa; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); - background-color: #f8f8f8; - } - #goog-wm-qt:hover, - #goog-wm-qt:focus { - border-color: #105cb6; - outline: 0; - color: #222; - } - input::-moz-focus-inner { - padding: 0; - border: 0; - } - body - .container - h1 - | Not found - span :( - p Sorry, but the page you were trying to view does not exist. - p It looks like this was the result of either: - ul - li a mistyped address - li an out-of-date link - script. - var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),GOOG_FIXURL_SITE = location.host; - script(src='https://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js') diff --git a/contributing.md b/contributing.md index b46bd1c63..c58adfb73 100644 --- a/contributing.md +++ b/contributing.md @@ -14,7 +14,7 @@ To run the generator: 1. Clone it and `cd` to its root 2. `npm install` 3. `npm link` (tells NPM to look to your own version) -4. `yo angular-fullstack` as normal. It should run from your cloned version rather than the one downloaded from NPM. +4. `yo angular-arduino` as normal. It should run from your cloned version rather than the one downloaded from NPM. ## Git Commit Guidelines diff --git a/endpoint/index.js b/endpoint/index.js index 2b3d7eb22..b2d394a7c 100644 --- a/endpoint/index.js +++ b/endpoint/index.js @@ -49,28 +49,15 @@ Generator.prototype.registerEndpoint = function registerEndpoint() { file: this.config.get('registerRoutesFile'), needle: this.config.get('routesNeedle'), splicable: [ - "app.use(\'" + this.route +"\', require(\'./api/" + this.name + "\'));" + this.classedName+"Router(app);" ] }; ngUtil.rewriteFile(routeConfig); } - - if (this.filters.socketio) { - if(this.config.get('insertSockets')) { - var socketConfig = { - file: this.config.get('registerSocketsFile'), - needle: this.config.get('socketsNeedle'), - splicable: [ - "require(\'../api/" + this.name + '/' + this.name + ".socket\').register(socket);" - ] - }; - ngUtil.rewriteFile(socketConfig); - } - } }; Generator.prototype.createFiles = function createFiles() { - var dest = this.config.get('endpointDirectory') || 'server/api/' + this.name; + var dest = this.config.get('endpointDirectory') || 'server'; this.sourceRoot(path.join(__dirname, './templates')); ngUtil.processDirectory(this, '.', dest); }; diff --git a/endpoint/templates/index.js b/endpoint/templates/index.js deleted file mode 100644 index 03fdc9779..000000000 --- a/endpoint/templates/index.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -var express = require('express'); -var controller = require('./<%= name %>.controller'); - -var router = express.Router(); - -router.get('/', controller.index);<% if(filters.mongoose) { %> -router.get('/:id', controller.show); -router.post('/', controller.create); -router.put('/:id', controller.update); -router.patch('/:id', controller.update); -router.delete('/:id', controller.destroy);<% } %> - -module.exports = router; \ No newline at end of file diff --git a/endpoint/templates/name.controller.ino b/endpoint/templates/name.controller.ino new file mode 100644 index 000000000..cae61b271 --- /dev/null +++ b/endpoint/templates/name.controller.ino @@ -0,0 +1,19 @@ +void create<%= classedName %>(Request &req, Response &res) { + res.noContent(); +} + +void read<%= classedName %>(Request &req, Response &res) { + res.noContent(); +} + +void update<%= classedName %>(Request &req, Response &res) { + res.noContent(); +} + +void delete<%= classedName %>(Request &req, Response &res) { + res.noContent(); +} + +void read<%= classedName %>s(Request &req, Response &res) { + res.noContent(); +} diff --git a/endpoint/templates/name.controller.js b/endpoint/templates/name.controller.js deleted file mode 100644 index 3d46b2ad4..000000000 --- a/endpoint/templates/name.controller.js +++ /dev/null @@ -1,60 +0,0 @@ -'use strict'; - -var _ = require('lodash');<% if (filters.mongoose) { %> -var <%= classedName %> = require('./<%= name %>.model');<% } %> - -// Get list of <%= name %>s -exports.index = function(req, res) {<% if (!filters.mongoose) { %> - res.json([]);<% } %><% if (filters.mongoose) { %> - <%= classedName %>.find(function (err, <%= name %>s) { - if(err) { return handleError(res, err); } - return res.status(200).json(<%= name %>s); - });<% } %> -};<% if (filters.mongoose) { %> - -// Get a single <%= name %> -exports.show = function(req, res) { - <%= classedName %>.findById(req.params.id, function (err, <%= name %>) { - if(err) { return handleError(res, err); } - if(!<%= name %>) { return res.status(404).send('Not Found'); } - return res.json(<%= name %>); - }); -}; - -// Creates a new <%= name %> in the DB. -exports.create = function(req, res) { - <%= classedName %>.create(req.body, function(err, <%= name %>) { - if(err) { return handleError(res, err); } - return res.status(201).json(<%= name %>); - }); -}; - -// Updates an existing <%= name %> in the DB. -exports.update = function(req, res) { - if(req.body._id) { delete req.body._id; } - <%= classedName %>.findById(req.params.id, function (err, <%= name %>) { - if (err) { return handleError(res, err); } - if(!<%= name %>) { return res.status(404).send('Not Found'); } - var updated = _.merge(<%= name %>, req.body); - updated.save(function (err) { - if (err) { return handleError(res, err); } - return res.status(200).json(<%= name %>); - }); - }); -}; - -// Deletes a <%= name %> from the DB. -exports.destroy = function(req, res) { - <%= classedName %>.findById(req.params.id, function (err, <%= name %>) { - if(err) { return handleError(res, err); } - if(!<%= name %>) { return res.status(404).send('Not Found'); } - <%= name %>.remove(function(err) { - if(err) { return handleError(res, err); } - return res.status(204).send('No Content'); - }); - }); -}; - -function handleError(res, err) { - return res.status(500).send(err); -}<% } %> \ No newline at end of file diff --git a/endpoint/templates/name.model(mongoose).js b/endpoint/templates/name.model(mongoose).js deleted file mode 100644 index 89e0dfaa7..000000000 --- a/endpoint/templates/name.model(mongoose).js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -var mongoose = require('mongoose'), - Schema = mongoose.Schema; - -var <%= classedName %>Schema = new Schema({ - name: String, - info: String, - active: Boolean -}); - -module.exports = mongoose.model('<%= classedName %>', <%= classedName %>Schema); \ No newline at end of file diff --git a/endpoint/templates/name.router.ino b/endpoint/templates/name.router.ino new file mode 100644 index 000000000..59510976b --- /dev/null +++ b/endpoint/templates/name.router.ino @@ -0,0 +1,11 @@ +Router <%= name %>Router("<%= route %>"); + +void <%= classedName %>Router(WebApp &app) { + <%= name %>Router.post("/", &create<%= classedName %>); + <%= name %>Router.get("/:id", &read<%= classedName %>); + <%= name %>Router.put("/:id", &update<%= classedName %>); + <%= name %>Router.del("/:id", &delete<%= classedName %>); + <%= name %>Router.get("/", &read<%= classedName %>s); + + app.use(&<%= name %>Router); +} diff --git a/endpoint/templates/name.socket(socketio).js b/endpoint/templates/name.socket(socketio).js deleted file mode 100644 index 886f585ee..000000000 --- a/endpoint/templates/name.socket(socketio).js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Broadcast updates to client when the model changes - */ - -'use strict'; - -var <%= classedName %> = require('./<%= name %>.model'); - -exports.register = function(socket) { - <%= classedName %>.schema.post('save', function (doc) { - onSave(socket, doc); - }); - <%= classedName %>.schema.post('remove', function (doc) { - onRemove(socket, doc); - }); -} - -function onSave(socket, doc, cb) { - socket.emit('<%= name %>:save', doc); -} - -function onRemove(socket, doc, cb) { - socket.emit('<%= name %>:remove', doc); -} \ No newline at end of file diff --git a/endpoint/templates/name.spec.js b/endpoint/templates/name.spec.js deleted file mode 100644 index fcad73ebd..000000000 --- a/endpoint/templates/name.spec.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -var should = require('should'); -var app = require('../../app'); -var request = require('supertest'); - -describe('GET <%= route %>', function() { - - it('should respond with JSON array', function(done) { - request(app) - .get('<%= route %>') - .expect(200) - .expect('Content-Type', /json/) - .end(function(err, res) { - if (err) return done(err); - res.body.should.be.instanceof(Array); - done(); - }); - }); -}); \ No newline at end of file diff --git a/generators/deploy/index.js b/generators/deploy/index.js deleted file mode 100644 index 6a3d5ec9c..000000000 --- a/generators/deploy/index.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; -var chalk = require('chalk'); -var yeoman = require('yeoman-generator'); -var util = require('util'); - -var Generator = module.exports = function Generator() { - yeoman.generators.Base.apply(this, arguments); -}; - -util.inherits(Generator, yeoman.generators.NamedBase); - -Generator.prototype.deprecated = function deprecated() { - this.log(chalk.yellow(chalk.bold('yo angular-fullstack:deploy') + ' is deprecated, instead use: \n') + - chalk.green('yo angular-fullstack:heroku') + ' or ' + chalk.green('yo angular-fullstack:openshift')); -}; \ No newline at end of file diff --git a/heroku/USAGE b/heroku/USAGE deleted file mode 100644 index 85c5450ce..000000000 --- a/heroku/USAGE +++ /dev/null @@ -1,8 +0,0 @@ -Description: - Initalizes a heroku app and generates a `dist` folder which is ready to push to heroku. - -Example: - yo angular-fullstack:heroku - - This will create: - a dist folder and initialize a heroku app diff --git a/heroku/index.js b/heroku/index.js deleted file mode 100644 index 3c34f37b0..000000000 --- a/heroku/index.js +++ /dev/null @@ -1,198 +0,0 @@ -'use strict'; -var util = require('util'); -var yeoman = require('yeoman-generator'); -var exec = require('child_process').exec; -var chalk = require('chalk'); -var path = require('path'); - -var Generator = module.exports = function Generator() { - yeoman.generators.Base.apply(this, arguments); - this.sourceRoot(path.join(__dirname, './templates')); - - try { - this.appname = require(path.join(process.cwd(), 'bower.json')).name; - } catch (e) { - this.appname = path.basename(process.cwd()); - } - this.appname = this._.slugify(this.appname); - this.filters = this.config.get('filters') || {}; -}; - -util.inherits(Generator, yeoman.generators.NamedBase); - -Generator.prototype.askForName = function askForName() { - var done = this.async(); - - var prompts = [{ - name: 'deployedName', - message: 'Name to deploy as (Leave blank for a random name):' - }]; - - this.prompt(prompts, function (props) { - this.deployedName = this._.slugify(props.deployedName); - done(); - }.bind(this)); -}; - -Generator.prototype.askForRegion = function askForRegion() { - var done = this.async(); - - var prompts = [{ - type: "list", - name: 'region', - message: 'On which region do you want to deploy ?', - choices: [ "US", "EU"], - default: 0 - }]; - - this.prompt(prompts, function (props) { - this.region = props.region.toLowerCase(); - done(); - }.bind(this)); -}; - -Generator.prototype.checkInstallation = function checkInstallation() { - if(this.abort) return; - var done = this.async(); - - exec('heroku --version', function (err) { - if (err) { - this.log.error('You don\'t have the Heroku Toolbelt installed. ' + - 'Grab it from https://toolbelt.heroku.com/'); - this.abort = true; - } - done(); - }.bind(this)); -}; - -Generator.prototype.gitInit = function gitInit() { - if(this.abort) return; - var done = this.async(); - - this.log(chalk.bold('\nInitializing deployment repo')); - this.mkdir('dist'); - var child = exec('git init', { cwd: 'dist' }, function (err, stdout, stderr) { - done(); - }.bind(this)); - child.stdout.on('data', function(data) { - console.log(data.toString()); - }); -}; - -Generator.prototype.herokuCreate = function herokuCreate() { - if(this.abort) return; - var done = this.async(); - var regionParams = (this.region !== 'us') ? ' --region ' + this.region : ''; - - this.log(chalk.bold('Creating heroku app and setting node environment')); - var child = exec('heroku apps:create ' + this.deployedName + regionParams + ' && heroku config:set NODE_ENV=production', { cwd: 'dist' }, function (err, stdout, stderr) { - if (err) { - this.abort = true; - this.log.error(err); - } else { - this.log('stdout: ' + stdout); - } - done(); - }.bind(this)); - - child.stdout.on('data', function(data) { - var output = data.toString(); - this.log(output); - }.bind(this)); -}; - -Generator.prototype.copyProcfile = function copyProcfile() { - if(this.abort) return; - var done = this.async(); - this.log(chalk.bold('Creating Procfile')); - this.copy('Procfile', 'dist/Procfile'); - this.conflicter.resolve(function (err) { - done(); - }); -}; - -Generator.prototype.gruntBuild = function gruntBuild() { - if(this.abort) return; - var done = this.async(); - - this.log(chalk.bold('\nBuilding dist folder, please wait...')); - var child = exec('grunt build', function (err, stdout) { - done(); - }.bind(this)); - child.stdout.on('data', function(data) { - this.log(data.toString()); - }.bind(this)); -}; - -Generator.prototype.gitCommit = function gitInit() { - if(this.abort) return; - var done = this.async(); - - this.log(chalk.bold('Adding files for initial commit')); - var child = exec('git add -A && git commit -m "Initial commit"', { cwd: 'dist' }, function (err, stdout, stderr) { - if (stdout.search('nothing to commit') >= 0) { - this.log('Re-pushing the existing "dist" build...'); - } else if (err) { - this.log.error(err); - } else { - this.log(chalk.green('Done, without errors.')); - } - done(); - }.bind(this)); - - child.stdout.on('data', function(data) { - this.log(data.toString()); - }.bind(this)); -}; - -Generator.prototype.gitForcePush = function gitForcePush() { - if(this.abort) return; - var done = this.async(); - - this.log(chalk.bold("\nUploading your initial application code.\n This may take "+chalk.cyan('several minutes')+" depending on your connection speed...")); - - var child = exec('git push -f heroku master', { cwd: 'dist' }, function (err, stdout, stderr) { - if (err) { - this.log.error(err); - } else { - var hasWarning = false; - - if(this.filters.mongoose) { - this.log(chalk.yellow('\nBecause you\'re using mongoose, you must add mongoDB to your heroku app.\n\t' + 'from `/dist`: ' + chalk.bold('heroku addons:add mongohq') + '\n')); - hasWarning = true; - } - - if(this.filters.facebookAuth) { - this.log(chalk.yellow('You will need to set environment variables for facebook auth. From `/dist`:\n\t' + - chalk.bold('heroku config:set FACEBOOK_ID=appId\n\t') + - chalk.bold('heroku config:set FACEBOOK_SECRET=secret\n'))); - hasWarning = true; - } - if(this.filters.googleAuth) { - this.log(chalk.yellow('You will need to set environment variables for google auth. From `/dist`:\n\t' + - chalk.bold('heroku config:set GOOGLE_ID=appId\n\t') + - chalk.bold('heroku config:set GOOGLE_SECRET=secret\n'))); - hasWarning = true; - } - if(this.filters.twitterAuth) { - this.log(chalk.yellow('You will need to set environment variables for twitter auth. From `/dist`:\n\t' + - chalk.bold('heroku config:set TWITTER_ID=appId\n\t') + - chalk.bold('heroku config:set TWITTER_SECRET=secret\n'))); - hasWarning = true; - } - - this.log(chalk.green('\nYour app should now be live. To view it run\n\t' + chalk.bold('cd dist && heroku open'))); - if(hasWarning) { - this.log(chalk.green('\nYou may need to address the issues mentioned above and restart the server for the app to work correctly.')); - } - - this.log(chalk.yellow('After app modification run\n\t' + chalk.bold('grunt build') + - '\nThen deploy with\n\t' + chalk.bold('grunt buildcontrol:heroku'))); - } - done(); - }.bind(this)); - - child.stdout.on('data', function(data) { - this.log(data.toString()); - }.bind(this)); -}; diff --git a/heroku/templates/Procfile b/heroku/templates/Procfile deleted file mode 100644 index 528737e6f..000000000 --- a/heroku/templates/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: node server/app.js diff --git a/openshift/USAGE b/openshift/USAGE deleted file mode 100644 index b3dd18759..000000000 --- a/openshift/USAGE +++ /dev/null @@ -1,8 +0,0 @@ -Description: - Initalizes an openshift app and generates a `dist` folder and pushes it to openshift. - -Example: - yo angular-fullstack:openshift - - This will create: - a dist folder and initialize an openshift app \ No newline at end of file diff --git a/openshift/index.js b/openshift/index.js deleted file mode 100644 index 518806b08..000000000 --- a/openshift/index.js +++ /dev/null @@ -1,299 +0,0 @@ -'use strict'; -var util = require('util'); -var yeoman = require('yeoman-generator'); -var childProcess = require('child_process'); -var chalk = require('chalk'); -var path = require('path'); -var exec = childProcess.exec; -var spawn = childProcess.spawn; - -var Generator = module.exports = function Generator() { - yeoman.generators.Base.apply(this, arguments); - this.sourceRoot(path.join(__dirname, './templates')); - - try { - this.appname = require(path.join(process.cwd(), 'bower.json')).name; - } catch (e) { - this.appname = path.basename(process.cwd()); - } - this.appname = this._.slugify(this.appname).split('-').join(''); - this.filters = this.config.get('filters') || {}; -}; - -util.inherits(Generator, yeoman.generators.NamedBase); - -Generator.prototype.askForName = function askForName() { - var done = this.async(); - - var prompts = [{ - name: 'deployedName', - message: 'Name to deploy as:', - default: this.appname - }]; - - this.prompt(prompts, function (props) { - this.deployedName = this._.slugify(props.deployedName).split('-').join(''); - done(); - }.bind(this)); -}; - -Generator.prototype.checkInstallation = function checkInstallation() { - if(this.abort) return; - var done = this.async(); - - exec('rhc --version', function (err) { - if (err) { - this.log.error('OpenShift\'s rhc command line interface is not available. ' + - 'You can install it via RubyGems with: gem install rhc'); - this.abort = true; - } - done(); - }.bind(this)); -}; - -Generator.prototype.gitInit = function gitInit() { - if(this.abort) return; - var done = this.async(); - - this.log(chalk.bold('Initializing deployment repo')); - this.mkdir('dist'); - exec('git init', { cwd: 'dist' }, function (err, stdout, stderr) { - this.log(stdout); - done(); - }.bind(this)); -}; - -Generator.prototype.gitRemoteCheck = function gitRemoteCheck() { - this.openshift_remote_exists = false; - if(this.abort || typeof this.dist_repo_url !== 'undefined') return; - var done = this.async(); - - this.log(chalk.bold("\nChecking for an existing git remote named '"+'openshift'+"'...")); - exec('git remote -v', { cwd: 'dist' }, function (err, stdout, stderr) { - var lines = stdout.split('\n'); - var dist_repo = ''; - if (err && stderr.search('DL is deprecated') === -1) { - this.log.error(err); - } else { - var repo_url_finder = new RegExp('openshift'+"[ ]*"); - lines.forEach(function(line) { - if(line.search(repo_url_finder) === 0 && dist_repo === '') { - var dist_repo_detailed = line.slice(line.match(repo_url_finder)[0].length); - dist_repo = dist_repo_detailed.slice(0, dist_repo_detailed.length - 7); - }}); - if (dist_repo !== ''){ - console.log("Found an existing git remote for this app: "+dist_repo); - this.dist_repo_url = dist_repo; - this.openshift_remote_exists = true; - } else { - console.log('No existing remote found.'); - } - } - done(); - }.bind(this)); -}; - -Generator.prototype.rhcAppShow = function rhcAppShow() { - if(this.abort || typeof this.dist_repo_url !== 'undefined') return; - var done = this.async(); - - this.log(chalk.bold("\nChecking for an existing OpenShift hosting environment...")); - var child = exec('rhc app show '+this.deployedName+' --noprompt', { cwd: 'dist' }, function (err, stdout, stderr) { - var lines = stdout.split('\n'); - var dist_repo = ''; - // Unauthenticated - if (stdout.search('Not authenticated') >= 0 || stdout.search('Invalid characters found in login') >= 0) { - this.log.error('Error: Not authenticated. Run "rhc setup" to login to your OpenShift account and try again.'); - this.abort = true; - } - // No remote found - else if (stdout.search('not found.') < 0) { - console.log('No existing app found.'); - } - // Error - else if (err && stderr.search('DL is deprecated') === -1) { - this.log.error(err); - } - // Remote found - else { - this.log(stdout); - var repo_url_finder = / *Git URL: */; - lines.forEach(function(line) { - if(line.search(repo_url_finder) === 0) { - dist_repo = line.slice(line.match(repo_url_finder)[0].length); - console.log("Found an existing git remote for this app: "+dist_repo); - }}); - if (dist_repo !== '') this.dist_repo_url = dist_repo; - } - done(); - }.bind(this)); -}; - -Generator.prototype.rhcAppCreate = function rhcAppCreate() { - if(this.abort || typeof this.dist_repo_url !== 'undefined') return; - var done = this.async(); - - this.log(chalk.bold("\nCreating your OpenShift hosting environment, this may take a couple minutes...")); - var child = exec('rhc app create '+this.deployedName+' nodejs-0.10 mongodb-2.4 -s --noprompt --no-git NODE_ENV=production', { cwd: 'dist' }, function (err, stdout, stderr) { - var lines = stdout.split('\n'); - this.log(stdout); - if (stdout.search('Not authenticated') >= 0 || stdout.search('Invalid characters found in login') >= 0) { - this.log.error('Error: Not authenticated. Run "rhc setup" to login to your OpenShift account and try again.'); - this.abort = true; - } else if (err && stderr.search('DL is deprecated') === -1) { - this.log.error(err); - } else { - var dist_repo = ''; - var repo_url_finder = / *Git remote: */; - lines.forEach(function(line) { - if(line.search(repo_url_finder) === 0) { - dist_repo = line.slice(line.match(repo_url_finder)[0].length); - }}); - - if (dist_repo !== '') this.dist_repo_url = dist_repo; - if(this.dist_repo_url !== undefined) { - this.log("New remote git repo at: "+this.dist_repo_url); - } - } - done(); - }.bind(this)); - - child.stdout.on('data', function(data) { - this.log(data.toString()); - }.bind(this)); -}; - -Generator.prototype.gitRemoteAdd = function gitRemoteAdd() { - if(this.abort || typeof this.dist_repo_url === 'undefined' || this.openshift_remote_exists) return; - var done = this.async(); - this.log(chalk.bold("\nAdding remote repo url: "+this.dist_repo_url)); - - var child = exec('git remote add '+'openshift'+' '+this.dist_repo_url, { cwd: 'dist' }, function (err, stdout, stderr) { - if (err) { - this.log.error(err); - } else { - this.openshift_remote_exists = true; - } - done(); - }.bind(this)); - - child.stdout.on('data', function(data) { - this.log(data.toString()); - }.bind(this)); -}; - -Generator.prototype.enableOpenShiftHotDeploy = function enableOpenshiftHotDeploy() { - if(this.abort || !this.openshift_remote_exists ) return; - var done = this.async(); - this.log(chalk.bold("\nEnabling HotDeploy for OpenShift")); - this.copy('hot_deploy', 'dist/.openshift/markers/hot_deploy'); - this.conflicter.resolve(function (err) { - done(); - }); -}; - -Generator.prototype.gruntBuild = function gruntBuild() { - if(this.abort || !this.openshift_remote_exists ) return; - var done = this.async(); - - this.log(chalk.bold('\nBuilding dist folder, please wait...')); - var child = exec('grunt build', function (err, stdout) { - if (err) { - this.log.error(err); - } - done(); - }.bind(this)); - - child.stdout.on('data', function(data) { - this.log(data.toString()); - }.bind(this)); -}; - -Generator.prototype.gitCommit = function gitInit() { - if(this.abort || !this.openshift_remote_exists ) return; - var done = this.async(); - - this.log(chalk.bold('\nAdding files for initial commit')); - var child = exec('git add -A && git commit -m "Initial commit"', { cwd: 'dist' }, function (err, stdout, stderr) { - if (stdout.search('nothing to commit') >= 0) { - this.log('Re-pushing the existing "dist" build...'); - } else if (err) { - this.log.error(err); - } else { - this.log(chalk.green('Done, without errors.')); - } - done(); - }.bind(this)); - - child.stdout.on('data', function(data) { - this.log(data.toString()); - }.bind(this)); -}; - -Generator.prototype.gitForcePush = function gitForcePush() { - if (this.abort || !this.openshift_remote_exists) return; - var done = this.async(); - this.log(chalk.bold("\nUploading your initial application code.\n This may take " + chalk.cyan('several minutes') + " depending on your connection speed...")); - - var push = spawn('git', ['push', '-f', 'openshift', 'master'], {cwd: 'dist'}); - var error = null; - - push.stderr.on('data', function (data) { - var output = data.toString(); - this.log.error(output); - }.bind(this)); - - push.stdout.on('data', function (data) { - var output = data.toString(); - this.log.stdin(output); - }.bind(this)); - - push.on('exit', function (code) { - if (code !== 0) { - this.abort = true; - return done(); - } - done(); - }.bind(this)); -}; - -Generator.prototype.restartApp = function restartApp() { - if(this.abort || !this.openshift_remote_exists ) return; - this.log(chalk.bold("\nRestarting your openshift app.\n")); - - var child = exec('rhc app restart -a ' + this.deployedName, function(err, stdout, stderr) { - - var host_url = ''; - var hasWarning = false; - var before_hostname = this.dist_repo_url.indexOf('@') + 1; - var after_hostname = this.dist_repo_url.length - ( 'openshift'.length + 12 ); - host_url = 'http://' + this.dist_repo_url.slice(before_hostname, after_hostname) + 'com'; - - if(this.filters.facebookAuth) { - this.log(chalk.yellow('You will need to set environment variables for facebook auth:\n\t' + - chalk.bold('rhc set-env FACEBOOK_ID=id -a ' + this.deployedName + '\n\t') + - chalk.bold('rhc set-env FACEBOOK_SECRET=secret -a ' + this.deployedName + '\n'))); - hasWarning = true; - } - if(this.filters.googleAuth) { - this.log(chalk.yellow('You will need to set environment variables for google auth:\n\t' + - chalk.bold('rhc set-env GOOGLE_ID=id -a ' + this.deployedName + '\n\t') + - chalk.bold('rhc set-env GOOGLE_SECRET=secret -a ' + this.deployedName + '\n'))); - hasWarning = true; - } - if(this.filters.twitterAuth) { - this.log(chalk.yellow('You will need to set environment variables for twitter auth:\n\t' + - chalk.bold('rhc set-env TWITTER_ID=id -a ' + this.deployedName + '\n\t') + - chalk.bold('rhc set-env TWITTER_SECRET=secret -a ' + this.deployedName + '\n'))); - hasWarning = true; - } - - this.log(chalk.green('\nYour app should now be live at \n\t' + chalk.bold(host_url))); - if(hasWarning) { - this.log(chalk.green('\nYou may need to address the issues mentioned above and restart the server for the app to work correctly \n\t' + - 'rhc app-restart -a ' + this.deployedName)); - } - this.log(chalk.yellow('After app modification run\n\t' + chalk.bold('grunt build') + - '\nThen deploy with\n\t' + chalk.bold('grunt buildcontrol:openshift'))); - }.bind(this)); -}; diff --git a/openshift/templates/hot_deploy b/openshift/templates/hot_deploy deleted file mode 100644 index e69de29bb..000000000 diff --git a/package.json b/package.json index 23d469194..0fad1f80c 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,11 @@ { - "name": "generator-angular-fullstack", - "version": "2.1.0", - "description": "Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node", + "name": "generator-angular-arduino", + "version": "0.1.4", + "description": "> Yeoman generator for creating AngularJS web applications with Arduino", "keywords": [ "yeoman-generator", - "mean", - "mongodb", "angularjs", - "express", + "arduino", "scaffold", "fullstack", "framework", @@ -15,21 +13,22 @@ "front-end", "app" ], - "homepage": "https://github.com/DaftMonk/generator-angular-fullstack", - "bugs": "https://github.com/DaftMonk/generator-angular-fullstack/issues", - "author": "Tyler Henkel", + "homepage": "https://github.com/lasselukkari/generator-angular-arduino", + "bugs": "https://github.com/lasselukkari/generator-angular-arduino/issues", + "author": "Lasse Lukkari", "repository": { "type": "git", - "url": "git://github.com/DaftMonk/generator-angular-fullstack.git" + "url": "git://github.com/lasselukkari/generator-angular-arduino.git" }, "scripts": { "test": "grunt test" }, "dependencies": { - "yeoman-generator": "~0.17.0", "chalk": "~0.4.0", + "generator-ng-component": "~0.0.4", + "serialport": "~1.7.4", "wiredep": "~0.4.2", - "generator-ng-component": "~0.0.4" + "yeoman-generator": "~0.17.0" }, "peerDependencies": { "yo": ">=1.2.0" diff --git a/readme.md b/readme.md index 21f73197a..28a14de05 100644 --- a/readme.md +++ b/readme.md @@ -1,19 +1,23 @@ -# AngularJS Full-Stack generator -[![Build Status](https://travis-ci.org/DaftMonk/generator-angular-fullstack.svg?branch=master)](http://travis-ci.org/DaftMonk/generator-angular-fullstack) [![npm version](https://badge.fury.io/js/generator-angular-fullstack.svg)](http://badge.fury.io/js/generator-angular-fullstack) ![](https://david-dm.org/daftmonk/generator-angular-fullstack.png) [![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/DaftMonk/generator-angular-fullstack) +# AngularJS Arduino generator -> Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node - lets you quickly set up a project following best practices. +> Yeoman generator for creating AngularJS web applications with Arduino - lets you quickly set up a project and upload it to your Arduino. -## Example project +Forked from [AngularJS Full-Stack generator](https://github.com/DaftMonk/generator-angular-fullstack) -Generated with defaults: http://fullstack-demo.herokuapp.com/. +## Example project -Source code: https://github.com/DaftMonk/fullstack-demo +Source code: https://github.com/lasselukkari/angular-arduino-demo ## Usage -Install `generator-angular-fullstack`: +First, you'll need to install `yo` and other required tools: +``` +npm install -g yo bower grunt-cli +``` + +Install `generator-angular-arduino`: ``` -npm install -g generator-angular-fullstack +npm install -g generator-angular-arduino ``` Make a new directory, and `cd` into it: @@ -21,16 +25,21 @@ Make a new directory, and `cd` into it: mkdir my-new-project && cd $_ ``` -Run `yo angular-fullstack`, optionally passing an app name: +Run `yo angular-arduino`, optionally passing an app name: ``` -yo angular-fullstack [app-name] +yo angular-arduino [app-name] ``` -Run `grunt` for building, `grunt serve` for preview, and `grunt serve:dist` for a preview of the built app. +Run `grunt` for building + uploading, `grunt serve` for ui preview. + +To build the project run `grunt build`. The built project in dist/server is compatible with the Arduino IDE. + +See generated grunt file for more available tasks. ## Prerequisites -* MongoDB - Download and Install [MongoDB](http://www.mongodb.org/downloads) - If you plan on scaffolding your project with mongoose, you'll need mongoDB to be installed and have the `mongod` process running. +* Arduino IDE 1.6.5 or later +* [aWOT](https://github.com/lasselukkari/aWOT) - Download [aWOT](https://github.com/lasselukkari/aWOT) either to your Arduino libraries folder or copy the .h and .cpp files to the server directory. ## Supported Configurations @@ -43,10 +52,13 @@ Run `grunt` for building, `grunt serve` for preview, and `grunt serve:dist` for **Server** -* Database: `None`, `MongoDB` -* Authentication boilerplate: `Yes`, `No` -* oAuth integrations: `Facebook` `Twitter` `Google` -* Socket.io integration: `Yes`, `No` +* Platform presets: `Uno`, `Mega`, `Due`, `Teensy3`, `ESP8266` + +Custom platform options can be set manually. + +Arduino Uno is barely usable. On Uno the example project consumes almost all available memory resources. Remove Serial lib to free some space. + +To enable the ESP8266 refer to [github.com/esp8266/Arduino](https://github.com/esp8266/Arduino) ## Injection @@ -65,28 +77,25 @@ A grunt task looks for new files in your `client/app` and `client/components` fo Available generators: * App - - [angular-fullstack](#app) (aka [angular-fullstack:app](#app)) + - [angular-arduino](#app) (aka [angular-arduino:app](#app)) * Server Side - - [angular-fullstack:endpoint](#endpoint) + - [angular-arduino:endpoint](#endpoint) * Client Side - - [angular-fullstack:route](#route) - - [angular-fullstack:controller](#controller) - - [angular-fullstack:filter](#filter) - - [angular-fullstack:directive](#directive) - - [angular-fullstack:service](#service) - - [angular-fullstack:provider](#service) - - [angular-fullstack:factory](#service) - - [angular-fullstack:decorator](#decorator) -* Deployment - - [angular-fullstack:openshift](#openshift) - - [angular-fullstack:heroku](#heroku) + - [angular-arduino:route](#route) + - [angular-arduino:controller](#controller) + - [angular-arduino:filter](#filter) + - [angular-arduino:directive](#directive) + - [angular-arduino:service](#service) + - [angular-arduino:provider](#service) + - [angular-arduino:factory](#service) + - [angular-arduino:decorator](#decorator) ### App -Sets up a new AngularJS + Express app, generating all the boilerplate you need to get started. +Sets up a new AngularJS + aWOT app, generating all the boilerplate you need to get started. Example: ```bash -yo angular-fullstack +yo angular-arduino ``` ### Endpoint @@ -95,24 +104,21 @@ Generates a new API endpoint. Example: ```bash -yo angular-fullstack:endpoint message +yo angular-arduino:endpoint message [?] What will the url of your endpoint be? /api/messages ``` Produces: - server/api/message/index.js - server/api/message/message.spec.js - server/api/message/message.controller.js - server/api/message/message.model.js (optional) - server/api/message/message.socket.js (optional) + server/message.router.js + server/message.controller.js ### Route Generates a new route. Example: ```bash -yo angular-fullstack:route myroute +yo angular-arduino:route myroute [?] Where would you like to create this route? client/app/ [?] What will the url of your route be? /myroute ``` @@ -131,7 +137,7 @@ Generates a controller. Example: ```bash -yo angular-fullstack:controller user +yo angular-arduino:controller user [?] Where would you like to create this controller? client/app/ ``` @@ -145,7 +151,7 @@ Generates a directive. Example: ```bash -yo angular-fullstack:directive myDirective +yo angular-arduino:directive myDirective [?] Where would you like to create this directive? client/app/ [?] Does this directive need an external html file? Yes ``` @@ -161,7 +167,7 @@ Produces: Example: ```bash -yo angular-fullstack:directive simple +yo angular-arduino:directive simple [?] Where would you like to create this directive? client/app/ [?] Does this directive need an external html file? No ``` @@ -176,7 +182,7 @@ Generates a filter. Example: ```bash -yo angular-fullstack:filter myFilter +yo angular-arduino:filter myFilter [?] Where would you like to create this filter? client/app/ ``` @@ -190,7 +196,7 @@ Generates an AngularJS service. Example: ```bash -yo angular-fullstack:service myService +yo angular-arduino:service myService [?] Where would you like to create this service? client/app/ ``` @@ -200,14 +206,14 @@ Produces: client/app/myService/myService.service.spec.js -You can also do `yo angular-fullstack:factory` and `yo angular-fullstack:provider` for other types of services. +You can also do `yo angular-arduino:factory` and `yo angular-arduino:provider` for other types of services. ### Decorator Generates an AngularJS service decorator. Example: ```bash -yo angular-fullstack:decorator serviceName +yo angular-arduino:decorator serviceName [?] Where would you like to create this decorator? client/app/ ``` @@ -215,109 +221,27 @@ Produces client/app/serviceName/serviceName.decorator.js -###Openshift - -Deploying to OpenShift can be done in just a few steps: - - yo angular-fullstack:openshift - -A live application URL will be available in the output. - -> **oAuth** -> -> If you're using any oAuth strategies, you must set environment variables for your selected oAuth. For example, if we're using Facebook oAuth we would do this : -> -> rhc set-env FACEBOOK_ID=id -a my-openshift-app -> rhc set-env FACEBOOK_SECRET=secret -a my-openshift-app -> -> You will also need to set `DOMAIN` environment variable: -> -> rhc set-env DOMAIN=.rhcloud.com -> -> # or (if you're using it): -> -> rhc set-env DOMAIN= -> -> After you've set the required environment variables, restart the server: -> -> rhc app-restart -a my-openshift-app - -To make your deployment process easier consider using [grunt-build-control](https://github.com/robwierzbowski/grunt-build-control). - -**Pushing Updates** - - grunt - -Commit and push the resulting build, located in your dist folder: - - grunt buildcontrol:openshift - -### Heroku - -Deploying to heroku only takes a few steps. - - yo angular-fullstack:heroku - -To work with your new heroku app using the command line, you will need to run any `heroku` commands from the `dist` folder. - - -If you're using mongoDB you will need to add a database to your app: - - heroku addons:add mongolab - -Your app should now be live. To view it run `heroku open`. - -> -> If you're using any oAuth strategies, you must set environment variables for your selected oAuth. For example, if we're using **Facebook** oAuth we would do this : -> -> heroku config:set FACEBOOK_ID=id -> heroku config:set FACEBOOK_SECRET=secret -> -> You will also need to set `DOMAIN` environment variable: -> -> heroku config:set DOMAIN=.herokuapp.com -> -> # or (if you're using it): -> -> heroku config:set DOMAIN= -> - -To make your deployment process easier consider using [grunt-build-control](https://github.com/robwierzbowski/grunt-build-control). - -#### Pushing Updates - - grunt - -Commit and push the resulting build, located in your dist folder: - - grunt buildcontrol:heroku - - ## Bower Components The following packages are always installed by the [app](#app) generator: * angular -* angular-cookies * angular-mocks * angular-resource * angular-sanitize * angular-scenario -* es5-shim -* font-awesome -* json3 * jquery -* lodash These packages are installed optionally depending on your configuration: * angular-route * angular-ui-router -* angular-socket-io * angular-bootstrap * bootstrap -All of these can be updated with `bower update` as new versions are released. +In index.html all dependencies are linked from CDN. Bower components are installed locally as a dev dependencies for running tests. + +You can install bower components as normal dependencies but this will consume lots of valuable software memory. ## Configuration Yeoman generated projects can be further tweaked according to your needs by modifying project files appropriately. @@ -326,23 +250,7 @@ A `.yo-rc` file is generated for helping you copy configuration across projects, ## Testing -Running `grunt test` will run the client and server unit tests with karma and mocha. - -Use `grunt test:server` to only run server tests. - -Use `grunt test:client` to only run client tests. - -**Protractor tests** - -To setup protractor e2e tests, you must first run - -`npm run update-webdriver` - -Use `grunt test:e2e` to have protractor go through tests located in the `e2e` folder. - -## Environment Variables - -Keeping your app secrets and other sensitive information in source control isn't a good idea. To have grunt launch your app with specific environment variables, add them to the git ignored environment config file: `server/config/local.env.js`. +Running `grunt test` will run the client tests with karma and mocha. ## Project Structure @@ -351,18 +259,10 @@ Overview ├── client │   ├── app - All of our app specific components go in here │   ├── assets - Custom assets: fonts, images, etc… - │   ├── components - Our reusable components, non-specific to to our app - │ - ├── e2e - Our protractor end to end tests + │   └── components - Our reusable components, non-specific to to our app │ └── server - ├── api - Our apps server api - ├── auth - For handling authentication with different auth strategies - ├── components - Our reusable or app-wide components - ├── config - Where we do the bulk of our apps configuration - │ └── local.env.js - Keep our environment variables out of source control - │   └── environment - Configuration specific to the node environment - └── views - Server rendered views + └── server.ino - Our main server Arduino sketch An example client component in `client/app` @@ -373,22 +273,14 @@ An example client component in `client/app` ├── main.html - View └── main.less - Styles -An example server component in `server/api` +An example server component in `server` - thing - ├── index.js - Routes - ├── thing.controller.js - Controller for our `thing` endpoint - ├── thing.model.js - Database model - ├── thing.socket.js - Register socket events - └── thing.spec.js - Test + ├── thing.route.ino - Routes + └── thing.controller.ino - Controller for our `thing` endpoint ## Contribute -See the [contributing docs](https://github.com/DaftMonk/generator-angular-fullstack/blob/master/contributing.md) - -This project has 2 main branches: `master` and `canary`. The `master` branch is where the current stable code lives and should be used for production setups. The `canary` branch is the main development branch, this is where PRs should be submitted to (backport fixes may be applied to `master`). - -By seperating the current stable code from the cutting-edge development we hope to provide a stable and efficient workflow for users and developers alike. +See the [contributing docs](https://github.com/lasselukkari/generator-angular-arduino/blob/master/contributing.md) When submitting an issue, please follow the [guidelines](https://github.com/yeoman/yeoman/blob/master/contributing.md#issue-submission). Especially important is to make sure Yeoman is up-to-date, and providing the command or commands that cause the issue. diff --git a/test/fixtures/.yo-rc.json b/test/fixtures/.yo-rc.json index b4b338ac4..eebf894d4 100644 --- a/test/fixtures/.yo-rc.json +++ b/test/fixtures/.yo-rc.json @@ -1,5 +1,5 @@ { - "generator-angular-fullstack": { + "generator-angular-arduino": { "insertRoutes": "true", "registerRoutesFile": "server/routes.js", "routesNeedle": "// Insert routes below", diff --git a/test/fixtures/bower.json b/test/fixtures/bower.json index 10dff6513..875e30bdc 100644 --- a/test/fixtures/bower.json +++ b/test/fixtures/bower.json @@ -1,24 +1,18 @@ { "name": "tempApp", "version": "0.0.0", - "dependencies": { - "angular": ">=1.2.*", - "json3": "~3.3.1", - "es5-shim": "~3.0.1", - "bootstrap-sass-official": "~3.1.1", - "bootstrap": "~3.1.1", - "angular-resource": ">=1.2.*", - "angular-cookies": ">=1.2.*", - "angular-sanitize": ">=1.2.*", - "angular-route": ">=1.2.*", - "angular-bootstrap": "~0.11.0", - "font-awesome": ">=4.1.0", - "lodash": "~2.4.1", - "angular-socket-io": "~0.6.0", - "angular-ui-router": "~0.2.10" - }, "devDependencies": { - "angular-mocks": ">=1.2.*", - "angular-scenario": ">=1.2.*" + "angular": "1.4.2", + "bootstrap-sass-official": "3.3.5", + "bootstrap": "3.3.5", + "angular-resource": "1.4.2", + "angular-cookies": "1.4.2", + "angular-sanitize": "1.4.2", + "angular-route": "1.4.2", + "angular-bootstrap": "0.13.0", + "lodash": "3.10.0", + "angular-ui-router": "0.2.15", + "angular-mocks": "1.4.2", + "angular-scenario": "1.4.2" } } diff --git a/test/fixtures/package.json b/test/fixtures/package.json index c110f7838..ade4c846c 100644 --- a/test/fixtures/package.json +++ b/test/fixtures/package.json @@ -1,41 +1,18 @@ { "name": "tempApp", "version": "0.0.0", - "main": "server/app.js", - "dependencies": { - "express": "~4.9.0", - "morgan": "~1.0.0", - "body-parser": "~1.5.0", - "method-override": "~1.0.0", - "serve-favicon": "~2.0.1", - "cookie-parser": "~1.0.1", - "express-session": "~1.0.2", - "errorhandler": "~1.0.0", - "compression": "~1.0.1", - "lodash": "~2.4.1", - "jade": "~1.2.0", - "ejs": "~0.8.4", - "mongoose": "~3.8.8", - "jsonwebtoken": "^0.3.0", - "express-jwt": "^0.1.3", - "passport": "~0.2.0", - "passport-local": "~0.1.6", - "passport-facebook": "latest", - "passport-twitter": "latest", - "passport-google-oauth": "latest", - "composable-middleware": "^0.3.0", - "connect-mongo": "^0.4.1", - "socket.io": "^1.0.6", - "socket.io-client": "^1.0.6", - "socketio-jwt": "^2.0.2" - }, + "dependencies": {}, "devDependencies": { + "connect-livereload": "~0.5.3", "grunt": "~0.4.4", + "grunt-arduino": "~0.1.0", "grunt-autoprefixer": "~0.7.2", + "grunt-awot": "~0.1.0", "grunt-wiredep": "~1.8.0", "grunt-concurrent": "~0.5.0", "grunt-contrib-clean": "~0.5.0", "grunt-contrib-concat": "~0.4.0", + "grunt-contrib-connect": "~0.10.1", "grunt-contrib-copy": "~0.5.0", "grunt-contrib-cssmin": "~0.9.0", "grunt-contrib-htmlmin": "~0.2.0", @@ -48,31 +25,20 @@ "grunt-contrib-less": "^0.11.0", "karma-babel-preprocessor": "^5.2.1", "grunt-babel": "~5.0.0", - "grunt-google-cdn": "~0.4.0", "grunt-newer": "~0.7.0", "grunt-ng-annotate": "^0.2.3", - "grunt-rev": "~0.1.0", "grunt-svgmin": "~0.4.0", "grunt-usemin": "~2.1.1", - "grunt-env": "~0.4.1", - "grunt-node-inspector": "~0.1.5", - "grunt-nodemon": "~0.2.0", "grunt-angular-templates": "^0.5.4", "grunt-dom-munger": "^3.4.0", - "grunt-protractor-runner": "^1.1.0", "grunt-injector": "~0.5.4", "grunt-karma": "~0.8.2", - "grunt-build-control": "DaftMonk/grunt-build-control", "grunt-mocha-test": "~0.10.2", "grunt-contrib-sass": "^0.7.3", "grunt-contrib-stylus": "latest", "jit-grunt": "^0.5.0", "time-grunt": "~0.3.1", - "grunt-express-server": "~0.4.17", - "grunt-open": "~0.2.3", - "open": "~0.0.4", "jshint-stylish": "~0.1.5", - "connect-livereload": "~0.4.0", "karma-ng-scenario": "~0.1.0", "karma-firefox-launcher": "~0.1.3", "karma-script-launcher": "~0.1.0", @@ -87,16 +53,13 @@ "karma-phantomjs-launcher": "~0.1.4", "karma": "~0.12.9", "karma-ng-html2js-preprocessor": "~0.1.0", - "supertest": "~0.11.0", "should": "~3.3.1" }, "engines": { "node": ">=0.10.0" }, "scripts": { - "start": "node server/app.js", - "test": "grunt test", - "update-webdriver": "node node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager update" - }, + "test": "grunt test" + }, "private": true } diff --git a/test/test-file-creation.js b/test/test-file-creation.js index 594dab05a..63fbb9f54 100644 --- a/test/test-file-creation.js +++ b/test/test-file-creation.js @@ -7,7 +7,7 @@ var expect = chai.expect; var fs = require('fs-extra'); var exec = require('child_process').exec; -describe('angular-fullstack generator', function () { +describe('angular-arduino generator', function () { var gen, defaultOptions = { script: 'js', markup: 'html', @@ -15,17 +15,17 @@ describe('angular-fullstack generator', function () { router: 'uirouter', bootstrap: true, uibootstrap: true, - mongoose: true, - auth: true, - oauth: [], - socketio: true + package: 'esp8266', + arch: 'esp8266', + board: 'esp8266', + serialPort: 'MOCK_PORT' }, dependenciesInstalled = false; function generatorTest(generatorType, name, mockPrompt, callback) { gen.run({}, function () { var afGenerator; var deps = [path.join('../..', generatorType)]; - afGenerator = helpers.createGenerator('angular-fullstack:' + generatorType, deps, [name]); + afGenerator = helpers.createGenerator('angular-arduino:' + generatorType, deps, [name]); helpers.mockPrompt(afGenerator, mockPrompt); afGenerator.run([], function () { @@ -49,7 +49,7 @@ describe('angular-fullstack generator', function () { return done(err); } - gen = helpers.createGenerator('angular-fullstack:app', deps); + gen = helpers.createGenerator('angular-arduino:app', deps); gen.options['skip-install'] = true; done(); }.bind(this)); @@ -69,10 +69,10 @@ describe('angular-fullstack generator', function () { helpers.mockPrompt(gen, defaultOptions); }); - it('should run client tests successfully', function(done) { + it('should run tests successfully', function(done) { this.timeout(60000); gen.run({}, function () { - exec('grunt test:client', function (error, stdout, stderr) { + exec('grunt test', function (error, stdout, stderr) { expect(stdout, 'Client tests failed \n' + stdout ).to.contain('Executed 1 of 1 SUCCESS'); done(); }); @@ -89,30 +89,10 @@ describe('angular-fullstack generator', function () { }); }); - it('should run server tests successfully', function(done) { - this.timeout(60000); - gen.run({}, function () { - exec('grunt test:server', function (error, stdout, stderr) { - expect(stdout, 'Server tests failed (do you have mongoDB running?) \n' + stdout).to.contain('Done, without errors.'); - done(); - }); - }); - }); - - it('should run server tests successfully with generated endpoint', function(done) { - this.timeout(60000); - generatorTest('endpoint', 'foo', {}, function() { - exec('grunt test:server', function (error, stdout, stderr) { - expect(stdout, 'Server tests failed (do you have mongoDB running?) \n' + stdout).to.contain('Done, without errors.'); - done(); - }); - }); - }); - it('should use existing config if available', function(done) { this.timeout(60000); fs.copySync(__dirname + '/fixtures/.yo-rc.json', __dirname + '/temp/.yo-rc.json'); - var gen = helpers.createGenerator('angular-fullstack:app', [ + var gen = helpers.createGenerator('angular-arduino:app', [ '../../app', [ helpers.createDummyGenerator(), @@ -131,18 +111,6 @@ describe('angular-fullstack generator', function () { done(); }); }); - -// it('should run e2e tests successfully', function(done) { -// this.timeout(80000); -// gen.run({}, function () { -// exec('npm run update-webdriver', function (error, stdout, stderr) { -// exec('grunt test:e2e', function (error, stdout, stderr) { -// expect(stdout, 'Client tests failed \n' + stdout ).to.contain('Done, without errors.'); -// done(); -// }); -// }); -// }) -// }); }); describe('with Babel ES6 preprocessor', function() { @@ -156,10 +124,10 @@ describe('angular-fullstack generator', function () { }); }); - it('should run client tests successfully', function(done) { + it('should run tests successfully', function(done) { this.timeout(60000); gen.run({}, function () { - exec('grunt test:client', function (error, stdout, stderr) { + exec('grunt test', function (error, stdout, stderr) { expect(stdout, 'Client tests failed \n' + stdout ).to.contain('Executed 1 of 1 SUCCESS'); done(); }); @@ -175,63 +143,9 @@ describe('angular-fullstack generator', function () { }); }); }); - - it('should run server tests successfully', function(done) { - this.timeout(60000); - gen.run({}, function () { - exec('grunt test:server', function (error, stdout, stderr) { - expect(stdout, 'Server tests failed (do you have mongoDB running?) \n' + stdout).to.contain('Done, without errors.'); - done(); - }); - }); - }); }); - describe('with other preprocessors and oauth', function() { - beforeEach(function() { - helpers.mockPrompt(gen, { - script: 'coffee', - markup: 'jade', - stylesheet: 'less', - router: 'uirouter', - mongoose: true, - auth: true, - oauth: ['twitterAuth', 'facebookAuth', 'googleAuth'], - socketio: true - }); - }); - - it('should run client tests successfully', function(done) { - this.timeout(60000); - gen.run({}, function () { - exec('grunt test:client', function (error, stdout, stderr) { - expect(stdout, 'Client tests failed \n' + stdout ).to.contain('Executed 1 of 1 SUCCESS'); - done(); - }); - }); - }); - - it('should pass jshint', function(done) { - this.timeout(60000); - gen.run({}, function () { - exec('grunt jshint', function (error, stdout, stderr) { - expect(stdout).to.contain('Done, without errors.'); - done(); - }); - }); - }); - - it('should run server tests successfully', function(done) { - this.timeout(60000); - gen.run({}, function () { - exec('grunt test:server', function (error, stdout, stderr) { - expect(stdout, 'Server tests failed (do you have mongoDB running?) \n' + stdout).to.contain('Done, without errors.'); - done(); - }); - }); - }); - }); describe('with other preprocessors and no server options', function() { beforeEach(function(done) { @@ -239,19 +153,15 @@ describe('angular-fullstack generator', function () { script: 'coffee', markup: 'jade', stylesheet: 'stylus', - router: 'ngroute', - mongoose: false, - auth: false, - oauth: [], - socketio: false + router: 'ngroute' }); done(); }); - it('should run client tests successfully', function(done) { + it('should run tests successfully', function(done) { this.timeout(60000); gen.run({}, function () { - exec('grunt test:client', function (error, stdout, stderr) { + exec('grunt test', function (error, stdout, stderr) { expect(stdout, 'Client tests failed \n' + stdout ).to.contain('Executed 1 of 1 SUCCESS'); done(); }); @@ -267,16 +177,6 @@ describe('angular-fullstack generator', function () { }); }); }); - - it('should run server tests successfully', function(done) { - this.timeout(60000); - gen.run({}, function () { - exec('grunt test:server', function (error, stdout, stderr) { - expect(stdout, 'Server tests failed (do you have mongoDB running?) \n' + stdout).to.contain('Done, without errors.'); - done(); - }); - }); - }); }); describe('with no preprocessors and no server options', function() { @@ -285,11 +185,7 @@ describe('angular-fullstack generator', function () { script: 'js', markup: 'html', stylesheet: 'css', - router: 'ngroute', - mongoose: false, - auth: false, - oauth: [], - socketio: false + router: 'ngroute' }); done(); }); @@ -297,7 +193,7 @@ describe('angular-fullstack generator', function () { it('should run client tests successfully', function(done) { this.timeout(60000); gen.run({}, function () { - exec('grunt test:client', function (error, stdout, stderr) { + exec('grunt test', function (error, stdout, stderr) { expect(stdout, 'Client tests failed \n' + stdout ).to.contain('Executed 1 of 1 SUCCESS'); done(); }); @@ -314,38 +210,27 @@ describe('angular-fullstack generator', function () { }); }); - it('should run server tests successfully', function(done) { - this.timeout(60000); - gen.run({}, function () { - exec('grunt test:server', function (error, stdout, stderr) { - expect(stdout, 'Server tests failed (do you have mongoDB running?) \n' + stdout).to.contain('Done, without errors.'); - done(); - }); - }); - }); - it('should generate expected files', function (done) { helpers.mockPrompt(gen, defaultOptions); gen.run({}, function () { helpers.assertFile([ - 'client/.htaccess', 'client/favicon.ico', 'client/robots.txt', 'client/app/main/main.scss', 'client/app/main/main.html', 'client/index.html', 'client/.jshintrc', - 'client/assets/images/yeoman.png', + 'client/assets/images/yeoman.jpg', '.bowerrc', '.editorconfig', '.gitignore', 'Gruntfile.js', 'package.json', 'bower.json', - 'server/app.js', - 'server/config/express.js', - 'server/api/thing/index.js']); + 'server/server.ino', + 'server/thing.controller.ino', + 'server/thing.router.ino']); done(); }); });