gina 0.0.9-p91b → 0.1.1-alpha.2

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.
Files changed (466) hide show
  1. package/INSTALL.md +46 -0
  2. package/{core/asset/html/static.html → Icon/r} +0 -0
  3. package/LICENSE +1 -1
  4. package/README-4Contributors.md +96 -0
  5. package/README.md +296 -104
  6. package/bin/cli +287 -0
  7. package/bin/cli-debug +60 -0
  8. package/bin/cmd +184 -0
  9. package/bin/gina +180 -0
  10. package/config/logger.json +17 -0
  11. package/doc/framework/cli/doc.json +9 -0
  12. package/doc/framework/index.md +60 -0
  13. package/framework/v0.1.1-alpha.2/AUTHORS +7 -0
  14. package/{core/utils/lib/inherits → framework/v0.1.1-alpha.2}/LICENSE +1 -1
  15. package/framework/v0.1.1-alpha.2/VERSION +1 -0
  16. package/{core/locales/dist/language/en.json → framework/v0.1.1-alpha.2/core/asset/html/nolayout.html} +0 -0
  17. package/{core/locales/dist/language/fr.json → framework/v0.1.1-alpha.2/core/asset/html/static.html} +0 -0
  18. package/{core → framework/v0.1.1-alpha.2/core}/asset/img/android-chrome-192x192.png +0 -0
  19. package/{core → framework/v0.1.1-alpha.2/core}/asset/img/android-chrome-512x512.png +0 -0
  20. package/{core → framework/v0.1.1-alpha.2/core}/asset/img/apple-touch-icon.png +0 -0
  21. package/{core → framework/v0.1.1-alpha.2/core}/asset/img/favicon-16x16.png +0 -0
  22. package/{core → framework/v0.1.1-alpha.2/core}/asset/img/favicon-32x32.png +0 -0
  23. package/{core → framework/v0.1.1-alpha.2/core}/asset/img/favicon.ico +0 -0
  24. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.js +20904 -0
  25. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.js.map +56 -0
  26. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.min.css +1 -0
  27. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.min.css.map +1 -0
  28. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.min.js +736 -0
  29. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.min.js.map +56 -0
  30. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.onload.min.js +5 -0
  31. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.onload.min.js.map +8 -0
  32. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/readme.md +192 -0
  33. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/uuid.json +23 -0
  34. package/framework/v0.1.1-alpha.2/core/config.js +2308 -0
  35. package/framework/v0.1.1-alpha.2/core/connectors/couchbase/index.js +757 -0
  36. package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/connector.js +20 -0
  37. package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/connector.v2.js +429 -0
  38. package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/connector.v3.js +432 -0
  39. package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/n1ql.js +14 -0
  40. package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/session-store.js +21 -0
  41. package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/session-store.v2.js +258 -0
  42. package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/session-store.v3.js +341 -0
  43. package/{core → framework/v0.1.1-alpha.2/core}/controller/controller.framework.js +3 -2
  44. package/framework/v0.1.1-alpha.2/core/controller/controller.js +3990 -0
  45. package/{core → framework/v0.1.1-alpha.2/core}/controller/index.js +5 -5
  46. package/framework/v0.1.1-alpha.2/core/deps/busboy/.travis.yml +17 -0
  47. package/framework/v0.1.1-alpha.2/core/deps/busboy/LICENSE +19 -0
  48. package/framework/v0.1.1-alpha.2/core/deps/busboy/README.md +225 -0
  49. package/framework/v0.1.1-alpha.2/core/deps/busboy/deps/encoding/encoding-indexes.js +73 -0
  50. package/framework/v0.1.1-alpha.2/core/deps/busboy/deps/encoding/encoding.js +2391 -0
  51. package/framework/v0.1.1-alpha.2/core/deps/busboy/lib/main.js +89 -0
  52. package/framework/v0.1.1-alpha.2/core/deps/busboy/lib/types/multipart.js +328 -0
  53. package/framework/v0.1.1-alpha.2/core/deps/busboy/lib/types/urlencoded.js +214 -0
  54. package/framework/v0.1.1-alpha.2/core/deps/busboy/lib/utils.js +191 -0
  55. package/framework/v0.1.1-alpha.2/core/deps/busboy/package.json +69 -0
  56. package/framework/v0.1.1-alpha.2/core/deps/swig-client/swig-2.0.0.min.js +5 -0
  57. package/{core → framework/v0.1.1-alpha.2/core}/dev/index.js +5 -5
  58. package/{core → framework/v0.1.1-alpha.2/core}/dev/lib/class.js +1 -1
  59. package/{core → framework/v0.1.1-alpha.2/core}/dev/lib/factory.js +1 -1
  60. package/{core → framework/v0.1.1-alpha.2/core}/dev/lib/tools.js +0 -0
  61. package/framework/v0.1.1-alpha.2/core/gna.js +1070 -0
  62. package/{core → framework/v0.1.1-alpha.2/core}/locales/README.md +41 -2
  63. package/{core → framework/v0.1.1-alpha.2/core}/locales/currency.json +0 -0
  64. package/{core/plugins/README.md → framework/v0.1.1-alpha.2/core/locales/dist/language/en.json} +0 -0
  65. package/{core/plugins/lib/intl/README.md → framework/v0.1.1-alpha.2/core/locales/dist/language/fr.json} +0 -0
  66. package/{core → framework/v0.1.1-alpha.2/core}/locales/dist/region/en.json +0 -0
  67. package/framework/v0.1.1-alpha.2/core/locales/dist/region/fr.json +9492 -0
  68. package/{core → framework/v0.1.1-alpha.2/core}/locales/index.js +5 -4
  69. package/{core → framework/v0.1.1-alpha.2/core}/locales/src/make.js +15 -12
  70. package/{core → framework/v0.1.1-alpha.2/core}/locales/src/resources/currency.csv +0 -0
  71. package/{core → framework/v0.1.1-alpha.2/core}/locales/src/resources/region.csv +0 -0
  72. package/{core → framework/v0.1.1-alpha.2/core}/locales/src/resources/region.mapping.json +0 -0
  73. package/{core → framework/v0.1.1-alpha.2/core}/mime.types +0 -0
  74. package/{core → framework/v0.1.1-alpha.2/core}/model/entity.js +156 -196
  75. package/{core → framework/v0.1.1-alpha.2/core}/model/index.js +67 -48
  76. package/{core → framework/v0.1.1-alpha.2/core}/model/template/entityFactory.js +2 -2
  77. package/{core → framework/v0.1.1-alpha.2/core}/model/template/index.js +8 -10
  78. package/{core/plugins/lib/storage → framework/v0.1.1-alpha.2/core/plugins}/README.md +0 -0
  79. package/{core → framework/v0.1.1-alpha.2/core}/plugins/index.js +3 -3
  80. package/{core/plugins/lib/validator → framework/v0.1.1-alpha.2/core/plugins/lib/file}/README.md +0 -0
  81. package/{core/plugins/lib/intl → framework/v0.1.1-alpha.2/core/plugins/lib/file}/build.json +0 -0
  82. package/framework/v0.1.1-alpha.2/core/plugins/lib/file/package.json +25 -0
  83. package/{core/utils/lib/collection → framework/v0.1.1-alpha.2/core/plugins/lib/intl}/README.md +0 -0
  84. package/{core/plugins/lib/storage → framework/v0.1.1-alpha.2/core/plugins/lib/intl}/build.json +0 -0
  85. package/{core → framework/v0.1.1-alpha.2/core}/plugins/lib/intl/package.json +3 -3
  86. package/{core → framework/v0.1.1-alpha.2/core}/plugins/lib/intl/src/main.js +17 -1
  87. package/{core/utils/lib/routing → framework/v0.1.1-alpha.2/core/plugins/lib/storage}/README.md +0 -0
  88. package/{core/plugins/lib/validator → framework/v0.1.1-alpha.2/core/plugins/lib/storage}/build.json +0 -0
  89. package/{core → framework/v0.1.1-alpha.2/core}/plugins/lib/storage/package.json +2 -2
  90. package/{core → framework/v0.1.1-alpha.2/core}/plugins/lib/storage/src/main.js +91 -85
  91. package/{core/utils/lib/url → framework/v0.1.1-alpha.2/core/plugins/lib/validator}/README.md +0 -0
  92. package/{core/utils/lib/collection → framework/v0.1.1-alpha.2/core/plugins/lib/validator}/build.json +0 -0
  93. package/{core → framework/v0.1.1-alpha.2/core}/plugins/lib/validator/package.json +3 -3
  94. package/framework/v0.1.1-alpha.2/core/plugins/lib/validator/src/form-validator.js +1762 -0
  95. package/framework/v0.1.1-alpha.2/core/plugins/lib/validator/src/main.js +6917 -0
  96. package/framework/v0.1.1-alpha.2/core/router.js +664 -0
  97. package/framework/v0.1.1-alpha.2/core/server.express.js +213 -0
  98. package/framework/v0.1.1-alpha.2/core/server.isaac.js +386 -0
  99. package/framework/v0.1.1-alpha.2/core/server.js +3010 -0
  100. package/{core → framework/v0.1.1-alpha.2/core}/status.codes +8 -0
  101. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/config/app.json +6 -0
  102. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/config/routing.json +11 -0
  103. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/config/settings.json +9 -0
  104. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/config/settings.server.json +30 -0
  105. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/config/templates.json +42 -0
  106. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/controllers/controller.content.js +39 -0
  107. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/controllers/controller.js +30 -0
  108. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/controllers/setup.js +111 -0
  109. package/{core/template/samples → framework/v0.1.1-alpha.2/core/template/boilerplate}/bundle/index.js +0 -0
  110. package/{core/template/samples/bundle → framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_namespace}/controllers/controller.js +9 -7
  111. package/{core/template/views → framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_public}/css/default.css +0 -0
  112. package/{core/template/views → framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_public}/css/vendor/readme.md +0 -0
  113. package/{core/template/views → framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_public}/favicon.ico +0 -0
  114. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_public/js/vendor/readme.md +1 -0
  115. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_public/readme.md +1 -0
  116. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_templates/handlers/main.js +24 -0
  117. package/{core/template/views/html/default.html → framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_templates/html/homepage.html} +0 -0
  118. package/{core/template/views/html/layout.html → framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_templates/html/layout/main.html} +2 -2
  119. package/{core → framework/v0.1.1-alpha.2/core}/template/command/gina.bat.tpl +0 -0
  120. package/{core → framework/v0.1.1-alpha.2/core}/template/command/gina.tpl +1 -1
  121. package/framework/v0.1.1-alpha.2/core/template/conf/env.json +76 -0
  122. package/{core/template/conf/project.json → framework/v0.1.1-alpha.2/core/template/conf/manifest.json} +1 -0
  123. package/{core → framework/v0.1.1-alpha.2/core}/template/conf/package.json +2 -2
  124. package/framework/v0.1.1-alpha.2/core/template/conf/settings.json +92 -0
  125. package/framework/v0.1.1-alpha.2/core/template/conf/statics.json +10 -0
  126. package/framework/v0.1.1-alpha.2/core/template/conf/templates.json +37 -0
  127. package/{core → framework/v0.1.1-alpha.2/core}/template/error/client/json/401.json +0 -0
  128. package/{core → framework/v0.1.1-alpha.2/core}/template/error/client/json/403.json +0 -0
  129. package/{core → framework/v0.1.1-alpha.2/core}/template/error/client/json/404.json +0 -0
  130. package/{core → framework/v0.1.1-alpha.2/core}/template/error/server/html/50x.html +0 -0
  131. package/{core → framework/v0.1.1-alpha.2/core}/template/error/server/json/500.json +0 -0
  132. package/{core → framework/v0.1.1-alpha.2/core}/template/error/server/json/503.json +0 -0
  133. package/{core/utils/lib/routing/build.json → framework/v0.1.1-alpha.2/core/template/extensions/logger/config.json} +0 -0
  134. package/{core/utils → framework/v0.1.1-alpha.2}/helpers/console.js +3 -3
  135. package/{core/utils → framework/v0.1.1-alpha.2}/helpers/context.js +240 -49
  136. package/framework/v0.1.1-alpha.2/helpers/dateFormat.js +528 -0
  137. package/framework/v0.1.1-alpha.2/helpers/index.js +79 -0
  138. package/framework/v0.1.1-alpha.2/helpers/json/README.md +0 -0
  139. package/framework/v0.1.1-alpha.2/helpers/json/package.json +20 -0
  140. package/framework/v0.1.1-alpha.2/helpers/json/src/main.js +97 -0
  141. package/{core/utils → framework/v0.1.1-alpha.2}/helpers/path.js +342 -140
  142. package/framework/v0.1.1-alpha.2/helpers/plugins/README.md +4 -0
  143. package/framework/v0.1.1-alpha.2/helpers/plugins/package.json +20 -0
  144. package/framework/v0.1.1-alpha.2/helpers/plugins/src/api-error.js +160 -0
  145. package/framework/v0.1.1-alpha.2/helpers/plugins/src/main.js +32 -0
  146. package/framework/v0.1.1-alpha.2/helpers/prototypes.js +218 -0
  147. package/{core/utils → framework/v0.1.1-alpha.2}/helpers/task.js +49 -29
  148. package/{core/utils → framework/v0.1.1-alpha.2}/helpers/text.js +7 -7
  149. package/framework/v0.1.1-alpha.2/lib/archiver/README.md +0 -0
  150. package/framework/v0.1.1-alpha.2/lib/archiver/build.json +0 -0
  151. package/framework/v0.1.1-alpha.2/lib/archiver/package.json +20 -0
  152. package/framework/v0.1.1-alpha.2/lib/archiver/src/dep/jszip.min.js +15 -0
  153. package/framework/v0.1.1-alpha.2/lib/archiver/src/main.js +499 -0
  154. package/framework/v0.1.1-alpha.2/lib/cmd/aliases.json +13 -0
  155. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/add.js +507 -0
  156. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/arguments.json +4 -0
  157. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/copy.js +15 -0
  158. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/cp.js +2 -0
  159. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/help.js +28 -0
  160. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/help.txt +67 -0
  161. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/list.js +129 -0
  162. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/remove.js +229 -0
  163. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/rename.js +4 -0
  164. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/restart.js +235 -0
  165. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/rm.js +2 -0
  166. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/start.js +394 -0
  167. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/status.js +3 -0
  168. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/stop.js +232 -0
  169. package/framework/v0.1.1-alpha.2/lib/cmd/env/add.js +436 -0
  170. package/framework/v0.1.1-alpha.2/lib/cmd/env/get.js +62 -0
  171. package/framework/v0.1.1-alpha.2/lib/cmd/env/help.js +28 -0
  172. package/framework/v0.1.1-alpha.2/lib/cmd/env/help.txt +33 -0
  173. package/framework/v0.1.1-alpha.2/lib/cmd/env/link-dev.js +80 -0
  174. package/framework/v0.1.1-alpha.2/lib/cmd/env/list.js +111 -0
  175. package/framework/v0.1.1-alpha.2/lib/cmd/env/remove.js +150 -0
  176. package/framework/v0.1.1-alpha.2/lib/cmd/env/rm.js +2 -0
  177. package/framework/v0.1.1-alpha.2/lib/cmd/env/set.js +57 -0
  178. package/framework/v0.1.1-alpha.2/lib/cmd/env/unset.js +44 -0
  179. package/framework/v0.1.1-alpha.2/lib/cmd/env/use.js +79 -0
  180. package/framework/v0.1.1-alpha.2/lib/cmd/framework/dot.js +70 -0
  181. package/framework/v0.1.1-alpha.2/lib/cmd/framework/get.js +0 -0
  182. package/framework/v0.1.1-alpha.2/lib/cmd/framework/help.js +39 -0
  183. package/framework/v0.1.1-alpha.2/lib/cmd/framework/help.txt +31 -0
  184. package/framework/v0.1.1-alpha.2/lib/cmd/framework/init.js +514 -0
  185. package/{core/utils/lib/cmd → framework/v0.1.1-alpha.2/lib/cmd/framework}/msg.json +3 -3
  186. package/framework/v0.1.1-alpha.2/lib/cmd/framework/open.js +50 -0
  187. package/framework/v0.1.1-alpha.2/lib/cmd/framework/restart.js +124 -0
  188. package/framework/v0.1.1-alpha.2/lib/cmd/framework/set.js +161 -0
  189. package/framework/v0.1.1-alpha.2/lib/cmd/framework/start.js +96 -0
  190. package/framework/v0.1.1-alpha.2/lib/cmd/framework/status.js +72 -0
  191. package/framework/v0.1.1-alpha.2/lib/cmd/framework/stop.js +159 -0
  192. package/framework/v0.1.1-alpha.2/lib/cmd/framework/tail.js +183 -0
  193. package/framework/v0.1.1-alpha.2/lib/cmd/framework/update.js +0 -0
  194. package/framework/v0.1.1-alpha.2/lib/cmd/framework/version.js +44 -0
  195. package/framework/v0.1.1-alpha.2/lib/cmd/gina-dev.1.md +66 -0
  196. package/framework/v0.1.1-alpha.2/lib/cmd/gina-framework.1.md +100 -0
  197. package/framework/v0.1.1-alpha.2/lib/cmd/gina.1.md +79 -0
  198. package/framework/v0.1.1-alpha.2/lib/cmd/helper.js +1147 -0
  199. package/framework/v0.1.1-alpha.2/lib/cmd/index.js +170 -0
  200. package/framework/v0.1.1-alpha.2/lib/cmd/msg.json +20 -0
  201. package/framework/v0.1.1-alpha.2/lib/cmd/port/help.js +28 -0
  202. package/framework/v0.1.1-alpha.2/lib/cmd/port/help.txt +31 -0
  203. package/framework/v0.1.1-alpha.2/lib/cmd/port/inc/scan.js +108 -0
  204. package/framework/v0.1.1-alpha.2/lib/cmd/port/list.js +176 -0
  205. package/framework/v0.1.1-alpha.2/lib/cmd/port/set.js +0 -0
  206. package/framework/v0.1.1-alpha.2/lib/cmd/project/add.js +528 -0
  207. package/framework/v0.1.1-alpha.2/lib/cmd/project/arguments.json +9 -0
  208. package/framework/v0.1.1-alpha.2/lib/cmd/project/build.js +115 -0
  209. package/framework/v0.1.1-alpha.2/lib/cmd/project/help.js +28 -0
  210. package/framework/v0.1.1-alpha.2/lib/cmd/project/help.txt +76 -0
  211. package/framework/v0.1.1-alpha.2/lib/cmd/project/import.js +2 -0
  212. package/framework/v0.1.1-alpha.2/lib/cmd/project/list.js +55 -0
  213. package/framework/v0.1.1-alpha.2/lib/cmd/project/move.js +0 -0
  214. package/framework/v0.1.1-alpha.2/lib/cmd/project/remove.js +144 -0
  215. package/framework/v0.1.1-alpha.2/lib/cmd/project/rename.js +162 -0
  216. package/framework/v0.1.1-alpha.2/lib/cmd/project/restart.js +0 -0
  217. package/framework/v0.1.1-alpha.2/lib/cmd/project/rm.js +2 -0
  218. package/framework/v0.1.1-alpha.2/lib/cmd/project/start.js +0 -0
  219. package/framework/v0.1.1-alpha.2/lib/cmd/project/status.js +3 -0
  220. package/framework/v0.1.1-alpha.2/lib/cmd/project/stop.js +0 -0
  221. package/framework/v0.1.1-alpha.2/lib/cmd/protocol/help.js +27 -0
  222. package/framework/v0.1.1-alpha.2/lib/cmd/protocol/help.txt +57 -0
  223. package/framework/v0.1.1-alpha.2/lib/cmd/protocol/list.js +239 -0
  224. package/framework/v0.1.1-alpha.2/lib/cmd/protocol/set.js +631 -0
  225. package/framework/v0.1.1-alpha.2/lib/cmd/scope/help.js +28 -0
  226. package/framework/v0.1.1-alpha.2/lib/cmd/scope/help.txt +33 -0
  227. package/framework/v0.1.1-alpha.2/lib/cmd/scope/link-local.js +80 -0
  228. package/framework/v0.1.1-alpha.2/lib/cmd/scope/list.js +116 -0
  229. package/framework/v0.1.1-alpha.2/lib/cmd/scope/remove.js +150 -0
  230. package/framework/v0.1.1-alpha.2/lib/cmd/scope/rm.js +2 -0
  231. package/framework/v0.1.1-alpha.2/lib/cmd/scope/set.js +57 -0
  232. package/framework/v0.1.1-alpha.2/lib/cmd/scope/unset.js +44 -0
  233. package/framework/v0.1.1-alpha.2/lib/cmd/scope/use.js +79 -0
  234. package/framework/v0.1.1-alpha.2/lib/cmd/view/add.js +311 -0
  235. package/framework/v0.1.1-alpha.2/lib/collection/README.md +5 -0
  236. package/framework/v0.1.1-alpha.2/lib/collection/build.json +0 -0
  237. package/{core/utils → framework/v0.1.1-alpha.2}/lib/collection/package.json +2 -2
  238. package/framework/v0.1.1-alpha.2/lib/collection/src/main.js +1459 -0
  239. package/{core/utils → framework/v0.1.1-alpha.2}/lib/config.js +49 -34
  240. package/framework/v0.1.1-alpha.2/lib/cron/README.md +7 -0
  241. package/framework/v0.1.1-alpha.2/lib/cron/package.json +20 -0
  242. package/framework/v0.1.1-alpha.2/lib/cron/src/main.js +176 -0
  243. package/{core/utils → framework/v0.1.1-alpha.2}/lib/generator/index.js +8 -4
  244. package/framework/v0.1.1-alpha.2/lib/index.js +116 -0
  245. package/framework/v0.1.1-alpha.2/lib/inherits/LICENSE +19 -0
  246. package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/README.md +0 -0
  247. package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/example/inheriting_eventemitter.js +0 -0
  248. package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/example/protected_inheritance.js +0 -0
  249. package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/example/simple_inheritance.js +0 -0
  250. package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/example/super_attribute_overridden_by_child_on_init.js +0 -0
  251. package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/package.json +2 -2
  252. package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/src/main.js +18 -19
  253. package/framework/v0.1.1-alpha.2/lib/logger/README.md +7 -0
  254. package/framework/v0.1.1-alpha.2/lib/logger/package.json +20 -0
  255. package/framework/v0.1.1-alpha.2/lib/logger/src/containers/default/index.js +55 -0
  256. package/framework/v0.1.1-alpha.2/lib/logger/src/containers/file/index.js +251 -0
  257. package/framework/v0.1.1-alpha.2/lib/logger/src/containers/file/lib/logrotator/README.md +100 -0
  258. package/framework/v0.1.1-alpha.2/lib/logger/src/containers/file/lib/logrotator/index.js +274 -0
  259. package/framework/v0.1.1-alpha.2/lib/logger/src/containers/mq/index.js +52 -0
  260. package/framework/v0.1.1-alpha.2/lib/logger/src/containers/mq/listener.js +302 -0
  261. package/framework/v0.1.1-alpha.2/lib/logger/src/containers/mq/speaker.js +118 -0
  262. package/framework/v0.1.1-alpha.2/lib/logger/src/helper.js +131 -0
  263. package/framework/v0.1.1-alpha.2/lib/logger/src/main.js +734 -0
  264. package/{core/utils → framework/v0.1.1-alpha.2}/lib/math/index.js +58 -35
  265. package/{core/utils → framework/v0.1.1-alpha.2}/lib/merge/README.md +5 -0
  266. package/{core/utils → framework/v0.1.1-alpha.2}/lib/merge/example/merge.js +1 -1
  267. package/{core/utils → framework/v0.1.1-alpha.2}/lib/merge/example/merge_2_literal objects.js +0 -0
  268. package/{core/utils → framework/v0.1.1-alpha.2}/lib/merge/example/merge_and_preserve_first.js +2 -0
  269. package/{core/utils → framework/v0.1.1-alpha.2}/lib/merge/package.json +2 -2
  270. package/framework/v0.1.1-alpha.2/lib/merge/src/main.js +531 -0
  271. package/{core/utils → framework/v0.1.1-alpha.2}/lib/model.js +42 -19
  272. package/framework/v0.1.1-alpha.2/lib/proc.js +518 -0
  273. package/framework/v0.1.1-alpha.2/lib/routing/README.md +0 -0
  274. package/framework/v0.1.1-alpha.2/lib/routing/build.json +0 -0
  275. package/{core/utils → framework/v0.1.1-alpha.2}/lib/routing/package.json +2 -2
  276. package/framework/v0.1.1-alpha.2/lib/routing/src/main.js +1492 -0
  277. package/framework/v0.1.1-alpha.2/lib/session-store.js +33 -0
  278. package/{core/utils → framework/v0.1.1-alpha.2}/lib/shell.js +43 -30
  279. package/framework/v0.1.1-alpha.2/lib/swig-filters/README.md +0 -0
  280. package/framework/v0.1.1-alpha.2/lib/swig-filters/package.json +20 -0
  281. package/framework/v0.1.1-alpha.2/lib/swig-filters/src/main.js +322 -0
  282. package/framework/v0.1.1-alpha.2/lib/url/README.md +0 -0
  283. package/{core/utils → framework/v0.1.1-alpha.2}/lib/url/index.js +2 -1
  284. package/{core/utils → framework/v0.1.1-alpha.2}/lib/url/mocks.json +0 -0
  285. package/{core/utils → framework/v0.1.1-alpha.2}/lib/url/routing.json +9 -9
  286. package/{core/utils → framework/v0.1.1-alpha.2}/lib/url/test.js +0 -0
  287. package/{core/utils → framework/v0.1.1-alpha.2}/lib/validator.js +7 -7
  288. package/framework/v0.1.1-alpha.2/package.json +14 -0
  289. package/package.json +35 -33
  290. package/resources/etc/init.d/debian/gina +117 -0
  291. package/resources/home/framework/env.json +34 -0
  292. package/resources/home/framework/locals.json +14 -0
  293. package/resources/home/framework/project.json +48 -0
  294. package/resources/home/framework/projects.json +6 -0
  295. package/resources/home/main.json +47 -0
  296. package/resources/home/settings.json +22 -0
  297. package/resources/home/user/extensions/logger/default/config.json +77 -0
  298. package/resources/home/user/extensions/logger/file/config.json +11 -0
  299. package/resources/img/android-chrome-192x192.png +0 -0
  300. package/resources/img/android-chrome-512x512.png +0 -0
  301. package/resources/img/apple-touch-icon.png +0 -0
  302. package/resources/img/favicon-16x16.png +0 -0
  303. package/resources/img/favicon-32x32.png +0 -0
  304. package/resources/img/favicon.ico +0 -0
  305. package/resources/package.json.template +50 -0
  306. package/script/lib.js +24 -0
  307. package/script/post_install.js +449 -157
  308. package/script/pre_install.js +277 -36
  309. package/script/prepare_version.js +425 -0
  310. package/utils/helper.js +438 -0
  311. package/utils/prototypes.js +239 -0
  312. package/utils/prototypes.json_clone.js +175 -0
  313. package/.npmignore +0 -6
  314. package/MIDDLEWARE +0 -1
  315. package/SUCCESS +0 -1
  316. package/VERSION +0 -1
  317. package/core/asset/html/nolayout.html +0 -1
  318. package/core/asset/js/plugin/build.dev.json +0 -28
  319. package/core/asset/js/plugin/build.json +0 -31
  320. package/core/asset/js/plugin/dist/gina.min.css +0 -1
  321. package/core/asset/js/plugin/dist/gina.min.css.map +0 -1
  322. package/core/asset/js/plugin/dist/gina.min.js +0 -13731
  323. package/core/asset/js/plugin/dist/gina.min.js.map +0 -42
  324. package/core/asset/js/plugin/dist/gina.onload.min.js +0 -3
  325. package/core/asset/js/plugin/dist/gina.onload.min.js.map +0 -8
  326. package/core/asset/js/plugin/readme.md +0 -152
  327. package/core/asset/js/plugin/src/gina/main.js +0 -132
  328. package/core/asset/js/plugin/src/gina/popin/css/design.css +0 -23
  329. package/core/asset/js/plugin/src/gina/popin/css/main.css +0 -1112
  330. package/core/asset/js/plugin/src/gina/popin/css/popin.css +0 -3
  331. package/core/asset/js/plugin/src/gina/popin/css/popin.css.map +0 -1
  332. package/core/asset/js/plugin/src/gina/popin/doc/TOC.md +0 -29
  333. package/core/asset/js/plugin/src/gina/popin/doc/css.md +0 -162
  334. package/core/asset/js/plugin/src/gina/popin/doc/extend.md +0 -663
  335. package/core/asset/js/plugin/src/gina/popin/doc/faq.md +0 -46
  336. package/core/asset/js/plugin/src/gina/popin/doc/html.md +0 -227
  337. package/core/asset/js/plugin/src/gina/popin/doc/js.md +0 -37
  338. package/core/asset/js/plugin/src/gina/popin/doc/misc.md +0 -178
  339. package/core/asset/js/plugin/src/gina/popin/doc/usage.md +0 -130
  340. package/core/asset/js/plugin/src/gina/popin/main.js +0 -783
  341. package/core/asset/js/plugin/src/gina/popin/sass/config.sass +0 -37
  342. package/core/asset/js/plugin/src/gina/popin/sass/gina-design.sass +0 -622
  343. package/core/asset/js/plugin/src/gina/popin/sass/gina-popin.sass +0 -54
  344. package/core/asset/js/plugin/src/gina/popin/sass/helper.scss +0 -73
  345. package/core/asset/js/plugin/src/gina/toolbar/.npmignore +0 -19
  346. package/core/asset/js/plugin/src/gina/toolbar/css/toolbar.css +0 -433
  347. package/core/asset/js/plugin/src/gina/toolbar/css/toolbar.css.map +0 -1
  348. package/core/asset/js/plugin/src/gina/toolbar/index.html +0 -285
  349. package/core/asset/js/plugin/src/gina/toolbar/index.kit +0 -120
  350. package/core/asset/js/plugin/src/gina/toolbar/jquery-3.1.0.min.js +0 -4
  351. package/core/asset/js/plugin/src/gina/toolbar/main.js +0 -693
  352. package/core/asset/js/plugin/src/gina/toolbar/mock.gina.json +0 -1
  353. package/core/asset/js/plugin/src/gina/toolbar/mock.user.json +0 -1
  354. package/core/asset/js/plugin/src/gina/toolbar/readme.md +0 -7
  355. package/core/asset/js/plugin/src/gina/toolbar/sass/toolbar.sass +0 -563
  356. package/core/asset/js/plugin/src/gina/toolbar/svg-src/Info-color.svg +0 -1
  357. package/core/asset/js/plugin/src/gina/toolbar/svg-src/Info-grey.svg +0 -1
  358. package/core/asset/js/plugin/src/gina/toolbar/svg-src/error-color.svg +0 -1
  359. package/core/asset/js/plugin/src/gina/toolbar/svg-src/error-grey.svg +0 -1
  360. package/core/asset/js/plugin/src/gina/toolbar/svg-src/info-optim.svg +0 -13
  361. package/core/asset/js/plugin/src/gina/toolbar/svg-src/logo-gina.svg +0 -1
  362. package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings-big.svg +0 -1
  363. package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings.afdesign +0 -0
  364. package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings.svg +0 -1
  365. package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-calendar-optim.svg +0 -1
  366. package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-calendar.svg +0 -1
  367. package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-card-optim.svg +0 -1
  368. package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-card.svg +0 -1
  369. package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-lock-optim.svg +0 -1
  370. package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-lock.svg +0 -1
  371. package/core/asset/js/plugin/src/gina/toolbar/svg-src/warning-color.svg +0 -1
  372. package/core/asset/js/plugin/src/gina/toolbar/svg-src/warning-grey.svg +0 -1
  373. package/core/asset/js/plugin/src/gina/toolbar/test.jpg +0 -0
  374. package/core/asset/js/plugin/src/gina/toolbar/toolbar.html +0 -104
  375. package/core/asset/js/plugin/src/gina/utils/dom.js +0 -24
  376. package/core/asset/js/plugin/src/gina/utils/events.js +0 -201
  377. package/core/asset/js/plugin/src/gina/utils/loader.js +0 -57
  378. package/core/asset/js/plugin/src/main.js +0 -235
  379. package/core/asset/js/plugin/src/vendor/jquery/1.11.1-css-event_alias.min.js +0 -5
  380. package/core/asset/js/plugin/src/vendor/jquery/1.12.4.min.js +0 -5
  381. package/core/asset/js/plugin/src/vendor/jquery/2.1.1-css-event_alias-sizzle.min.js +0 -4
  382. package/core/asset/js/plugin/src/vendor/jquery/README.md +0 -14
  383. package/core/asset/js/plugin/src/vendor/jquery/slim-3.1.1.min.js +0 -4
  384. package/core/config.js +0 -1225
  385. package/core/controller/controller.js +0 -1860
  386. package/core/gna.js +0 -908
  387. package/core/plugins/lib/validator/src/form-validator.js +0 -788
  388. package/core/plugins/lib/validator/src/main.js +0 -2056
  389. package/core/router.js +0 -717
  390. package/core/server.js +0 -1363
  391. package/core/template/conf/env.json +0 -70
  392. package/core/template/conf/settings.json +0 -48
  393. package/core/template/conf/statics.json +0 -6
  394. package/core/template/conf/views.json +0 -16
  395. package/core/template/samples/bundle/config/app.json +0 -4
  396. package/core/template/samples/bundle/config/routing.json +0 -9
  397. package/core/template/samples/bundle/controllers/setup.js +0 -33
  398. package/core/template/views/js/vendor/readme.md +0 -1
  399. package/core/template/views/readme.md +0 -1
  400. package/core/utils/helpers/dateFormat.js +0 -264
  401. package/core/utils/helpers/index.js +0 -202
  402. package/core/utils/index.js +0 -75
  403. package/core/utils/lib/cmd/app.js +0 -686
  404. package/core/utils/lib/cmd/basic.help.txt +0 -40
  405. package/core/utils/lib/cmd/basic.js +0 -141
  406. package/core/utils/lib/cmd/gina-add-bundle.js +0 -328
  407. package/core/utils/lib/cmd/gina-add-views.js +0 -99
  408. package/core/utils/lib/cmd/gina-build.js +0 -218
  409. package/core/utils/lib/cmd/gina-clean.js +0 -26
  410. package/core/utils/lib/cmd/gina-connect.js +0 -176
  411. package/core/utils/lib/cmd/gina-delete-bundle.js +0 -176
  412. package/core/utils/lib/cmd/gina-deploy.js +0 -452
  413. package/core/utils/lib/cmd/gina-init-project.js +0 -83
  414. package/core/utils/lib/cmd/gina-start-bundle.js +0 -3
  415. package/core/utils/lib/cmd/gina-start.js +0 -3
  416. package/core/utils/lib/cmd/index.js +0 -157
  417. package/core/utils/lib/cmd/project.js +0 -14
  418. package/core/utils/lib/collection/src/main.js +0 -650
  419. package/core/utils/lib/logger/containers/file.js +0 -11
  420. package/core/utils/lib/logger/index.js +0 -260
  421. package/core/utils/lib/merge/src/main.js +0 -344
  422. package/core/utils/lib/proc.js +0 -416
  423. package/core/utils/lib/routing/src/main.js +0 -165
  424. package/documentation/css/default.css +0 -3
  425. package/documentation/html/home.html +0 -6
  426. package/documentation/html/inc/_footer.html +0 -5
  427. package/documentation/html/layout.html +0 -21
  428. package/documentation/img/debug-conf1.png +0 -0
  429. package/documentation/img/debug-conf2.png +0 -0
  430. package/documentation/img/debug-conf3.png +0 -0
  431. package/documentation/img/debug-conf4.png +0 -0
  432. package/documentation/img/debug-conf5.png +0 -0
  433. package/documentation/img/debug-conf6.png +0 -0
  434. package/documentation/img/debug-conf7.png +0 -0
  435. package/documentation/img/debug-new1.png +0 -0
  436. package/documentation/img/debug-new2.png +0 -0
  437. package/documentation/img/debug-start.png +0 -0
  438. package/documentation/md/api/controller/main.md +0 -74
  439. package/migration_note.md +0 -7
  440. package/package-lock.json +0 -611
  441. package/script/pre_publish.js +0 -207
  442. package/tutorial/Commands/README.md +0 -56
  443. package/tutorial/Commands/add-bundle-result.png +0 -0
  444. package/tutorial/Commands/add-bundle.png +0 -0
  445. package/tutorial/Commands/delete-bundle.png +0 -0
  446. package/tutorial/Commands/help.png +0 -0
  447. package/tutorial/Commands/init-project.png +0 -0
  448. package/tutorial/Commands/start-bundle-result.png +0 -0
  449. package/tutorial/Commands/start-bundle-stop.png +0 -0
  450. package/tutorial/Commands/start-bundle.png +0 -0
  451. package/tutorial/Commands/version.png +0 -0
  452. package/tutorial/ETC/README.md +0 -74
  453. package/tutorial/ETC/add-bundle-result.png +0 -0
  454. package/tutorial/ETC/add-bundle.png +0 -0
  455. package/tutorial/ETC/init-project.png +0 -0
  456. package/tutorial/Install/README.md +0 -54
  457. package/tutorial/Install/git-get.png +0 -0
  458. package/tutorial/Install/git-install-end.png +0 -0
  459. package/tutorial/Install/git-install-result.png +0 -0
  460. package/tutorial/Install/git-install-start.png +0 -0
  461. package/tutorial/Install/install-end.png +0 -0
  462. package/tutorial/Install/install-result.png +0 -0
  463. package/tutorial/Install/install-start.png +0 -0
  464. package/tutorial/WebStorm/README.md +0 -30
  465. package/tutorial/WebStorm/closure-compiler.png +0 -0
  466. 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