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/gna.js
DELETED
|
@@ -1,908 +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
|
-
* Gina Core Bootstrap
|
|
11
|
-
*
|
|
12
|
-
* @package Gina
|
|
13
|
-
* @author Rhinostone <gina@rhinostone.com>
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
var gna = {core:{}};
|
|
17
|
-
var fs = require('fs');
|
|
18
|
-
var child = require('child_process');
|
|
19
|
-
var Config = require('./config');
|
|
20
|
-
var Router = require('./router');
|
|
21
|
-
var config = null;
|
|
22
|
-
var tmp = null;
|
|
23
|
-
var utils = require('./utils');
|
|
24
|
-
var locales = require('./locales');
|
|
25
|
-
var plugins = require('./plugins');
|
|
26
|
-
|
|
27
|
-
var console = utils.logger;
|
|
28
|
-
var Proc = utils.Proc;
|
|
29
|
-
var modelUtil = new utils.Model();
|
|
30
|
-
var EventEmitter = require('events').EventEmitter;
|
|
31
|
-
var e = new EventEmitter();
|
|
32
|
-
|
|
33
|
-
gna.initialized = process.initialized = false;
|
|
34
|
-
gna.routed = process.routed = false;
|
|
35
|
-
gna.utils = utils;
|
|
36
|
-
gna.locales = locales;
|
|
37
|
-
gna.plugins = plugins;
|
|
38
|
-
|
|
39
|
-
var Server = require('./server');//TODO require('./server').http
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// BO cooking..
|
|
43
|
-
var startWithGina = false;
|
|
44
|
-
//copy & backup for utils/cmd/app.js.
|
|
45
|
-
tmp = process.argv;
|
|
46
|
-
|
|
47
|
-
// filter $ node.. o $ gina with or without env
|
|
48
|
-
if (tmp.length >= 4) {
|
|
49
|
-
if ( /\/index\.js/.test(tmp[1]) ) {
|
|
50
|
-
startWithGina = true;
|
|
51
|
-
|
|
52
|
-
try {
|
|
53
|
-
setContext('paths', JSON.parse(tmp[3]).paths);//And so on if you need to.
|
|
54
|
-
setContext('processList', JSON.parse(tmp[3]).processList);
|
|
55
|
-
setContext('gina.process', JSON.parse(tmp[3]).process);
|
|
56
|
-
//Cleaning process argv.
|
|
57
|
-
tmp.splice(3);
|
|
58
|
-
} catch (err) {}
|
|
59
|
-
|
|
60
|
-
} else {
|
|
61
|
-
var matched = null
|
|
62
|
-
, obj = {}
|
|
63
|
-
, arg = null
|
|
64
|
-
, filename = null
|
|
65
|
-
, paramsContent = null;
|
|
66
|
-
|
|
67
|
-
var checkArgv = function (obj, arg) {
|
|
68
|
-
|
|
69
|
-
if ( /\"paths\"/.test(arg) ) {
|
|
70
|
-
obj = JSON.parse(arg);
|
|
71
|
-
setContext('paths', obj.paths);//And so on if you need to.
|
|
72
|
-
|
|
73
|
-
if ( /\"bundle\"/.test(arg) ) {
|
|
74
|
-
setContext('bundle', obj.bundle);//And so on if you need to.
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if ( /\"bundles\"/.test(arg) ) {
|
|
78
|
-
setContext('bundles', obj.bundles);//And so on if you need to.
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if ( /\"config\"/.test(arg) ) {
|
|
82
|
-
if ( typeof(obj.bundle) != 'undefined' )
|
|
83
|
-
obj.config.bundle = obj.bundle;
|
|
84
|
-
|
|
85
|
-
setContext('gina.config', obj.config);//And so on if you need to.
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if ( /\"env\"/.test(arg) ) {
|
|
89
|
-
setContext('env', obj.env);//And so on if you need to.
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if ( /\"process\"/.test(arg) ) {
|
|
93
|
-
setContext('gina.process', obj.process);//And so on if you need to.
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if ( /\"processList\"/.test(arg) ) {
|
|
97
|
-
setContext('processList', obj.processList);//And so on if you need to.
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
process.argv.splice(3);
|
|
101
|
-
|
|
102
|
-
return true
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return false
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
for (var p = 0, len = tmp.length; p < len; ++p ) {
|
|
109
|
-
|
|
110
|
-
if ( /--argv-filename/.test(tmp[p]) ) {
|
|
111
|
-
filename = _(tmp[p].replace(/--argv-filename=/, ''));
|
|
112
|
-
paramsContent = fs.readFileSync(filename).toString();
|
|
113
|
-
|
|
114
|
-
if ( checkArgv(obj, paramsContent) ) {
|
|
115
|
-
|
|
116
|
-
fs.unlinkSync(filename);
|
|
117
|
-
|
|
118
|
-
filename = null;
|
|
119
|
-
paramsContent = null;
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
} else {
|
|
124
|
-
|
|
125
|
-
if ( checkArgv(obj, tmp[p]) ) {
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
tmp = null;
|
|
134
|
-
|
|
135
|
-
setPath( 'node', _(process.argv[0]) );
|
|
136
|
-
|
|
137
|
-
//var ginaPath = getPath('gina.core');
|
|
138
|
-
var ginaPath = getPath('gina').core;
|
|
139
|
-
if ( typeof(ginaPath) == 'undefined' ) {
|
|
140
|
-
ginaPath = _(__dirname);
|
|
141
|
-
setPath('gina.core', ginaPath);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
var gina = getPath('gina').root;
|
|
145
|
-
if (!gina) {
|
|
146
|
-
var pathArr = new _(ginaPath).toUnixStyle().split('/'), pathStr = '';
|
|
147
|
-
for (var i = 0, len = pathArr.length; i<len; ++i) {
|
|
148
|
-
if (pathArr[i] === 'gina') {
|
|
149
|
-
pathArr.splice(i+1);
|
|
150
|
-
pathStr = pathArr.join('/');
|
|
151
|
-
break
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
gina = _(pathStr);
|
|
156
|
-
setPath('gina.root', gina)
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
var root = getPath('root');
|
|
160
|
-
|
|
161
|
-
if (!root) {
|
|
162
|
-
var pathArr = new _(ginaPath).toUnixStyle().split('/'), pathStr = '';
|
|
163
|
-
for (var i = 0, len = pathArr.length; i<len; ++i) {
|
|
164
|
-
if (pathArr[i] === 'node_modules') {
|
|
165
|
-
pathArr.splice(i);
|
|
166
|
-
pathStr = pathArr.join('/');
|
|
167
|
-
break
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
root = _(pathStr);
|
|
172
|
-
setPath('root', root)
|
|
173
|
-
}
|
|
174
|
-
gna.executionPath = root;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
setContext('gina.Config', Config);
|
|
178
|
-
setContext('gina.Router', Router);
|
|
179
|
-
setContext('gina.utils', utils);
|
|
180
|
-
setContext('gina.locales', locales);
|
|
181
|
-
setContext('gina.plugins', plugins);
|
|
182
|
-
|
|
183
|
-
var envs = ['dev', 'debug', 'stage', 'prod'];
|
|
184
|
-
var protocols = ['http', 'https']; // will support https for the 0.0.10
|
|
185
|
-
var env;
|
|
186
|
-
//Setting env.
|
|
187
|
-
if ( !process.env.NODE_ENV ) {
|
|
188
|
-
env = ( typeof(process.argv[2]) != 'undefined') ? process.argv[2].toLowerCase() : 'prod';
|
|
189
|
-
} else {
|
|
190
|
-
env = process.env.NODE_ENV
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
gna.env = process.env.NODE_ENV = env;
|
|
194
|
-
|
|
195
|
-
//gna.env.isWin32 = process.env.isWin32 = function() {
|
|
196
|
-
// return (os.platform() == 'win32') ? true : false;
|
|
197
|
-
//};
|
|
198
|
-
gna.env.isWin32 = process.env.isWin32 = isWin32
|
|
199
|
-
|
|
200
|
-
//Cahceless is also defined in the main config : Config::isCacheless().
|
|
201
|
-
process.env.IS_CACHELESS = (env == "dev" || env == "debug") ? true : false;
|
|
202
|
-
setContext('cacheless', process.env.IS_CACHELESS);
|
|
203
|
-
|
|
204
|
-
//console.log('ENV => ', env);
|
|
205
|
-
//console.log('HOW ', process.argv.length, process.argv);
|
|
206
|
-
|
|
207
|
-
var bundlesPath = getPath('mountPath');
|
|
208
|
-
|
|
209
|
-
var p = new _(process.argv[1]).toUnixStyle().split("/");
|
|
210
|
-
var isSym = false;
|
|
211
|
-
var path;
|
|
212
|
-
|
|
213
|
-
var isPath = (/\//).test(process.argv[1]) || (/\\/).test(process.argv[1]);
|
|
214
|
-
if (!isPath) {
|
|
215
|
-
//lequel ?
|
|
216
|
-
try {
|
|
217
|
-
isSym = fs.lstatSync( _(bundlesPath +'/'+ process.argv[1]) ).isSymbolicLink();
|
|
218
|
-
} catch (err) {
|
|
219
|
-
//Did not find it ^^.
|
|
220
|
-
}
|
|
221
|
-
} else {
|
|
222
|
-
process.argv[1] = _(process.argv[1]);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
// Todo - load from env.json or locals or project.json ??
|
|
227
|
-
|
|
228
|
-
var abort = function(err) {
|
|
229
|
-
if (
|
|
230
|
-
process.argv[2] == '-s' && startWithGina
|
|
231
|
-
|| process.argv[2] == '--start' && startWithGina
|
|
232
|
-
//Avoid -h, -v ....
|
|
233
|
-
|| !startWithGina && isPath && process.argv.length > 3
|
|
234
|
-
|
|
235
|
-
) {
|
|
236
|
-
if (isPath && !startWithGina) {
|
|
237
|
-
console.log('You are trying to load gina by hand: just make sure that your env ['+env+'] matches the given path ['+ path +']');
|
|
238
|
-
} else if ( typeof(err.stack) != 'undefined' ) {
|
|
239
|
-
console.log('Gina could not determine which bundle to load: ' + err +' ['+env+']' + '\n' + err.stack);
|
|
240
|
-
} else {
|
|
241
|
-
console.log('Gina could not determine which bundle to load: ' + err +' ['+env+']');
|
|
242
|
-
}
|
|
243
|
-
process.exit(1);
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Get project conf from project.json
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
* @param {function} callback
|
|
252
|
-
* @return {object} data - Result conf object
|
|
253
|
-
* */
|
|
254
|
-
gna.getProjectConfiguration = function (callback){
|
|
255
|
-
|
|
256
|
-
var modulesPackage = _(root + '/project.json');
|
|
257
|
-
var project = {};
|
|
258
|
-
|
|
259
|
-
//Merging with existing;
|
|
260
|
-
if ( fs.existsSync(modulesPackage) ) {
|
|
261
|
-
try {
|
|
262
|
-
|
|
263
|
-
var dep = require(modulesPackage);
|
|
264
|
-
//console.log('ENV: ', env );
|
|
265
|
-
//console.log('PROCESS: ', process.argv );
|
|
266
|
-
//console.log(" now loading....", modulesPackage);
|
|
267
|
-
//console.log('content ', dep);
|
|
268
|
-
if ( typeof(dep['bundles']) == "undefined") {
|
|
269
|
-
dep['bundles'] = {};
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
if (
|
|
273
|
-
typeof(dep['bundles']) != "undefined"
|
|
274
|
-
&& typeof(project['bundles']) != "undefined"
|
|
275
|
-
) {
|
|
276
|
-
|
|
277
|
-
for (var d in dep) {
|
|
278
|
-
|
|
279
|
-
if (d == 'bundles')
|
|
280
|
-
for (var p in dep[d]) project['bundles'][p] = dep['bundles'][p];
|
|
281
|
-
else
|
|
282
|
-
project[d] = dep[d];
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
} else {
|
|
286
|
-
project = dep;
|
|
287
|
-
}
|
|
288
|
-
gna.project = project;
|
|
289
|
-
callback(false, project);
|
|
290
|
-
} catch (err) {
|
|
291
|
-
gna.project = project;
|
|
292
|
-
callback(err);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
} else {
|
|
296
|
-
console.warn('missing project !');
|
|
297
|
-
gna.project = project;
|
|
298
|
-
callback(false, project);
|
|
299
|
-
}
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* mount release => bundle
|
|
304
|
-
* @param {string} source
|
|
305
|
-
* @param {string} target
|
|
306
|
-
* @param {string} type
|
|
307
|
-
*
|
|
308
|
-
* @callback callback
|
|
309
|
-
* @param {boolean|string} err
|
|
310
|
-
* */
|
|
311
|
-
gna.mount = process.mount = function(bundlesPath, source, target, type, callback){
|
|
312
|
-
if ( typeof(type) == 'function') {
|
|
313
|
-
var callback = type;
|
|
314
|
-
type = 'dir';
|
|
315
|
-
}
|
|
316
|
-
//creating folders.
|
|
317
|
-
//use junction when using Win XP os.release == '5.1.2600'
|
|
318
|
-
var exists = fs.existsSync(source);
|
|
319
|
-
console.debug('source: ', source);
|
|
320
|
-
console.debug('checking before mounting ', target, fs.existsSync(target), bundlesPath);
|
|
321
|
-
if ( fs.existsSync(target) ) {
|
|
322
|
-
try {
|
|
323
|
-
fs.unlinkSync(target)
|
|
324
|
-
} catch (err) {
|
|
325
|
-
callback(err)
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
if ( exists ) {
|
|
329
|
-
//will override existing each time you restart.
|
|
330
|
-
var pathToMount = utils.generator.createPathSync(bundlesPath, function onPathCreated(err){
|
|
331
|
-
if (!err) {
|
|
332
|
-
try {
|
|
333
|
-
if ( type != undefined)
|
|
334
|
-
fs.symlinkSync(source, target, type)
|
|
335
|
-
else
|
|
336
|
-
fs.symlinkSync(source, target);
|
|
337
|
-
|
|
338
|
-
callback(false)
|
|
339
|
-
} catch (err) {
|
|
340
|
-
if (err) {
|
|
341
|
-
console.emerg(err.stack||err.message);
|
|
342
|
-
process.exit(1)
|
|
343
|
-
}
|
|
344
|
-
if ( fs.existsSync(target) ) {
|
|
345
|
-
var stats = fs.lstatSync(target);
|
|
346
|
-
if ( stats.isDirectory() ) {
|
|
347
|
-
var d = new _(target).rm( function(err){
|
|
348
|
-
callback(err);
|
|
349
|
-
})
|
|
350
|
-
} else {
|
|
351
|
-
fs.unlinkSync(target);
|
|
352
|
-
callback(err)
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
} else {
|
|
357
|
-
console.error(err);
|
|
358
|
-
callback(err)
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
} else {
|
|
362
|
-
// Means that it did not find the release. Build and re mount.
|
|
363
|
-
callback('Found no release to mount for: ', source)
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
var mountChildrenSync = function(project, bundles, i) {
|
|
368
|
-
var i = i || 1; // ignoring startingApp (master)
|
|
369
|
-
if (i > bundles.length -1) {
|
|
370
|
-
return
|
|
371
|
-
}
|
|
372
|
-
var source = (env == 'dev' || env == 'debug') ? _( root +'/'+project.bundles[bundles[i]].src) : _( root +'/'+ project.bundles[bundles[i]].release.target )
|
|
373
|
-
, target = _( root +'/'+ project.bundles[bundles[i]].release.link )
|
|
374
|
-
, type = 'dir';
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
if ( fs.existsSync(target) ) {
|
|
380
|
-
try {
|
|
381
|
-
fs.unlinkSync(target)
|
|
382
|
-
} catch (err) {
|
|
383
|
-
console.emerg(err.stack);
|
|
384
|
-
process.exit(1)
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
if ( fs.existsSync(source) ) {
|
|
389
|
-
utils.generator.createPathSync(bundlesPath, function onPathCreated(err){
|
|
390
|
-
if (!err) {
|
|
391
|
-
// cleanning first
|
|
392
|
-
var list = fs.readdirSync(bundlesPath)
|
|
393
|
-
, f = 0
|
|
394
|
-
, len = list.length
|
|
395
|
-
, fPath = null;
|
|
396
|
-
|
|
397
|
-
for (; f < len; ++f) {
|
|
398
|
-
fPath = _(bundlesPath + '/'+ list[f], true)
|
|
399
|
-
if ( !/^\./.test(fPath) ) {
|
|
400
|
-
fs.unlinkSync( fPath )
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
// mount
|
|
404
|
-
try {
|
|
405
|
-
if ( type != undefined)
|
|
406
|
-
fs.symlinkSync(source, target, type)
|
|
407
|
-
else
|
|
408
|
-
fs.symlinkSync(source, target);
|
|
409
|
-
|
|
410
|
-
mountChildrenSync(project, bundles, i+1)
|
|
411
|
-
|
|
412
|
-
} catch (err) {
|
|
413
|
-
console.emerg(err.stack||err.message);
|
|
414
|
-
process.exit(1)
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
} else {
|
|
418
|
-
console.error(err.stack);
|
|
419
|
-
process.exit(1)
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
} else {
|
|
423
|
-
console.emerg( new Error('Found no release to mount for: '+ source).stack)
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
// get configuration
|
|
429
|
-
gna.getProjectConfiguration( function onGettingProjectConfig(err, project) {
|
|
430
|
-
|
|
431
|
-
if (err) console.error(err.stack);
|
|
432
|
-
|
|
433
|
-
var appName, path;
|
|
434
|
-
|
|
435
|
-
var packs = project.bundles;
|
|
436
|
-
if (startWithGina) {
|
|
437
|
-
if (!isPath) {
|
|
438
|
-
appName = getContext('bundle');
|
|
439
|
-
if ( typeof(packs[appName].release.version) == 'undefined' && typeof(packs[appName].tag) != 'undefined') {
|
|
440
|
-
packs[appName].release.version = packs[appName].tag
|
|
441
|
-
}
|
|
442
|
-
packs[appName].release.target = 'releases/'+ appName +'/' + env +'/'+ packs[appName].release.version;
|
|
443
|
-
path = (env == 'dev' || env == 'debug') ? packs[appName].src : packs[appName].release.target
|
|
444
|
-
} else {
|
|
445
|
-
path = _(process.argv[1])
|
|
446
|
-
}
|
|
447
|
-
} else {
|
|
448
|
-
path = _(process.argv[1])
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
path = path.replace(root + '/', '');
|
|
454
|
-
var search;
|
|
455
|
-
if ( (/index.js/).test(path) || p[p.length-1] == 'index') {
|
|
456
|
-
var self;
|
|
457
|
-
path = ( self = path.split('/') ).splice(0, self.length-1).join('/')
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
try {
|
|
461
|
-
//finding app.
|
|
462
|
-
var target, source, tmp;
|
|
463
|
-
for (var bundle in packs) {
|
|
464
|
-
//is bundle ?
|
|
465
|
-
tmp = "";
|
|
466
|
-
if (
|
|
467
|
-
typeof(packs[bundle].release) != 'undefined' && env == 'prod'
|
|
468
|
-
|| typeof(packs[bundle].release) != 'undefined' && env == 'stage'
|
|
469
|
-
) {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
if ( typeof(packs[bundle].release.version) == 'undefined' && typeof(packs[bundle].tag) != 'undefined') {
|
|
473
|
-
packs[bundle].release.version = packs[bundle].tag
|
|
474
|
-
}
|
|
475
|
-
packs[bundle].release.target = 'releases/'+ bundle +'/' + env +'/'+ packs[bundle].release.version;
|
|
476
|
-
tmp = packs[bundle].release.target.replace(/\//g, '').replace(/\\/g, '');
|
|
477
|
-
|
|
478
|
-
if ( !appName && tmp == path.replace(/\//g, '').replace(/\\/g, '') ) {
|
|
479
|
-
appName = bundle;
|
|
480
|
-
break
|
|
481
|
-
}
|
|
482
|
-
} else if (
|
|
483
|
-
typeof(packs[bundle].src) != 'undefined' && env == 'dev'
|
|
484
|
-
|| typeof(packs[bundle].src) != 'undefined' && env == 'debug'
|
|
485
|
-
) {
|
|
486
|
-
|
|
487
|
-
tmp = packs[bundle].src.replace(/\//g, '').replace(/\\/g, '');
|
|
488
|
-
if ( tmp == path.replace(/\//g, '').replace(/\\/g, '') ) {
|
|
489
|
-
appName = bundle;
|
|
490
|
-
break
|
|
491
|
-
}
|
|
492
|
-
} else {
|
|
493
|
-
abort('Path mismatched with env: ' + path)
|
|
494
|
-
}
|
|
495
|
-
// else, not a bundle
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
if (appName == undefined) {
|
|
499
|
-
setContext('bundle', undefined);
|
|
500
|
-
abort('No bundle found for path: ' + path)
|
|
501
|
-
} else {
|
|
502
|
-
var projectName = null;
|
|
503
|
-
if ( typeof(project.name) != 'undefined' ) {
|
|
504
|
-
projectName = project.name
|
|
505
|
-
}
|
|
506
|
-
setContext('project', projectName);
|
|
507
|
-
setContext('bundle', appName);
|
|
508
|
-
setContext('env', env);
|
|
509
|
-
setContext('bundlesPath', _( root +'/'+ path.split('/')[0]) );
|
|
510
|
-
setContext('bundlePath', _( root +'/'+ path) );
|
|
511
|
-
setPath('bundlesPath', _( root +'/'+ path.split('/')[0]) );
|
|
512
|
-
//to remove after merging gina processes into a single process.
|
|
513
|
-
var processList = getContext('processList');
|
|
514
|
-
process.list = processList;
|
|
515
|
-
var bundleProcess = new Proc(appName, process);
|
|
516
|
-
bundleProcess.register(appName, process.pid)
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
} catch (err) {
|
|
520
|
-
abort(err)
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
/**
|
|
524
|
-
* On middleware initialization
|
|
525
|
-
*
|
|
526
|
-
* @callback callback
|
|
527
|
-
*
|
|
528
|
-
* */
|
|
529
|
-
gna.onInitialize = process.onInitialize = function(callback) {
|
|
530
|
-
|
|
531
|
-
gna.initialized = true;
|
|
532
|
-
e.once('init', function(instance, middleware, conf) {
|
|
533
|
-
|
|
534
|
-
var configuration = config.getInstance();
|
|
535
|
-
|
|
536
|
-
modelUtil.loadAllModels(
|
|
537
|
-
conf.bundles,
|
|
538
|
-
configuration,
|
|
539
|
-
env,
|
|
540
|
-
function() {
|
|
541
|
-
|
|
542
|
-
joinContext(conf.contexts);
|
|
543
|
-
gna.getConfig = function(name){
|
|
544
|
-
var tmp = "";
|
|
545
|
-
if ( typeof(name) != 'undefined' ) {
|
|
546
|
-
try {
|
|
547
|
-
//Protect it.
|
|
548
|
-
tmp = JSON.stringify(conf.content[name]);
|
|
549
|
-
return JSON.parse(tmp)
|
|
550
|
-
} catch (err) {
|
|
551
|
-
console.error(err.stack);
|
|
552
|
-
return undefined
|
|
553
|
-
}
|
|
554
|
-
} else {
|
|
555
|
-
//console.error("config!!!! ", conf);
|
|
556
|
-
tmp = JSON.stringify(conf);
|
|
557
|
-
return JSON.parse(tmp)
|
|
558
|
-
}
|
|
559
|
-
};
|
|
560
|
-
try {
|
|
561
|
-
//configureMiddleware(instance, express); // no, no and no...
|
|
562
|
-
callback(e, instance, middleware)
|
|
563
|
-
} catch (err) {
|
|
564
|
-
// TODO Output this to the error logger.
|
|
565
|
-
console.error('Could not complete initialization: ', err.stack)
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
})// EO modelUtil
|
|
569
|
-
|
|
570
|
-
})
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
* On Server started
|
|
575
|
-
*
|
|
576
|
-
* @callback callback
|
|
577
|
-
*
|
|
578
|
-
* */
|
|
579
|
-
gna.onStarted = process.onStarted = function(callback) {
|
|
580
|
-
|
|
581
|
-
gna.started = true;
|
|
582
|
-
e.once('server#started', function(conf){
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
// open default browser for dev env only
|
|
586
|
-
// if (env == 'dev') {
|
|
587
|
-
// var payload = JSON.stringify({
|
|
588
|
-
// code : 200,
|
|
589
|
-
// command : "reload"
|
|
590
|
-
// });
|
|
591
|
-
//
|
|
592
|
-
// if (self.ioClient) { // if client has already made connexion
|
|
593
|
-
//
|
|
594
|
-
// } else {
|
|
595
|
-
// // get default home
|
|
596
|
-
// child.spawn('open', [conf.hostname])
|
|
597
|
-
// }
|
|
598
|
-
// }
|
|
599
|
-
|
|
600
|
-
// will start watchers from here
|
|
601
|
-
callback()
|
|
602
|
-
})
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
gna.onRouting = process.onRouting = function(callback) {
|
|
606
|
-
|
|
607
|
-
gna.routed = true;
|
|
608
|
-
e.once('route', function(request, response, next, params) {
|
|
609
|
-
|
|
610
|
-
try {
|
|
611
|
-
callback(e, request, response, next, params)
|
|
612
|
-
} catch (err) {
|
|
613
|
-
// TODO Output this to the error logger.
|
|
614
|
-
console.error('Could not complete routing: ', err.stack)
|
|
615
|
-
}
|
|
616
|
-
})
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
gna.onError = process.onError = function(callback) {
|
|
620
|
-
gna.errorCatched = true;
|
|
621
|
-
e.on('error', function(err, request, response, next) {
|
|
622
|
-
callback(err, request, response, next)
|
|
623
|
-
})
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
gna.getShutdownConnector = process.getShutdownConnector = function(callback) {
|
|
627
|
-
var connPath = _(bundlesPath +'/'+ appName + '/config/connector.json');
|
|
628
|
-
fs.readFile(connPath, function onRead(err, content) {
|
|
629
|
-
try {
|
|
630
|
-
callback(err, JSON.parse(content).httpClient.shutdown)
|
|
631
|
-
} catch (err) {
|
|
632
|
-
callback(err)
|
|
633
|
-
}
|
|
634
|
-
})
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
gna.getShutdownConnectorSync = process.getShutdownConnectorSync = function() {
|
|
638
|
-
var connPath = _(bundlesPath +'/'+ appName + '/config/connector.json');
|
|
639
|
-
try {
|
|
640
|
-
var content = fs.readFileSync(connPath);
|
|
641
|
-
return JSON.parse(content).httpClient.shutdown
|
|
642
|
-
} catch (err) {
|
|
643
|
-
return undefined
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
gna.getMountedBundles = process.getMountedBundles = function(callback) {
|
|
648
|
-
fs.readdir(bundlesPath, function onRead(err, files) {
|
|
649
|
-
callback(err, files)
|
|
650
|
-
})
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
gna.getMountedBundlesSync = process.getMountedBundlesSync = function() {
|
|
654
|
-
try {
|
|
655
|
-
return fs.readdirSync(bundlesPath)
|
|
656
|
-
} catch (err) {
|
|
657
|
-
return err.stack
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
gna.getRunningBundlesSync = process.getRunningBundlesSync = function() {
|
|
662
|
-
|
|
663
|
-
//TODO - Do that thru IPC or thru socket. ???
|
|
664
|
-
var pidPath = _(getPath('globalTmpPath') +'/pid');
|
|
665
|
-
var files = fs.readdirSync(pidPath);
|
|
666
|
-
|
|
667
|
-
var name = '';
|
|
668
|
-
var indexTmp = null;
|
|
669
|
-
|
|
670
|
-
var content = [];
|
|
671
|
-
var contentGina = [];
|
|
672
|
-
var shutdown = [];
|
|
673
|
-
var shutdownGina = [];
|
|
674
|
-
|
|
675
|
-
var bundleGinaPid = getContext('gina').process;
|
|
676
|
-
|
|
677
|
-
//Sort Bundle / Gina instance to get a array [BUNDLE,GINA,SHUTDOWN,GINASHUTDOWN].
|
|
678
|
-
for (var f=0; f<files.length; ++f) {
|
|
679
|
-
|
|
680
|
-
name = fs.readFileSync( _(pidPath +'/'+ files[f]) ).toString();
|
|
681
|
-
|
|
682
|
-
if ( name == "shutdown" ) {
|
|
683
|
-
shutdown[0] = {};
|
|
684
|
-
shutdown[0]['pid'] = files[f];
|
|
685
|
-
shutdown[0]['name'] = name;
|
|
686
|
-
shutdown[0]['path'] = _(pidPath +'/'+ files[f]);
|
|
687
|
-
} else if ( files[f] == bundleGinaPid ){
|
|
688
|
-
shutdownGina[0] = {};
|
|
689
|
-
shutdownGina[0]['pid'] = files[f];
|
|
690
|
-
shutdownGina[0]['name'] = name;
|
|
691
|
-
shutdownGina[0]['path'] = _(pidPath +'/'+ files[f]);
|
|
692
|
-
} else if ( name == "gina" ) {
|
|
693
|
-
indexTmp = contentGina.length;
|
|
694
|
-
contentGina[indexTmp] = {};
|
|
695
|
-
contentGina[indexTmp]['pid'] = files[f];
|
|
696
|
-
contentGina[indexTmp]['name'] = name;
|
|
697
|
-
contentGina[indexTmp]['path'] = _(pidPath +'/'+ files[f]);
|
|
698
|
-
} else {
|
|
699
|
-
indexTmp = content.length;
|
|
700
|
-
content[indexTmp] = {};
|
|
701
|
-
content[indexTmp]['pid'] = files[f];
|
|
702
|
-
content[indexTmp]['name'] = name;
|
|
703
|
-
content[indexTmp]['path'] = _(pidPath +'/'+ files[f]);
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
//Remove GINA instance, avoid killing gina bundle before/while bundle is remove.
|
|
708
|
-
//Bundle kill/remove gina instance himself.
|
|
709
|
-
//content = content.concat(contentGina);
|
|
710
|
-
content = content.concat(shutdown);
|
|
711
|
-
content = content.concat(shutdownGina);
|
|
712
|
-
|
|
713
|
-
return content
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
gna.getVersion = process.getVersion = function(bundle) {
|
|
717
|
-
var name = bundle || appName;
|
|
718
|
-
name = name.replace(/gina: /, '');
|
|
719
|
-
|
|
720
|
-
if ( name != undefined) {
|
|
721
|
-
try {
|
|
722
|
-
var str = fs.readFileSync( _(bundlesPath + '/' + bundle + '/config/app.json') ).toString();
|
|
723
|
-
var version = JSON.parse(str).version;
|
|
724
|
-
return version
|
|
725
|
-
} catch (err) {
|
|
726
|
-
return err
|
|
727
|
-
}
|
|
728
|
-
} else {
|
|
729
|
-
return undefined
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
/**
|
|
734
|
-
* Start server
|
|
735
|
-
*
|
|
736
|
-
* @param {string} [executionPath]
|
|
737
|
-
* */
|
|
738
|
-
gna.start = process.start = function() { //TODO - Add protocol in arguments
|
|
739
|
-
|
|
740
|
-
var core = gna.core;
|
|
741
|
-
//Get bundle name.
|
|
742
|
-
console.log('appName ', appName);
|
|
743
|
-
core.startingApp = appName;
|
|
744
|
-
core.executionPath = root;
|
|
745
|
-
core.ginaPath = ginaPath;
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
//Inherits parent (gina) context.
|
|
749
|
-
if ( typeof(process.argv[3]) != 'undefined' ) {
|
|
750
|
-
setContext( JSON.parse(process.argv[3]) )
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
//check here for mount point source...
|
|
755
|
-
if ( typeof(project.bundles[core.startingApp].release.version) == 'undefined' && typeof(project.bundles[core.startingApp].tag) != 'undefined') {
|
|
756
|
-
project.bundles[core.startingApp].release.version = project.bundles[core.startingApp].tag
|
|
757
|
-
}
|
|
758
|
-
project.bundles[core.startingApp].release.target = 'releases/'+ core.startingApp +'/' + env +'/'+ project.bundles[core.startingApp].release.version;
|
|
759
|
-
|
|
760
|
-
var source = (env == 'dev' || env == 'debug') ? _( root +'/'+project.bundles[core.startingApp].src) : _( root +'/'+ project.bundles[core.startingApp].release.target );
|
|
761
|
-
var bundlesPath = getPath('bundlesPath');
|
|
762
|
-
var mountPath = getPath('mountPath')
|
|
763
|
-
if ( !fs.existsSync(mountPath) )
|
|
764
|
-
fs.mkdirSync(mountPath);
|
|
765
|
-
|
|
766
|
-
var tmpSource = _(bundlesPath +'/'+ core.startingApp);
|
|
767
|
-
var linkPath = _( root +'/'+ project.bundles[core.startingApp].release.link );
|
|
768
|
-
|
|
769
|
-
gna.mount( bundlesPath, source, linkPath, function onBundleMounted(mountErr) {
|
|
770
|
-
if (mountErr) {
|
|
771
|
-
console.error(mountErr.stack);
|
|
772
|
-
process.exit(1)
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
if (!Config.instance) {
|
|
776
|
-
config = new Config({
|
|
777
|
-
env : env,
|
|
778
|
-
executionPath : core.executionPath,
|
|
779
|
-
startingApp : core.startingApp,
|
|
780
|
-
ginaPath : core.ginaPath
|
|
781
|
-
});
|
|
782
|
-
} else {
|
|
783
|
-
config = Config.instance
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
setContext('gina.config', config);
|
|
787
|
-
config.onReady( function(err, obj){
|
|
788
|
-
|
|
789
|
-
if (err) console.error(err, err.stack);
|
|
790
|
-
|
|
791
|
-
var initialize = function(err, instance, middleware, conf) {
|
|
792
|
-
|
|
793
|
-
if (!err) {
|
|
794
|
-
|
|
795
|
-
//On user conf complete.
|
|
796
|
-
e.on('complete', function(instance){
|
|
797
|
-
// catching unhandled errors
|
|
798
|
-
if ( typeof(instance.use) == 'function' ) {
|
|
799
|
-
instance.use( function onUnhandledError(err, req, res, next){
|
|
800
|
-
if (err) {
|
|
801
|
-
e.emit('error', err, req, res, next)
|
|
802
|
-
} else {
|
|
803
|
-
next()
|
|
804
|
-
}
|
|
805
|
-
})
|
|
806
|
-
}
|
|
807
|
-
// ( !isStandalone || isStandalone && isMaster )
|
|
808
|
-
server.start(instance)
|
|
809
|
-
});
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
if (!mountErr) {
|
|
813
|
-
// -- BO
|
|
814
|
-
e.emit('init', instance, middleware, conf);
|
|
815
|
-
|
|
816
|
-
//In case there is no user init.
|
|
817
|
-
if (!gna.initialized) {
|
|
818
|
-
// we want to be able to load the model
|
|
819
|
-
var configuration = config.getInstance();
|
|
820
|
-
modelUtil.loadAllModels(
|
|
821
|
-
conf.bundles,
|
|
822
|
-
configuration,
|
|
823
|
-
env,
|
|
824
|
-
function() {
|
|
825
|
-
|
|
826
|
-
joinContext(conf.contexts);
|
|
827
|
-
try {
|
|
828
|
-
//configureMiddleware(instance, express); // no, no and no...
|
|
829
|
-
e.emit('complete', instance);
|
|
830
|
-
} catch (err) {
|
|
831
|
-
// TODO Output this to the error logger.
|
|
832
|
-
console.error('Could not complete initialization: ', err.stack)
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
})// EO modelUtil
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
console.debug('[ '+core.startingApp+' ] mounted!! ', conf.bundle, process.pid)
|
|
839
|
-
// -- EO
|
|
840
|
-
} else {
|
|
841
|
-
console.error( 'Could not mount bundle ' + core.startingApp + '. ' + 'Could not mount bundle ' + core.startingApp + '. ' + (err.stack||err.message));
|
|
842
|
-
|
|
843
|
-
abort(err)
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
} else {
|
|
847
|
-
console.error(err.stack||err.message)
|
|
848
|
-
}
|
|
849
|
-
};
|
|
850
|
-
|
|
851
|
-
var isStandalone = obj.isStandalone;
|
|
852
|
-
var opt = {
|
|
853
|
-
bundle : core.startingApp,
|
|
854
|
-
//Apps list.
|
|
855
|
-
bundles : obj.bundles,
|
|
856
|
-
allBundles : obj.allBundles,
|
|
857
|
-
env : obj.env,
|
|
858
|
-
version : obj.version,
|
|
859
|
-
isStandalone : isStandalone,
|
|
860
|
-
executionPath : core.executionPath,
|
|
861
|
-
conf : obj.conf
|
|
862
|
-
};
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
if (isStandalone && obj.bundles.length > 1) {
|
|
866
|
-
// mount child as well
|
|
867
|
-
mountChildrenSync(project, obj.bundles);
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
var server = new Server(opt);
|
|
871
|
-
server
|
|
872
|
-
.onConfigured(initialize)
|
|
873
|
-
.onStarted( function(conf) {
|
|
874
|
-
e.emit('server#started', conf)
|
|
875
|
-
});
|
|
876
|
-
|
|
877
|
-
})//EO config.
|
|
878
|
-
})//EO mount.
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
/**
|
|
882
|
-
* Stop server
|
|
883
|
-
* */
|
|
884
|
-
gna.stop = process.stop = function(pid, code) {
|
|
885
|
-
console.log("stoped server");
|
|
886
|
-
if(typeof(code) != "undefined")
|
|
887
|
-
process.exit(code);
|
|
888
|
-
|
|
889
|
-
process.exit()
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
/**
|
|
893
|
-
* Get Status
|
|
894
|
-
* */
|
|
895
|
-
gna.status = process.status = function(bundle) {
|
|
896
|
-
console.log("getting server status")
|
|
897
|
-
}
|
|
898
|
-
/**
|
|
899
|
-
* Restart server
|
|
900
|
-
* */
|
|
901
|
-
gna.restart = process.restart = function() {
|
|
902
|
-
console.log("starting server")
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
});//EO onDoneGettingProjectConfiguration.
|
|
907
|
-
|
|
908
|
-
module.exports = gna
|