gina 0.1.1-alpha.22 → 0.1.1-alpha.220

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 (369) hide show
  1. package/AUTHORS +2 -1
  2. package/LICENSE +1 -1
  3. package/README-4Contributors.md +30 -0
  4. package/README.md +210 -32
  5. package/bin/cli +166 -68
  6. package/bin/cli-debug +49 -18
  7. package/bin/cmd +40 -18
  8. package/bin/gina +48 -37
  9. package/framework/{v0.1.1-alpha.22/lib/inherits → v0.1.1-alpha.220}/LICENSE +1 -1
  10. package/framework/v0.1.1-alpha.220/VERSION +1 -0
  11. package/framework/{v0.1.1-alpha.22/core/asset/js/plugin/readme.md → v0.1.1-alpha.220/core/asset/plugin/README.md} +31 -9
  12. package/framework/v0.1.1-alpha.220/core/asset/plugin/dist/vendor/gina/css/gina.min.css +1 -0
  13. package/framework/v0.1.1-alpha.220/core/asset/plugin/dist/vendor/gina/css/gina.min.css.map +1 -0
  14. package/framework/v0.1.1-alpha.220/core/asset/plugin/dist/vendor/gina/html/toolbar.html +251 -0
  15. package/framework/{v0.1.1-alpha.22/core/asset/js/plugin/dist → v0.1.1-alpha.220/core/asset/plugin/dist/vendor/gina/js}/gina.js +4364 -3175
  16. package/framework/v0.1.1-alpha.220/core/asset/plugin/dist/vendor/gina/js/gina.min.js +764 -0
  17. package/framework/v0.1.1-alpha.220/core/asset/plugin/dist/vendor/gina/js/gina.min.js.map +8 -0
  18. package/framework/v0.1.1-alpha.220/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js +5 -0
  19. package/framework/v0.1.1-alpha.220/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js.map +8 -0
  20. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/config.js +172 -79
  21. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/connectors/couchbase/index.js +373 -259
  22. package/framework/v0.1.1-alpha.220/core/connectors/couchbase/lib/connector.js +22 -0
  23. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/connectors/couchbase/lib/connector.v2.js +51 -51
  24. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/connectors/couchbase/lib/connector.v3.js +51 -51
  25. package/framework/v0.1.1-alpha.220/core/connectors/couchbase/lib/connector.v4.js +384 -0
  26. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/connectors/couchbase/lib/n1ql.js +3 -2
  27. package/framework/v0.1.1-alpha.220/core/connectors/couchbase/lib/session-store.js +22 -0
  28. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/connectors/couchbase/lib/session-store.v3.js +12 -12
  29. package/framework/v0.1.1-alpha.220/core/connectors/couchbase/lib/session-store.v4.js +361 -0
  30. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/controller/controller.js +921 -773
  31. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/dev/index.js +1 -1
  32. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/dev/lib/class.js +1 -1
  33. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/dev/lib/factory.js +2 -2
  34. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/gna.js +13 -9
  35. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/locales/README.md +5 -0
  36. package/framework/v0.1.1-alpha.220/core/locales/dist/region/en.json +5727 -0
  37. package/framework/v0.1.1-alpha.220/core/locales/dist/region/fr.json +11452 -0
  38. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/locales/index.js +2 -2
  39. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/locales/src/make.js +39 -41
  40. package/framework/v0.1.1-alpha.220/core/locales/src/resources/region.mapping.json +43 -0
  41. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/model/entity.js +87 -67
  42. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/model/index.js +16 -16
  43. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/model/template/entityFactory.js +1 -1
  44. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/model/template/index.js +17 -15
  45. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/plugins/index.js +1 -1
  46. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/plugins/lib/file/package.json +1 -1
  47. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/plugins/lib/intl/package.json +1 -1
  48. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/plugins/lib/intl/src/main.js +5 -5
  49. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/plugins/lib/storage/package.json +1 -1
  50. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/plugins/lib/storage/src/main.js +6 -5
  51. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/plugins/lib/validator/package.json +1 -1
  52. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/plugins/lib/validator/src/form-validator.js +403 -300
  53. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/plugins/lib/validator/src/main.js +1368 -1314
  54. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/router.js +99 -90
  55. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/server.isaac.js +203 -180
  56. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/server.js +439 -238
  57. package/framework/v0.1.1-alpha.220/core/template/boilerplate/bundle/config/settings.json +12 -0
  58. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/boilerplate/bundle/config/settings.server.json +4 -4
  59. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/boilerplate/bundle/config/templates.json +4 -4
  60. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/boilerplate/bundle/controllers/controller.content.js +1 -1
  61. package/framework/v0.1.1-alpha.220/core/template/boilerplate/bundle/controllers/setup.js +111 -0
  62. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/boilerplate/bundle/index.js +13 -1
  63. package/framework/v0.1.1-alpha.220/core/template/boilerplate/bundle_templates/html/content/homepage.html +8 -0
  64. package/framework/v0.1.1-alpha.220/core/template/boilerplate/bundle_templates/html/includes/error-msg-noscript.html +11 -0
  65. package/framework/v0.1.1-alpha.220/core/template/boilerplate/bundle_templates/html/includes/error-msg-outdated-browser.html +8 -0
  66. package/framework/{v0.1.1-alpha.22/core/template/boilerplate/bundle_templates/html/layout → v0.1.1-alpha.220/core/template/boilerplate/bundle_templates/html/layouts}/main.html +10 -3
  67. package/framework/v0.1.1-alpha.220/core/template/command/gina.bat.tpl +8 -0
  68. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/command/gina.tpl +4 -4
  69. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/conf/env.json +11 -0
  70. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/conf/package.json +1 -1
  71. package/framework/v0.1.1-alpha.220/core/template/conf/statics.json +12 -0
  72. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/conf/templates.json +2 -2
  73. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/helpers/console.js +3 -3
  74. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/helpers/context.js +148 -7
  75. package/framework/v0.1.1-alpha.220/helpers/data/LICENSE +9 -0
  76. package/framework/v0.1.1-alpha.220/helpers/data/README.md +12 -0
  77. package/framework/v0.1.1-alpha.220/helpers/data/package.json +20 -0
  78. package/framework/v0.1.1-alpha.220/helpers/data/src/main.js +295 -0
  79. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/helpers/dateFormat.js +9 -7
  80. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/helpers/index.js +13 -8
  81. package/framework/v0.1.1-alpha.220/helpers/json/LICENSE +9 -0
  82. package/framework/v0.1.1-alpha.220/helpers/json/README.md +12 -0
  83. package/framework/{v0.1.1-alpha.22/helpers/plugins → v0.1.1-alpha.220/helpers/json}/package.json +2 -2
  84. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/helpers/json/src/main.js +28 -26
  85. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/helpers/path.js +176 -96
  86. package/framework/{v0.1.1-alpha.22/helpers/json → v0.1.1-alpha.220/helpers/plugins}/package.json +2 -2
  87. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/helpers/plugins/src/api-error.js +23 -23
  88. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/helpers/plugins/src/main.js +3 -3
  89. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/helpers/prototypes.js +46 -38
  90. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/helpers/task.js +21 -14
  91. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/helpers/text.js +2 -2
  92. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/archiver/package.json +1 -1
  93. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/archiver/src/dep/jszip.min.js +3 -3
  94. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/archiver/src/main.js +168 -168
  95. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/aliases.json +4 -1
  96. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/bundle/add.js +84 -27
  97. package/framework/v0.1.1-alpha.220/lib/cmd/bundle/arguments.json +7 -0
  98. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/bundle/help.txt +4 -2
  99. package/framework/v0.1.1-alpha.220/lib/cmd/bundle/list.js +176 -0
  100. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/bundle/remove.js +36 -27
  101. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/bundle/start.js +264 -46
  102. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/bundle/stop.js +93 -74
  103. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/env/add.js +44 -43
  104. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/env/list.js +23 -4
  105. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/env/remove.js +19 -19
  106. package/framework/{v0.1.1-alpha.22/lib/cmd/scope → v0.1.1-alpha.220/lib/cmd/env}/use.js +21 -1
  107. package/framework/v0.1.1-alpha.220/lib/cmd/framework/build.js +88 -0
  108. package/framework/v0.1.1-alpha.220/lib/cmd/framework/init.js +798 -0
  109. package/framework/v0.1.1-alpha.220/lib/cmd/framework/link-node-modules.js +116 -0
  110. package/framework/v0.1.1-alpha.220/lib/cmd/framework/link.js +114 -0
  111. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/framework/open.js +22 -1
  112. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/framework/restart.js +61 -26
  113. package/framework/v0.1.1-alpha.220/lib/cmd/framework/set.js +293 -0
  114. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/framework/start.js +46 -20
  115. package/framework/v0.1.1-alpha.220/lib/cmd/framework/status.js +141 -0
  116. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/framework/stop.js +47 -28
  117. package/framework/v0.1.1-alpha.220/lib/cmd/framework/tail.js +302 -0
  118. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/framework/version.js +15 -3
  119. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/helper.js +131 -18
  120. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/index.js +23 -23
  121. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/port/inc/scan.js +32 -16
  122. package/framework/v0.1.1-alpha.220/lib/cmd/port/list.js +462 -0
  123. package/framework/v0.1.1-alpha.220/lib/cmd/port/reset.js +429 -0
  124. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/project/add.js +147 -122
  125. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/project/arguments.json +2 -1
  126. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/project/build.js +28 -28
  127. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/project/list.js +19 -2
  128. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/project/remove.js +19 -17
  129. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/project/rename.js +11 -11
  130. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/protocol/set.js +256 -209
  131. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/scope/list.js +27 -8
  132. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/scope/remove.js +19 -19
  133. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/view/add.js +35 -10
  134. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/collection/package.json +1 -1
  135. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/collection/src/main.js +243 -242
  136. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/config.js +31 -30
  137. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cron/package.json +1 -1
  138. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cron/src/main.js +10 -9
  139. package/framework/v0.1.1-alpha.220/lib/domain/LICENSE +9 -0
  140. package/framework/v0.1.1-alpha.220/lib/domain/README.md +46 -0
  141. package/framework/v0.1.1-alpha.220/lib/domain/dist/public_suffix_list.dat +14186 -0
  142. package/framework/v0.1.1-alpha.220/lib/domain/package.json +20 -0
  143. package/framework/v0.1.1-alpha.220/lib/domain/src/main.js +442 -0
  144. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/generator/index.js +5 -5
  145. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/index.js +3 -2
  146. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220/lib/inherits}/LICENSE +1 -1
  147. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/inherits/README.md +2 -2
  148. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/inherits/package.json +3 -4
  149. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/inherits/src/main.js +3 -3
  150. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/logger/package.json +2 -2
  151. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/logger/src/containers/default/index.js +13 -2
  152. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/logger/src/containers/file/index.js +109 -14
  153. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/logger/src/containers/mq/index.js +12 -3
  154. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/logger/src/containers/mq/listener.js +16 -14
  155. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/logger/src/containers/mq/speaker.js +32 -3
  156. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/logger/src/helper.js +21 -1
  157. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/logger/src/main.js +36 -9
  158. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/math/index.js +9 -9
  159. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/merge/README.md +2 -2
  160. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/merge/package.json +1 -1
  161. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/merge/src/main.js +118 -91
  162. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/model.js +10 -10
  163. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/proc.js +87 -49
  164. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/routing/package.json +1 -1
  165. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/routing/src/main.js +313 -285
  166. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/session-store.js +6 -6
  167. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/shell.js +3 -3
  168. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/swig-filters/package.json +1 -1
  169. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/swig-filters/src/main.js +140 -119
  170. package/framework/v0.1.1-alpha.220/lib/url/README.md +0 -0
  171. package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/validator.js +2 -2
  172. package/framework/v0.1.1-alpha.220/package.json +14 -0
  173. package/package.json +37 -25
  174. package/resources/home/main.json +53 -4
  175. package/resources/home/settings.json +9 -0
  176. package/resources/home/user/extensions/logger/default/config.json +1 -1
  177. package/resources/package.json.template +29 -18
  178. package/script/lib.js +0 -0
  179. package/script/post_install.js +479 -141
  180. package/script/pre_install.js +508 -77
  181. package/services/.gna/67fdf1b224a2ed5597e63d4b64283834468e05e3.txt +0 -0
  182. package/services/.gna/arch +1 -0
  183. package/services/.gna/locals.json +14 -0
  184. package/services/.gna/platform +1 -0
  185. package/services/configure +6 -0
  186. package/services/env.json +18 -0
  187. package/services/manifest.json +30 -0
  188. package/services/package.json +11 -0
  189. package/services/src/proxy/config/app.json +6 -0
  190. package/services/src/proxy/config/routing.json +11 -0
  191. package/services/src/proxy/config/settings.json +9 -0
  192. package/services/src/proxy/config/settings.server.json +31 -0
  193. package/services/src/proxy/config/statics.json +3 -0
  194. package/services/src/proxy/controllers/controller.content.js +58 -0
  195. package/services/src/proxy/controllers/controller.js +30 -0
  196. package/{framework/v0.1.1-alpha.22/core/template/boilerplate/bundle → services/src/proxy}/controllers/setup.js +14 -14
  197. package/services/src/proxy/index.js +31 -0
  198. package/services/src/proxy/lib/domain/README.md +48 -0
  199. package/services/src/proxy/lib/domain/src/config/public_suffix_list.dat +14186 -0
  200. package/services/src/toolbar/config/app.json +6 -0
  201. package/services/src/toolbar/config/routing.json +11 -0
  202. package/{framework/v0.1.1-alpha.22/core/template/boilerplate/bundle → services/src/toolbar}/config/settings.json +0 -0
  203. package/services/src/toolbar/config/settings.server.json +30 -0
  204. package/services/src/toolbar/controllers/controller.content.js +39 -0
  205. package/services/src/toolbar/controllers/controller.js +30 -0
  206. package/services/src/toolbar/controllers/setup.js +111 -0
  207. package/services/src/toolbar/index.js +43 -0
  208. package/utils/helper.js +236 -185
  209. package/utils/prototypes.js +9 -9
  210. package/utils/prototypes.json_clone.js +70 -37
  211. package/doc/framework/cli/doc.json +0 -9
  212. package/doc/framework/index.md +0 -60
  213. package/framework/v0.1.1-alpha.22/VERSION +0 -1
  214. package/framework/v0.1.1-alpha.22/core/asset/js/plugin/dist/gina.js.map +0 -56
  215. package/framework/v0.1.1-alpha.22/core/asset/js/plugin/dist/gina.min.css +0 -1
  216. package/framework/v0.1.1-alpha.22/core/asset/js/plugin/dist/gina.min.css.map +0 -1
  217. package/framework/v0.1.1-alpha.22/core/asset/js/plugin/dist/gina.min.js +0 -736
  218. package/framework/v0.1.1-alpha.22/core/asset/js/plugin/dist/gina.min.js.map +0 -56
  219. package/framework/v0.1.1-alpha.22/core/asset/js/plugin/dist/gina.onload.min.js +0 -5
  220. package/framework/v0.1.1-alpha.22/core/asset/js/plugin/dist/gina.onload.min.js.map +0 -8
  221. package/framework/v0.1.1-alpha.22/core/connectors/couchbase/lib/connector.js +0 -20
  222. package/framework/v0.1.1-alpha.22/core/connectors/couchbase/lib/session-store.js +0 -21
  223. package/framework/v0.1.1-alpha.22/core/locales/dist/region/en.json +0 -9492
  224. package/framework/v0.1.1-alpha.22/core/locales/dist/region/fr.json +0 -9492
  225. package/framework/v0.1.1-alpha.22/core/locales/src/resources/region.mapping.json +0 -28
  226. package/framework/v0.1.1-alpha.22/core/template/boilerplate/bundle_templates/html/homepage.html +0 -4
  227. package/framework/v0.1.1-alpha.22/core/template/conf/statics.json +0 -10
  228. package/framework/v0.1.1-alpha.22/lib/cmd/bundle/arguments.json +0 -4
  229. package/framework/v0.1.1-alpha.22/lib/cmd/bundle/list.js +0 -129
  230. package/framework/v0.1.1-alpha.22/lib/cmd/framework/init.js +0 -514
  231. package/framework/v0.1.1-alpha.22/lib/cmd/framework/set.js +0 -161
  232. package/framework/v0.1.1-alpha.22/lib/cmd/framework/status.js +0 -72
  233. package/framework/v0.1.1-alpha.22/lib/cmd/framework/tail.js +0 -183
  234. package/framework/v0.1.1-alpha.22/lib/cmd/port/list.js +0 -176
  235. package/framework/v0.1.1-alpha.22/package.json +0 -14
  236. package/script/prepare_version.js +0 -429
  237. /package/{framework/v0.1.1-alpha.22/core/template/command/gina.bat.tpl → bin/gina.bat} +0 -0
  238. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/AUTHORS +0 -0
  239. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/asset/html/nolayout.html +0 -0
  240. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/asset/html/static.html +0 -0
  241. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/asset/img/android-chrome-192x192.png +0 -0
  242. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/asset/img/android-chrome-512x512.png +0 -0
  243. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/asset/img/apple-touch-icon.png +0 -0
  244. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/asset/img/favicon-16x16.png +0 -0
  245. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/asset/img/favicon-32x32.png +0 -0
  246. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/asset/img/favicon.ico +0 -0
  247. /package/framework/{v0.1.1-alpha.22/core/asset/js → v0.1.1-alpha.220/core/asset}/plugin/uuid.json +0 -0
  248. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/connectors/couchbase/lib/session-store.v2.js +0 -0
  249. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/controller/controller.framework.js +0 -0
  250. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/controller/index.js +0 -0
  251. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/deps/busboy/.travis.yml +0 -0
  252. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/deps/busboy/LICENSE +0 -0
  253. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/deps/busboy/README.md +0 -0
  254. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/deps/busboy/deps/encoding/encoding-indexes.js +0 -0
  255. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/deps/busboy/deps/encoding/encoding.js +0 -0
  256. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/deps/busboy/lib/main.js +0 -0
  257. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/deps/busboy/lib/types/multipart.js +0 -0
  258. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/deps/busboy/lib/types/urlencoded.js +0 -0
  259. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/deps/busboy/lib/utils.js +0 -0
  260. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/deps/busboy/package.json +0 -0
  261. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/deps/swig-client/swig-2.0.0.min.js +0 -0
  262. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/dev/lib/tools.js +0 -0
  263. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/locales/currency.json +0 -0
  264. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/locales/dist/language/en.json +0 -0
  265. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/locales/dist/language/fr.json +0 -0
  266. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/locales/src/resources/currency.csv +0 -0
  267. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/locales/src/resources/region.csv +0 -0
  268. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/mime.types +0 -0
  269. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/plugins/README.md +0 -0
  270. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/plugins/lib/file/README.md +0 -0
  271. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/plugins/lib/file/build.json +0 -0
  272. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/plugins/lib/intl/README.md +0 -0
  273. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/plugins/lib/intl/build.json +0 -0
  274. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/plugins/lib/storage/README.md +0 -0
  275. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/plugins/lib/storage/build.json +0 -0
  276. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/plugins/lib/validator/README.md +0 -0
  277. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/plugins/lib/validator/build.json +0 -0
  278. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/server.express.js +0 -0
  279. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/status.codes +0 -0
  280. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/boilerplate/bundle/config/app.json +0 -0
  281. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/boilerplate/bundle/config/routing.json +0 -0
  282. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/boilerplate/bundle/controllers/controller.js +0 -0
  283. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/boilerplate/bundle_namespace/controllers/controller.js +0 -0
  284. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/boilerplate/bundle_public/css/default.css +0 -0
  285. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/boilerplate/bundle_public/css/vendor/readme.md +0 -0
  286. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/boilerplate/bundle_public/favicon.ico +0 -0
  287. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/boilerplate/bundle_public/js/vendor/readme.md +0 -0
  288. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/boilerplate/bundle_public/readme.md +0 -0
  289. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/boilerplate/bundle_templates/handlers/main.js +0 -0
  290. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/conf/manifest.json +0 -0
  291. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/conf/settings.json +0 -0
  292. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/error/client/json/401.json +0 -0
  293. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/error/client/json/403.json +0 -0
  294. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/error/client/json/404.json +0 -0
  295. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/error/server/html/50x.html +0 -0
  296. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/error/server/json/500.json +0 -0
  297. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/error/server/json/503.json +0 -0
  298. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/core/template/extensions/logger/config.json +0 -0
  299. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/helpers/plugins/README.md +0 -0
  300. /package/framework/{v0.1.1-alpha.22/helpers/json → v0.1.1-alpha.220/lib/archiver}/README.md +0 -0
  301. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/archiver/build.json +0 -0
  302. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/bundle/copy.js +0 -0
  303. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/bundle/cp.js +0 -0
  304. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/bundle/help.js +0 -0
  305. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/bundle/rename.js +0 -0
  306. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/bundle/restart.js +0 -0
  307. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/bundle/rm.js +0 -0
  308. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/bundle/status.js +0 -0
  309. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/env/get.js +0 -0
  310. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/env/help.js +0 -0
  311. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/env/help.txt +0 -0
  312. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/env/link-dev.js +0 -0
  313. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/env/rm.js +0 -0
  314. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/env/set.js +0 -0
  315. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/env/unset.js +0 -0
  316. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/framework/dot.js +0 -0
  317. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/framework/get.js +0 -0
  318. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/framework/help.js +0 -0
  319. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/framework/help.txt +0 -0
  320. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/framework/msg.json +0 -0
  321. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/framework/update.js +0 -0
  322. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/gina-dev.1.md +0 -0
  323. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/gina-framework.1.md +0 -0
  324. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/gina.1.md +0 -0
  325. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/msg.json +0 -0
  326. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/port/help.js +0 -0
  327. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/port/help.txt +0 -0
  328. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/port/set.js +0 -0
  329. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/project/help.js +0 -0
  330. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/project/help.txt +0 -0
  331. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/project/import.js +0 -0
  332. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/project/move.js +0 -0
  333. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/project/restart.js +0 -0
  334. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/project/rm.js +0 -0
  335. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/project/start.js +0 -0
  336. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/project/status.js +0 -0
  337. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/project/stop.js +0 -0
  338. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/protocol/help.js +0 -0
  339. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/protocol/help.txt +0 -0
  340. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/protocol/list.js +0 -0
  341. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/scope/help.js +0 -0
  342. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/scope/help.txt +0 -0
  343. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/scope/link-local.js +0 -0
  344. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/scope/rm.js +0 -0
  345. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/scope/set.js +0 -0
  346. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cmd/scope/unset.js +0 -0
  347. /package/framework/{v0.1.1-alpha.22/lib/cmd/env → v0.1.1-alpha.220/lib/cmd/scope}/use.js +0 -0
  348. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/collection/README.md +0 -0
  349. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/collection/build.json +0 -0
  350. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/cron/README.md +0 -0
  351. /package/framework/{v0.1.1-alpha.22/lib/archiver/README.md → v0.1.1-alpha.220/lib/domain/exemples/backend.js} +0 -0
  352. /package/framework/{v0.1.1-alpha.22/lib/routing/README.md → v0.1.1-alpha.220/lib/domain/exemples/frontend.html} +0 -0
  353. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/inherits/example/inheriting_eventemitter.js +0 -0
  354. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/inherits/example/protected_inheritance.js +0 -0
  355. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/inherits/example/simple_inheritance.js +0 -0
  356. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/inherits/example/super_attribute_overridden_by_child_on_init.js +0 -0
  357. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/logger/README.md +0 -0
  358. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/logger/src/containers/file/lib/logrotator/README.md +0 -0
  359. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/logger/src/containers/file/lib/logrotator/index.js +0 -0
  360. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/merge/example/merge.js +0 -0
  361. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/merge/example/merge_2_literal objects.js +0 -0
  362. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/merge/example/merge_and_preserve_first.js +0 -0
  363. /package/framework/{v0.1.1-alpha.22/lib/swig-filters → v0.1.1-alpha.220/lib/routing}/README.md +0 -0
  364. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/routing/build.json +0 -0
  365. /package/framework/{v0.1.1-alpha.22/lib/url → v0.1.1-alpha.220/lib/swig-filters}/README.md +0 -0
  366. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/url/index.js +0 -0
  367. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/url/mocks.json +0 -0
  368. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/url/routing.json +0 -0
  369. /package/framework/{v0.1.1-alpha.22 → v0.1.1-alpha.220}/lib/url/test.js +0 -0
@@ -1,6 +1,8 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
1
3
  /**
2
4
  * This file is part of the gina package.
3
- * Copyright (c) 2017 Rhinostone <contact@gina.io>
5
+ * Copyright (c) 2009-2023 Rhinostone <contact@gina.io>
4
6
  *
5
7
  * For the full copyright and license information, please view the LICENSE
6
8
  * file that was distributed with this source code.
@@ -8,10 +10,68 @@
8
10
 
9
11
  //Imports
10
12
  var fs = require('fs');
13
+ var os = require("os");
11
14
  var util = require('util');
12
15
  var promisify = util.promisify;
13
16
  const { execSync } = require('child_process');
14
17
 
18
+ var isWin32 = function() {
19
+ return (process.platform === 'win32') ? true : false;
20
+ };
21
+ var isWritableSync = function(path) {
22
+ var canWrite = false;
23
+ if ( fs.accessSync && typeof(fs.accessSync) != 'undefined' ) {
24
+ try {
25
+ fs.accessSync(path, fs.constants.W_OK);
26
+ canWrite = true;
27
+ } catch (err) {
28
+ canWrite = false;
29
+ }
30
+ } else { // support for old version of nodejs
31
+
32
+ try {
33
+ canWrite = (fs.statSync(path).mode & (fs.constants.S_IRUSR | fs.constants.S_IRGRP | fs.constants.S_IROTH));
34
+ } catch (err) {
35
+ canWrite = false
36
+ }
37
+ }
38
+
39
+ return canWrite
40
+ };
41
+
42
+ var getUserHome = function() {
43
+ var home = os.homedir ? os.homedir : function() {
44
+ var homeDir = process.env[(isWin32()) ? 'USERPROFILE' : 'HOME'];
45
+
46
+ if ( !homeDir || homeDir == '' ) {
47
+ throw new Error('Home directory not defined or not found !');
48
+ }
49
+
50
+ if ( !isWritableSync(homeDir) ) {
51
+ throw new Error('Home directory found but not writable: need permissions for `'+ homeDir +'`');
52
+ }
53
+
54
+ return homeDir;
55
+ };
56
+
57
+ return home()
58
+ };
59
+
60
+ // just in case `post_install` is called by hand
61
+ var initialDir = process.cwd();
62
+ var frameworkPath = __dirname +'/..';
63
+ if ( !fs.existsSync(frameworkPath +'/node_modules/colors') ) {
64
+ process.chdir(frameworkPath);
65
+
66
+ var oldConfigGlobal = process.env.npm_config_global;
67
+ process.env.npm_config_global=false;
68
+ var cmd = ( isWin32() ) ? 'npm.cmd install colors@1.4.0' : 'npm install colors@1.4.0';
69
+ execSync(cmd);
70
+ process.env.npm_config_global=oldConfigGlobal;
71
+
72
+ process.chdir(initialDir);
73
+ }
74
+
15
75
  var lib = require('./lib');
16
76
  var console = lib.logger;
17
77
 
@@ -20,6 +80,7 @@ var ginaPath = (scriptPath.replace(/\\/g, '/')).replace('/script', '');
20
80
  var help = require(ginaPath + '/utils/helper.js');
21
81
  var pack = ginaPath + '/package.json';
22
82
  pack = (isWin32()) ? pack.replace(/\//g, '\\') : pack;
83
+ var helpers = null;
23
84
 
24
85
 
25
86
  /**
@@ -28,47 +89,181 @@ pack = (isWin32()) ? pack.replace(/\//g, '\\') : pack;
28
89
  * */
29
90
  function PostInstall() {
30
91
 
31
- var self = {}, _this = this;
92
+ var self = {};
32
93
 
33
- //Initialize post installation scripts.
34
- var init = function() {
35
- self.isWin32 = isWin32();//getEnvVar('GINA_IS_WIN32');
36
- self.path = getEnvVar('GINA_FRAMEWORK');
37
- self.gina = getEnvVar('GINA_DIR');
38
- self.root = self.gina; // by default
39
- self.isGlobalInstall = false;
40
- self.prefix = execSync('npm config get prefix');
41
- self.isCustomPrefix = false;
94
+ var configure = function() {
95
+
96
+ // TODO - handle windows case
97
+ if ( /^true$/i.test(isWin32()) ) {
98
+ throw new Error('Windows in not yet fully supported. Thank you for your patience');
99
+ }
100
+
101
+ self.isWin32 = isWin32();
102
+ self.isGlobalInstall = ( typeof(process.env.npm_config_global) != 'undefined' && /^(true|false)$/i.test(process.env.npm_config_global) )
103
+ ? (/^true$/i.test(process.env.npm_config_global) ? true: false)
104
+ : false;
105
+ self.isResetNeeded = ( typeof(process.env.npm_config_reset) != 'undefined' && /^(true|false)$/i.test(process.env.npm_config_reset) )
106
+ ? (/^true$/i.test(process.env.npm_config_reset) ? true: false)
107
+ : false;
108
+ self.defaultPrefix = execSync('npm config get prefix').toString().replace(/\n$/g, '');
109
+ // var pkg = null;
110
+ // try {
111
+ // if (self.isGlobalInstall) {
112
+ // pkg = execSync('npm list -g gina --long --json').toString().replace(/\n$/g, '');
113
+ // } else {
114
+ // pkg = execSync('npm list gina --long --json').toString().replace(/\n$/g, '');
115
+ // }
116
+ // } catch(err) {
117
+ // throw err
118
+ // }
119
+ // self.optionalPrefix = JSON.parse(pkg).dependencies.gina.config.optionalPrefix.replace(/^\~/, getUserHome());
42
120
 
121
+ // `process.env.npm_config_prefix` is only retrieved on `npm install gina`
122
+ // and it should always be equal to `self.defaultPrefix`
123
+ self.prefix = process.env.npm_config_prefix || self.defaultPrefix;
124
+ self.isCustomPrefix = false;
125
+ self.isGinaInstalled = false;
126
+
127
+ // Overriding thru passed arguments
43
128
  var args = process.argv, i = 0, len = args.length;
44
129
  for (; i < len; ++i) {
45
- if (args[i] == '-g' ) {
130
+ if ( /^(\-g|\-\-global)$/.test(args[i]) ) {
46
131
  self.isGlobalInstall = true;
47
132
  continue;
48
133
  }
49
- if (args[i] == '--prefix' ) {
134
+
135
+ if ( /^\-\-reset$/.test(args[i]) ) {
136
+ self.isResetNeeded = true;
137
+ continue;
138
+ }
139
+
140
+ if ( /^\-\-prefix\=/.test(args[i] ) ) {
50
141
  self.isCustomPrefix = true;
51
142
  self.prefix = args[i].split(/\=/)[1];
143
+ self.prefix = self.prefix.replace(/^\~/, getUserHome());
52
144
  continue;
53
145
  }
146
+
147
+ if ( /^\-\-log-level\=/.test(args[i]) ) {
148
+ var logLevel = args[i].split(/\=/)[1];
149
+ console.setLevel(logLevel, 'gina');
150
+ process.env.LOG_LEVEL=logLevel;
151
+ }
54
152
  }
55
153
 
56
- self.prefix = self.prefix.toString().replace(/\n/g, '');
154
+ if (self.prefix != self.defaultPrefix) {
155
+ self.isCustomPrefix = true;
156
+ }
57
157
 
58
- console.debug('Is this for Windows ? ' + self.isWin32);
158
+ // For local install
159
+ console.debug('self.isGlobalInstall => '+ self.isGlobalInstall);
160
+ if ( !self.isGlobalInstall ) {
161
+ console.warn('Local installation is not fully supported at the moment.');
162
+ console.warn('You are encouraged to use `npm install -g gina`\nor, if you are trying to link gina to your project, use `npm link gina` if Gina has already been installed globally\n');
163
+ // Just in case someone is trying to run post_install from the `gina` module of from the project dir
164
+ if (!/node\_modules(\\\\|\/)gina$/.test(process.env.INIT_CWD)) {
165
+ self.prefix = process.env.INIT_CWD || process.cwd();
166
+ }
59
167
 
60
- if ( !self.isGlobalInstall ) { //global install
61
- self.root = process.cwd(); // project path
62
- console.error('local installation is not supported for this version at the moment.');
63
- console.info('please use `npm install -g gina`');
64
- process.exit(1);
168
+ // No package.json ?
169
+ var projectName = self.prefix.split('/').slice(-1)[0];
170
+ var projectPackageJsonObj = new _(self.prefix +'/package.json', true);
171
+ console.info('Checking for: '+ projectPackageJsonObj.toString(), '['+ projectPackageJsonObj.existsSync() +']');
172
+ if ( !projectPackageJsonObj.existsSync() ) {
173
+ var defaultPackageJsonContent = {
174
+ "name": ""+ projectName,
175
+ "version": "0.0.1",
176
+ "description": projectName+ " is a nice project !",
177
+ "engine": [
178
+ "node >=" + process.version.substring(1)
179
+ ]
180
+ };
181
+ console.warn('No `package.json` found for your project, creating one to avoid install exceptions');
182
+ lib.generator.createFileFromDataSync(defaultPackageJsonContent, projectPackageJsonObj.toString());
183
+ }
65
184
  }
66
185
 
67
- console.debug('prefix path: ' + self.prefix);
68
- console.debug('framework path: ' + self.gina);
69
- console.debug('framework version path: ' + self.path);
70
- console.debug('cwd path: ' + self.root );
71
- console.debug('this is a global install ...');
186
+ // checking permission
187
+ var hasPermissionsForBin = isWritableSync(self.prefix + ( isWin32() ? '\\' : '/' ) + 'bin');
188
+ var hasPermissionsForLib = isWritableSync(self.prefix + ( isWin32() ? '\\' : '/' ) + 'lib');
189
+ var hasPermissionsForVar = isWritableSync(self.prefix + ( isWin32() ? '\\' : '/' ) + 'var');
190
+ if ( !hasPermissionsForBin || !hasPermissionsForLib || !hasPermissionsForVar) {
191
+ if (!hasPermissionsForBin) {
192
+ console.warn('Path not accessible or missing: '+ self.prefix + ( isWin32() ? '\\' : '/' ) + 'bin')
193
+ }
194
+ if (!hasPermissionsForLib) {
195
+ console.warn('Path not accessible or missing: '+ self.prefix + ( isWin32() ? '\\' : '/' ) + 'lib')
196
+ }
197
+ if (!hasPermissionsForVar) {
198
+ console.warn('Path not accessible or missing: '+ self.prefix + ( isWin32() ? '\\' : '/' ) + 'var')
199
+ }
200
+
201
+ // console.warn('You do not have sufficient permissions. Switching to `--prefix='+ self.optionalPrefix +'`');
202
+ // process.env.npm_config_prefix = self.prefix = self.optionalPrefix;
203
+ }
204
+
205
+ var pkg = null, pkgObj = null, cmd = null;
206
+ try {
207
+ cmd = 'npm list gina --long --json --prefix='+ self.prefix;
208
+ if (self.isGlobalInstall) {
209
+ cmd += ' -g';
210
+ }
211
+ pkg = execSync(cmd).toString().replace(/\n$/g, '');
212
+ self.optionalPrefix = JSON.parse(pkg).dependencies.gina.config.optionalPrefix.replace(/^\~/, getUserHome());
213
+
214
+ } catch(err) {
215
+ // throw err
216
+ // ignore exception
217
+ }
218
+
219
+ pkgObj = JSON.parse(pkg);
220
+ self.optionalPrefix = pkgObj.dependencies.gina.config.optionalPrefix.replace(/^\~/, getUserHome());
221
+
222
+ if ( self.prefix != self.defaultPrefix ) {
223
+ self.isCustomPrefix = true;
224
+ }
225
+
226
+ self.gina = __dirname +'/..';
227
+ // tying to figure out if gina is already install the given prefix
228
+ var hasFoundGina = pkg;
229
+ try {
230
+ hasFoundGina = JSON.parse(hasFoundGina);
231
+ if ( hasFoundGina.dependencies && typeof(hasFoundGina.dependencies.gina) != 'undefined' ) {
232
+ self.isGinaInstalled = true;
233
+ self.versionPath = self.gina;
234
+ self.versionPath += (isWin32()) ? '\\framework\\' : '/framework/';
235
+ self.version = hasFoundGina.dependencies.gina.version;
236
+ self.versionPath += 'v'+ self.version;
237
+
238
+ self.shortVersion = self.version.split('.');
239
+ self.shortVersion.splice(2);
240
+ self.shortVersion = self.shortVersion.join('.');
241
+
242
+ console.debug('Install path => '+ hasFoundGina.dependencies.gina.path);
243
+
244
+ // OK ... found installed gina but on a different prefix
245
+ // In this case, let's assume that it is not really installed
246
+ console.info('A previous version of gina has been detected');
247
+ if ( !new RegExp('^'+ self.prefix).test(hasFoundGina.dependencies.gina.path) ) {
248
+ self.isGinaInstalled = false;
249
+ console.info('Ignoring previous because of a mismatching install prefix');
250
+ }
251
+
252
+ }
253
+ } catch (err) {}
254
+
255
+ console.debug('self.defaultPrefix => '+ self.defaultPrefix);
256
+ console.debug('self.optionalPrefix => '+ self.optionalPrefix );
257
+ console.debug('self.prefix => '+ self.prefix);
258
+ console.debug('self.isCustomPrefix => ', self.isCustomPrefix);
259
+ // only available when running the script with NPM
260
+ console.debug('process.env.npm_config_prefix => '+ process.env.npm_config_prefix);
261
+ }
262
+
263
+ //Initialize post installation scripts.
264
+ var init = function() {
265
+ configure();
266
+ helpers = require(self.versionPath+ '/helpers');
72
267
 
73
268
  begin(0);
74
269
  }
@@ -77,7 +272,6 @@ function PostInstall() {
77
272
  * Bebin - Will run checking tasks in order of declaration
78
273
  * */
79
274
  var begin = async function(i) {
80
- //console.debug('i is ', i);
81
275
  var n = 0, funct = null, functName = null;
82
276
  for (let t in self) {
83
277
  if ( typeof(self[t]) == 'function') {
@@ -95,7 +289,7 @@ function PostInstall() {
95
289
 
96
290
  // to handle sync vs async to allow execution in order of declaration
97
291
  if (funct) {
98
- eval('async function on'+functName+'(){ await promisify('+ funct + ')().catch(function(e){ console.error(e.toString()); process.exit(-1);}).then(function(){ begin('+(i+1)+')});}; on'+functName+'();'); // jshint ignore:line
292
+ eval('async function on'+functName+'(){ await promisify('+ funct + ')().catch(function(e){ console.error(e.toString()); process.exit(1);}).then(function(){ begin('+(i+1)+')});}; on'+functName+'();'); // jshint ignore:line
99
293
  } else {
100
294
  process.exit(0);
101
295
  }
@@ -153,10 +347,10 @@ function PostInstall() {
153
347
 
154
348
 
155
349
  self.createVersionFile = function(done) {
156
- var version = require( _(self.gina + '/package.json') ).version;
157
- console.debug('writting version number: '+ version);
350
+ var version = self.version;
351
+ console.debug('Writting version number: '+ version);
158
352
 
159
- var target = _(self.path + '/VERSION');
353
+ var target = _(self.versionPath + '/VERSION');
160
354
  try {
161
355
  if ( fs.existsSync(target) ) {
162
356
  fs.unlinkSync(target)
@@ -169,13 +363,20 @@ function PostInstall() {
169
363
  done();
170
364
  }
171
365
 
366
+ // TODO - Remove this part
172
367
  var configureGina = function() {
173
368
  // link to ./bin/cli to binaries dir
174
369
  if (!self.isWin32) {
175
- var binPath = _(self.prefix+'/bin', true);
176
- var cli = _(binPath +'/gina');
370
+ var binPath = null;
371
+ if ( !self.isGlobalInstall() ) {
372
+ binPath = new _(self.prefix+'/node_modules/.bin', true).existsSync() ? _(self.prefix+'/node_modules/.bin', true) : '';
373
+ } else {
374
+ binPath = new _(self.prefix+'/lib/node_modules/gina/bin', true)
375
+ }
376
+
377
+ var cli = _(binPath +'/gina', true);
177
378
  // TODO - remove this part for the next version
178
- var cliDebug = _(binPath +'/gina-debug');
379
+ var cliDebug = _(binPath +'/gina-debug', true);
179
380
 
180
381
  if ( fs.existsSync(cli) ) {
181
382
  fs.unlinkSync(cli)
@@ -185,24 +386,33 @@ function PostInstall() {
185
386
  fs.unlinkSync(cliDebug)
186
387
  }
187
388
 
188
- var cmd = 'ln -s '+ self.gina +'/bin/gina '+ binPath +'/gina';
189
- console.debug('running: '+ cmd);
190
- run(cmd, { cwd: _(self.path), tmp: _(self.root +'/tmp'), outToProcessSTD: true })
191
- .onData(function(data){
192
- console.info(data)
193
- })
194
- .onComplete( function onDone(err, data){
195
- if (err) {
196
- console.error(err);
197
- console.warn('try to run : sudo ' + cmd);
198
- }
199
- });
389
+
390
+ if ( !self.isGlobalInstall() ) {
391
+ new _(cli, true).symlinkSync( _(self.prefix +'/gina', true) )
392
+ }
393
+ // else {
394
+ // new _(cli, true).symlinkSync( _(self.prefix +'/bin/', true) )
395
+ // }
396
+
397
+
398
+ // var cmd = 'ln -s '+ self.gina +'/bin/gina '+ binPath;
399
+ // console.debug('running: '+ cmd);
400
+ // run(cmd, { cwd: _(self.versionPath), tmp: _(self.root +'/tmp'), outToProcessSTD: true })
401
+ // .onData(function(data){
402
+ // console.info(data)
403
+ // })
404
+ // .onComplete( function onDone(err, data){
405
+ // if (err) {
406
+ // console.error(err);
407
+ // console.warn('try to run : sudo ' + cmd);
408
+ // }
409
+ // });
200
410
  // To debug, you just need to run:
201
411
  // gina <topic>:<task> --inspect-gina
202
412
  //
203
413
  // TODO - remove this part for the next version
204
414
  // cmd = 'ln -s '+ self.gina +'/bin/cli-debug '+ binPath +'/gina-debug';
205
- // run(cmd, { cwd: _(self.path), tmp: _(self.root +'/tmp'), outToProcessSTD: true })
415
+ // run(cmd, { cwd: _(self.versionPath), tmp: _(self.root +'/tmp'), outToProcessSTD: true })
206
416
  // .onData(function(data){
207
417
  // console.info(data)
208
418
  // })
@@ -219,55 +429,57 @@ function PostInstall() {
219
429
  }
220
430
 
221
431
  //Creating framework command line file for nix.
222
- var createGinaFile = function(win32Name, callback) {
223
- console.info('Creating framework command line: '+ _(self.path + '/package.json') );
224
-
225
- var name = require( _(self.path + '/package.json') ).name;
226
- console.info('Package name: '+ name );
227
- var appPath = _( self.path.substring(0, (self.path.length - ("node_modules/" + name + '/').length)) );
228
- var source = _(self.path + '/core/template/command/gina.tpl');
229
- var target = _(appPath +'/'+ name);
230
- if ( typeof(win32Name) != 'undefined') {
231
- target = _(appPath +'/'+ win32Name)
232
- }
233
- //Will override.
234
- console.info('linking to binaries dir ... ');
235
- if ( typeof(callback) != 'undefined') {
236
- if ( !self.isGlobalInstall ) { // local install only
237
- lib.generator.createFileFromTemplate(source, target, function onGinaFileCreated(err) {
238
- callback(err)
432
+ var createGinaFile = function(callback) {
433
+ // local install only
434
+ if (self.isGlobalInstall) {
435
+ return callback(false);
436
+ }
239
437
 
240
- })
241
- } else {
438
+ console.info('Current prefix: '+ self.prefix );
439
+ console.info('Current package.json: '+ _(self.gina + '/package.json', true) );
440
+
441
+ console.info('Creating framework command line:');
442
+ var appPath = process.env.INIT_CWD;
443
+ console.debug('App path: '+ appPath);
444
+ var source = _(appPath + '/node_modules/.bin/gina', true);
445
+ var target = _(appPath +'/gina', true);
446
+ if ( isWin32() ) {
447
+ source = _(appPath + '/node_modules/.bin/gina.bat', true)
448
+ target = _(appPath +'/gina.bat', true)
449
+ }
450
+ console.debug('Source: '+ source);
451
+ console.debug('Target: '+ target);
242
452
 
243
- // configureGina();
244
- callback(false)
245
- }
246
- } else {
247
- if ( !self.isGlobalInstall ) {
248
- lib.generator.createFileFromTemplate(source, target)
453
+ if ( callback && typeof(callback) != 'undefined') {
454
+ console.info('Linking to binaries dir: '+ source +' -> '+ target);
455
+ try {
456
+ if ( fs.existsSync(target) ) {
457
+ fs.unlinkSync(target)
458
+ }
459
+ new _(source).symlinkSync(target)
460
+ } catch (err) {
461
+ return callback(err)
249
462
  }
250
- // else {
251
- // configureGina();
252
- // }
463
+
464
+ return callback(false);
253
465
  }
254
466
  }
255
467
 
256
468
  self.createGinaFileForPlatform = async function(done) {
257
469
  console.info('Creating platform file');
258
- var name = require( _(self.path + '/package.json') ).name;
470
+ // var name = require( _(self.versionPath + '/package.json') ).name;
259
471
 
260
- var filename = ( (self.isWin32) ? '.' : '' ) + name;
472
+ // var filename = ( (self.isWin32) ? '.' : '' ) + name;
261
473
 
262
- var keepGoing = function(filename) {
474
+ var keepGoing = function() {
263
475
 
264
- createGinaFile(filename, function onFileCreated(err) {
476
+ createGinaFile(function onFileCreated(err) {
265
477
  if (err) {
266
478
  return done(err)
267
479
  }
268
480
 
269
481
  // this is done to allow multiple calls of post_install.js
270
- var filename = _(self.path + '/SUCCESS');
482
+ var filename = _(self.versionPath + '/SUCCESS');
271
483
  var installed = fs.existsSync( filename );
272
484
  if (installed) {
273
485
  fs.unlinkSync( filename );
@@ -289,8 +501,8 @@ function PostInstall() {
289
501
  if ( !hasNodeModulesSync() ) {
290
502
  return npmInstall(done)
291
503
  } else {
292
- var target = new _(self.path + '/node_modules');
293
- console.debug('replacing: ', target.toString() );
504
+ var target = new _(self.versionPath + '/node_modules');
505
+ console.debug('Replacing: ', target.toString() );
294
506
  return target
295
507
  .rm( function onRemove(err) {
296
508
  if (err) {
@@ -304,60 +516,56 @@ function PostInstall() {
304
516
  })
305
517
  }
306
518
 
307
- if (self.isWin32) {
308
- var appPath = _( self.path.substring(0, (self.path.length - ("node_modules/" + name + '/').length)) );
309
- var source = _(self.path + '/core/template/command/gina.bat.tpl');
310
- var target = _(appPath +'/'+ name + '.bat');
311
- if ( fs.existsSync(target) ) {
312
- fs.unlinkSync(target);
313
- // have to wait for windows to complete this
314
- setTimeout( async function(){
315
- lib.generator.createFileFromTemplate(source, target);
316
- await keepGoing(filename)
317
- }, 1000)
318
- } else {
319
- lib.generator.createFileFromTemplate(source, target);
320
- await keepGoing(filename)
321
- }
322
-
323
- } else {
324
- await keepGoing(filename)
325
- }
519
+ // if (self.isWin32) {
520
+ // // var appPath = _( self.versionPath.substring(0, (self.versionPath.length - ("node_modules/" + name + '/').length)) );
521
+ // var appPath = process.cwd()
522
+ // var source = _(self.versionPath + '/core/template/command/gina.bat.tpl');
523
+ // var target = _(appPath +'/'+ name + '.bat');
524
+ // if ( fs.existsSync(target) ) {
525
+ // fs.unlinkSync(target);
526
+ // // have to wait for windows to complete this
527
+ // setTimeout( async function(){
528
+ // lib.generator.createFileFromTemplate(source, target);
529
+ // await keepGoing(filename)
530
+ // }, 1000)
531
+ // } else {
532
+ // lib.generator.createFileFromTemplate(source, target);
533
+ // await keepGoing(filename)
534
+ // }
535
+
536
+ // } else {
537
+ await keepGoing()
538
+ // }
326
539
  }
327
540
 
328
541
 
329
542
  var hasNodeModulesSync = function() {
330
- return fs.existsSync( _(self.path + '/node_modules') )
543
+ return fs.existsSync( _(self.versionPath + '/node_modules') )
331
544
  }
332
545
 
333
546
 
334
547
  var npmInstall = function(done) {
335
548
 
336
- done();
337
-
338
- console.info('now installing modules: please, wait ...');
549
+ console.info('Now installing modules. Please, wait ...');
339
550
  console.info('Prefix ('+ self.isCustomPrefix +'): '+ self.prefix);
340
- var cmd = self.prefix +'/bin/';
341
- cmd += ( isWin32() ) ? 'npm.cmd install' : 'npm install';
551
+ console.info('Default prefix: '+ self.defaultPrefix);
552
+ var initialDir = process.cwd();
342
553
 
343
- console.info('running: '+ cmd +' from '+ _(self.path) );
344
- console.info('running TMP: '+ _(self.root +'/tmp') );
345
554
 
346
- if ( !new _(self.root +'/tmp').existsSync() ) {
347
- new _(self.root +'/tmp').mkdirSync()
348
- }
349
- run(cmd, { cwd: _(self.path), tmp: _(self.root +'/tmp'), outToProcessSTD: true })
350
- .onData(function onData(data){
351
- console.info(data)
352
- })
353
- .onComplete( function onDone(err, data){
354
- if (!err) {
355
- console.info('completed: '+ cmd);
356
- return done()
357
- }
358
- console.info('error found: '+ err + '\n=> '+ data);
359
- done(err)
360
- })
555
+ var cmd = ( isWin32() ) ? 'npm.cmd install' : 'npm install';
556
+
557
+ process.chdir( self.versionPath );
558
+
559
+ console.info('Running: `'+ cmd +'` from '+ process.cwd() );
560
+ console.info('Running using TMPDIR: '+ _(getTmpDir(), true) );
561
+ var oldConfigGlobal = process.env.npm_config_global;
562
+ process.env.npm_config_global = false;
563
+ console.info('Running using TMPDIR: '+ cmd);
564
+ console.info(execSync(cmd).toString());
565
+ process.chdir(initialDir);
566
+ process.env.npm_config_global = oldConfigGlobal;
567
+
568
+ done()
361
569
  }
362
570
 
363
571
  self.cleanupIfNeeded = function(done) {
@@ -369,22 +577,56 @@ function PostInstall() {
369
577
  if ( new _(frameworkPath +'/node_modules/colors', true).existsSync() ) {
370
578
  var initialDir = process.cwd();
371
579
  process.chdir(frameworkPath);
372
- var cmd = self.prefix +'/bin/';
373
- cmd += ( isWin32() ) ? 'npm.cmd rm colors' : 'npm rm colors';
580
+ var oldConfigGlobal = process.env.npm_config_global;
581
+ process.env.npm_config_global=false;
582
+
583
+ // var cmd = self.prefix +'/bin/';
584
+ // cmd += ( isWin32() ) ? 'npm.cmd rm colors' : 'npm rm colors';
585
+
586
+ var cmd = ( isWin32() ) ? 'npm.cmd rm colors' : 'npm rm colors';
587
+
374
588
  try {
375
589
  execSync(cmd);
376
590
  console.debug('Removed default `colors` module from `GINA_DIR`... This is normal ;)');
377
591
  } catch (npmErr) {
592
+ process.chdir(initialDir);
378
593
  return done(npmErr);
379
594
  }
380
595
 
381
596
  process.chdir(initialDir);
597
+ process.env.npm_config_global=oldConfigGlobal;
382
598
  }
383
599
 
384
600
  done()
385
601
  }
386
602
 
387
603
  self.checkUserExtensions = async function(done) {
604
+ var err = null;
605
+ var versionDirObj = new _( getUserHome() +'/.gina/'+ self.shortVersion, true);
606
+ console.debug('versionDirObj: '+ versionDirObj.toString() );
607
+ if ( !versionDirObj.existsSync() ) {
608
+ versionDirObj.mkdirSync()
609
+ }
610
+ var defaultSettingsObj = new _(versionDirObj.toString() + '/settings.json', true);
611
+ if (!defaultSettingsObj.existsSync()) {
612
+ promisify(new _(self.gina +'/resources/home/main.json').cp)(defaultSettingsObj.toString())
613
+ .catch( function onCopyError(_err) {
614
+ err = _err;
615
+ })
616
+ }
617
+ if (err) {
618
+ return done(err);
619
+ }
620
+ var defaultMainObj = new _(versionDirObj.toString() + '/main.json', true);
621
+ if (!defaultMainObj.existsSync()) {
622
+ promisify(new _(self.gina +'/resources/home/main.json').cp)(defaultMainObj.toString())
623
+ .catch( function onCopyError(_err) {
624
+ err = _err;
625
+ })
626
+ }
627
+ if (err) {
628
+ return done(err);
629
+ }
388
630
 
389
631
  var userDir = _(getUserHome() + '/.gina/user', true);
390
632
  // var userDirObj = new _(userDir);
@@ -402,9 +644,12 @@ function PostInstall() {
402
644
 
403
645
  // reading default extensions
404
646
  var ext = _(self.gina +'/resources/home/user/extensions', true);
647
+ // if (!self.isCustomPrefix) {
648
+ // ext = _( self.defaultPrefix + '/lib/node_modules/gina/bin/gina')
649
+ // }
405
650
  var folders = [];
406
651
  try {
407
- console.debug('Reading : '+ ext + ' - isDirectory ? '+ fs.lstatSync( ext ).isDirectory() );
652
+ console.debug('Reading :'+ ext + ' - isDirectory ? '+ fs.lstatSync( ext ).isDirectory() );
408
653
  folders = fs.readdirSync(ext);
409
654
 
410
655
  } catch(readErr) {
@@ -436,7 +681,6 @@ function PostInstall() {
436
681
 
437
682
  let files = []
438
683
  , extDir = _(ext +'/'+ dir, true)
439
- , extDirObj = new _(extDir)
440
684
  ;
441
685
  try {
442
686
 
@@ -454,7 +698,7 @@ function PostInstall() {
454
698
 
455
699
  for (let n = 0, nLen = files.length; n < nLen; n++) {
456
700
  let file = files[n];
457
- console.debug('file --> ', file);
701
+ console.debug('File --> ', file);
458
702
  let extentionPath = _(extDir +'/'+ file, true);
459
703
  let extensionPathObj = new _(extentionPath);
460
704
  // redefined
@@ -469,11 +713,11 @@ function PostInstall() {
469
713
  err = _err;
470
714
  })
471
715
  .then( function onCopy(_destination) {// jshint ignore:line
472
- console.info('Copy '+ extentionPath +' to '+ _destination +' done !');
716
+ console.debug('Copy '+ extentionPath +' to '+ _destination +' done !');
473
717
  });
474
718
 
475
719
  if (err) {
476
- throw err;
720
+ return done(err);
477
721
  }
478
722
  }
479
723
  }
@@ -483,6 +727,64 @@ function PostInstall() {
483
727
  done()
484
728
  }
485
729
 
730
+ /**
731
+ * Updated user's profile
732
+ * Will edit ~/.profile, check and add if needed path to Gina binary
733
+ *
734
+ */
735
+ self.updateUserProfile = async function(done) {
736
+
737
+ if ( !self.isGlobalInstall || isWin32() ) {
738
+ return done()
739
+ }
740
+ if (!self.isCustomPrefix || self.prefix == self.defaultPrefix) {
741
+ return done()
742
+ }
743
+
744
+ var profilePath = getUserHome() + '/.profile';
745
+ var profilePathObj = new _(profilePath);
746
+ if ( !profilePathObj.existsSync() ) {
747
+ cmd = 'touch '+ profilePath;
748
+ await promisify(run)(cmd, { cwd: _(self.versionPath), tmp: _(getTmpDir(), true), outToProcessSTD: true, shell: "/bin/bash"})
749
+ .catch(function onError(err){
750
+ if (err) {
751
+ console.warn('Try to run: sudo ' + cmd);
752
+ return done(err);
753
+ }
754
+ });
755
+ }
756
+
757
+ var inFile = null;
758
+ var patt = _(self.prefix.replace( new RegExp( '^' +getUserHome() ), '(.*)[$]HOME') + '/bin', true);
759
+ try {
760
+ inFile = execSync("cat ~/.profile | grep -Eo '" + patt +"'", {shell: "/bin/bash"}).toString();
761
+ } catch (err) {
762
+ // nothing to do
763
+ }
764
+
765
+ if (!inFile) {
766
+ patt = patt.replace('(.*)[$]', '$');
767
+ inFile = '\nif [ -d "'+ patt +'" ]; then';
768
+ inFile += '\n PATH="'+ patt +':$PATH"';
769
+ inFile += '\nfi\n';
770
+ try {
771
+ fs.appendFileSync( getUserHome()+'/.profile', inFile );
772
+ } catch (err) {
773
+ return done(err);
774
+ }
775
+ inFile = null;
776
+
777
+ // we need to source/update ~/.profile
778
+ try {
779
+ execSync("source "+ profilePath, {shell: "/bin/bash"});
780
+ } catch (err) {
781
+ return done(err)
782
+ }
783
+ }
784
+
785
+ done()
786
+ }
787
+
486
788
  var restoreSymlinks = function() {
487
789
  var archivesPath = _(getUserHome() + '/.gina/archives/framework', true);
488
790
  var frameworkPath = _(self.gina +'/framework', true);
@@ -491,9 +793,13 @@ function PostInstall() {
491
793
  return;
492
794
  }
493
795
  // get current framework version
494
- var package = require(pack);
495
- var currentVersion = 'v'+ package.version.replace(/^v/, '');
496
-
796
+ var ginaPackage = require(pack);
797
+ self.versionPath = self.gina;
798
+ self.version = ginaPackage.version.replace(/^v/, '');
799
+ self.shortVersion = self.version.split('.');
800
+ self.shortVersion.splice(2);
801
+ self.shortVersion = self.shortVersion.join('.');
802
+ var currentVersion = 'v'+ self.version;
497
803
  // cleanup first
498
804
  var versionsFolders = fs.readdirSync(frameworkPath);
499
805
  for (let i = 0, len = versionsFolders.length; i < len; i++) {
@@ -506,15 +812,17 @@ function PostInstall() {
506
812
  // intercept & remove existing symlinks or old versions dir
507
813
  try {
508
814
  if ( fs.lstatSync( _(frameworkPath +'/'+ dir, true) ).isSymbolicLink() ) {
509
- new _(frameworkPath +'/'+ dir, true).rmSync();
510
- console.debug('Removing Symlink: '+ dir);
815
+ console.debug('Removing Symlink: '+ _(frameworkPath +'/'+ dir, true) );
816
+ // new _(frameworkPath +'/'+ dir, true).rmSync();
817
+ fs.unlinkSync(_(frameworkPath +'/'+ dir, true));
511
818
  continue;
512
819
  }
513
- else if (
820
+
821
+ if (
514
822
  dir != currentVersion
515
823
  && fs.lstatSync( _(frameworkPath +'/'+ dir, true) ).isDirectory()
516
824
  ) {
517
- console.debug('Removing old version: '+ dir);
825
+ console.debug('Removing old version: '+ _(frameworkPath +'/'+ dir, true));
518
826
  new _(frameworkPath +'/'+ dir, true).rmSync()
519
827
  }
520
828
  } catch (e) {
@@ -546,15 +854,39 @@ function PostInstall() {
546
854
  }
547
855
  }
548
856
 
857
+
549
858
  self.end = function(done) {
550
859
 
551
860
  restoreSymlinks();
552
861
 
862
+ // configuring Gina
863
+ var ginaBinanry = _(self.gina + '/bin/gina', true);
864
+ if (!self.isCustomPrefix && self.isGlobalInstall) {
865
+ ginaBinanry = _( self.defaultPrefix + '/lib/node_modules/gina/bin/gina', true)
866
+ }
867
+
868
+ if ( !fs.existsSync(ginaBinanry) ) {
869
+ console.error('Outch: `'+ ginaBinanry +'` not found !');
870
+ }
871
+
872
+ var cmd = null;
873
+ try {
874
+ cmd = ginaBinanry + ' framework:set --global-mode='+ self.isGlobalInstall;
875
+ console.info('Running: '+ cmd);
876
+ console.debug(execSync(cmd));
877
+ cmd = ginaBinanry + ' framework:set --prefix='+ self.prefix;
878
+ console.info('Running: '+ cmd);
879
+ console.debug(execSync(cmd));
880
+ } catch (err) {
881
+ return done(err)
882
+ }
883
+
884
+
553
885
  // Update middleware file
554
- var filename = _(self.path) + '/MIDDLEWARE';
886
+ var filename = _(self.versionPath) + '/MIDDLEWARE';
555
887
  var msg = "Gina's command line tool has been installed.";
556
888
 
557
- var deps = require(_(self.path) + '/package.json').dependecies;
889
+ var deps = require(_(self.versionPath) + '/package.json').dependecies;
558
890
 
559
891
  var version = require( _(self.gina + '/package.json') ).version;
560
892
  var middleware = 'isaac@'+version; // by default
@@ -565,11 +897,12 @@ function PostInstall() {
565
897
  }
566
898
  }
567
899
 
568
- var expressPackage = _(self.path + '/node_modules/express/package.json');
900
+ var expressPackage = _(self.versionPath + '/node_modules/express/package.json');
569
901
  if ( typeof(middleware) == 'undefined' && fs.existsSync(expressPackage) ) {
570
902
  middleware = require(expressPackage).version;
571
903
  middleware = 'express@' + middleware;
572
- } else if (typeof(middleware) == 'undefined') {
904
+ }
905
+ else if (typeof(middleware) == 'undefined') {
573
906
  return done( new Error('No middleware found !!') );
574
907
  }
575
908
 
@@ -581,6 +914,8 @@ function PostInstall() {
581
914
  if (err) {
582
915
  return done(err)
583
916
  }
917
+ console.debug('Updated: def !== middleware case');
918
+ // execSync(self.prefix +'/bin/gina framework:set --prefix='+ self.prefix);
584
919
  console.info(msg);
585
920
  done()
586
921
  })
@@ -590,12 +925,15 @@ function PostInstall() {
590
925
  if (err) {
591
926
  return done(err)
592
927
  }
928
+ console.info('File created case');
929
+
593
930
  console.info(msg);
594
931
  done()
595
932
  })
596
933
  }
597
934
  }
598
935
 
936
+
599
937
  init()
600
938
  }
601
939
  new PostInstall()