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
|
@@ -0,0 +1,1070 @@
|
|
|
1
|
+
//"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This file is part of the gina package.
|
|
4
|
+
* Copyright (c) 2009-2022 Rhinostone <contact@gina.io>
|
|
5
|
+
*
|
|
6
|
+
* For the full copyright and license information, please view the LICENSE
|
|
7
|
+
* file that was distributed with this source code.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Gina Core Bootstrap
|
|
12
|
+
*
|
|
13
|
+
* @package Gina
|
|
14
|
+
* @author Rhinostone <contact@gina.io>
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
var fs = require('fs');
|
|
18
|
+
const { promisify } = require('util');
|
|
19
|
+
var EventEmitter = require('events').EventEmitter;
|
|
20
|
+
var e = new EventEmitter();
|
|
21
|
+
|
|
22
|
+
// by default
|
|
23
|
+
var gna = {
|
|
24
|
+
core:{},
|
|
25
|
+
os:{}
|
|
26
|
+
};
|
|
27
|
+
var Config = require('./config');
|
|
28
|
+
var config = null;
|
|
29
|
+
// helpers were previously loaded
|
|
30
|
+
|
|
31
|
+
var lib = require('./../lib');
|
|
32
|
+
|
|
33
|
+
var console = lib.logger;
|
|
34
|
+
var Proc = lib.Proc;
|
|
35
|
+
var locales = require('./locales');
|
|
36
|
+
var plugins = require('./../core/plugins');
|
|
37
|
+
var modelUtil = new lib.Model();
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
gna.initialized = process.initialized = false;
|
|
42
|
+
gna.routed = process.routed = false;
|
|
43
|
+
|
|
44
|
+
gna.utils = lib;
|
|
45
|
+
gna.locales = locales;
|
|
46
|
+
gna.plugins = plugins;
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
// BO cooking..
|
|
50
|
+
|
|
51
|
+
var isLoadedThroughCLI = false; // with gina
|
|
52
|
+
var isLoadedThroughWorker = false;
|
|
53
|
+
|
|
54
|
+
//copy & backup for utils/cmd/app.js.
|
|
55
|
+
var tmp = JSON.clone(process.argv); // by default
|
|
56
|
+
var projectName = null;
|
|
57
|
+
|
|
58
|
+
// filter $ node.. o $ gina with or without env
|
|
59
|
+
if (process.argv.length >= 3 /**&& /gina$/.test(process.argv[1])*/ ) {
|
|
60
|
+
|
|
61
|
+
var ctxObj = null;
|
|
62
|
+
if ( /(child)\.js$/.test(tmp[1]) ) { // required under a worker
|
|
63
|
+
|
|
64
|
+
isLoadedThroughWorker = true;
|
|
65
|
+
var ctxFilename = null;
|
|
66
|
+
|
|
67
|
+
for (var a = 0, aLen = tmp.length; a < aLen; ++a) {
|
|
68
|
+
|
|
69
|
+
if (/^--argv-filename=/.test(tmp[a])) {
|
|
70
|
+
ctxFilename = tmp[a].split(/=/)[1];
|
|
71
|
+
console.debug('[ FRAMEWORK ] Found context file `' + ctxFilename +'`' );
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
if (ctxFilename) {
|
|
78
|
+
|
|
79
|
+
setContext('argvFilename', _(ctxFilename, true));
|
|
80
|
+
|
|
81
|
+
var importedContext = JSON.parse( fs.readFileSync(_(ctxFilename, true)) );
|
|
82
|
+
|
|
83
|
+
tmp[2] = {};
|
|
84
|
+
tmp[2].paths = importedContext.paths;
|
|
85
|
+
tmp[2].envVars = importedContext.envVars;
|
|
86
|
+
tmp[2].processList = importedContext.processList;
|
|
87
|
+
tmp[2].ginaProcess = importedContext.ginaProcess;
|
|
88
|
+
tmp[2].debugPort = importedContext.debugPort;
|
|
89
|
+
|
|
90
|
+
tmp[3] = importedContext.project || importedContext.config.projectName;
|
|
91
|
+
tmp[4] = importedContext.bundle;
|
|
92
|
+
|
|
93
|
+
setContext('env', importedContext.env);
|
|
94
|
+
setContext('bundles', importedContext.bundles);
|
|
95
|
+
setContext('debugPort', importedContext.debugPort);
|
|
96
|
+
|
|
97
|
+
ctxObj = tmp[2];
|
|
98
|
+
|
|
99
|
+
} else {
|
|
100
|
+
throw new Error('[ FRAMEWORK ] No *.ctx file found to import context !')
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
isLoadedThroughCLI = true;
|
|
104
|
+
ctxObj = JSON.parse(tmp[2]);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
try {
|
|
109
|
+
|
|
110
|
+
require(ctxObj.paths.gina.root + '/utils/helper');
|
|
111
|
+
|
|
112
|
+
setContext('paths', ctxObj.paths);//And so on if you need to.
|
|
113
|
+
|
|
114
|
+
setContext('processList', ctxObj.processList);
|
|
115
|
+
setContext('ginaProcess', ctxObj.ginaProcess);
|
|
116
|
+
setContext('debugPort', ctxObj.debugPort);
|
|
117
|
+
|
|
118
|
+
projectName = tmp[3];
|
|
119
|
+
setContext('projectName', projectName);
|
|
120
|
+
setContext('bundle', tmp[4]);
|
|
121
|
+
|
|
122
|
+
var obj = ctxObj.envVars;
|
|
123
|
+
var evar = '';
|
|
124
|
+
|
|
125
|
+
if ( typeof(obj) != 'undefined') {
|
|
126
|
+
|
|
127
|
+
for (var a in obj) {
|
|
128
|
+
|
|
129
|
+
if (
|
|
130
|
+
a.substr(0, 5) === 'GINA_'
|
|
131
|
+
|| a.substr(0, 7) === 'VENDOR_'
|
|
132
|
+
|| a.substr(0, 5) === 'USER_'
|
|
133
|
+
) {
|
|
134
|
+
evar = obj[a];
|
|
135
|
+
|
|
136
|
+
//Boolean values.
|
|
137
|
+
|
|
138
|
+
if (obj[a] === "true") {
|
|
139
|
+
evar = true
|
|
140
|
+
}
|
|
141
|
+
if (obj[a] === "false") {
|
|
142
|
+
evar = false
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
setEnvVar(a, evar, true)
|
|
146
|
+
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
}
|
|
150
|
+
defineDefault(obj)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
//Cleaning process argv.
|
|
155
|
+
if (isLoadedThroughCLI )
|
|
156
|
+
process.argv.splice(2);
|
|
157
|
+
|
|
158
|
+
} catch (error) {
|
|
159
|
+
console.error('[ FRAMEWORK ][ configurationError ] ', error.stack || error.message || error);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
tmp = null;
|
|
164
|
+
|
|
165
|
+
setPath( 'node', _(process.argv[0]) );
|
|
166
|
+
|
|
167
|
+
var ginaPath = null;
|
|
168
|
+
try {
|
|
169
|
+
ginaPath = getPath('gina').core;
|
|
170
|
+
} catch(err) {
|
|
171
|
+
ginaPath = _(__dirname);
|
|
172
|
+
setPath('gina.core', ginaPath);
|
|
173
|
+
ginaPath = getPath('gina').core;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if ( typeof(getEnvVar) == 'undefined') {
|
|
177
|
+
console.debug('[ FRAMEWORK ][PROCESS ARGV] Process ARGV error ' + process.argv);
|
|
178
|
+
}
|
|
179
|
+
//console.debug('[ FRAMEWORK ] GINA_HOMEDIR ' + getEnvVar('GINA_HOMEDIR') );
|
|
180
|
+
|
|
181
|
+
var projects = require( _(GINA_HOMEDIR + '/projects.json') );
|
|
182
|
+
var root = projects[projectName].path;
|
|
183
|
+
|
|
184
|
+
gna.executionPath = root;
|
|
185
|
+
setPath('project', root);
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
setContext('gina.utils', lib);
|
|
190
|
+
setContext('gina.Config', Config);
|
|
191
|
+
setContext('gina.locales', locales);
|
|
192
|
+
setContext('gina.plugins', plugins);
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
//Setting env.
|
|
197
|
+
var env = process.env.NODE_ENV || projects[projectName]['def_env']
|
|
198
|
+
, isDev = (env === projects[projectName]['dev_env']) ? true: false
|
|
199
|
+
, isLocalScope = (projects[projectName]['local_scope'] === projects[projectName]['def_scope']) ? true: false
|
|
200
|
+
;
|
|
201
|
+
|
|
202
|
+
gna.env = process.env.NODE_ENV = env;
|
|
203
|
+
gna.os.isWin32 = process.env.isWin32 = isWin32;
|
|
204
|
+
gna.isAborting = false;
|
|
205
|
+
//Cahceless is also defined in the main config : Config::isCacheless().
|
|
206
|
+
process.env.NODE_ENV_IS_DEV = (/^true$/i.test(isDev)) ? true : false;
|
|
207
|
+
process.env.NODE_SCOPE = projects[projectName]['def_scope'];
|
|
208
|
+
process.env.NODE_SCOPE_IS_LOCAL = (/^true$/i.test(isLocalScope)) ? true : false;
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
var bundlesPath = (isDev) ? projects[projectName]['path'] + '/src' : projects[projectName]['path'] + '/bundles';
|
|
212
|
+
setPath('bundles', _(bundlesPath, true));
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
var Router = require('./router');
|
|
216
|
+
setContext('gina.Router', Router);
|
|
217
|
+
//TODO require('./server').http
|
|
218
|
+
//TODO - HTTP vs HTTPS
|
|
219
|
+
var Server = require('./server');
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
var p = new _(process.argv[1]).toUnixStyle().split("/");
|
|
223
|
+
var isSym = false;
|
|
224
|
+
var path;
|
|
225
|
+
|
|
226
|
+
var isPath = (/\//).test(process.argv[1]) || (/\\/).test(process.argv[1]);
|
|
227
|
+
if (!isPath) {
|
|
228
|
+
//lequel ?
|
|
229
|
+
try {
|
|
230
|
+
isSym = fs.lstatSync( _(bundlesPath +'/'+ process.argv[1]) ).isSymbolicLink();
|
|
231
|
+
} catch (err) {
|
|
232
|
+
//Did not find it ^^.
|
|
233
|
+
}
|
|
234
|
+
} else {
|
|
235
|
+
process.argv[1] = _(process.argv[1]);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
// Todo - load from env.json or locals or manifest.json ??
|
|
240
|
+
/**
|
|
241
|
+
* abort
|
|
242
|
+
*
|
|
243
|
+
* @param {string|object} err
|
|
244
|
+
* @param {string} [bunlde]
|
|
245
|
+
*/
|
|
246
|
+
var abort = function(err, bundle) {
|
|
247
|
+
gna.isAborting = true;
|
|
248
|
+
if (
|
|
249
|
+
process.argv[2] == '-s' && isLoadedThroughCLI
|
|
250
|
+
|| process.argv[2] == '--start' && isLoadedThroughCLI
|
|
251
|
+
//Avoid -h, -v ....
|
|
252
|
+
|| !isLoadedThroughCLI && isPath && process.argv.length > 3
|
|
253
|
+
|
|
254
|
+
) {
|
|
255
|
+
if (isPath && !isLoadedThroughCLI) {
|
|
256
|
+
console.emerg('[ FRAMEWORK ] You are trying to load gina by hand: just make sure that your env ['+env+'] matches the given path ['+ path +']\n'+ (err.stack||err));
|
|
257
|
+
} else if ( typeof(err.stack) != 'undefined' ) {
|
|
258
|
+
console.emerg('[ FRAMEWORK ] Gina could not determine which bundle to load: ' + err +' ['+env+']' + '\n' + err.stack);
|
|
259
|
+
} else {
|
|
260
|
+
console.emerg('[ FRAMEWORK ] Gina could not determine which bundle to load: ' + err +' ['+env+']');
|
|
261
|
+
}
|
|
262
|
+
} else {
|
|
263
|
+
console.emerg(err.stack||err);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
process.exit(1);
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
gna.emit = e.emit;
|
|
270
|
+
gna.started = false;
|
|
271
|
+
|
|
272
|
+
var isBundleMounted = function(projects, bundlesPath, bundle, cb) {
|
|
273
|
+
var isMounted = false
|
|
274
|
+
, env = process.env.NODE_ENV
|
|
275
|
+
, manisfestPath = null
|
|
276
|
+
, manifest = null
|
|
277
|
+
, project = projects[projectName]
|
|
278
|
+
;
|
|
279
|
+
// supported envs
|
|
280
|
+
setContext('envs', project.envs);
|
|
281
|
+
|
|
282
|
+
// skip this step for workers
|
|
283
|
+
if (isLoadedThroughWorker) {
|
|
284
|
+
return cb(false)
|
|
285
|
+
}
|
|
286
|
+
try {
|
|
287
|
+
manisfestPath = _(project.path + '/manifest.json', true);
|
|
288
|
+
manifest = requireJSON(manisfestPath);
|
|
289
|
+
|
|
290
|
+
if ( !new _(manisfestPath).existsSync() ) {
|
|
291
|
+
throw new Error('Manifest not found in your project `'+ projectName +'`')
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
isMounted = new _( project.path +'/'+ manifest.bundles[bundle].link ).existsSync();
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
} catch (err) {
|
|
298
|
+
console.emerg(err);
|
|
299
|
+
return cb(err);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
console.debug('Is `'+ bundle +'` mounted ?', isMounted);
|
|
303
|
+
if (!gna.started && isMounted) {
|
|
304
|
+
new _( project.path +'/'+ manifest.bundles[bundle].link ).rmSync();
|
|
305
|
+
isMounted = false;
|
|
306
|
+
}
|
|
307
|
+
if (!isMounted) {
|
|
308
|
+
var source = null, linkPath = null;
|
|
309
|
+
try {
|
|
310
|
+
source = (isDev) ? _( root +'/'+manifest.bundles[bundle].src) : _( root +'/'+ manifest.bundles[bundle].releases[env].target );
|
|
311
|
+
linkPath = _( root +'/'+ manifest.bundles[bundle].link );
|
|
312
|
+
console.debug('Mounting bundle `'+ bundle +'` to : ', linkPath);
|
|
313
|
+
} catch (err) {
|
|
314
|
+
return cb(err)
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
gna.mount(bundlesPath, source, linkPath, cb)
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Get project conf from manifest.json
|
|
329
|
+
*
|
|
330
|
+
*
|
|
331
|
+
* @param {function} callback
|
|
332
|
+
* @returns {object} data - Result conf object
|
|
333
|
+
* */
|
|
334
|
+
gna.getProjectConfiguration = function (callback){
|
|
335
|
+
|
|
336
|
+
var modulesPackage = _(root + '/manifest.json');
|
|
337
|
+
var project = {}
|
|
338
|
+
, bundles = [];
|
|
339
|
+
|
|
340
|
+
//console.debug('modulesPackage ', modulesPackage, fs.existsSync(modulesPackage));
|
|
341
|
+
//Merging with existing;
|
|
342
|
+
if ( fs.existsSync(modulesPackage) ) {
|
|
343
|
+
try {
|
|
344
|
+
|
|
345
|
+
var dep = require(modulesPackage);
|
|
346
|
+
//console.log('ENV: ', env );
|
|
347
|
+
//console.log('PROCESS: ', process.argv );
|
|
348
|
+
//console.log(" now loading....", modulesPackage);
|
|
349
|
+
//console.log('content ', dep);
|
|
350
|
+
if ( typeof(dep['bundles']) == "undefined") {
|
|
351
|
+
dep['bundles'] = {};
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
if (
|
|
355
|
+
typeof(dep['bundles']) != "undefined"
|
|
356
|
+
&& typeof(project['bundles']) != "undefined"
|
|
357
|
+
) {
|
|
358
|
+
|
|
359
|
+
for (var d in dep) {
|
|
360
|
+
|
|
361
|
+
if (d == 'bundles') {
|
|
362
|
+
for (var p in dep[d]) {
|
|
363
|
+
project['bundles'][p] = dep['bundles'][p];
|
|
364
|
+
}
|
|
365
|
+
} else {
|
|
366
|
+
project[d] = dep[d];
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
}
|
|
370
|
+
} else {
|
|
371
|
+
project = dep;
|
|
372
|
+
}
|
|
373
|
+
gna.project = project;
|
|
374
|
+
|
|
375
|
+
var bundle = getContext('bundle');
|
|
376
|
+
var bundlePath = getPath('project') + '/';
|
|
377
|
+
bundlePath += ( isDev ) ? project.bundles[ bundle ].src : project.bundles[ bundle ].link;
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
for (var b in project.bundles) {
|
|
381
|
+
bundles.push(b)
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
setContext('env', env);
|
|
385
|
+
setContext('bundles', bundles);
|
|
386
|
+
setPath('bundle', _(bundlePath, true));
|
|
387
|
+
setPath('helpers', _(bundlePath+'/helpers', true));
|
|
388
|
+
setPath('lib', _(bundlePath+'/lib', true));
|
|
389
|
+
setPath('models', _(bundlePath+'/models', true));
|
|
390
|
+
setPath('controllers', _(bundlePath+'/controllers', true));
|
|
391
|
+
|
|
392
|
+
callback(false, project);
|
|
393
|
+
} catch (err) {
|
|
394
|
+
gna.project = project;
|
|
395
|
+
callback(err);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
} else {
|
|
399
|
+
console.warn('[ FRAMEWORK ] Missing project !');
|
|
400
|
+
gna.project = project;
|
|
401
|
+
callback(false, project);
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* mount release => bundle
|
|
407
|
+
* @param {string} source
|
|
408
|
+
* @param {string} target
|
|
409
|
+
* @param {string} type
|
|
410
|
+
*
|
|
411
|
+
* @callback callback
|
|
412
|
+
* @param {boolean|string} err
|
|
413
|
+
* */
|
|
414
|
+
gna.mount = process.mount = function(bundlesPath, source, target, type, callback){
|
|
415
|
+
if ( typeof(type) == 'function') {
|
|
416
|
+
callback = type;
|
|
417
|
+
type = 'dir';
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
//creating folders.
|
|
422
|
+
//use junction when using Win XP os.release == '5.1.2600'
|
|
423
|
+
var mountingPath = getPath('project') + '/bundles';
|
|
424
|
+
console.debug('mounting path: ', mountingPath);
|
|
425
|
+
if ( !fs.existsSync(mountingPath) ) {
|
|
426
|
+
new _(mountingPath).mkdirSync();
|
|
427
|
+
}
|
|
428
|
+
var tmpPath = getPath('project') + '/tmp';
|
|
429
|
+
console.debug('tmp path: ', tmpPath);
|
|
430
|
+
if ( !fs.existsSync(tmpPath) ) {
|
|
431
|
+
new _(tmpPath).mkdirSync();
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
var isSourceFound = fs.existsSync(source)
|
|
435
|
+
, isTargetFound = fs.existsSync(target)
|
|
436
|
+
;
|
|
437
|
+
console.debug('[ FRAMEWORK ][ MOUNT ] Source: ', source);
|
|
438
|
+
console.debug('[ FRAMEWORK ][ MOUNT ] Checking before mounting ', target, isTargetFound, bundlesPath);
|
|
439
|
+
if ( isTargetFound ) {
|
|
440
|
+
try {
|
|
441
|
+
console.debug('[ FRAMEWORK ][ MOUNT ] removing old build ', target);
|
|
442
|
+
fs.unlinkSync(target)
|
|
443
|
+
} catch (err) {
|
|
444
|
+
callback(err)
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// hack to test none-dev env without building: in case you did not build your bundle, but you have the src available
|
|
449
|
+
if (!isSourceFound && !isDev) {
|
|
450
|
+
var srcPathObj = new _( root +'/'+ gna.project.bundles[gna.core.startingApp].src);
|
|
451
|
+
if ( srcPathObj.existsSync() ) {
|
|
452
|
+
var d =(d = _(source).split(/\//g)).splice(0, d.length-1).join('/');
|
|
453
|
+
var destinationObj = new _(d);
|
|
454
|
+
if (!destinationObj.existsSync()) {
|
|
455
|
+
destinationObj.mkdirSync();
|
|
456
|
+
}
|
|
457
|
+
srcPathObj.symlinkSync(_(source));
|
|
458
|
+
isSourceFound = true;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
if ( isSourceFound ) {
|
|
463
|
+
//will override existing each time you restart.
|
|
464
|
+
gna.utils.generator.createPathSync(bundlesPath, function onPathCreated(err){
|
|
465
|
+
if (!err) {
|
|
466
|
+
try {
|
|
467
|
+
var targetObj = new _(target);
|
|
468
|
+
if ( targetObj.existsSync() ) {
|
|
469
|
+
targetObj.rmSync();
|
|
470
|
+
}
|
|
471
|
+
if ( type != undefined)
|
|
472
|
+
fs.symlinkSync(source, target, type)
|
|
473
|
+
else
|
|
474
|
+
fs.symlinkSync(source, target);
|
|
475
|
+
|
|
476
|
+
// symlink created
|
|
477
|
+
callback(false);
|
|
478
|
+
|
|
479
|
+
} catch (err) {
|
|
480
|
+
if (err) {
|
|
481
|
+
console.emerg('[ FRAMEWORK ] '+ (err.stack||err.message));
|
|
482
|
+
process.exit(1)
|
|
483
|
+
}
|
|
484
|
+
if ( fs.existsSync(target) ) {
|
|
485
|
+
var stats = fs.lstatSync(target);
|
|
486
|
+
if ( stats.isDirectory() ) {
|
|
487
|
+
var d = new _(target).rm( function(err){
|
|
488
|
+
callback(err);
|
|
489
|
+
})
|
|
490
|
+
} else {
|
|
491
|
+
fs.unlinkSync(target);
|
|
492
|
+
callback(err)
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
} else {
|
|
497
|
+
console.error(err);
|
|
498
|
+
callback(err)
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
} else {
|
|
502
|
+
// Means that it did not find the release. Build and re mount.
|
|
503
|
+
callback( new Error('[ FRAMEWORK ] Did not find a release to mount from: '+ source) )
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
// mounting bundle if needed
|
|
509
|
+
isBundleMounted(projects, bundlesPath, getContext('bundle'), function onBundleMounted(err) {
|
|
510
|
+
if (err) {
|
|
511
|
+
return abort(err);
|
|
512
|
+
}
|
|
513
|
+
// get configuration
|
|
514
|
+
gna.getProjectConfiguration( async function onGettingProjectConfig(err, project) {
|
|
515
|
+
|
|
516
|
+
if (err) console.error(err.stack);
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* On middleware initialization
|
|
520
|
+
*
|
|
521
|
+
* @callback callback
|
|
522
|
+
*
|
|
523
|
+
* */
|
|
524
|
+
gna.onInitialize = process.onInitialize = function(callback) {
|
|
525
|
+
|
|
526
|
+
gna.initialized = true;
|
|
527
|
+
e.once('init', function(instance, middleware, conf) {
|
|
528
|
+
|
|
529
|
+
var configuration = config.getInstance();
|
|
530
|
+
|
|
531
|
+
modelUtil.loadAllModels(
|
|
532
|
+
conf.bundles,
|
|
533
|
+
configuration,
|
|
534
|
+
env,
|
|
535
|
+
function() {
|
|
536
|
+
|
|
537
|
+
joinContext(conf.contexts);
|
|
538
|
+
gna.getConfig = function(name){
|
|
539
|
+
var tmp = '';
|
|
540
|
+
if ( typeof(name) != 'undefined' ) {
|
|
541
|
+
try {
|
|
542
|
+
//Protect it.
|
|
543
|
+
// tmp = JSON.stringify(conf.content[name]);
|
|
544
|
+
// return JSON.parse(tmp)
|
|
545
|
+
return JSON.clone(conf.content[name])
|
|
546
|
+
} catch (err) {
|
|
547
|
+
console.error('[ FRAMEWORK ] ', err.stack);
|
|
548
|
+
return undefined
|
|
549
|
+
}
|
|
550
|
+
} else {
|
|
551
|
+
// tmp = JSON.stringify(conf);
|
|
552
|
+
// return JSON.parse(tmp)
|
|
553
|
+
return JSON.clone(conf)
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
try {
|
|
557
|
+
//configureMiddleware(instance, express); // no, no and no...
|
|
558
|
+
callback(e, instance, middleware)
|
|
559
|
+
} catch (err) {
|
|
560
|
+
// TODO Output this to the error logger.
|
|
561
|
+
console.error('[ FRAMEWORK ] Could not complete initialization: ', err.stack)
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
})// EO modelUtil
|
|
565
|
+
|
|
566
|
+
})
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* On Server started
|
|
571
|
+
*
|
|
572
|
+
* @callback callback
|
|
573
|
+
*
|
|
574
|
+
* */
|
|
575
|
+
gna.onStarted = process.onStarted = function(callback) {
|
|
576
|
+
|
|
577
|
+
gna.started = true;
|
|
578
|
+
e.once('server#started', function(conf){
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
// open default browser for dev env only
|
|
582
|
+
// if ( isDev) {
|
|
583
|
+
// var payload = JSON.stringify({
|
|
584
|
+
// code : 200,
|
|
585
|
+
// command : "open"
|
|
586
|
+
// });
|
|
587
|
+
|
|
588
|
+
// if (self.ioClient) { // if client has already made connexion
|
|
589
|
+
// payload.command = "reload"
|
|
590
|
+
// } else {
|
|
591
|
+
// // get default home
|
|
592
|
+
// // helper/task::run() should be triggered from ioClient
|
|
593
|
+
// //run('open', [conf.hostname + conf.server.webroot])
|
|
594
|
+
// }
|
|
595
|
+
// }
|
|
596
|
+
|
|
597
|
+
// will start watchers from here
|
|
598
|
+
callback()
|
|
599
|
+
})
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
gna.onRouting = process.onRouting = function(callback) {
|
|
603
|
+
|
|
604
|
+
gna.routed = true;
|
|
605
|
+
e.once('route', function(request, response, next, params) {
|
|
606
|
+
|
|
607
|
+
try {
|
|
608
|
+
callback(e, request, response, next, params)
|
|
609
|
+
} catch (err) {
|
|
610
|
+
// TODO Output this to the error logger.
|
|
611
|
+
console.error('[ FRAMEWORK ] Could not complete routing: ', err.stack)
|
|
612
|
+
}
|
|
613
|
+
})
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
gna.getShutdownConnector = process.getShutdownConnector = function(callback) {
|
|
617
|
+
var connPath = _(bundlesPath +'/'+ appName + '/config/connector.json');
|
|
618
|
+
fs.readFile(connPath, function onRead(err, content) {
|
|
619
|
+
try {
|
|
620
|
+
callback(err, JSON.parse(content).httpClient.shutdown)
|
|
621
|
+
} catch (err) {
|
|
622
|
+
callback(err)
|
|
623
|
+
}
|
|
624
|
+
})
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
gna.onError = process.onError = function(callback) {
|
|
628
|
+
gna.errorCatched = true;
|
|
629
|
+
e.on('error', function(err, request, response, next) {
|
|
630
|
+
|
|
631
|
+
callback(err, request, response, next)
|
|
632
|
+
})
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
gna.getShutdownConnectorSync = process.getShutdownConnectorSync = function() {
|
|
636
|
+
var connPath = _(bundlesPath +'/'+ appName + '/config/connector.json');
|
|
637
|
+
try {
|
|
638
|
+
var content = fs.readFileSync(connPath);
|
|
639
|
+
return JSON.parse(content).httpClient.shutdown
|
|
640
|
+
} catch (err) {
|
|
641
|
+
return undefined
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
gna.getMountedBundles = process.getMountedBundles = function(callback) {
|
|
646
|
+
fs.readdir(bundlesPath, function onRead(err, files) {
|
|
647
|
+
callback(err, files)
|
|
648
|
+
})
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
gna.getMountedBundlesSync = process.getMountedBundlesSync = function() {
|
|
652
|
+
try {
|
|
653
|
+
return fs.readdirSync(bundlesPath)
|
|
654
|
+
} catch (err) {
|
|
655
|
+
return err.stack
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
gna.getRunningBundlesSync = process.getRunningBundlesSync = function() {
|
|
660
|
+
|
|
661
|
+
//TODO - Do that thru IPC or thru socket. ???
|
|
662
|
+
var pidPath = _(getPath('globalTmpPath') +'/pid');
|
|
663
|
+
var files = fs.readdirSync(pidPath);
|
|
664
|
+
|
|
665
|
+
var name = '';
|
|
666
|
+
var indexTmp = null;
|
|
667
|
+
|
|
668
|
+
var content = [];
|
|
669
|
+
var contentGina = [];
|
|
670
|
+
var shutdown = [];
|
|
671
|
+
var shutdownGina = [];
|
|
672
|
+
|
|
673
|
+
var bundleGinaPid = getContext('ginaProcess');
|
|
674
|
+
|
|
675
|
+
//Sort Bundle / Gina instance to get a array [BUNDLE,GINA,SHUTDOWN,GINASHUTDOWN].
|
|
676
|
+
for (var f=0; f<files.length; ++f) {
|
|
677
|
+
|
|
678
|
+
name = fs.readFileSync( _(pidPath +'/'+ files[f]) ).toString();
|
|
679
|
+
|
|
680
|
+
if ( name == "shutdown" ) {
|
|
681
|
+
shutdown[0] = {};
|
|
682
|
+
shutdown[0]['pid'] = files[f];
|
|
683
|
+
shutdown[0]['name'] = name;
|
|
684
|
+
shutdown[0]['path'] = _(pidPath +'/'+ files[f]);
|
|
685
|
+
} else if ( files[f] == bundleGinaPid ){
|
|
686
|
+
shutdownGina[0] = {};
|
|
687
|
+
shutdownGina[0]['pid'] = files[f];
|
|
688
|
+
shutdownGina[0]['name'] = name;
|
|
689
|
+
shutdownGina[0]['path'] = _(pidPath +'/'+ files[f]);
|
|
690
|
+
} else if ( name == "gina" ) {
|
|
691
|
+
indexTmp = contentGina.length;
|
|
692
|
+
contentGina[indexTmp] = {};
|
|
693
|
+
contentGina[indexTmp]['pid'] = files[f];
|
|
694
|
+
contentGina[indexTmp]['name'] = name;
|
|
695
|
+
contentGina[indexTmp]['path'] = _(pidPath +'/'+ files[f]);
|
|
696
|
+
} else {
|
|
697
|
+
indexTmp = content.length;
|
|
698
|
+
content[indexTmp] = {};
|
|
699
|
+
content[indexTmp]['pid'] = files[f];
|
|
700
|
+
content[indexTmp]['name'] = name;
|
|
701
|
+
content[indexTmp]['path'] = _(pidPath +'/'+ files[f]);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
//Remove GINA instance, avoid killing gina bundle before/while bundle is remove.
|
|
706
|
+
//Bundle kill/remove gina instance himself.
|
|
707
|
+
//content = content.concat(contentGina);
|
|
708
|
+
content = content.concat(shutdown);
|
|
709
|
+
content = content.concat(shutdownGina);
|
|
710
|
+
|
|
711
|
+
return content
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
gna.getVersion = process.getVersion = function(bundle) {
|
|
715
|
+
var name = bundle || appName;
|
|
716
|
+
name = name.replace(/gina: /, '');
|
|
717
|
+
|
|
718
|
+
if ( name != undefined) {
|
|
719
|
+
try {
|
|
720
|
+
var str = fs.readFileSync( _(bundlesPath + '/' + bundle + '/config/app.json') ).toString();
|
|
721
|
+
var version = JSON.parse(str).version;
|
|
722
|
+
return version
|
|
723
|
+
} catch (err) {
|
|
724
|
+
return err
|
|
725
|
+
}
|
|
726
|
+
} else {
|
|
727
|
+
return undefined
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Start server
|
|
733
|
+
*
|
|
734
|
+
* @param {string} [executionPath]
|
|
735
|
+
* */
|
|
736
|
+
gna.start = process.start = function() { //TODO - Add protocol in arguments
|
|
737
|
+
|
|
738
|
+
var core = gna.core;
|
|
739
|
+
//Get bundle name.
|
|
740
|
+
if (appName == undefined) {
|
|
741
|
+
appName = getContext('bundle')
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
if (projectName == undefined) {
|
|
745
|
+
projectName = getContext('projectName')
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
core.projectName = projectName;
|
|
750
|
+
core.startingApp = appName; // bundleName
|
|
751
|
+
core.executionPath = root;
|
|
752
|
+
core.ginaPath = ginaPath;
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
//Inherits parent (gina) context.
|
|
756
|
+
if ( typeof(process.argv[3]) != 'undefined' ) {
|
|
757
|
+
setContext( JSON.parse(process.argv[3]) )
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
//check here for mount point source...
|
|
761
|
+
// if ( typeof(project.bundles[core.startingApp].version) == 'undefined' && typeof(project.bundles[core.startingApp].tag) != 'undefined') {
|
|
762
|
+
// project.bundles[core.startingApp].version = project.bundles[core.startingApp].tag
|
|
763
|
+
// }
|
|
764
|
+
// project.bundles[core.startingApp].releases[env].target = 'releases/'+ core.startingApp +'/' + env +'/'+ project.bundles[core.startingApp].version;
|
|
765
|
+
// var source = (isDev) ? _( root +'/'+project.bundles[core.startingApp].src) : _( root +'/'+ project.bundles[core.startingApp].releases[env].target );
|
|
766
|
+
// var linkPath = _( root +'/'+ project.bundles[core.startingApp].link );
|
|
767
|
+
// console.debug('Mounting bundle `'+ appName +'` to : ', linkPath);
|
|
768
|
+
// gna.mount( bundlesPath, source, linkPath, function onBundleMounted(mountErr) {
|
|
769
|
+
|
|
770
|
+
// if (mountErr) {
|
|
771
|
+
// abort(mountErr.stack);
|
|
772
|
+
// }
|
|
773
|
+
|
|
774
|
+
if (!Config.instance) {
|
|
775
|
+
config = new Config({
|
|
776
|
+
env : env,
|
|
777
|
+
executionPath : core.executionPath,
|
|
778
|
+
projectName : core.projectName,
|
|
779
|
+
startingApp : core.startingApp,
|
|
780
|
+
ginaPath : core.ginaPath
|
|
781
|
+
});
|
|
782
|
+
} else {
|
|
783
|
+
config = Config.instance
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
setContext('gina.config', config);
|
|
788
|
+
config.onReady( function(err, obj){
|
|
789
|
+
var isStandalone = obj.isStandalone;
|
|
790
|
+
|
|
791
|
+
if (err) console.error(err, err.stack);
|
|
792
|
+
|
|
793
|
+
var initialize = function(err, instance, middleware, conf) {
|
|
794
|
+
var errMsg = null;
|
|
795
|
+
if (!err) {
|
|
796
|
+
|
|
797
|
+
//On user conf complete.
|
|
798
|
+
e.on('complete', function(instance){
|
|
799
|
+
|
|
800
|
+
server.on('started', function (conf) {
|
|
801
|
+
|
|
802
|
+
// setting default global middlewares
|
|
803
|
+
if ( typeof(instance.use) == 'function' ) {
|
|
804
|
+
|
|
805
|
+
// catching unhandled errors
|
|
806
|
+
instance.use( function cathUnhandledErrorMiddlewar(error, request, response, next){
|
|
807
|
+
|
|
808
|
+
if (arguments.length < 4) {
|
|
809
|
+
next = response;
|
|
810
|
+
response = request;
|
|
811
|
+
request = error;
|
|
812
|
+
error = false ;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
if (error) {
|
|
816
|
+
e.emit('error', error, request, response, next)
|
|
817
|
+
} else {
|
|
818
|
+
next()
|
|
819
|
+
}
|
|
820
|
+
});
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
instance.use( function composeHeadersMiddleware(error, request, response, next) {
|
|
824
|
+
|
|
825
|
+
if (arguments.length < 4) {
|
|
826
|
+
next = response;
|
|
827
|
+
response = request;
|
|
828
|
+
request = error;
|
|
829
|
+
error = false ;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
if (error) {
|
|
833
|
+
e.emit('error', error, request, response, next)
|
|
834
|
+
} else {
|
|
835
|
+
|
|
836
|
+
instance.completeHeaders(null, request, response);
|
|
837
|
+
|
|
838
|
+
if ( typeof(request.isPreflightRequest) != 'undefined' && request.isPreflightRequest ) {
|
|
839
|
+
var ext = 'html';
|
|
840
|
+
var headers = {
|
|
841
|
+
// Responses to the OPTIONS method are not cacheable. - https://tools.ietf.org/html/rfc7231#section-4.3.7
|
|
842
|
+
//'cache-control': 'no-cache, no-store, must-revalidate', // preventing browsers from using cache
|
|
843
|
+
'cache-control': 'no-cache',
|
|
844
|
+
'pragma': 'no-cache',
|
|
845
|
+
'expires': '0',
|
|
846
|
+
'content-type': conf.server.coreConfiguration.mime[ext]
|
|
847
|
+
};
|
|
848
|
+
|
|
849
|
+
// if ( /http\/2/.test(conf.server.protocol) ) {
|
|
850
|
+
// if (!response.stream.destroyed) {
|
|
851
|
+
// headers[':status'] = 200;
|
|
852
|
+
// headers[':authority'] = request.headers[':authority'];
|
|
853
|
+
// response.stream.respond(headers);
|
|
854
|
+
// response.stream.end();
|
|
855
|
+
// return;
|
|
856
|
+
// }
|
|
857
|
+
// } else {
|
|
858
|
+
response.writeHead(200, headers);
|
|
859
|
+
response.end();
|
|
860
|
+
//}
|
|
861
|
+
|
|
862
|
+
} else {
|
|
863
|
+
next(false, request, response)
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
})
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
e.emit('server#started', conf);
|
|
871
|
+
|
|
872
|
+
setTimeout( async function onStarted() {
|
|
873
|
+
|
|
874
|
+
if ( conf.server.scheme == 'https' && /true/i.test(process.env.NODE_SCOPE_IS_LOCAL) ) {
|
|
875
|
+
await server.verifyCertificate(conf.host, conf.server.port);
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
console.info('is now online V(-.o)V',
|
|
879
|
+
'\nbundle: [ ' + conf.bundle +' ]',
|
|
880
|
+
'\nenv: [ '+ conf.env +' ]',
|
|
881
|
+
'\nengine: ' + conf.server.engine,
|
|
882
|
+
'\nprotocol: ' + conf.server.protocol,
|
|
883
|
+
'\nscheme: ' + conf.server.scheme,
|
|
884
|
+
'\nport: ' + conf.server.port,
|
|
885
|
+
'\ndebugPort: ' + conf.server.debugPort,
|
|
886
|
+
'\npid: ' + process.pid,
|
|
887
|
+
'\nThis way please -> '+ conf.hostname + conf.server.webroot
|
|
888
|
+
);
|
|
889
|
+
// placing end:flag to allow the CLI to retrieve bundl info from here
|
|
890
|
+
console.notice('[ FRAMEWORK ] Bundle started !');
|
|
891
|
+
}, 1000);
|
|
892
|
+
|
|
893
|
+
});
|
|
894
|
+
|
|
895
|
+
// placing strat:flag to allow the CLI to retrieve bundl info from here
|
|
896
|
+
console.notice('[ FRAMEWORK ][ '+ process.pid +' ] '+ conf.bundle +'@'+ core.projectName +' mounted !');
|
|
897
|
+
server.start(instance);
|
|
898
|
+
|
|
899
|
+
});
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
// if (!mountErr) {
|
|
904
|
+
// -- BO
|
|
905
|
+
e.emit('init', instance, middleware, conf);
|
|
906
|
+
//In case there is no user init.
|
|
907
|
+
if (!gna.initialized) {
|
|
908
|
+
e.emit('complete', instance);
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
// -- EO
|
|
913
|
+
// } else {
|
|
914
|
+
// errMsg = new Error('[ FRAMEWORK ] Could not mount bundle ' + core.startingApp + '. ' + 'Could not mount bundle ' + core.startingApp + '. ' + (err.stack||err.message));
|
|
915
|
+
// //console.error(errMsg);
|
|
916
|
+
// abort(errMsg)
|
|
917
|
+
// }
|
|
918
|
+
|
|
919
|
+
} else {
|
|
920
|
+
errMsg = new Error('[ FRAMEWORK ] '+ (err.stack||err.message));
|
|
921
|
+
console.error(errMsg);
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
|
|
925
|
+
var opt = {
|
|
926
|
+
projectName : core.projectName,
|
|
927
|
+
bundle : core.startingApp,
|
|
928
|
+
//Apps list.
|
|
929
|
+
bundles : obj.bundles,
|
|
930
|
+
allBundles : obj.allBundles,
|
|
931
|
+
env : obj.env,
|
|
932
|
+
isStandalone : isStandalone,
|
|
933
|
+
executionPath : core.executionPath,
|
|
934
|
+
conf : obj.conf
|
|
935
|
+
};
|
|
936
|
+
|
|
937
|
+
var server = new Server(opt);
|
|
938
|
+
server.onConfigured(initialize);
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
})//EO config.
|
|
942
|
+
//})//EO mount.
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* Stop server
|
|
947
|
+
* */
|
|
948
|
+
gna.stop = process.stop = function(pid, code) {
|
|
949
|
+
console.info('[ FRAMEWORK ] Stopped service');
|
|
950
|
+
if (typeof(code) != 'undefined')
|
|
951
|
+
process.exit(code);
|
|
952
|
+
|
|
953
|
+
process.exit()
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* Get Status
|
|
958
|
+
* */
|
|
959
|
+
gna.status = process.status = function(bundle) {
|
|
960
|
+
console.info('[ FRAMEWORK ] Getting service status')
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* Restart server
|
|
964
|
+
* */
|
|
965
|
+
gna.restart = process.restart = function() {
|
|
966
|
+
console.info('[ FRAMEWORK ] Starting service')
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
var appName = null, path = null;
|
|
972
|
+
|
|
973
|
+
var packs = project.bundles;
|
|
974
|
+
if (isLoadedThroughCLI) {
|
|
975
|
+
appName = getContext('bundle');
|
|
976
|
+
if (!isPath) {
|
|
977
|
+
//appName = getContext('bundle');
|
|
978
|
+
if (typeof (packs[appName].version) == 'undefined' && typeof (packs[appName].tag) != 'undefined') {
|
|
979
|
+
packs[appName].version = packs[appName].tag
|
|
980
|
+
}
|
|
981
|
+
packs[appName].releases[env].target = 'releases/' + appName + '/' + env + '/' + packs[appName].version;
|
|
982
|
+
path = (isDev) ? packs[appName].src : packs[appName].releases[env].target
|
|
983
|
+
} else {
|
|
984
|
+
path = _(process.argv[1])
|
|
985
|
+
}
|
|
986
|
+
} else {
|
|
987
|
+
path = _(process.argv[1])
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
path = path.replace(root + '/', '');
|
|
991
|
+
var search = null;
|
|
992
|
+
if ((/index.js/).test(path) || p[p.length - 1] == 'index') {
|
|
993
|
+
var self = null;
|
|
994
|
+
path = (self = path.split('/')).splice(0, self.length - 1).join('/')
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
try {
|
|
998
|
+
var projectName = null;
|
|
999
|
+
var processList = null;
|
|
1000
|
+
var bundleProcess = null;
|
|
1001
|
+
//finding app.
|
|
1002
|
+
if (!isLoadedThroughWorker) {
|
|
1003
|
+
var target, source, tmp;
|
|
1004
|
+
for (let bundle in packs) {
|
|
1005
|
+
//is bundle ?
|
|
1006
|
+
tmp = '';
|
|
1007
|
+
// For all but dev
|
|
1008
|
+
if (
|
|
1009
|
+
typeof (packs[bundle].releases) != 'undefined' && !isDev
|
|
1010
|
+
) {
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
if (typeof (packs[bundle].version) == 'undefined' && typeof (packs[bundle].tag) != 'undefined') {
|
|
1014
|
+
packs[bundle].version = packs[bundle].tag
|
|
1015
|
+
}
|
|
1016
|
+
packs[bundle].releases[env].target = 'releases/' + bundle + '/' + env + '/' + packs[bundle].version;
|
|
1017
|
+
tmp = packs[bundle].releases[env].target.replace(/\//g, '').replace(/\\/g, '');
|
|
1018
|
+
|
|
1019
|
+
if (!appName && tmp == path.replace(/\//g, '').replace(/\\/g, '')) {
|
|
1020
|
+
appName = bundle;
|
|
1021
|
+
break
|
|
1022
|
+
}
|
|
1023
|
+
} else if (
|
|
1024
|
+
typeof (packs[bundle].src) != 'undefined' && isDev
|
|
1025
|
+
) {
|
|
1026
|
+
|
|
1027
|
+
tmp = packs[bundle].src.replace(/\//g, '').replace(/\\/g, '');
|
|
1028
|
+
if (tmp == path.replace(/\//g, '').replace(/\\/g, '')) {
|
|
1029
|
+
appName = bundle;
|
|
1030
|
+
break
|
|
1031
|
+
}
|
|
1032
|
+
} else {
|
|
1033
|
+
abort('Path mismatched with env: ' + path);
|
|
1034
|
+
}
|
|
1035
|
+
// else, not a bundle
|
|
1036
|
+
} // EO for (let bundle in packs) {
|
|
1037
|
+
|
|
1038
|
+
if ( /^true$/i.test(gna.isAborting) ) {
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
if (appName == undefined) {
|
|
1043
|
+
setContext('bundle', undefined);
|
|
1044
|
+
abort('No bundle found for path: ' + path)
|
|
1045
|
+
} else {
|
|
1046
|
+
setContext('bundle', appName);
|
|
1047
|
+
//to remove after merging gina processes into a single process.
|
|
1048
|
+
projectName = getContext('projectName');
|
|
1049
|
+
processList = getContext('processList');
|
|
1050
|
+
process.list = processList;
|
|
1051
|
+
bundleProcess = new Proc(appName + '@' + projectName, process);
|
|
1052
|
+
bundleProcess.register(appName + '@' + projectName, process.pid);
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
} else {
|
|
1056
|
+
appName = getContext('bundle');
|
|
1057
|
+
projectName = getContext('projectName');
|
|
1058
|
+
processList = getContext('processList');
|
|
1059
|
+
process.list = processList;
|
|
1060
|
+
bundleProcess = new Proc(appName + '@' + projectName, process);
|
|
1061
|
+
bundleProcess.register(appName + '@' + projectName, process.pid)
|
|
1062
|
+
}
|
|
1063
|
+
} catch (err) {
|
|
1064
|
+
abort(err)
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
|
|
1068
|
+
});//EO onDoneGettingProjectConfiguration.
|
|
1069
|
+
});
|
|
1070
|
+
module.exports = gna
|