gina 0.1.1-alpha.23 → 0.1.1-alpha.230

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