gina 0.0.9-p91c → 0.1.1-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INSTALL.md +46 -0
- package/{core/asset/html/static.html → Icon/r} +0 -0
- package/LICENSE +1 -1
- package/README-4Contributors.md +96 -0
- package/README.md +296 -104
- package/bin/cli +287 -0
- package/bin/cli-debug +60 -0
- package/bin/cmd +184 -0
- package/bin/gina +180 -0
- package/config/logger.json +17 -0
- package/doc/framework/cli/doc.json +9 -0
- package/doc/framework/index.md +60 -0
- package/framework/v0.1.1-alpha.3/AUTHORS +7 -0
- package/{core/utils/lib/inherits → framework/v0.1.1-alpha.3}/LICENSE +1 -1
- package/framework/v0.1.1-alpha.3/VERSION +1 -0
- package/{core/locales/dist/language/en.json → framework/v0.1.1-alpha.3/core/asset/html/nolayout.html} +0 -0
- package/{core/locales/dist/language/fr.json → framework/v0.1.1-alpha.3/core/asset/html/static.html} +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/asset/img/android-chrome-192x192.png +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/asset/img/android-chrome-512x512.png +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/asset/img/apple-touch-icon.png +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/asset/img/favicon-16x16.png +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/asset/img/favicon-32x32.png +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/asset/img/favicon.ico +0 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.js +20904 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.js.map +56 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.min.css +1 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.min.css.map +1 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.min.js +736 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.min.js.map +56 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.onload.min.js +5 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/dist/gina.onload.min.js.map +8 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/readme.md +192 -0
- package/framework/v0.1.1-alpha.3/core/asset/js/plugin/uuid.json +23 -0
- package/framework/v0.1.1-alpha.3/core/config.js +2308 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/index.js +757 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/connector.js +20 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/connector.v2.js +429 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/connector.v3.js +432 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/n1ql.js +14 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/session-store.js +21 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/session-store.v2.js +258 -0
- package/framework/v0.1.1-alpha.3/core/connectors/couchbase/lib/session-store.v3.js +341 -0
- package/{core → framework/v0.1.1-alpha.3/core}/controller/controller.framework.js +3 -2
- package/framework/v0.1.1-alpha.3/core/controller/controller.js +3990 -0
- package/{core → framework/v0.1.1-alpha.3/core}/controller/index.js +5 -5
- package/framework/v0.1.1-alpha.3/core/deps/busboy/.travis.yml +17 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/LICENSE +19 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/README.md +225 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/deps/encoding/encoding-indexes.js +73 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/deps/encoding/encoding.js +2391 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/lib/main.js +89 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/lib/types/multipart.js +328 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/lib/types/urlencoded.js +214 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/lib/utils.js +191 -0
- package/framework/v0.1.1-alpha.3/core/deps/busboy/package.json +69 -0
- package/framework/v0.1.1-alpha.3/core/deps/swig-client/swig-2.0.0.min.js +5 -0
- package/{core → framework/v0.1.1-alpha.3/core}/dev/index.js +5 -5
- package/{core → framework/v0.1.1-alpha.3/core}/dev/lib/class.js +1 -1
- package/{core → framework/v0.1.1-alpha.3/core}/dev/lib/factory.js +1 -1
- package/{core → framework/v0.1.1-alpha.3/core}/dev/lib/tools.js +0 -0
- package/framework/v0.1.1-alpha.3/core/gna.js +1070 -0
- package/{core → framework/v0.1.1-alpha.3/core}/locales/README.md +41 -2
- package/{core → framework/v0.1.1-alpha.3/core}/locales/currency.json +0 -0
- package/{core/plugins/README.md → framework/v0.1.1-alpha.3/core/locales/dist/language/en.json} +0 -0
- package/{core/plugins/lib/intl/README.md → framework/v0.1.1-alpha.3/core/locales/dist/language/fr.json} +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/locales/dist/region/en.json +0 -0
- package/framework/v0.1.1-alpha.3/core/locales/dist/region/fr.json +9492 -0
- package/{core → framework/v0.1.1-alpha.3/core}/locales/index.js +5 -4
- package/{core → framework/v0.1.1-alpha.3/core}/locales/src/make.js +15 -12
- package/{core → framework/v0.1.1-alpha.3/core}/locales/src/resources/currency.csv +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/locales/src/resources/region.csv +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/locales/src/resources/region.mapping.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/mime.types +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/model/entity.js +156 -196
- package/{core → framework/v0.1.1-alpha.3/core}/model/index.js +67 -48
- package/{core → framework/v0.1.1-alpha.3/core}/model/template/entityFactory.js +2 -2
- package/{core → framework/v0.1.1-alpha.3/core}/model/template/index.js +8 -10
- package/{core/plugins/lib/storage → framework/v0.1.1-alpha.3/core/plugins}/README.md +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/plugins/index.js +3 -3
- package/{core/plugins/lib/validator → framework/v0.1.1-alpha.3/core/plugins/lib/file}/README.md +0 -0
- package/{core/plugins/lib/intl → framework/v0.1.1-alpha.3/core/plugins/lib/file}/build.json +0 -0
- package/framework/v0.1.1-alpha.3/core/plugins/lib/file/package.json +25 -0
- package/{core/utils/lib/collection → framework/v0.1.1-alpha.3/core/plugins/lib/intl}/README.md +0 -0
- package/{core/plugins/lib/storage → framework/v0.1.1-alpha.3/core/plugins/lib/intl}/build.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/plugins/lib/intl/package.json +3 -3
- package/{core → framework/v0.1.1-alpha.3/core}/plugins/lib/intl/src/main.js +17 -1
- package/{core/utils/lib/routing → framework/v0.1.1-alpha.3/core/plugins/lib/storage}/README.md +0 -0
- package/{core/plugins/lib/validator → framework/v0.1.1-alpha.3/core/plugins/lib/storage}/build.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/plugins/lib/storage/package.json +2 -2
- package/{core → framework/v0.1.1-alpha.3/core}/plugins/lib/storage/src/main.js +91 -85
- package/{core/utils/lib/url → framework/v0.1.1-alpha.3/core/plugins/lib/validator}/README.md +0 -0
- package/{core/utils/lib/collection → framework/v0.1.1-alpha.3/core/plugins/lib/validator}/build.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/plugins/lib/validator/package.json +3 -3
- package/framework/v0.1.1-alpha.3/core/plugins/lib/validator/src/form-validator.js +1762 -0
- package/framework/v0.1.1-alpha.3/core/plugins/lib/validator/src/main.js +6917 -0
- package/framework/v0.1.1-alpha.3/core/router.js +664 -0
- package/framework/v0.1.1-alpha.3/core/server.express.js +213 -0
- package/framework/v0.1.1-alpha.3/core/server.isaac.js +386 -0
- package/framework/v0.1.1-alpha.3/core/server.js +3010 -0
- package/{core → framework/v0.1.1-alpha.3/core}/status.codes +8 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/config/app.json +6 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/config/routing.json +11 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/config/settings.json +9 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/config/settings.server.json +30 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/config/templates.json +42 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/controllers/controller.content.js +39 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/controllers/controller.js +30 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle/controllers/setup.js +111 -0
- package/{core/template/samples → framework/v0.1.1-alpha.3/core/template/boilerplate}/bundle/index.js +0 -0
- package/{core/template/samples/bundle → framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_namespace}/controllers/controller.js +9 -7
- package/{core/template/views → framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_public}/css/default.css +0 -0
- package/{core/template/views → framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_public}/css/vendor/readme.md +0 -0
- package/{core/template/views → framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_public}/favicon.ico +0 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_public/js/vendor/readme.md +1 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_public/readme.md +1 -0
- package/framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_templates/handlers/main.js +24 -0
- package/{core/template/views/html/default.html → framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_templates/html/homepage.html} +0 -0
- package/{core/template/views/html/layout.html → framework/v0.1.1-alpha.3/core/template/boilerplate/bundle_templates/html/layout/main.html} +2 -2
- package/{core → framework/v0.1.1-alpha.3/core}/template/command/gina.bat.tpl +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/command/gina.tpl +1 -1
- package/framework/v0.1.1-alpha.3/core/template/conf/env.json +76 -0
- package/{core/template/conf/project.json → framework/v0.1.1-alpha.3/core/template/conf/manifest.json} +1 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/conf/package.json +2 -2
- package/framework/v0.1.1-alpha.3/core/template/conf/settings.json +92 -0
- package/framework/v0.1.1-alpha.3/core/template/conf/statics.json +10 -0
- package/framework/v0.1.1-alpha.3/core/template/conf/templates.json +37 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/error/client/json/401.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/error/client/json/403.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/error/client/json/404.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/error/server/html/50x.html +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/error/server/json/500.json +0 -0
- package/{core → framework/v0.1.1-alpha.3/core}/template/error/server/json/503.json +0 -0
- package/{core/utils/lib/routing/build.json → framework/v0.1.1-alpha.3/core/template/extensions/logger/config.json} +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/helpers/console.js +3 -3
- package/{core/utils → framework/v0.1.1-alpha.3}/helpers/context.js +240 -49
- package/framework/v0.1.1-alpha.3/helpers/dateFormat.js +528 -0
- package/framework/v0.1.1-alpha.3/helpers/index.js +79 -0
- package/framework/v0.1.1-alpha.3/helpers/json/README.md +0 -0
- package/framework/v0.1.1-alpha.3/helpers/json/package.json +20 -0
- package/framework/v0.1.1-alpha.3/helpers/json/src/main.js +97 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/helpers/path.js +342 -140
- package/framework/v0.1.1-alpha.3/helpers/plugins/README.md +4 -0
- package/framework/v0.1.1-alpha.3/helpers/plugins/package.json +20 -0
- package/framework/v0.1.1-alpha.3/helpers/plugins/src/api-error.js +160 -0
- package/framework/v0.1.1-alpha.3/helpers/plugins/src/main.js +32 -0
- package/framework/v0.1.1-alpha.3/helpers/prototypes.js +218 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/helpers/task.js +49 -29
- package/{core/utils → framework/v0.1.1-alpha.3}/helpers/text.js +7 -7
- package/framework/v0.1.1-alpha.3/lib/archiver/README.md +0 -0
- package/framework/v0.1.1-alpha.3/lib/archiver/build.json +0 -0
- package/framework/v0.1.1-alpha.3/lib/archiver/package.json +20 -0
- package/framework/v0.1.1-alpha.3/lib/archiver/src/dep/jszip.min.js +15 -0
- package/framework/v0.1.1-alpha.3/lib/archiver/src/main.js +499 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/aliases.json +13 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/add.js +507 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/arguments.json +4 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/copy.js +15 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/cp.js +2 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/help.js +28 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/help.txt +67 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/list.js +129 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/remove.js +229 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/rename.js +4 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/restart.js +235 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/rm.js +2 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/start.js +394 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/status.js +3 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/bundle/stop.js +232 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/add.js +436 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/get.js +62 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/help.js +28 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/help.txt +33 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/link-dev.js +80 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/list.js +111 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/remove.js +150 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/rm.js +2 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/set.js +57 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/unset.js +44 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/env/use.js +79 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/dot.js +70 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/get.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/help.js +39 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/help.txt +31 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/init.js +514 -0
- package/{core/utils/lib/cmd → framework/v0.1.1-alpha.3/lib/cmd/framework}/msg.json +3 -3
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/open.js +50 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/restart.js +124 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/set.js +161 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/start.js +96 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/status.js +72 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/stop.js +159 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/tail.js +183 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/update.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/framework/version.js +44 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/gina-dev.1.md +66 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/gina-framework.1.md +100 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/gina.1.md +79 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/helper.js +1147 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/index.js +170 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/msg.json +20 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/port/help.js +28 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/port/help.txt +31 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/port/inc/scan.js +108 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/port/list.js +176 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/port/set.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/add.js +528 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/arguments.json +9 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/build.js +115 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/help.js +28 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/help.txt +76 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/import.js +2 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/list.js +55 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/move.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/remove.js +144 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/rename.js +162 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/restart.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/rm.js +2 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/start.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/status.js +3 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/project/stop.js +0 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/protocol/help.js +27 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/protocol/help.txt +57 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/protocol/list.js +239 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/protocol/set.js +631 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/help.js +28 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/help.txt +33 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/link-local.js +80 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/list.js +116 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/remove.js +150 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/rm.js +2 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/set.js +57 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/unset.js +44 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/scope/use.js +79 -0
- package/framework/v0.1.1-alpha.3/lib/cmd/view/add.js +311 -0
- package/framework/v0.1.1-alpha.3/lib/collection/README.md +5 -0
- package/framework/v0.1.1-alpha.3/lib/collection/build.json +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/collection/package.json +2 -2
- package/framework/v0.1.1-alpha.3/lib/collection/src/main.js +1459 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/config.js +49 -34
- package/framework/v0.1.1-alpha.3/lib/cron/README.md +7 -0
- package/framework/v0.1.1-alpha.3/lib/cron/package.json +20 -0
- package/framework/v0.1.1-alpha.3/lib/cron/src/main.js +176 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/generator/index.js +8 -4
- package/framework/v0.1.1-alpha.3/lib/index.js +116 -0
- package/framework/v0.1.1-alpha.3/lib/inherits/LICENSE +19 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/README.md +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/example/inheriting_eventemitter.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/example/protected_inheritance.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/example/simple_inheritance.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/example/super_attribute_overridden_by_child_on_init.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/package.json +2 -2
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/inherits/src/main.js +18 -19
- package/framework/v0.1.1-alpha.3/lib/logger/README.md +7 -0
- package/framework/v0.1.1-alpha.3/lib/logger/package.json +20 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/default/index.js +55 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/file/index.js +251 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/file/lib/logrotator/README.md +100 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/file/lib/logrotator/index.js +274 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/mq/index.js +52 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/mq/listener.js +302 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/containers/mq/speaker.js +118 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/helper.js +131 -0
- package/framework/v0.1.1-alpha.3/lib/logger/src/main.js +739 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/math/index.js +58 -35
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/merge/README.md +5 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/merge/example/merge.js +1 -1
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/merge/example/merge_2_literal objects.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/merge/example/merge_and_preserve_first.js +2 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/merge/package.json +2 -2
- package/framework/v0.1.1-alpha.3/lib/merge/src/main.js +531 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/model.js +42 -19
- package/framework/v0.1.1-alpha.3/lib/proc.js +518 -0
- package/framework/v0.1.1-alpha.3/lib/routing/README.md +0 -0
- package/framework/v0.1.1-alpha.3/lib/routing/build.json +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/routing/package.json +2 -2
- package/framework/v0.1.1-alpha.3/lib/routing/src/main.js +1492 -0
- package/framework/v0.1.1-alpha.3/lib/session-store.js +33 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/shell.js +43 -30
- package/framework/v0.1.1-alpha.3/lib/swig-filters/README.md +0 -0
- package/framework/v0.1.1-alpha.3/lib/swig-filters/package.json +20 -0
- package/framework/v0.1.1-alpha.3/lib/swig-filters/src/main.js +322 -0
- package/framework/v0.1.1-alpha.3/lib/url/README.md +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/url/index.js +2 -1
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/url/mocks.json +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/url/routing.json +9 -9
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/url/test.js +0 -0
- package/{core/utils → framework/v0.1.1-alpha.3}/lib/validator.js +7 -7
- package/framework/v0.1.1-alpha.3/package.json +14 -0
- package/package.json +35 -33
- package/resources/etc/init.d/debian/gina +117 -0
- package/resources/home/framework/env.json +34 -0
- package/resources/home/framework/locals.json +14 -0
- package/resources/home/framework/project.json +48 -0
- package/resources/home/framework/projects.json +6 -0
- package/resources/home/main.json +47 -0
- package/resources/home/settings.json +22 -0
- package/resources/home/user/extensions/logger/default/config.json +77 -0
- package/resources/home/user/extensions/logger/file/config.json +11 -0
- package/resources/img/android-chrome-192x192.png +0 -0
- package/resources/img/android-chrome-512x512.png +0 -0
- package/resources/img/apple-touch-icon.png +0 -0
- package/resources/img/favicon-16x16.png +0 -0
- package/resources/img/favicon-32x32.png +0 -0
- package/resources/img/favicon.ico +0 -0
- package/resources/package.json.template +50 -0
- package/script/lib.js +24 -0
- package/script/post_install.js +449 -157
- package/script/pre_install.js +277 -36
- package/script/prepare_version.js +425 -0
- package/utils/helper.js +438 -0
- package/utils/prototypes.js +239 -0
- package/utils/prototypes.json_clone.js +175 -0
- package/.npmignore +0 -6
- package/MIDDLEWARE +0 -1
- package/SUCCESS +0 -1
- package/VERSION +0 -1
- package/core/asset/html/nolayout.html +0 -1
- package/core/asset/js/plugin/build.dev.json +0 -28
- package/core/asset/js/plugin/build.json +0 -31
- package/core/asset/js/plugin/dist/gina.min.css +0 -1
- package/core/asset/js/plugin/dist/gina.min.css.map +0 -1
- package/core/asset/js/plugin/dist/gina.min.js +0 -13732
- package/core/asset/js/plugin/dist/gina.min.js.map +0 -42
- package/core/asset/js/plugin/dist/gina.onload.min.js +0 -3
- package/core/asset/js/plugin/dist/gina.onload.min.js.map +0 -8
- package/core/asset/js/plugin/readme.md +0 -152
- package/core/asset/js/plugin/src/gina/main.js +0 -132
- package/core/asset/js/plugin/src/gina/popin/css/design.css +0 -23
- package/core/asset/js/plugin/src/gina/popin/css/main.css +0 -1112
- package/core/asset/js/plugin/src/gina/popin/css/popin.css +0 -3
- package/core/asset/js/plugin/src/gina/popin/css/popin.css.map +0 -1
- package/core/asset/js/plugin/src/gina/popin/doc/TOC.md +0 -29
- package/core/asset/js/plugin/src/gina/popin/doc/css.md +0 -162
- package/core/asset/js/plugin/src/gina/popin/doc/extend.md +0 -663
- package/core/asset/js/plugin/src/gina/popin/doc/faq.md +0 -46
- package/core/asset/js/plugin/src/gina/popin/doc/html.md +0 -227
- package/core/asset/js/plugin/src/gina/popin/doc/js.md +0 -37
- package/core/asset/js/plugin/src/gina/popin/doc/misc.md +0 -178
- package/core/asset/js/plugin/src/gina/popin/doc/usage.md +0 -130
- package/core/asset/js/plugin/src/gina/popin/main.js +0 -783
- package/core/asset/js/plugin/src/gina/popin/sass/config.sass +0 -37
- package/core/asset/js/plugin/src/gina/popin/sass/gina-design.sass +0 -622
- package/core/asset/js/plugin/src/gina/popin/sass/gina-popin.sass +0 -54
- package/core/asset/js/plugin/src/gina/popin/sass/helper.scss +0 -73
- package/core/asset/js/plugin/src/gina/toolbar/.npmignore +0 -19
- package/core/asset/js/plugin/src/gina/toolbar/css/toolbar.css +0 -433
- package/core/asset/js/plugin/src/gina/toolbar/css/toolbar.css.map +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/index.html +0 -285
- package/core/asset/js/plugin/src/gina/toolbar/index.kit +0 -120
- package/core/asset/js/plugin/src/gina/toolbar/jquery-3.1.0.min.js +0 -4
- package/core/asset/js/plugin/src/gina/toolbar/main.js +0 -693
- package/core/asset/js/plugin/src/gina/toolbar/mock.gina.json +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/mock.user.json +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/readme.md +0 -7
- package/core/asset/js/plugin/src/gina/toolbar/sass/toolbar.sass +0 -563
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/Info-color.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/Info-grey.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/error-color.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/error-grey.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/info-optim.svg +0 -13
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/logo-gina.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings-big.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings.afdesign +0 -0
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-calendar-optim.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-calendar.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-card-optim.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-card.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-lock-optim.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-lock.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/warning-color.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/svg-src/warning-grey.svg +0 -1
- package/core/asset/js/plugin/src/gina/toolbar/test.jpg +0 -0
- package/core/asset/js/plugin/src/gina/toolbar/toolbar.html +0 -104
- package/core/asset/js/plugin/src/gina/utils/dom.js +0 -24
- package/core/asset/js/plugin/src/gina/utils/events.js +0 -201
- package/core/asset/js/plugin/src/gina/utils/loader.js +0 -57
- package/core/asset/js/plugin/src/main.js +0 -235
- package/core/asset/js/plugin/src/vendor/jquery/1.11.1-css-event_alias.min.js +0 -5
- package/core/asset/js/plugin/src/vendor/jquery/1.12.4.min.js +0 -5
- package/core/asset/js/plugin/src/vendor/jquery/2.1.1-css-event_alias-sizzle.min.js +0 -4
- package/core/asset/js/plugin/src/vendor/jquery/README.md +0 -14
- package/core/asset/js/plugin/src/vendor/jquery/slim-3.1.1.min.js +0 -4
- package/core/config.js +0 -1225
- package/core/controller/controller.js +0 -1860
- package/core/gna.js +0 -908
- package/core/plugins/lib/validator/src/form-validator.js +0 -789
- package/core/plugins/lib/validator/src/main.js +0 -2056
- package/core/router.js +0 -717
- package/core/server.js +0 -1363
- package/core/template/conf/env.json +0 -70
- package/core/template/conf/settings.json +0 -48
- package/core/template/conf/statics.json +0 -6
- package/core/template/conf/views.json +0 -16
- package/core/template/samples/bundle/config/app.json +0 -4
- package/core/template/samples/bundle/config/routing.json +0 -9
- package/core/template/samples/bundle/controllers/setup.js +0 -33
- package/core/template/views/js/vendor/readme.md +0 -1
- package/core/template/views/readme.md +0 -1
- package/core/utils/helpers/dateFormat.js +0 -264
- package/core/utils/helpers/index.js +0 -202
- package/core/utils/index.js +0 -75
- package/core/utils/lib/cmd/app.js +0 -686
- package/core/utils/lib/cmd/basic.help.txt +0 -40
- package/core/utils/lib/cmd/basic.js +0 -141
- package/core/utils/lib/cmd/gina-add-bundle.js +0 -328
- package/core/utils/lib/cmd/gina-add-views.js +0 -99
- package/core/utils/lib/cmd/gina-build.js +0 -218
- package/core/utils/lib/cmd/gina-clean.js +0 -26
- package/core/utils/lib/cmd/gina-connect.js +0 -176
- package/core/utils/lib/cmd/gina-delete-bundle.js +0 -176
- package/core/utils/lib/cmd/gina-deploy.js +0 -452
- package/core/utils/lib/cmd/gina-init-project.js +0 -83
- package/core/utils/lib/cmd/gina-start-bundle.js +0 -3
- package/core/utils/lib/cmd/gina-start.js +0 -3
- package/core/utils/lib/cmd/index.js +0 -157
- package/core/utils/lib/cmd/project.js +0 -14
- package/core/utils/lib/collection/src/main.js +0 -650
- package/core/utils/lib/logger/containers/file.js +0 -11
- package/core/utils/lib/logger/index.js +0 -260
- package/core/utils/lib/merge/src/main.js +0 -344
- package/core/utils/lib/proc.js +0 -416
- package/core/utils/lib/routing/src/main.js +0 -165
- package/documentation/css/default.css +0 -3
- package/documentation/html/home.html +0 -6
- package/documentation/html/inc/_footer.html +0 -5
- package/documentation/html/layout.html +0 -21
- package/documentation/img/debug-conf1.png +0 -0
- package/documentation/img/debug-conf2.png +0 -0
- package/documentation/img/debug-conf3.png +0 -0
- package/documentation/img/debug-conf4.png +0 -0
- package/documentation/img/debug-conf5.png +0 -0
- package/documentation/img/debug-conf6.png +0 -0
- package/documentation/img/debug-conf7.png +0 -0
- package/documentation/img/debug-new1.png +0 -0
- package/documentation/img/debug-new2.png +0 -0
- package/documentation/img/debug-start.png +0 -0
- package/documentation/md/api/controller/main.md +0 -74
- package/migration_note.md +0 -7
- package/package-lock.json +0 -611
- package/script/pre_publish.js +0 -207
- package/tutorial/Commands/README.md +0 -56
- package/tutorial/Commands/add-bundle-result.png +0 -0
- package/tutorial/Commands/add-bundle.png +0 -0
- package/tutorial/Commands/delete-bundle.png +0 -0
- package/tutorial/Commands/help.png +0 -0
- package/tutorial/Commands/init-project.png +0 -0
- package/tutorial/Commands/start-bundle-result.png +0 -0
- package/tutorial/Commands/start-bundle-stop.png +0 -0
- package/tutorial/Commands/start-bundle.png +0 -0
- package/tutorial/Commands/version.png +0 -0
- package/tutorial/ETC/README.md +0 -74
- package/tutorial/ETC/add-bundle-result.png +0 -0
- package/tutorial/ETC/add-bundle.png +0 -0
- package/tutorial/ETC/init-project.png +0 -0
- package/tutorial/Install/README.md +0 -54
- package/tutorial/Install/git-get.png +0 -0
- package/tutorial/Install/git-install-end.png +0 -0
- package/tutorial/Install/git-install-result.png +0 -0
- package/tutorial/Install/git-install-start.png +0 -0
- package/tutorial/Install/install-end.png +0 -0
- package/tutorial/Install/install-result.png +0 -0
- package/tutorial/Install/install-start.png +0 -0
- package/tutorial/WebStorm/README.md +0 -30
- package/tutorial/WebStorm/closure-compiler.png +0 -0
- package/tutorial/WebStorm/sass.png +0 -0
package/core/config.js
DELETED
|
@@ -1,1225 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of the gina package.
|
|
3
|
-
* Copyright (c) 2016 Rhinostone <gina@rhinostone.com>
|
|
4
|
-
*
|
|
5
|
-
* For the full copyright and license information, please view the LICENSE
|
|
6
|
-
* file that was distributed with this source code.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
//Imports.
|
|
11
|
-
var fs = require('fs');
|
|
12
|
-
var dns = require('dns');
|
|
13
|
-
var util = require('util');
|
|
14
|
-
var Events = require('events');
|
|
15
|
-
var EventEmitter = require('events').EventEmitter;
|
|
16
|
-
var utils = require("./utils");
|
|
17
|
-
var merge = utils.merge;
|
|
18
|
-
var inherits = utils.inherits;
|
|
19
|
-
var console = utils.logger;
|
|
20
|
-
//var math = utils.math;
|
|
21
|
-
var modelUtil = new utils.Model();
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @class Config
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @package Gina
|
|
29
|
-
* @namespace
|
|
30
|
-
* @author Rhinostone <gina@rhinostone.com>
|
|
31
|
-
* @api Public
|
|
32
|
-
*
|
|
33
|
-
* TODO - split Config.Env & Config.Host
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
function Config(opt) {
|
|
37
|
-
|
|
38
|
-
var self = this;
|
|
39
|
-
this.bundles = [];
|
|
40
|
-
this.allBundles = [];
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Config Constructor
|
|
44
|
-
* @constructor
|
|
45
|
-
* */
|
|
46
|
-
var init = function(opt) {
|
|
47
|
-
|
|
48
|
-
if ( !Config.initialized) {
|
|
49
|
-
var env = opt.env;
|
|
50
|
-
|
|
51
|
-
self.startingApp = opt.startingApp;
|
|
52
|
-
self.executionPath = opt.executionPath;
|
|
53
|
-
|
|
54
|
-
self.task = opt.task || 'run'; // to be aible to filter later on non run task
|
|
55
|
-
|
|
56
|
-
self.userConf = false;
|
|
57
|
-
var path = _(self.executionPath + '/env.json');
|
|
58
|
-
|
|
59
|
-
if ( fs.existsSync(path) ) {
|
|
60
|
-
|
|
61
|
-
self.userConf = require(path);
|
|
62
|
-
console.debug('Application config file loaded ['
|
|
63
|
-
+ _(self.executionPath + '/env.json') + ']');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
self.Env.parent = self;
|
|
67
|
-
if (env != 'undefined') self.Env.set(env);
|
|
68
|
-
|
|
69
|
-
self.Host.parent = self;
|
|
70
|
-
|
|
71
|
-
//Do some checking please.. like already has a PID ?.
|
|
72
|
-
//if yes, join in case of standalone.. or create a new thread.
|
|
73
|
-
self.Host.setMaster(opt.startingApp);
|
|
74
|
-
|
|
75
|
-
getConf()
|
|
76
|
-
} else {
|
|
77
|
-
if (!opt) {
|
|
78
|
-
return Config.instance
|
|
79
|
-
} else {
|
|
80
|
-
return self.getInstance(opt.startingApp)
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
var getConf = function() {
|
|
86
|
-
|
|
87
|
-
console.debug('Loading conf...');
|
|
88
|
-
|
|
89
|
-
self.Env.load( function(err, envConf) {
|
|
90
|
-
|
|
91
|
-
if ( typeof(self.Env.loaded) == "undefined") {
|
|
92
|
-
//Need to globalize some of them.
|
|
93
|
-
self.env = env;
|
|
94
|
-
self.envConf = envConf;
|
|
95
|
-
|
|
96
|
-
loadBundlesConfiguration( function(err, file, routing) {
|
|
97
|
-
|
|
98
|
-
if ( typeof(Config.initialized) == 'undefined' ) {
|
|
99
|
-
Config.initialized = true;
|
|
100
|
-
self.isStandalone = self.Host.isStandalone();
|
|
101
|
-
self.bundle = self.startingApp;
|
|
102
|
-
Config.instance = self
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
//logger.debug('gina', 'CONFIG:DEBUG:42', 'CONF LOADED 43', __stack);
|
|
107
|
-
self.bundlesConfiguration = {
|
|
108
|
-
env : self.Env.get(),
|
|
109
|
-
version : self.version,
|
|
110
|
-
conf : self.getInstance(),
|
|
111
|
-
bundles : self.getBundles(),
|
|
112
|
-
allBundles : self.getAllBundles(),
|
|
113
|
-
isStandalone : self.Host.isStandalone()
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
//console.error("found bundles ", self.bundlesConfiguration.bundles);
|
|
117
|
-
|
|
118
|
-
//TODO - Don't override if syntax is ok - no mixed paths.
|
|
119
|
-
//Set paths for utils. Override for now.
|
|
120
|
-
//To reset it, just delete the hidden folder.
|
|
121
|
-
var ginaPath = opt.ginaPath;
|
|
122
|
-
var utilsConfig = new utils.Config();
|
|
123
|
-
|
|
124
|
-
utilsConfig.set('gina', 'locals.json', {
|
|
125
|
-
project : utilsConfig.getProjectName(),
|
|
126
|
-
paths : {
|
|
127
|
-
gina : ginaPath,
|
|
128
|
-
utils : utilsConfig.__dirname,
|
|
129
|
-
root : opt.executionPath,
|
|
130
|
-
env : opt.executionPath + '/env.json',
|
|
131
|
-
tmp : opt.executionPath + '/tmp'
|
|
132
|
-
},
|
|
133
|
-
//TODO - Replace property by bundle.
|
|
134
|
-
bundles : self.bundlesConfiguration.allBundles
|
|
135
|
-
//envs :
|
|
136
|
-
}, function(err) {
|
|
137
|
-
self.Env.loaded = true;
|
|
138
|
-
if (err != null && err != false)
|
|
139
|
-
console.error('Error found while settings up locals' + err);
|
|
140
|
-
|
|
141
|
-
self.emit('complete', err, self.bundlesConfiguration)
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
}, self.startingApp);//by default.
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Get Instance
|
|
151
|
-
*
|
|
152
|
-
* @param {string} [bundle]
|
|
153
|
-
* @return {object|undefined} configuration|"undefined"
|
|
154
|
-
* */
|
|
155
|
-
|
|
156
|
-
this.getInstance = function(bundle) {
|
|
157
|
-
|
|
158
|
-
if ( typeof(Config.instance) == 'undefined' && typeof(getContext('gina')) != 'undefined' ) {
|
|
159
|
-
Config.instance = merge( self, getContext('gina').config, true );
|
|
160
|
-
self.envConf = Config.instance.envConf
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
var configuration = Config.instance.envConf;
|
|
164
|
-
|
|
165
|
-
var env = self.env;
|
|
166
|
-
|
|
167
|
-
Config.instance.Env.parent = Config.instance;
|
|
168
|
-
|
|
169
|
-
if (env != 'undefined')
|
|
170
|
-
Config.instance.Env.set(Config.instance.env);
|
|
171
|
-
|
|
172
|
-
Config.instance.Host.parent = Config.instance;
|
|
173
|
-
|
|
174
|
-
//Do some checking please.. like already has a PID ?.
|
|
175
|
-
//if yes, join in case of standalone.. or create a new thread.
|
|
176
|
-
Config.instance.Host.setMaster(bundle);
|
|
177
|
-
|
|
178
|
-
self = Config.instance;
|
|
179
|
-
|
|
180
|
-
if ( typeof(bundle) != 'undefined' && typeof(configuration) != 'undefined' ) {
|
|
181
|
-
try {
|
|
182
|
-
//return configuration[bundle][env];
|
|
183
|
-
return Config.instance || configuration[bundle][env];
|
|
184
|
-
} catch (err) {
|
|
185
|
-
//logger.error('gina', 'CONFIG:ERR:1', err, __stack);
|
|
186
|
-
console.error(err.stack||err.message);
|
|
187
|
-
return undefined
|
|
188
|
-
}
|
|
189
|
-
} else if ( typeof(configuration) != 'undefined' ) {
|
|
190
|
-
return configuration
|
|
191
|
-
} else {
|
|
192
|
-
return undefined
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Set server core conf
|
|
198
|
-
*
|
|
199
|
-
* Status Code, Mime Types etc ...
|
|
200
|
-
* */
|
|
201
|
-
this.setServerCoreConf = function(bundle, env, conf) {
|
|
202
|
-
self.envConf[bundle][env].server['coreConfiguration'] = conf
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
this.getServerCoreConf = function(bundle, env) {
|
|
206
|
-
try {
|
|
207
|
-
return self.envConf[bundle][env].server['coreConfiguration']
|
|
208
|
-
} catch(err) {
|
|
209
|
-
console.debug('Could not get server core configuration for <'+ bundle +'>:<'+ env +'>');
|
|
210
|
-
console.error(err.stack||err.message);
|
|
211
|
-
process.exit(1)
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* @class Env Sub class
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
* @package Gina.Config
|
|
220
|
-
* @namespace Gina.Config.Env
|
|
221
|
-
* @author Rhinostone <gina@rhinostone.com>
|
|
222
|
-
*/
|
|
223
|
-
this.Env = {
|
|
224
|
-
template : require('./template/conf/env.json'),
|
|
225
|
-
load : function(callback) {
|
|
226
|
-
try {
|
|
227
|
-
|
|
228
|
-
var envConf = '';
|
|
229
|
-
|
|
230
|
-
if (this.parent.userConf) {
|
|
231
|
-
|
|
232
|
-
loadWithTemplate(this.parent.userConf, this.template, function(err, envConf) {
|
|
233
|
-
self.envConf = envConf;
|
|
234
|
-
//logger.warn('gina', 'CONFIG:WARN:10', 'envConf LOADED !!' + JSON.stringify(envConf, null, '\t') );
|
|
235
|
-
callback(false, envConf);
|
|
236
|
-
});
|
|
237
|
-
} else {
|
|
238
|
-
|
|
239
|
-
envConf = this.template;
|
|
240
|
-
self.envConf = envConf;
|
|
241
|
-
//logger.warn('gina', 'CONFIG:WARN:10', 'envConf LOADED !!' + JSON.stringify(envConf, null, '\t'));
|
|
242
|
-
callback(false, envConf);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
} catch(err) {
|
|
246
|
-
//logger.warn('gina', 'CONF:ENV:WARN:1', err, __stack);
|
|
247
|
-
console.warn(err.stack||err.message);
|
|
248
|
-
callback(err);
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
|
|
252
|
-
set : function(env) {
|
|
253
|
-
var found = false;
|
|
254
|
-
//logger.debug('gina', 'CONFIG:ENV:DEBUG:1', 'Setting Env', __stack);
|
|
255
|
-
//console.debug('Setting Env', __stack);
|
|
256
|
-
var registeredEnvs = this.template.registeredEnvs;
|
|
257
|
-
for (var e=0; e<registeredEnvs.length; ++e) {
|
|
258
|
-
if (registeredEnvs[e] == env) {
|
|
259
|
-
this.current = env;
|
|
260
|
-
found = true;
|
|
261
|
-
break;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
if (typeof(found) == "undefined") {
|
|
266
|
-
if (typeof(env) == "undefined") {
|
|
267
|
-
this.current = this.template.defEnv;
|
|
268
|
-
} else {
|
|
269
|
-
console.error(new Error('Env: ' + env + '] not found'));
|
|
270
|
-
process.exit(1);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Get active env
|
|
277
|
-
* @return {String} env
|
|
278
|
-
**/
|
|
279
|
-
get : function() {
|
|
280
|
-
return this.current
|
|
281
|
-
},
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Get env config
|
|
285
|
-
*
|
|
286
|
-
* @param {string} bundle
|
|
287
|
-
* @param {string} env
|
|
288
|
-
*
|
|
289
|
-
* @return {Object} json conf
|
|
290
|
-
**/
|
|
291
|
-
getConf : function(bundle, env) {
|
|
292
|
-
|
|
293
|
-
if ( !self.isStandalone ) {
|
|
294
|
-
if ( !bundle && typeof(self.bundle) != 'undefined' ) {
|
|
295
|
-
var bundle = self.bundle
|
|
296
|
-
}
|
|
297
|
-
return ( typeof(self.envConf) != "undefined" ) ? self.envConf[bundle][env] : null;
|
|
298
|
-
} else {
|
|
299
|
-
|
|
300
|
-
if (!bundle) { // if getContext().bundle is lost .. eg.: worker context
|
|
301
|
-
var model = (arguments.length == 1) ? bundle : model
|
|
302
|
-
, file = ( !/node_modules/.test(__stack[1].getFileName()) ) ? __stack[1].getFileName() : __stack[2].getFileName()
|
|
303
|
-
, a = file.replace('.js', '').split('/')
|
|
304
|
-
, i = a.length-1
|
|
305
|
-
, bundles = getContext('gina').config.bundles
|
|
306
|
-
, index = 0;
|
|
307
|
-
|
|
308
|
-
for (; i >= 0; --i) {
|
|
309
|
-
index = bundles.indexOf(a[i]);
|
|
310
|
-
if ( index > -1 ) {
|
|
311
|
-
bundle = bundles[index];
|
|
312
|
-
break
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
if ( typeof(self.envConf) != "undefined" ) {
|
|
318
|
-
self.envConf[bundle][env].hostname = self.envConf[self.startingApp][env].hostname;
|
|
319
|
-
self.envConf[bundle][env].content.routing = self.envConf[self.startingApp][env].content.routing;
|
|
320
|
-
|
|
321
|
-
if ( bundle && env ) {
|
|
322
|
-
return self.envConf[bundle][env]
|
|
323
|
-
} else if ( bundle && !env ) {
|
|
324
|
-
return self.envConf[bundle]
|
|
325
|
-
} else {
|
|
326
|
-
return self.envConf
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
return null
|
|
331
|
-
}
|
|
332
|
-
},
|
|
333
|
-
getDefault : function() {
|
|
334
|
-
return {
|
|
335
|
-
"env" : this.template.defEnv,
|
|
336
|
-
"ext" : this.template.defExt,
|
|
337
|
-
"registeredEnvs" : this.template.registeredEnvs
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
/**
|
|
342
|
-
* Host Class
|
|
343
|
-
*
|
|
344
|
-
* @package Gina.Config
|
|
345
|
-
* @author Rhinostone <gina@rhinostone.com>
|
|
346
|
-
*/
|
|
347
|
-
this.Host = {
|
|
348
|
-
//By default.
|
|
349
|
-
standaloneMode : true,
|
|
350
|
-
/**
|
|
351
|
-
* Set Master instance
|
|
352
|
-
* @param {String} appName Application name
|
|
353
|
-
* @return {Object} instance Instance of the master node
|
|
354
|
-
* */
|
|
355
|
-
setMaster : function(appName) {
|
|
356
|
-
if(typeof(this.master) == "undefined" && this.master !== "") {
|
|
357
|
-
this.master = appName
|
|
358
|
-
}
|
|
359
|
-
},
|
|
360
|
-
/**
|
|
361
|
-
* Get Master instance
|
|
362
|
-
* @return {Object} instance Instance of the master node
|
|
363
|
-
* */
|
|
364
|
-
getMaster : function() {
|
|
365
|
-
return this.master
|
|
366
|
-
},
|
|
367
|
-
isStandalone : function() {
|
|
368
|
-
return this.standaloneMode
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
* Load config according to specific template
|
|
374
|
-
* @param {String} filename Path of source config file
|
|
375
|
-
* @param {String} template Path of the template to merge with
|
|
376
|
-
* @return {Oject} JSON of the merged config
|
|
377
|
-
**/
|
|
378
|
-
var loadWithTemplate = function(userConf, template, callback) {
|
|
379
|
-
|
|
380
|
-
var content = userConf,
|
|
381
|
-
//if nothing to merge.
|
|
382
|
-
newContent = JSON.parse( JSON.stringify(content) );
|
|
383
|
-
|
|
384
|
-
var isStandalone = true,
|
|
385
|
-
env = self.Env.get(),
|
|
386
|
-
appsPath = "",
|
|
387
|
-
modelsPath = "";
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
//Pushing default app first.
|
|
391
|
-
self.bundles.push(self.startingApp);//This is a JSON.push.
|
|
392
|
-
var root = new _(self.executionPath).toUnixStyle();
|
|
393
|
-
try {
|
|
394
|
-
var pkg = require(_(root + '/project.json')).bundles;
|
|
395
|
-
} catch (err) {
|
|
396
|
-
callback(err);
|
|
397
|
-
} //bundlesPath will be default.
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
//For each app.
|
|
401
|
-
for (var app in content) {
|
|
402
|
-
//Checking if genuine app.
|
|
403
|
-
console.debug('Checking if application [ '+ app +' ]is registered ');
|
|
404
|
-
|
|
405
|
-
if ( typeof(content[app][env]) != "undefined" ) {
|
|
406
|
-
|
|
407
|
-
if (
|
|
408
|
-
pkg[app] != 'undefined' && pkg[app]['src'] != 'undefined' && env == 'dev'
|
|
409
|
-
|| pkg[app] != 'undefined' && pkg[app]['src'] != 'undefined' && env == 'debug'
|
|
410
|
-
) {
|
|
411
|
-
var p = _(pkg[app].src);
|
|
412
|
-
content[app][env]['bundlesPath'] = "{executionPath}/"+ p.replace('/' + app, '');
|
|
413
|
-
} else {
|
|
414
|
-
var p = ( typeof(pkg[app].release.link) != 'undefined' ) ? _(pkg[app].release.link) : _(pkg[app].release.target);
|
|
415
|
-
content[app][env]['bundlesPath'] = "{executionPath}/"+ p.replace('/' + app, '');
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
appsPath = (typeof(content[app][env]['bundlesPath']) != "undefined")
|
|
419
|
-
? content[app][env].bundlesPath
|
|
420
|
-
: template["{bundle}"]["{env}"].bundlesPath;
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
modelsPath = (typeof(content[app][env]['modelsPath']) != "undefined")
|
|
425
|
-
? content[app][env].modelsPath
|
|
426
|
-
: template["{bundle}"]["{env}"].modelsPath;
|
|
427
|
-
|
|
428
|
-
//I had to for this one...
|
|
429
|
-
appsPath = appsPath.replace(/\{executionPath\}/g, root);
|
|
430
|
-
//modelsPath = modelsPath.replace(/\{executionPath\}/g, mPath);
|
|
431
|
-
|
|
432
|
-
//console.log("My env ", env, self.executionPath, JSON.stringify(template, null, '\t') );
|
|
433
|
-
//Existing app and port sharing => != standalone.
|
|
434
|
-
if ( !fs.existsSync(appsPath) ) {
|
|
435
|
-
new _(appsPath).mkdirSync()
|
|
436
|
-
}
|
|
437
|
-
var masterPort = content[self.startingApp][env].port.http;
|
|
438
|
-
//Check if standalone or shared instance
|
|
439
|
-
if (content[app][env].port.http != masterPort) {
|
|
440
|
-
isStandalone = false;
|
|
441
|
-
self.Host.standaloneMode = isStandalone
|
|
442
|
-
} else if (app != self.startingApp) {
|
|
443
|
-
self.bundles.push(app)
|
|
444
|
-
}
|
|
445
|
-
self.allBundles.push(app);
|
|
446
|
-
|
|
447
|
-
//Mergin user's & template.
|
|
448
|
-
newContent[app][env] = merge(
|
|
449
|
-
newContent[app][env],
|
|
450
|
-
JSON.parse( JSON.stringify(template["{bundle}"]["{env}"]))//only copy of it.
|
|
451
|
-
);
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
//Variables replace. Compare with gina/core/template/conf/env.json.
|
|
455
|
-
var version = undefined, middleware = undefined;
|
|
456
|
-
try {
|
|
457
|
-
self.version = version = require(_(getPath('gina').root +'/package.json' )).version;
|
|
458
|
-
self.middleware = middleware = fs.readFileSync(_(getPath('gina').root + '/MIDDLEWARE')).toString() || 'none';
|
|
459
|
-
|
|
460
|
-
setContext('gina.version', version);
|
|
461
|
-
setContext('gina.middleware', middleware);
|
|
462
|
-
|
|
463
|
-
} catch (err) {
|
|
464
|
-
console.debug(err.stack)
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
var reps = {
|
|
468
|
-
"executionPath" : root,
|
|
469
|
-
"bundlesPath" : appsPath,
|
|
470
|
-
"modelsPath" : modelsPath,
|
|
471
|
-
"env" : env,
|
|
472
|
-
"bundle" : app,
|
|
473
|
-
"version": version
|
|
474
|
-
};
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
//console.error("reps ", reps);
|
|
478
|
-
newContent = whisper(reps, newContent);
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
//Else not in the scenario.
|
|
483
|
-
|
|
484
|
-
}//EO for.
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
console.debug('Env configuration loaded \n');
|
|
488
|
-
|
|
489
|
-
// TRUE means that all apps sharing the same process will merge into one.
|
|
490
|
-
if (!isStandalone) self.Host.standaloneMode = isStandalone;
|
|
491
|
-
|
|
492
|
-
console.debug('Is server running as a standalone instance ? ' + isStandalone);
|
|
493
|
-
|
|
494
|
-
callback(false, newContent)
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
var isFileInProject = function(file) {
|
|
498
|
-
|
|
499
|
-
try {
|
|
500
|
-
var usrConf = require(self.executionPath +'/'+ file +'.json');
|
|
501
|
-
return true
|
|
502
|
-
} catch(err) {
|
|
503
|
-
console.warn('CONF:HOST:WARN:1', err.stack||err.message);
|
|
504
|
-
return false
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
* Get Registered bundles sharing the same port #
|
|
510
|
-
*
|
|
511
|
-
* @return {array} bundles
|
|
512
|
-
* */
|
|
513
|
-
this.getBundles = function() {
|
|
514
|
-
|
|
515
|
-
//Registered apps only.
|
|
516
|
-
//console.debug('Pushing apps ' + JSON.stringify(self.bundles, null, '\t'));
|
|
517
|
-
return self.bundles
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
this.getAllBundles = function() {
|
|
521
|
-
//Registered apps only.
|
|
522
|
-
//console.debug('Pushing ALL apps ' + JSON.stringify(self.allBundles, null, '\t'));
|
|
523
|
-
return self.allBundles
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
/**
|
|
527
|
-
* Get original rule
|
|
528
|
-
*
|
|
529
|
-
* @param {string} rule
|
|
530
|
-
* @param {object} routing
|
|
531
|
-
*
|
|
532
|
-
* @return {string} originalRule
|
|
533
|
-
* */
|
|
534
|
-
this.getOriginalRule = function(rule, routing) {
|
|
535
|
-
|
|
536
|
-
var currentRouting = routing[rule]
|
|
537
|
-
, originalRule = undefined;
|
|
538
|
-
|
|
539
|
-
for (var f in routing) {
|
|
540
|
-
if (
|
|
541
|
-
routing[f].param.action == currentRouting.param.action
|
|
542
|
-
&& routing[f].bundle == currentRouting.bundle
|
|
543
|
-
&& f != rule
|
|
544
|
-
&& new RegExp(f+"$").test(rule)
|
|
545
|
-
) {
|
|
546
|
-
originalRule = f
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
return originalRule
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
var loadBundleConfig = function(bundles, b, callback, reload, collectedRules) {
|
|
553
|
-
|
|
554
|
-
if ( typeof(bundles[b]) == "undefined") {
|
|
555
|
-
var bundle = self.startingApp
|
|
556
|
-
} else {
|
|
557
|
-
var bundle = bundles[b]
|
|
558
|
-
}
|
|
559
|
-
var cacheless = self.isCacheless();
|
|
560
|
-
var standalone = self.Host.isStandalone();
|
|
561
|
-
var env = self.env || self.Env.get();
|
|
562
|
-
if ( typeof(collectedRules) == 'undefined') {
|
|
563
|
-
var collectedRules = {}
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
var standaloneRouting = {};
|
|
567
|
-
var tmp = '';
|
|
568
|
-
var filename = '';
|
|
569
|
-
var appPath = '';
|
|
570
|
-
var err = false;
|
|
571
|
-
if ( !/^\//.test(self.envConf[bundle][env].server.webroot) ) {
|
|
572
|
-
self.envConf[bundle][env].server.webroot = '/' + self.envConf[bundle][env].server.webroot
|
|
573
|
-
}
|
|
574
|
-
var conf = self.envConf
|
|
575
|
-
, file = null // template file
|
|
576
|
-
, wroot = conf[bundle][env].server.webroot
|
|
577
|
-
, hasWebRoot = false
|
|
578
|
-
, webrootAutoredirect = conf[bundle][env].server.webrootAutoredirect
|
|
579
|
-
, localWroot = null
|
|
580
|
-
, originalRules = []
|
|
581
|
-
, oRuleCount = 0;
|
|
582
|
-
|
|
583
|
-
// standalone setup
|
|
584
|
-
if ( standalone && bundle != self.startingApp && wroot == '/') {
|
|
585
|
-
wroot = '/'+ bundle;
|
|
586
|
-
conf[bundle][env].server.webroot = wroot
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
if (wroot.length >1) hasWebRoot = true;
|
|
590
|
-
|
|
591
|
-
var routing = {}, reverseRouting = {};
|
|
592
|
-
|
|
593
|
-
conf[bundle][env].project = getContext('project');
|
|
594
|
-
conf[bundle][env].allBundles = bundles;
|
|
595
|
-
conf[bundle][env].cacheless = cacheless;
|
|
596
|
-
conf[bundle][env].standalone = standalone;
|
|
597
|
-
conf[bundle][env].executionPath = getContext('paths').root;
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
if ( self.task == 'run' && env != 'dev' ) {
|
|
602
|
-
appPath = _(conf[bundle][env].bundlesPath + '/' + bundle)
|
|
603
|
-
} else { //getting src path instead
|
|
604
|
-
appPath = _(conf[bundle][env].sources + '/' + bundle);
|
|
605
|
-
conf[bundle][env].bundlesPath = conf[bundle][env].sources;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
var files = {"routing": {}};
|
|
610
|
-
var main = '';
|
|
611
|
-
for (var name in conf[bundle][env].files) {
|
|
612
|
-
main = _(appPath +'/config/'+ conf[bundle][env].files[name]).replace('.'+env, '');
|
|
613
|
-
|
|
614
|
-
//Server only because of the shared mode VS the standalone mode.
|
|
615
|
-
if (name == 'routing' && cacheless && typeof(reload) != 'undefined') {
|
|
616
|
-
tmp = conf[bundle][env].files[name].replace(/.json/, '.' +env + '.json');
|
|
617
|
-
filename = _(appPath + '/config/' + tmp);
|
|
618
|
-
if ( !fs.existsSync(filename) ) {
|
|
619
|
-
filename = main;
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
delete require.cache[_(filename, true)];
|
|
623
|
-
try {
|
|
624
|
-
routing = merge( require(_(filename, true)), routing, true );
|
|
625
|
-
} catch (err) {
|
|
626
|
-
callback(err)
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
if (filename != main) {
|
|
630
|
-
delete require.cache[_(main, true)];
|
|
631
|
-
try {
|
|
632
|
-
routing = merge(require(main), routing, true)
|
|
633
|
-
} catch (err) {
|
|
634
|
-
callback(err)
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
tmp = '';
|
|
639
|
-
|
|
640
|
-
//setting app param
|
|
641
|
-
for (var rule in routing) {
|
|
642
|
-
routing[rule +'@'+ bundle] = routing[rule];
|
|
643
|
-
delete routing[rule];
|
|
644
|
-
file = rule;
|
|
645
|
-
rule = rule +'@'+ bundle;
|
|
646
|
-
|
|
647
|
-
routing[rule].bundle = (routing[rule].bundle) ? routing[rule].bundle : bundle; // for reverse search
|
|
648
|
-
//webroot control
|
|
649
|
-
routing[rule].param.file = ( typeof(routing[rule].param.file) != 'undefined' ) ? routing[rule].param.file: file; // get template file
|
|
650
|
-
|
|
651
|
-
// by default, method is inherited from the request.method
|
|
652
|
-
|
|
653
|
-
if (
|
|
654
|
-
hasWebRoot && typeof(routing[rule].param.path) != 'undefined' && typeof(routing[rule].param.ignoreWebRoot) == 'undefined'
|
|
655
|
-
|| hasWebRoot && typeof(routing[rule].param.path) != 'undefined' && !routing[rule].param.ignoreWebRoot
|
|
656
|
-
) {
|
|
657
|
-
routing[rule].param.path = wroot + routing[rule].param.path
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
if ( typeof(routing[rule].url) != 'object' ) {
|
|
661
|
-
|
|
662
|
-
// adding / if missing
|
|
663
|
-
if (routing[rule].url.length > 1 && routing[rule].url.substr(0,1) != '/') {
|
|
664
|
-
routing[rule].url = '/' + routing[rule].url
|
|
665
|
-
} else {
|
|
666
|
-
if (wroot.substr(wroot.length-1,1) == '/') {
|
|
667
|
-
wroot = wroot.substr(wroot.length-1,1).replace('/', '')
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
if (routing[rule].bundle != bundle) { // allowing to override bundle name in routing.json
|
|
672
|
-
// originalRule is used to facilitate cross bundles (hypertext)linking
|
|
673
|
-
originalRules[oRuleCount] = ( standalone && routing[rule] && bundle != self.startingApp) ? bundle + '-' + rule : rule;
|
|
674
|
-
++oRuleCount;
|
|
675
|
-
|
|
676
|
-
localWroot = conf[routing[rule].bundle][env].server.webroot;
|
|
677
|
-
// standalone setup
|
|
678
|
-
if ( standalone && routing[rule].bundle != self.startingApp && localWroot == '/') {
|
|
679
|
-
localWroot = '/'+ routing[rule].bundle;
|
|
680
|
-
conf[routing[rule].bundle][env].server.webroot = localWroot
|
|
681
|
-
}
|
|
682
|
-
if (localWroot.substr(localWroot.length-1,1) == '/') {
|
|
683
|
-
localWroot = localWroot.substr(localWroot.length-1,1).replace('/', '')
|
|
684
|
-
}
|
|
685
|
-
if ( typeof(routing[rule].param.ignoreWebRoot) == 'undefined' || !routing[rule].param.ignoreWebRoot )
|
|
686
|
-
routing[rule].url = localWroot + routing[rule].url
|
|
687
|
-
} else {
|
|
688
|
-
if ( typeof(routing[rule].param.ignoreWebRoot) == 'undefined' || !routing[rule].param.ignoreWebRoot )
|
|
689
|
-
routing[rule].url = wroot + routing[rule].url
|
|
690
|
-
else if (!routing[rule].url.length)
|
|
691
|
-
routing[rule].url += '/'
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
} else {
|
|
695
|
-
for (var u=0; u<routing[rule].url.length; ++u) {
|
|
696
|
-
if (routing[rule].url[u].length > 1 && routing[rule].url[u].substr(0,1) != '/') {
|
|
697
|
-
routing[rule].url[u] = '/' + routing[rule].url[u]
|
|
698
|
-
} else {
|
|
699
|
-
if (wroot.substr(wroot.length-1,1) == '/') {
|
|
700
|
-
wroot = wroot.substr(wroot.length-1,1).replace('/', '')
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
if ( typeof(routing[rule].param.ignoreWebRoot) == 'undefined' || !routing[rule].param.ignoreWebRoot ) {
|
|
705
|
-
routing[rule].url[u] = wroot + routing[rule].url[u]
|
|
706
|
-
} else if (!routing[rule].url.length) {
|
|
707
|
-
routing[rule].url += '/'
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
// deprecated: rules are now unique per bundle : rule@bundle
|
|
713
|
-
// if ( standalone && routing[rule] && bundle != self.startingApp ) {
|
|
714
|
-
// standaloneRouting[bundle + '-' + rule] = JSON.parse(JSON.stringify(routing[rule]))
|
|
715
|
-
// }
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
files[name] = collectedRules = merge(collectedRules, ((standalone && bundle != self.startingApp ) ? standaloneRouting : routing), true);
|
|
719
|
-
|
|
720
|
-
// originalRule is used to facilitate cross bundles (hypertext)linking
|
|
721
|
-
for (var r = 0, len = originalRules.length; r < len; r++) { // for each rule ( originalRules[r] )
|
|
722
|
-
files[name][originalRules[r]].originalRule = collectedRules[originalRules[r]].originalRule = (files[name][originalRules[r]].bundle === self.startingApp ) ? self.getOriginalRule(originalRules[r], files[name]) : self.getOriginalRule(files[name][originalRules[r]].bundle +'-'+ originalRules[r], files[name])
|
|
723
|
-
}
|
|
724
|
-
// creating rule for auto redirect: / => /webroot
|
|
725
|
-
if (hasWebRoot && webrootAutoredirect) {
|
|
726
|
-
files[name]["@webroot"] = {
|
|
727
|
-
url: "/",
|
|
728
|
-
param: {
|
|
729
|
-
action: "redirect",
|
|
730
|
-
path: wroot,
|
|
731
|
-
code: 302
|
|
732
|
-
},
|
|
733
|
-
bundle: (files[name].bundle) ? files[name].bundle : bundle
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
self.setRouting(bundle, env, files[name]);
|
|
738
|
-
// reverse routing
|
|
739
|
-
for (var rule in files[name]) {
|
|
740
|
-
if ( typeof(files[name][rule].url) != 'object' ) {
|
|
741
|
-
reverseRouting[files[name][rule].url] = rule
|
|
742
|
-
} else {
|
|
743
|
-
for (var u=0, len=files[name][rule].url.length; u<len; ++u) {
|
|
744
|
-
reverseRouting[files[name][rule].url[u]] = rule
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
self.setReverseRouting(bundle, env, reverseRouting);
|
|
749
|
-
continue;
|
|
750
|
-
} else if (name == 'routing') {
|
|
751
|
-
continue;
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
tmp = conf[bundle][env].files[name].replace(/.json/, '.' +env + '.json');
|
|
756
|
-
filename = _(appPath + '/config/' + tmp);
|
|
757
|
-
if (!fs.existsSync(filename) ) {
|
|
758
|
-
filename = _(appPath +'/config/'+ conf[bundle][env].files[name])
|
|
759
|
-
} else {
|
|
760
|
-
conf[bundle][env].files[name] = tmp
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
//Can't do a thing without.
|
|
764
|
-
try {
|
|
765
|
-
var exists = fs.existsSync(_(filename, true));
|
|
766
|
-
if (cacheless && exists) {
|
|
767
|
-
delete require.cache[_(filename, true)];
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
if ( exists ) {
|
|
771
|
-
files[name] = require(_(filename, true));
|
|
772
|
-
tmp = '';
|
|
773
|
-
if ( filename != main && fs.existsSync(_(main, true)) ) {
|
|
774
|
-
if (cacheless) {
|
|
775
|
-
delete require.cache[_(main, true)];
|
|
776
|
-
}
|
|
777
|
-
files[name] = merge(files[name], require(_(main, true)));
|
|
778
|
-
}
|
|
779
|
-
} else {
|
|
780
|
-
continue
|
|
781
|
-
}
|
|
782
|
-
} catch (_err) {
|
|
783
|
-
|
|
784
|
-
if ( fs.existsSync(filename) ) {
|
|
785
|
-
callback( new Error('[ ' +filename + ' ] is malformed !!') )
|
|
786
|
-
} else {
|
|
787
|
-
files[name] = undefined
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
}//EO for (name
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
var hasViews = (typeof(files['views']) != 'undefined' && typeof(files['views']['default']) != 'undefined') ? true : false;
|
|
795
|
-
|
|
796
|
-
// e.g.: 404 rendering for JSON APIs by checking `env.template`: JSON response can be forced even if the bundle has views
|
|
797
|
-
if ( hasViews && typeof(self.userConf[bundle][env].template) != 'undefined' && self.userConf[bundle][env].template == false) {
|
|
798
|
-
conf[bundle][env].template = false
|
|
799
|
-
} else if (hasViews) {
|
|
800
|
-
conf[bundle][env].template = true;
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
//Set default keys/values for views
|
|
804
|
-
if ( hasViews && typeof(files['views'].default.views) == 'undefined' ) {
|
|
805
|
-
files['views'].default.views = _(appPath +'/views')
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
if ( hasViews && typeof(files['views'].default.html) == 'undefined' ) {
|
|
809
|
-
files['views'].default.html = _(appPath +'/views/html')
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
if ( hasViews && typeof(files['views'].default.theme) == 'undefined' ) {
|
|
813
|
-
files['views'].default.theme = 'default_theme'
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
//Constants to be exposed in configuration files.
|
|
818
|
-
var reps = {
|
|
819
|
-
"gina" : getPath('gina').root,
|
|
820
|
-
"root" : conf[bundle][env].executionPath,
|
|
821
|
-
"env" : env,
|
|
822
|
-
"executionPath" : conf[bundle][env].executionPath,
|
|
823
|
-
"bundlesPath" : conf[bundle][env].bundlesPath,
|
|
824
|
-
"mountPath" : conf[bundle][env].mountPath,
|
|
825
|
-
"bundlePath" : conf[bundle][env].bundlePath,
|
|
826
|
-
"modelsPath" : conf[bundle][env].modelsPath,
|
|
827
|
-
"logsPath" : conf[bundle][env].logsPath,
|
|
828
|
-
"tmpPath" : conf[bundle][env].tmpPath,
|
|
829
|
-
"bundle" : bundle,
|
|
830
|
-
"host" : conf[bundle][env].host
|
|
831
|
-
};
|
|
832
|
-
|
|
833
|
-
if (hasViews && typeof(files['views'].default) != 'undefined') {
|
|
834
|
-
reps['views'] = files['views'].default.views;
|
|
835
|
-
reps['html'] = files['views'].default.html;
|
|
836
|
-
reps['theme'] = files['views'].default.theme;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
var ports = conf[bundle][env].port;
|
|
840
|
-
for (var p in ports) {
|
|
841
|
-
reps[p+'Port'] = ports[p]
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
var localEnv = conf[bundle][env].executionPath + '/env.local.json';
|
|
845
|
-
if ( env == 'dev' && fs.existsSync(localEnv) ) {
|
|
846
|
-
conf[bundle][env] = merge(conf[bundle][env], require(localEnv), true);
|
|
847
|
-
}
|
|
848
|
-
var envKeys = conf[bundle][env];
|
|
849
|
-
for (var k in envKeys) {
|
|
850
|
-
if ( typeof(envKeys[k]) != 'object' && typeof(envKeys[k]) != 'array' ) {
|
|
851
|
-
reps[k] = envKeys[k]
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
try {
|
|
857
|
-
//var corePath = getPath('gina.core');
|
|
858
|
-
var corePath = getPath('gina').core;
|
|
859
|
-
var settingsPath = _(corePath +'/template/conf/settings.json', true);
|
|
860
|
-
var staticsPath = _(corePath +'/template/conf/statics.json', true);
|
|
861
|
-
var viewsPath = _(corePath +'/template/conf/views.json', true);
|
|
862
|
-
|
|
863
|
-
if ( typeof(files['settings']) == 'undefined' ) {
|
|
864
|
-
files['settings'] = require(settingsPath)
|
|
865
|
-
} else if ( typeof(files['settings']) != 'undefined' ) {
|
|
866
|
-
var defaultSettings = require(settingsPath);
|
|
867
|
-
|
|
868
|
-
files['settings'] = merge(files['settings'], defaultSettings)
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
if (fs.existsSync(staticsPath))
|
|
872
|
-
delete require.cache[staticsPath];
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
if (hasViews && typeof(files['statics']) == 'undefined') {
|
|
876
|
-
files['statics'] = require(staticsPath)
|
|
877
|
-
} else if ( typeof(files['statics']) != 'undefined' ) {
|
|
878
|
-
var defaultAliases = require(staticsPath);
|
|
879
|
-
|
|
880
|
-
files['statics'] = merge(files['statics'], defaultAliases)
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
// public root directories
|
|
885
|
-
if (reps['views']) { // !== hasViews; you don't need views to access statics
|
|
886
|
-
var d = 0
|
|
887
|
-
, dirs = fs.readdirSync(reps['views'])
|
|
888
|
-
, statics = {};
|
|
889
|
-
// ignoring html (template) directory
|
|
890
|
-
dirs.splice(dirs.indexOf(new _(reps.html, true).toArray().last()), 1);
|
|
891
|
-
// making statics allowed directories
|
|
892
|
-
while ( d < dirs.length) {
|
|
893
|
-
if ( !/^\./.test(dirs[d]) && fs.lstatSync(_(reps.views +'/'+ dirs[d], true)).isDirectory() ) {
|
|
894
|
-
statics[dirs[d]] = _('{views}/'+dirs[d], true)
|
|
895
|
-
}
|
|
896
|
-
++d
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
if (hasWebRoot) {
|
|
900
|
-
var wrootKey = wroot.substr(1);
|
|
901
|
-
for (var p in files['statics']) {
|
|
902
|
-
files['statics'][wrootKey +'/'+ p] = files['statics'][p]
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
files['statics'] = merge(files['statics'], statics);
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
if (hasViews && typeof(files['views']) == 'undefined') {
|
|
911
|
-
files['views'] = require(viewsPath)
|
|
912
|
-
} else if ( typeof(files['views']) != 'undefined' ) {
|
|
913
|
-
var defaultViews = require(viewsPath);
|
|
914
|
-
|
|
915
|
-
files['views'] = merge(files['views'], defaultViews)
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
} catch (err) {
|
|
919
|
-
callback(err)
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
//webroot vs statics
|
|
925
|
-
if (// Please, don't add `hasViews` condition. You can download files without having views: like for a `webdrive` API
|
|
926
|
-
conf[bundle][env].server.webroot != '/' &&
|
|
927
|
-
typeof(files['statics']) != 'undefined'
|
|
928
|
-
) {
|
|
929
|
-
var newStatics = {}, _wroot = '';
|
|
930
|
-
if (!wroot) {
|
|
931
|
-
_wroot = ( conf[bundle][env].server.webroot.substr(0,1) == '/' ) ? conf[bundle][env].server.webroot.substr(1) : conf[bundle][env].server.webroot;
|
|
932
|
-
} else {
|
|
933
|
-
_wroot = ( wroot.substr(0,1) == '/' ) ? wroot.substr(1) : wroot;
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
var k;
|
|
937
|
-
for (var i in files['statics']) {
|
|
938
|
-
k = i;
|
|
939
|
-
if ( !(new RegExp(wroot)).test(i) ) {
|
|
940
|
-
|
|
941
|
-
// if (i.substr(0, 1) != '/') {
|
|
942
|
-
// i = '/' + i
|
|
943
|
-
// }
|
|
944
|
-
//newStatics[ _wroot + i] = files['statics'][k]
|
|
945
|
-
newStatics[i] = files['statics'][k]
|
|
946
|
-
} else {
|
|
947
|
-
newStatics[k] = files['statics'][k]
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
delete files['statics'][k]
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
files['statics'] = JSON.parse( JSON.stringify(newStatics) );
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
//webroot javascripts
|
|
957
|
-
if (hasViews &&
|
|
958
|
-
conf[bundle][env].server.webroot != '/' &&
|
|
959
|
-
typeof(files['views'].default.javascripts) != 'undefined'
|
|
960
|
-
) {
|
|
961
|
-
for (var v in files['views']) {
|
|
962
|
-
if (!files['views'][v].javascripts) continue;
|
|
963
|
-
for (var i=0; i<files['views'][v].javascripts.length; ++i) {
|
|
964
|
-
if (
|
|
965
|
-
files['views'][v].javascripts[i].substr(0,1) != '{' &&
|
|
966
|
-
!/\:\/\//.test(files['views'][v].javascripts[i])
|
|
967
|
-
) {
|
|
968
|
-
if (files['views'][v].javascripts[i].substr(0,1) != '/')
|
|
969
|
-
files['views'][v].javascripts[i] = '/'+files['views'][v].javascripts[i];
|
|
970
|
-
|
|
971
|
-
// support src like:
|
|
972
|
-
if (/^\/\//.test(files['views'][v].javascripts[i]) )
|
|
973
|
-
files['views'][v].javascripts[i] = files['views'][v].javascripts[i]
|
|
974
|
-
else
|
|
975
|
-
files['views'][v].javascripts[i] = conf[bundle][env].server.webroot + files['views'][v].javascripts[i]
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
}
|
|
981
|
-
//webroot stylesheets
|
|
982
|
-
if (hasViews &&
|
|
983
|
-
conf[bundle][env].server.webroot != '/' &&
|
|
984
|
-
typeof(files['views'].default.stylesheets) != 'undefined'
|
|
985
|
-
) {
|
|
986
|
-
for (var v in files['views']) {
|
|
987
|
-
if (!files['views'][v].stylesheets) continue;
|
|
988
|
-
for (var i=0; i<files['views'][v].stylesheets.length; ++i) {
|
|
989
|
-
if (
|
|
990
|
-
files['views'][v].stylesheets[i].substr(0,1) != '{' &&
|
|
991
|
-
!/\:\/\//.test(files['views'][v].stylesheets[i])
|
|
992
|
-
) {
|
|
993
|
-
if (files['views'][v].stylesheets[i].substr(0,1) != '/')
|
|
994
|
-
files['views'][v].stylesheets[i] = '/'+files['views'][v].stylesheets[i];
|
|
995
|
-
|
|
996
|
-
if (/^\/\//.test(files['views'][v].stylesheets[i]) )
|
|
997
|
-
files['views'][v].stylesheets[i] = files['views'][v].stylesheets[i]
|
|
998
|
-
else
|
|
999
|
-
files['views'][v].stylesheets[i] = conf[bundle][env].server.webroot + files['views'][v].stylesheets[i]
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
files = whisper(reps, files);
|
|
1006
|
-
|
|
1007
|
-
// loading forms rules
|
|
1008
|
-
if (hasViews && typeof(files['views'].default.forms) != 'undefined') {
|
|
1009
|
-
try {
|
|
1010
|
-
files['forms'] = loadForms(files['views'].default.forms)
|
|
1011
|
-
} catch (err) {
|
|
1012
|
-
callback(err)
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
// plugin loader (frontend framework)
|
|
1017
|
-
if ( hasViews && typeof(files['views'].default.pluginLoader) != 'undefined' ) {
|
|
1018
|
-
var loaderSrcPath = null;
|
|
1019
|
-
loaderSrcPath = files['views'].default.pluginLoader.replace(/(\{src\:|\})/g, '');
|
|
1020
|
-
try {
|
|
1021
|
-
// will get a buffer
|
|
1022
|
-
if (cacheless) {
|
|
1023
|
-
delete require.cache[_(loaderSrcPath, true)]
|
|
1024
|
-
}
|
|
1025
|
-
files['views'].default.pluginLoader = fs.readFileSync( _(loaderSrcPath, true))
|
|
1026
|
-
} catch (err) {
|
|
1027
|
-
callback(err)
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
|
-
if ( typeof(conf[bundle][env].content) == 'undefined') {
|
|
1032
|
-
conf[bundle][env].content = {}
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
conf[bundle][env].content = files;
|
|
1036
|
-
conf[bundle][env].bundle = bundle;
|
|
1037
|
-
if (bundle == self.startingApp)
|
|
1038
|
-
conf[bundle][env].bundles = self.getBundles();
|
|
1039
|
-
|
|
1040
|
-
conf[bundle][env].env = env;
|
|
1041
|
-
// this setting is replace on http requests by the value extracted form the request header
|
|
1042
|
-
conf[bundle][env].hostname = conf[bundle][env].protocol + '://' + conf[bundle][env].host + ':' + conf[bundle][env].port[conf[bundle][env].protocol];
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
self.envConf[bundle][env] = conf[bundle][env];
|
|
1046
|
-
++b;
|
|
1047
|
-
if (b < bundles.length) {
|
|
1048
|
-
loadBundleConfig(bundles, b, callback, reload, collectedRules)
|
|
1049
|
-
} else {
|
|
1050
|
-
callback(err, files, collectedRules)
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
var loadForms = function(formsDir) {
|
|
1055
|
-
var forms = { rules: {}}, cacheless = self.isCacheless(), root = '';
|
|
1056
|
-
|
|
1057
|
-
if ( fs.existsSync(formsDir) ) {
|
|
1058
|
-
root = ''+formsDir;
|
|
1059
|
-
// browsing dir
|
|
1060
|
-
var readDir = function (dir, forms, key) {
|
|
1061
|
-
var files = fs.readdirSync(dir)
|
|
1062
|
-
, filename = ''
|
|
1063
|
-
, k = null;
|
|
1064
|
-
|
|
1065
|
-
for (var i = 0, len = files.length; i < len; ++i) {
|
|
1066
|
-
if ( !/^\./.test(files[i]) ) {
|
|
1067
|
-
filename = _(dir + '/' + files[i], true);
|
|
1068
|
-
|
|
1069
|
-
if ( fs.statSync(filename).isDirectory() ) {
|
|
1070
|
-
key += dir.replace(root, '') +'/'+ files[i] + '/';
|
|
1071
|
-
k = key.split(/\//g);
|
|
1072
|
-
forms[k[k.length-2]] = {};
|
|
1073
|
-
|
|
1074
|
-
readDir( filename, forms[ k[k.length-2] ], key );
|
|
1075
|
-
|
|
1076
|
-
} else {
|
|
1077
|
-
|
|
1078
|
-
key = files[i].replace('.json', '').replace(/\-/g, '.');
|
|
1079
|
-
try {
|
|
1080
|
-
|
|
1081
|
-
if (cacheless) {
|
|
1082
|
-
delete require.cache[filename];
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
k = key.split(/\//g);
|
|
1086
|
-
forms[ k[k.length-1] ] = require(filename)
|
|
1087
|
-
|
|
1088
|
-
} catch(err) {
|
|
1089
|
-
throw new Error('[ ' +filename + ' ] is malformed !!')
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
};
|
|
1095
|
-
|
|
1096
|
-
readDir(formsDir, forms, '/')
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
return forms
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
/**
|
|
1103
|
-
* Load Apps Configuration
|
|
1104
|
-
*
|
|
1105
|
-
* TODO - simplify / optimize
|
|
1106
|
-
* */
|
|
1107
|
-
var loadBundlesConfiguration = function(callback) {
|
|
1108
|
-
//var bundles = self.getBundles();
|
|
1109
|
-
var bundles = self.getAllBundles();
|
|
1110
|
-
|
|
1111
|
-
loadBundleConfig(bundles, 0, callback)
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
/**
|
|
1115
|
-
* Check is cache is disabled
|
|
1116
|
-
*
|
|
1117
|
-
* @return {boolean} isUsingCache
|
|
1118
|
-
* */
|
|
1119
|
-
this.isCacheless = function() {
|
|
1120
|
-
var env = self.Env.get();//Config.instance.Env.get();
|
|
1121
|
-
//Also defined in core/gna.
|
|
1122
|
-
return (env == "dev" || env == "debug") ? true : false
|
|
1123
|
-
}
|
|
1124
|
-
/**
|
|
1125
|
-
* Refresh for cachless mode
|
|
1126
|
-
*
|
|
1127
|
-
* @param {string} bundle
|
|
1128
|
-
*
|
|
1129
|
-
* @callback callback
|
|
1130
|
-
* @param {boolean|string} err
|
|
1131
|
-
* */
|
|
1132
|
-
this.refresh = function(bundle, callback) {
|
|
1133
|
-
//Reload conf. who likes repetition ?
|
|
1134
|
-
loadBundleConfig(
|
|
1135
|
-
self.allBundles,
|
|
1136
|
-
0,
|
|
1137
|
-
function doneLoadingBundleConfig(err, files, routing) {
|
|
1138
|
-
if (!err) {
|
|
1139
|
-
callback(false, routing)
|
|
1140
|
-
} else {
|
|
1141
|
-
callback(err)
|
|
1142
|
-
}
|
|
1143
|
-
}, true)
|
|
1144
|
-
}//EO refresh.
|
|
1145
|
-
|
|
1146
|
-
/**
|
|
1147
|
-
* Reloading bundle model
|
|
1148
|
-
*
|
|
1149
|
-
* @param {string} bundle - bundle name
|
|
1150
|
-
* @callback {function} callback
|
|
1151
|
-
* @param {boolean} error
|
|
1152
|
-
* */
|
|
1153
|
-
this.refreshModels = function(bundle, env, callback) {
|
|
1154
|
-
var conf = self.envConf[bundle][env]
|
|
1155
|
-
//Reload models.
|
|
1156
|
-
, modelsPath = _(conf.modelsPath);
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
fs.exists(modelsPath, function(exists){
|
|
1160
|
-
if (exists && self.startingApp == conf.bundle) {
|
|
1161
|
-
modelUtil.reloadModels(
|
|
1162
|
-
conf,
|
|
1163
|
-
function doneReloadingModel(err) {
|
|
1164
|
-
callback(err)
|
|
1165
|
-
})
|
|
1166
|
-
} else {
|
|
1167
|
-
callback(false)
|
|
1168
|
-
}
|
|
1169
|
-
})
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
/**
|
|
1173
|
-
* Setting routing for non dev env
|
|
1174
|
-
*
|
|
1175
|
-
* @param {object} routing
|
|
1176
|
-
* */
|
|
1177
|
-
this.setRouting = function(bundle, env, routing) {
|
|
1178
|
-
if (!self.envConf[bundle][env].content)
|
|
1179
|
-
self.envConf[bundle][env].content = {};
|
|
1180
|
-
|
|
1181
|
-
self.envConf[bundle][env].content.routing = routing;
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
this.getRouting = function(bundle, env) {
|
|
1185
|
-
var routing = self.envConf[bundle][env].content.routing;
|
|
1186
|
-
|
|
1187
|
-
return routing;
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
|
-
this.setReverseRouting = function(bundle, env, reverseRouting) {
|
|
1191
|
-
self.envConf[bundle][env].content.reverseRouting = reverseRouting
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1194
|
-
if (!opt) {
|
|
1195
|
-
|
|
1196
|
-
this.setBundles = function(bundles) {
|
|
1197
|
-
self.bundles = bundles
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
if (Config.instance)
|
|
1201
|
-
return Config.instance;
|
|
1202
|
-
|
|
1203
|
-
} else {
|
|
1204
|
-
|
|
1205
|
-
//Defined before init.
|
|
1206
|
-
var env = opt.env, _ready = {err:'not ready', val: null};
|
|
1207
|
-
|
|
1208
|
-
this.env = opt.env;
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
this.onReady = function(callback) {
|
|
1212
|
-
self.once('complete', function(err, config) {
|
|
1213
|
-
callback(err, config)
|
|
1214
|
-
})
|
|
1215
|
-
return self
|
|
1216
|
-
};
|
|
1217
|
-
|
|
1218
|
-
init(opt)
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
return this
|
|
1222
|
-
};
|
|
1223
|
-
|
|
1224
|
-
Config = inherits(Config, EventEmitter);
|
|
1225
|
-
module.exports = Config
|