gina 0.0.9-p91c → 0.1.1-alpha.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (466) hide show
  1. package/AUTHORS +2 -1
  2. package/INSTALL.md +46 -0
  3. package/{core/asset/html/static.html → Icon/r} +0 -0
  4. package/LICENSE +1 -1
  5. package/README-4Contributors.md +96 -0
  6. package/README.md +397 -101
  7. package/bin/cli +305 -0
  8. package/bin/cli-debug +60 -0
  9. package/bin/cmd +184 -0
  10. package/bin/gina +180 -0
  11. package/config/logger.json +17 -0
  12. package/framework/v0.1.1-alpha.100/AUTHORS +7 -0
  13. package/{core/utils/lib/inherits → framework/v0.1.1-alpha.100}/LICENSE +1 -1
  14. package/framework/v0.1.1-alpha.100/VERSION +1 -0
  15. package/{core/locales/dist/language/en.json → framework/v0.1.1-alpha.100/core/asset/html/nolayout.html} +0 -0
  16. package/{core/locales/dist/language/fr.json → framework/v0.1.1-alpha.100/core/asset/html/static.html} +0 -0
  17. package/{core → framework/v0.1.1-alpha.100/core}/asset/img/android-chrome-192x192.png +0 -0
  18. package/{core → framework/v0.1.1-alpha.100/core}/asset/img/android-chrome-512x512.png +0 -0
  19. package/{core → framework/v0.1.1-alpha.100/core}/asset/img/apple-touch-icon.png +0 -0
  20. package/{core → framework/v0.1.1-alpha.100/core}/asset/img/favicon-16x16.png +0 -0
  21. package/{core → framework/v0.1.1-alpha.100/core}/asset/img/favicon-32x32.png +0 -0
  22. package/{core → framework/v0.1.1-alpha.100/core}/asset/img/favicon.ico +0 -0
  23. package/framework/v0.1.1-alpha.100/core/asset/js/plugin/dist/gina.js +20904 -0
  24. package/framework/v0.1.1-alpha.100/core/asset/js/plugin/dist/gina.js.map +56 -0
  25. package/framework/v0.1.1-alpha.100/core/asset/js/plugin/dist/gina.min.css +1 -0
  26. package/framework/v0.1.1-alpha.100/core/asset/js/plugin/dist/gina.min.css.map +1 -0
  27. package/framework/v0.1.1-alpha.100/core/asset/js/plugin/dist/gina.min.js +736 -0
  28. package/framework/v0.1.1-alpha.100/core/asset/js/plugin/dist/gina.min.js.map +56 -0
  29. package/framework/v0.1.1-alpha.100/core/asset/js/plugin/dist/gina.onload.min.js +5 -0
  30. package/framework/v0.1.1-alpha.100/core/asset/js/plugin/dist/gina.onload.min.js.map +8 -0
  31. package/framework/v0.1.1-alpha.100/core/asset/js/plugin/readme.md +192 -0
  32. package/framework/v0.1.1-alpha.100/core/asset/js/plugin/uuid.json +23 -0
  33. package/framework/v0.1.1-alpha.100/core/config.js +2308 -0
  34. package/framework/v0.1.1-alpha.100/core/connectors/couchbase/index.js +757 -0
  35. package/framework/v0.1.1-alpha.100/core/connectors/couchbase/lib/connector.js +20 -0
  36. package/framework/v0.1.1-alpha.100/core/connectors/couchbase/lib/connector.v2.js +429 -0
  37. package/framework/v0.1.1-alpha.100/core/connectors/couchbase/lib/connector.v3.js +432 -0
  38. package/framework/v0.1.1-alpha.100/core/connectors/couchbase/lib/n1ql.js +14 -0
  39. package/framework/v0.1.1-alpha.100/core/connectors/couchbase/lib/session-store.js +21 -0
  40. package/framework/v0.1.1-alpha.100/core/connectors/couchbase/lib/session-store.v2.js +258 -0
  41. package/framework/v0.1.1-alpha.100/core/connectors/couchbase/lib/session-store.v3.js +341 -0
  42. package/{core → framework/v0.1.1-alpha.100/core}/controller/controller.framework.js +3 -2
  43. package/framework/v0.1.1-alpha.100/core/controller/controller.js +3990 -0
  44. package/{core → framework/v0.1.1-alpha.100/core}/controller/index.js +5 -5
  45. package/framework/v0.1.1-alpha.100/core/deps/busboy/.travis.yml +17 -0
  46. package/framework/v0.1.1-alpha.100/core/deps/busboy/LICENSE +19 -0
  47. package/framework/v0.1.1-alpha.100/core/deps/busboy/README.md +225 -0
  48. package/framework/v0.1.1-alpha.100/core/deps/busboy/deps/encoding/encoding-indexes.js +73 -0
  49. package/framework/v0.1.1-alpha.100/core/deps/busboy/deps/encoding/encoding.js +2391 -0
  50. package/framework/v0.1.1-alpha.100/core/deps/busboy/lib/main.js +89 -0
  51. package/framework/v0.1.1-alpha.100/core/deps/busboy/lib/types/multipart.js +328 -0
  52. package/framework/v0.1.1-alpha.100/core/deps/busboy/lib/types/urlencoded.js +214 -0
  53. package/framework/v0.1.1-alpha.100/core/deps/busboy/lib/utils.js +191 -0
  54. package/framework/v0.1.1-alpha.100/core/deps/busboy/package.json +69 -0
  55. package/framework/v0.1.1-alpha.100/core/deps/swig-client/swig-2.0.0.min.js +5 -0
  56. package/{core → framework/v0.1.1-alpha.100/core}/dev/index.js +5 -5
  57. package/{core → framework/v0.1.1-alpha.100/core}/dev/lib/class.js +1 -1
  58. package/{core → framework/v0.1.1-alpha.100/core}/dev/lib/factory.js +1 -1
  59. package/{core → framework/v0.1.1-alpha.100/core}/dev/lib/tools.js +0 -0
  60. package/framework/v0.1.1-alpha.100/core/gna.js +1070 -0
  61. package/{core → framework/v0.1.1-alpha.100/core}/locales/README.md +41 -2
  62. package/{core → framework/v0.1.1-alpha.100/core}/locales/currency.json +0 -0
  63. package/{core/plugins/README.md → framework/v0.1.1-alpha.100/core/locales/dist/language/en.json} +0 -0
  64. package/{core/plugins/lib/intl/README.md → framework/v0.1.1-alpha.100/core/locales/dist/language/fr.json} +0 -0
  65. package/{core → framework/v0.1.1-alpha.100/core}/locales/dist/region/en.json +0 -0
  66. package/framework/v0.1.1-alpha.100/core/locales/dist/region/fr.json +9492 -0
  67. package/{core → framework/v0.1.1-alpha.100/core}/locales/index.js +5 -4
  68. package/{core → framework/v0.1.1-alpha.100/core}/locales/src/make.js +15 -12
  69. package/{core → framework/v0.1.1-alpha.100/core}/locales/src/resources/currency.csv +0 -0
  70. package/{core → framework/v0.1.1-alpha.100/core}/locales/src/resources/region.csv +0 -0
  71. package/{core → framework/v0.1.1-alpha.100/core}/locales/src/resources/region.mapping.json +0 -0
  72. package/{core → framework/v0.1.1-alpha.100/core}/mime.types +0 -0
  73. package/{core → framework/v0.1.1-alpha.100/core}/model/entity.js +156 -196
  74. package/{core → framework/v0.1.1-alpha.100/core}/model/index.js +67 -48
  75. package/{core → framework/v0.1.1-alpha.100/core}/model/template/entityFactory.js +2 -2
  76. package/{core → framework/v0.1.1-alpha.100/core}/model/template/index.js +8 -10
  77. package/{core/plugins/lib/storage → framework/v0.1.1-alpha.100/core/plugins}/README.md +0 -0
  78. package/{core → framework/v0.1.1-alpha.100/core}/plugins/index.js +3 -3
  79. package/{core/plugins/lib/validator → framework/v0.1.1-alpha.100/core/plugins/lib/file}/README.md +0 -0
  80. package/{core/plugins/lib/intl → framework/v0.1.1-alpha.100/core/plugins/lib/file}/build.json +0 -0
  81. package/framework/v0.1.1-alpha.100/core/plugins/lib/file/package.json +25 -0
  82. package/{core/utils/lib/collection → framework/v0.1.1-alpha.100/core/plugins/lib/intl}/README.md +0 -0
  83. package/{core/plugins/lib/storage → framework/v0.1.1-alpha.100/core/plugins/lib/intl}/build.json +0 -0
  84. package/{core → framework/v0.1.1-alpha.100/core}/plugins/lib/intl/package.json +3 -3
  85. package/{core → framework/v0.1.1-alpha.100/core}/plugins/lib/intl/src/main.js +17 -1
  86. package/{core/utils/lib/routing → framework/v0.1.1-alpha.100/core/plugins/lib/storage}/README.md +0 -0
  87. package/{core/plugins/lib/validator → framework/v0.1.1-alpha.100/core/plugins/lib/storage}/build.json +0 -0
  88. package/{core → framework/v0.1.1-alpha.100/core}/plugins/lib/storage/package.json +2 -2
  89. package/{core → framework/v0.1.1-alpha.100/core}/plugins/lib/storage/src/main.js +91 -85
  90. package/{core/utils/lib/url → framework/v0.1.1-alpha.100/core/plugins/lib/validator}/README.md +0 -0
  91. package/{core/utils/lib/collection → framework/v0.1.1-alpha.100/core/plugins/lib/validator}/build.json +0 -0
  92. package/{core → framework/v0.1.1-alpha.100/core}/plugins/lib/validator/package.json +3 -3
  93. package/framework/v0.1.1-alpha.100/core/plugins/lib/validator/src/form-validator.js +1762 -0
  94. package/framework/v0.1.1-alpha.100/core/plugins/lib/validator/src/main.js +6917 -0
  95. package/framework/v0.1.1-alpha.100/core/router.js +664 -0
  96. package/framework/v0.1.1-alpha.100/core/server.express.js +213 -0
  97. package/framework/v0.1.1-alpha.100/core/server.isaac.js +386 -0
  98. package/framework/v0.1.1-alpha.100/core/server.js +3010 -0
  99. package/{core → framework/v0.1.1-alpha.100/core}/status.codes +8 -0
  100. package/framework/v0.1.1-alpha.100/core/template/boilerplate/bundle/config/app.json +6 -0
  101. package/framework/v0.1.1-alpha.100/core/template/boilerplate/bundle/config/routing.json +11 -0
  102. package/framework/v0.1.1-alpha.100/core/template/boilerplate/bundle/config/settings.json +9 -0
  103. package/framework/v0.1.1-alpha.100/core/template/boilerplate/bundle/config/settings.server.json +30 -0
  104. package/framework/v0.1.1-alpha.100/core/template/boilerplate/bundle/config/templates.json +42 -0
  105. package/framework/v0.1.1-alpha.100/core/template/boilerplate/bundle/controllers/controller.content.js +39 -0
  106. package/framework/v0.1.1-alpha.100/core/template/boilerplate/bundle/controllers/controller.js +30 -0
  107. package/framework/v0.1.1-alpha.100/core/template/boilerplate/bundle/controllers/setup.js +111 -0
  108. package/{core/template/samples → framework/v0.1.1-alpha.100/core/template/boilerplate}/bundle/index.js +0 -0
  109. package/{core/template/samples/bundle → framework/v0.1.1-alpha.100/core/template/boilerplate/bundle_namespace}/controllers/controller.js +9 -7
  110. package/{core/template/views → framework/v0.1.1-alpha.100/core/template/boilerplate/bundle_public}/css/default.css +0 -0
  111. package/{core/template/views → framework/v0.1.1-alpha.100/core/template/boilerplate/bundle_public}/css/vendor/readme.md +0 -0
  112. package/{core/template/views → framework/v0.1.1-alpha.100/core/template/boilerplate/bundle_public}/favicon.ico +0 -0
  113. package/framework/v0.1.1-alpha.100/core/template/boilerplate/bundle_public/js/vendor/readme.md +1 -0
  114. package/framework/v0.1.1-alpha.100/core/template/boilerplate/bundle_public/readme.md +1 -0
  115. package/framework/v0.1.1-alpha.100/core/template/boilerplate/bundle_templates/handlers/main.js +24 -0
  116. package/{core/template/views/html/default.html → framework/v0.1.1-alpha.100/core/template/boilerplate/bundle_templates/html/homepage.html} +0 -0
  117. package/{core/template/views/html/layout.html → framework/v0.1.1-alpha.100/core/template/boilerplate/bundle_templates/html/layout/main.html} +2 -2
  118. package/{core → framework/v0.1.1-alpha.100/core}/template/command/gina.bat.tpl +0 -0
  119. package/{core → framework/v0.1.1-alpha.100/core}/template/command/gina.tpl +1 -1
  120. package/framework/v0.1.1-alpha.100/core/template/conf/env.json +76 -0
  121. package/{core/template/conf/project.json → framework/v0.1.1-alpha.100/core/template/conf/manifest.json} +1 -0
  122. package/{core → framework/v0.1.1-alpha.100/core}/template/conf/package.json +2 -2
  123. package/framework/v0.1.1-alpha.100/core/template/conf/settings.json +92 -0
  124. package/framework/v0.1.1-alpha.100/core/template/conf/statics.json +10 -0
  125. package/framework/v0.1.1-alpha.100/core/template/conf/templates.json +37 -0
  126. package/{core → framework/v0.1.1-alpha.100/core}/template/error/client/json/401.json +0 -0
  127. package/{core → framework/v0.1.1-alpha.100/core}/template/error/client/json/403.json +0 -0
  128. package/{core → framework/v0.1.1-alpha.100/core}/template/error/client/json/404.json +0 -0
  129. package/{core → framework/v0.1.1-alpha.100/core}/template/error/server/html/50x.html +0 -0
  130. package/{core → framework/v0.1.1-alpha.100/core}/template/error/server/json/500.json +0 -0
  131. package/{core → framework/v0.1.1-alpha.100/core}/template/error/server/json/503.json +0 -0
  132. package/{core/utils/lib/routing/build.json → framework/v0.1.1-alpha.100/core/template/extensions/logger/config.json} +0 -0
  133. package/{core/utils → framework/v0.1.1-alpha.100}/helpers/console.js +3 -3
  134. package/{core/utils → framework/v0.1.1-alpha.100}/helpers/context.js +240 -49
  135. package/framework/v0.1.1-alpha.100/helpers/dateFormat.js +528 -0
  136. package/framework/v0.1.1-alpha.100/helpers/index.js +79 -0
  137. package/framework/v0.1.1-alpha.100/helpers/json/README.md +0 -0
  138. package/framework/v0.1.1-alpha.100/helpers/json/package.json +20 -0
  139. package/framework/v0.1.1-alpha.100/helpers/json/src/main.js +97 -0
  140. package/{core/utils → framework/v0.1.1-alpha.100}/helpers/path.js +333 -126
  141. package/framework/v0.1.1-alpha.100/helpers/plugins/README.md +4 -0
  142. package/framework/v0.1.1-alpha.100/helpers/plugins/package.json +20 -0
  143. package/framework/v0.1.1-alpha.100/helpers/plugins/src/api-error.js +160 -0
  144. package/framework/v0.1.1-alpha.100/helpers/plugins/src/main.js +32 -0
  145. package/framework/v0.1.1-alpha.100/helpers/prototypes.js +218 -0
  146. package/{core/utils → framework/v0.1.1-alpha.100}/helpers/task.js +58 -31
  147. package/{core/utils → framework/v0.1.1-alpha.100}/helpers/text.js +7 -7
  148. package/framework/v0.1.1-alpha.100/lib/archiver/README.md +0 -0
  149. package/framework/v0.1.1-alpha.100/lib/archiver/build.json +0 -0
  150. package/framework/v0.1.1-alpha.100/lib/archiver/package.json +20 -0
  151. package/framework/v0.1.1-alpha.100/lib/archiver/src/dep/jszip.min.js +15 -0
  152. package/framework/v0.1.1-alpha.100/lib/archiver/src/main.js +499 -0
  153. package/framework/v0.1.1-alpha.100/lib/cmd/aliases.json +13 -0
  154. package/framework/v0.1.1-alpha.100/lib/cmd/bundle/add.js +507 -0
  155. package/framework/v0.1.1-alpha.100/lib/cmd/bundle/arguments.json +4 -0
  156. package/framework/v0.1.1-alpha.100/lib/cmd/bundle/copy.js +15 -0
  157. package/framework/v0.1.1-alpha.100/lib/cmd/bundle/cp.js +2 -0
  158. package/framework/v0.1.1-alpha.100/lib/cmd/bundle/help.js +28 -0
  159. package/framework/v0.1.1-alpha.100/lib/cmd/bundle/help.txt +67 -0
  160. package/framework/v0.1.1-alpha.100/lib/cmd/bundle/list.js +129 -0
  161. package/framework/v0.1.1-alpha.100/lib/cmd/bundle/remove.js +229 -0
  162. package/framework/v0.1.1-alpha.100/lib/cmd/bundle/rename.js +4 -0
  163. package/framework/v0.1.1-alpha.100/lib/cmd/bundle/restart.js +235 -0
  164. package/framework/v0.1.1-alpha.100/lib/cmd/bundle/rm.js +2 -0
  165. package/framework/v0.1.1-alpha.100/lib/cmd/bundle/start.js +394 -0
  166. package/framework/v0.1.1-alpha.100/lib/cmd/bundle/status.js +3 -0
  167. package/framework/v0.1.1-alpha.100/lib/cmd/bundle/stop.js +232 -0
  168. package/framework/v0.1.1-alpha.100/lib/cmd/env/add.js +436 -0
  169. package/framework/v0.1.1-alpha.100/lib/cmd/env/get.js +62 -0
  170. package/framework/v0.1.1-alpha.100/lib/cmd/env/help.js +28 -0
  171. package/framework/v0.1.1-alpha.100/lib/cmd/env/help.txt +33 -0
  172. package/framework/v0.1.1-alpha.100/lib/cmd/env/link-dev.js +80 -0
  173. package/framework/v0.1.1-alpha.100/lib/cmd/env/list.js +111 -0
  174. package/framework/v0.1.1-alpha.100/lib/cmd/env/remove.js +150 -0
  175. package/framework/v0.1.1-alpha.100/lib/cmd/env/rm.js +2 -0
  176. package/framework/v0.1.1-alpha.100/lib/cmd/env/set.js +57 -0
  177. package/framework/v0.1.1-alpha.100/lib/cmd/env/unset.js +44 -0
  178. package/framework/v0.1.1-alpha.100/lib/cmd/env/use.js +79 -0
  179. package/framework/v0.1.1-alpha.100/lib/cmd/framework/dot.js +70 -0
  180. package/framework/v0.1.1-alpha.100/lib/cmd/framework/get.js +0 -0
  181. package/framework/v0.1.1-alpha.100/lib/cmd/framework/help.js +39 -0
  182. package/framework/v0.1.1-alpha.100/lib/cmd/framework/help.txt +31 -0
  183. package/framework/v0.1.1-alpha.100/lib/cmd/framework/init.js +541 -0
  184. package/{core/utils/lib/cmd → framework/v0.1.1-alpha.100/lib/cmd/framework}/msg.json +3 -3
  185. package/framework/v0.1.1-alpha.100/lib/cmd/framework/open.js +50 -0
  186. package/framework/v0.1.1-alpha.100/lib/cmd/framework/restart.js +124 -0
  187. package/framework/v0.1.1-alpha.100/lib/cmd/framework/set.js +216 -0
  188. package/framework/v0.1.1-alpha.100/lib/cmd/framework/start.js +96 -0
  189. package/framework/v0.1.1-alpha.100/lib/cmd/framework/status.js +72 -0
  190. package/framework/v0.1.1-alpha.100/lib/cmd/framework/stop.js +159 -0
  191. package/framework/v0.1.1-alpha.100/lib/cmd/framework/tail.js +184 -0
  192. package/framework/v0.1.1-alpha.100/lib/cmd/framework/update.js +0 -0
  193. package/framework/v0.1.1-alpha.100/lib/cmd/framework/version.js +44 -0
  194. package/framework/v0.1.1-alpha.100/lib/cmd/gina-dev.1.md +66 -0
  195. package/framework/v0.1.1-alpha.100/lib/cmd/gina-framework.1.md +100 -0
  196. package/framework/v0.1.1-alpha.100/lib/cmd/gina.1.md +79 -0
  197. package/framework/v0.1.1-alpha.100/lib/cmd/helper.js +1147 -0
  198. package/framework/v0.1.1-alpha.100/lib/cmd/index.js +170 -0
  199. package/framework/v0.1.1-alpha.100/lib/cmd/msg.json +20 -0
  200. package/framework/v0.1.1-alpha.100/lib/cmd/port/help.js +28 -0
  201. package/framework/v0.1.1-alpha.100/lib/cmd/port/help.txt +31 -0
  202. package/framework/v0.1.1-alpha.100/lib/cmd/port/inc/scan.js +108 -0
  203. package/framework/v0.1.1-alpha.100/lib/cmd/port/list.js +176 -0
  204. package/framework/v0.1.1-alpha.100/lib/cmd/port/set.js +0 -0
  205. package/framework/v0.1.1-alpha.100/lib/cmd/project/add.js +528 -0
  206. package/framework/v0.1.1-alpha.100/lib/cmd/project/arguments.json +9 -0
  207. package/framework/v0.1.1-alpha.100/lib/cmd/project/build.js +115 -0
  208. package/framework/v0.1.1-alpha.100/lib/cmd/project/help.js +28 -0
  209. package/framework/v0.1.1-alpha.100/lib/cmd/project/help.txt +76 -0
  210. package/framework/v0.1.1-alpha.100/lib/cmd/project/import.js +2 -0
  211. package/framework/v0.1.1-alpha.100/lib/cmd/project/list.js +55 -0
  212. package/framework/v0.1.1-alpha.100/lib/cmd/project/move.js +0 -0
  213. package/framework/v0.1.1-alpha.100/lib/cmd/project/remove.js +144 -0
  214. package/framework/v0.1.1-alpha.100/lib/cmd/project/rename.js +162 -0
  215. package/framework/v0.1.1-alpha.100/lib/cmd/project/restart.js +0 -0
  216. package/framework/v0.1.1-alpha.100/lib/cmd/project/rm.js +2 -0
  217. package/framework/v0.1.1-alpha.100/lib/cmd/project/start.js +0 -0
  218. package/framework/v0.1.1-alpha.100/lib/cmd/project/status.js +3 -0
  219. package/framework/v0.1.1-alpha.100/lib/cmd/project/stop.js +0 -0
  220. package/framework/v0.1.1-alpha.100/lib/cmd/protocol/help.js +27 -0
  221. package/framework/v0.1.1-alpha.100/lib/cmd/protocol/help.txt +57 -0
  222. package/framework/v0.1.1-alpha.100/lib/cmd/protocol/list.js +239 -0
  223. package/framework/v0.1.1-alpha.100/lib/cmd/protocol/set.js +631 -0
  224. package/framework/v0.1.1-alpha.100/lib/cmd/scope/help.js +28 -0
  225. package/framework/v0.1.1-alpha.100/lib/cmd/scope/help.txt +33 -0
  226. package/framework/v0.1.1-alpha.100/lib/cmd/scope/link-local.js +80 -0
  227. package/framework/v0.1.1-alpha.100/lib/cmd/scope/list.js +116 -0
  228. package/framework/v0.1.1-alpha.100/lib/cmd/scope/remove.js +150 -0
  229. package/framework/v0.1.1-alpha.100/lib/cmd/scope/rm.js +2 -0
  230. package/framework/v0.1.1-alpha.100/lib/cmd/scope/set.js +57 -0
  231. package/framework/v0.1.1-alpha.100/lib/cmd/scope/unset.js +44 -0
  232. package/framework/v0.1.1-alpha.100/lib/cmd/scope/use.js +79 -0
  233. package/framework/v0.1.1-alpha.100/lib/cmd/view/add.js +311 -0
  234. package/framework/v0.1.1-alpha.100/lib/collection/README.md +5 -0
  235. package/framework/v0.1.1-alpha.100/lib/collection/build.json +0 -0
  236. package/{core/utils → framework/v0.1.1-alpha.100}/lib/collection/package.json +2 -2
  237. package/framework/v0.1.1-alpha.100/lib/collection/src/main.js +1459 -0
  238. package/{core/utils → framework/v0.1.1-alpha.100}/lib/config.js +49 -34
  239. package/framework/v0.1.1-alpha.100/lib/cron/README.md +7 -0
  240. package/framework/v0.1.1-alpha.100/lib/cron/package.json +20 -0
  241. package/framework/v0.1.1-alpha.100/lib/cron/src/main.js +176 -0
  242. package/{core/utils → framework/v0.1.1-alpha.100}/lib/generator/index.js +8 -4
  243. package/framework/v0.1.1-alpha.100/lib/index.js +116 -0
  244. package/framework/v0.1.1-alpha.100/lib/inherits/LICENSE +19 -0
  245. package/{core/utils → framework/v0.1.1-alpha.100}/lib/inherits/README.md +0 -0
  246. package/{core/utils → framework/v0.1.1-alpha.100}/lib/inherits/example/inheriting_eventemitter.js +0 -0
  247. package/{core/utils → framework/v0.1.1-alpha.100}/lib/inherits/example/protected_inheritance.js +0 -0
  248. package/{core/utils → framework/v0.1.1-alpha.100}/lib/inherits/example/simple_inheritance.js +0 -0
  249. package/{core/utils → framework/v0.1.1-alpha.100}/lib/inherits/example/super_attribute_overridden_by_child_on_init.js +0 -0
  250. package/{core/utils → framework/v0.1.1-alpha.100}/lib/inherits/package.json +2 -2
  251. package/{core/utils → framework/v0.1.1-alpha.100}/lib/inherits/src/main.js +18 -19
  252. package/framework/v0.1.1-alpha.100/lib/logger/README.md +7 -0
  253. package/framework/v0.1.1-alpha.100/lib/logger/package.json +20 -0
  254. package/framework/v0.1.1-alpha.100/lib/logger/src/containers/default/index.js +55 -0
  255. package/framework/v0.1.1-alpha.100/lib/logger/src/containers/file/index.js +251 -0
  256. package/framework/v0.1.1-alpha.100/lib/logger/src/containers/file/lib/logrotator/README.md +100 -0
  257. package/framework/v0.1.1-alpha.100/lib/logger/src/containers/file/lib/logrotator/index.js +274 -0
  258. package/framework/v0.1.1-alpha.100/lib/logger/src/containers/mq/index.js +52 -0
  259. package/framework/v0.1.1-alpha.100/lib/logger/src/containers/mq/listener.js +302 -0
  260. package/framework/v0.1.1-alpha.100/lib/logger/src/containers/mq/speaker.js +118 -0
  261. package/framework/v0.1.1-alpha.100/lib/logger/src/helper.js +131 -0
  262. package/framework/v0.1.1-alpha.100/lib/logger/src/main.js +739 -0
  263. package/{core/utils → framework/v0.1.1-alpha.100}/lib/math/index.js +58 -35
  264. package/{core/utils → framework/v0.1.1-alpha.100}/lib/merge/README.md +5 -0
  265. package/{core/utils → framework/v0.1.1-alpha.100}/lib/merge/example/merge.js +1 -1
  266. package/{core/utils → framework/v0.1.1-alpha.100}/lib/merge/example/merge_2_literal objects.js +0 -0
  267. package/{core/utils → framework/v0.1.1-alpha.100}/lib/merge/example/merge_and_preserve_first.js +2 -0
  268. package/{core/utils → framework/v0.1.1-alpha.100}/lib/merge/package.json +2 -2
  269. package/framework/v0.1.1-alpha.100/lib/merge/src/main.js +531 -0
  270. package/{core/utils → framework/v0.1.1-alpha.100}/lib/model.js +42 -19
  271. package/framework/v0.1.1-alpha.100/lib/proc.js +518 -0
  272. package/framework/v0.1.1-alpha.100/lib/routing/README.md +0 -0
  273. package/framework/v0.1.1-alpha.100/lib/routing/build.json +0 -0
  274. package/{core/utils → framework/v0.1.1-alpha.100}/lib/routing/package.json +2 -2
  275. package/framework/v0.1.1-alpha.100/lib/routing/src/main.js +1492 -0
  276. package/framework/v0.1.1-alpha.100/lib/session-store.js +33 -0
  277. package/{core/utils → framework/v0.1.1-alpha.100}/lib/shell.js +43 -30
  278. package/framework/v0.1.1-alpha.100/lib/swig-filters/README.md +0 -0
  279. package/framework/v0.1.1-alpha.100/lib/swig-filters/package.json +20 -0
  280. package/framework/v0.1.1-alpha.100/lib/swig-filters/src/main.js +322 -0
  281. package/framework/v0.1.1-alpha.100/lib/url/README.md +0 -0
  282. package/{core/utils → framework/v0.1.1-alpha.100}/lib/url/index.js +2 -1
  283. package/{core/utils → framework/v0.1.1-alpha.100}/lib/url/mocks.json +0 -0
  284. package/{core/utils → framework/v0.1.1-alpha.100}/lib/url/routing.json +9 -9
  285. package/{core/utils → framework/v0.1.1-alpha.100}/lib/url/test.js +0 -0
  286. package/{core/utils → framework/v0.1.1-alpha.100}/lib/validator.js +7 -7
  287. package/framework/v0.1.1-alpha.100/package.json +14 -0
  288. package/package.json +44 -33
  289. package/resources/etc/init.d/debian/gina +117 -0
  290. package/resources/home/framework/env.json +34 -0
  291. package/resources/home/framework/locals.json +14 -0
  292. package/resources/home/framework/project.json +48 -0
  293. package/resources/home/framework/projects.json +6 -0
  294. package/resources/home/main.json +65 -0
  295. package/resources/home/settings.json +24 -0
  296. package/resources/home/user/extensions/logger/default/config.json +77 -0
  297. package/resources/home/user/extensions/logger/file/config.json +11 -0
  298. package/resources/img/android-chrome-192x192.png +0 -0
  299. package/resources/img/android-chrome-512x512.png +0 -0
  300. package/resources/img/apple-touch-icon.png +0 -0
  301. package/resources/img/favicon-16x16.png +0 -0
  302. package/resources/img/favicon-32x32.png +0 -0
  303. package/resources/img/favicon.ico +0 -0
  304. package/resources/package.json.template +61 -0
  305. package/script/lib.js +24 -0
  306. package/script/post_install.js +747 -169
  307. package/script/post_publish.js +185 -0
  308. package/script/pre_install.js +627 -37
  309. package/script/prepare_version.js +552 -0
  310. package/utils/helper.js +620 -0
  311. package/utils/prototypes.js +239 -0
  312. package/utils/prototypes.json_clone.js +175 -0
  313. package/.npmignore +0 -6
  314. package/MIDDLEWARE +0 -1
  315. package/SUCCESS +0 -1
  316. package/VERSION +0 -1
  317. package/core/asset/html/nolayout.html +0 -1
  318. package/core/asset/js/plugin/build.dev.json +0 -28
  319. package/core/asset/js/plugin/build.json +0 -31
  320. package/core/asset/js/plugin/dist/gina.min.css +0 -1
  321. package/core/asset/js/plugin/dist/gina.min.css.map +0 -1
  322. package/core/asset/js/plugin/dist/gina.min.js +0 -13732
  323. package/core/asset/js/plugin/dist/gina.min.js.map +0 -42
  324. package/core/asset/js/plugin/dist/gina.onload.min.js +0 -3
  325. package/core/asset/js/plugin/dist/gina.onload.min.js.map +0 -8
  326. package/core/asset/js/plugin/readme.md +0 -152
  327. package/core/asset/js/plugin/src/gina/main.js +0 -132
  328. package/core/asset/js/plugin/src/gina/popin/css/design.css +0 -23
  329. package/core/asset/js/plugin/src/gina/popin/css/main.css +0 -1112
  330. package/core/asset/js/plugin/src/gina/popin/css/popin.css +0 -3
  331. package/core/asset/js/plugin/src/gina/popin/css/popin.css.map +0 -1
  332. package/core/asset/js/plugin/src/gina/popin/doc/TOC.md +0 -29
  333. package/core/asset/js/plugin/src/gina/popin/doc/css.md +0 -162
  334. package/core/asset/js/plugin/src/gina/popin/doc/extend.md +0 -663
  335. package/core/asset/js/plugin/src/gina/popin/doc/faq.md +0 -46
  336. package/core/asset/js/plugin/src/gina/popin/doc/html.md +0 -227
  337. package/core/asset/js/plugin/src/gina/popin/doc/js.md +0 -37
  338. package/core/asset/js/plugin/src/gina/popin/doc/misc.md +0 -178
  339. package/core/asset/js/plugin/src/gina/popin/doc/usage.md +0 -130
  340. package/core/asset/js/plugin/src/gina/popin/main.js +0 -783
  341. package/core/asset/js/plugin/src/gina/popin/sass/config.sass +0 -37
  342. package/core/asset/js/plugin/src/gina/popin/sass/gina-design.sass +0 -622
  343. package/core/asset/js/plugin/src/gina/popin/sass/gina-popin.sass +0 -54
  344. package/core/asset/js/plugin/src/gina/popin/sass/helper.scss +0 -73
  345. package/core/asset/js/plugin/src/gina/toolbar/.npmignore +0 -19
  346. package/core/asset/js/plugin/src/gina/toolbar/css/toolbar.css +0 -433
  347. package/core/asset/js/plugin/src/gina/toolbar/css/toolbar.css.map +0 -1
  348. package/core/asset/js/plugin/src/gina/toolbar/index.html +0 -285
  349. package/core/asset/js/plugin/src/gina/toolbar/index.kit +0 -120
  350. package/core/asset/js/plugin/src/gina/toolbar/jquery-3.1.0.min.js +0 -4
  351. package/core/asset/js/plugin/src/gina/toolbar/main.js +0 -693
  352. package/core/asset/js/plugin/src/gina/toolbar/mock.gina.json +0 -1
  353. package/core/asset/js/plugin/src/gina/toolbar/mock.user.json +0 -1
  354. package/core/asset/js/plugin/src/gina/toolbar/readme.md +0 -7
  355. package/core/asset/js/plugin/src/gina/toolbar/sass/toolbar.sass +0 -563
  356. package/core/asset/js/plugin/src/gina/toolbar/svg-src/Info-color.svg +0 -1
  357. package/core/asset/js/plugin/src/gina/toolbar/svg-src/Info-grey.svg +0 -1
  358. package/core/asset/js/plugin/src/gina/toolbar/svg-src/error-color.svg +0 -1
  359. package/core/asset/js/plugin/src/gina/toolbar/svg-src/error-grey.svg +0 -1
  360. package/core/asset/js/plugin/src/gina/toolbar/svg-src/info-optim.svg +0 -13
  361. package/core/asset/js/plugin/src/gina/toolbar/svg-src/logo-gina.svg +0 -1
  362. package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings-big.svg +0 -1
  363. package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings.afdesign +0 -0
  364. package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings.svg +0 -1
  365. package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-calendar-optim.svg +0 -1
  366. package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-calendar.svg +0 -1
  367. package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-card-optim.svg +0 -1
  368. package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-card.svg +0 -1
  369. package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-lock-optim.svg +0 -1
  370. package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-lock.svg +0 -1
  371. package/core/asset/js/plugin/src/gina/toolbar/svg-src/warning-color.svg +0 -1
  372. package/core/asset/js/plugin/src/gina/toolbar/svg-src/warning-grey.svg +0 -1
  373. package/core/asset/js/plugin/src/gina/toolbar/test.jpg +0 -0
  374. package/core/asset/js/plugin/src/gina/toolbar/toolbar.html +0 -104
  375. package/core/asset/js/plugin/src/gina/utils/dom.js +0 -24
  376. package/core/asset/js/plugin/src/gina/utils/events.js +0 -201
  377. package/core/asset/js/plugin/src/gina/utils/loader.js +0 -57
  378. package/core/asset/js/plugin/src/main.js +0 -235
  379. package/core/asset/js/plugin/src/vendor/jquery/1.11.1-css-event_alias.min.js +0 -5
  380. package/core/asset/js/plugin/src/vendor/jquery/1.12.4.min.js +0 -5
  381. package/core/asset/js/plugin/src/vendor/jquery/2.1.1-css-event_alias-sizzle.min.js +0 -4
  382. package/core/asset/js/plugin/src/vendor/jquery/README.md +0 -14
  383. package/core/asset/js/plugin/src/vendor/jquery/slim-3.1.1.min.js +0 -4
  384. package/core/config.js +0 -1225
  385. package/core/controller/controller.js +0 -1860
  386. package/core/gna.js +0 -908
  387. package/core/plugins/lib/validator/src/form-validator.js +0 -789
  388. package/core/plugins/lib/validator/src/main.js +0 -2056
  389. package/core/router.js +0 -717
  390. package/core/server.js +0 -1363
  391. package/core/template/conf/env.json +0 -70
  392. package/core/template/conf/settings.json +0 -48
  393. package/core/template/conf/statics.json +0 -6
  394. package/core/template/conf/views.json +0 -16
  395. package/core/template/samples/bundle/config/app.json +0 -4
  396. package/core/template/samples/bundle/config/routing.json +0 -9
  397. package/core/template/samples/bundle/controllers/setup.js +0 -33
  398. package/core/template/views/js/vendor/readme.md +0 -1
  399. package/core/template/views/readme.md +0 -1
  400. package/core/utils/helpers/dateFormat.js +0 -264
  401. package/core/utils/helpers/index.js +0 -202
  402. package/core/utils/index.js +0 -75
  403. package/core/utils/lib/cmd/app.js +0 -686
  404. package/core/utils/lib/cmd/basic.help.txt +0 -40
  405. package/core/utils/lib/cmd/basic.js +0 -141
  406. package/core/utils/lib/cmd/gina-add-bundle.js +0 -328
  407. package/core/utils/lib/cmd/gina-add-views.js +0 -99
  408. package/core/utils/lib/cmd/gina-build.js +0 -218
  409. package/core/utils/lib/cmd/gina-clean.js +0 -26
  410. package/core/utils/lib/cmd/gina-connect.js +0 -176
  411. package/core/utils/lib/cmd/gina-delete-bundle.js +0 -176
  412. package/core/utils/lib/cmd/gina-deploy.js +0 -452
  413. package/core/utils/lib/cmd/gina-init-project.js +0 -83
  414. package/core/utils/lib/cmd/gina-start-bundle.js +0 -3
  415. package/core/utils/lib/cmd/gina-start.js +0 -3
  416. package/core/utils/lib/cmd/index.js +0 -157
  417. package/core/utils/lib/cmd/project.js +0 -14
  418. package/core/utils/lib/collection/src/main.js +0 -650
  419. package/core/utils/lib/logger/containers/file.js +0 -11
  420. package/core/utils/lib/logger/index.js +0 -260
  421. package/core/utils/lib/merge/src/main.js +0 -344
  422. package/core/utils/lib/proc.js +0 -416
  423. package/core/utils/lib/routing/src/main.js +0 -165
  424. package/documentation/css/default.css +0 -3
  425. package/documentation/html/home.html +0 -6
  426. package/documentation/html/inc/_footer.html +0 -5
  427. package/documentation/html/layout.html +0 -21
  428. package/documentation/img/debug-conf1.png +0 -0
  429. package/documentation/img/debug-conf2.png +0 -0
  430. package/documentation/img/debug-conf3.png +0 -0
  431. package/documentation/img/debug-conf4.png +0 -0
  432. package/documentation/img/debug-conf5.png +0 -0
  433. package/documentation/img/debug-conf6.png +0 -0
  434. package/documentation/img/debug-conf7.png +0 -0
  435. package/documentation/img/debug-new1.png +0 -0
  436. package/documentation/img/debug-new2.png +0 -0
  437. package/documentation/img/debug-start.png +0 -0
  438. package/documentation/md/api/controller/main.md +0 -74
  439. package/migration_note.md +0 -7
  440. package/package-lock.json +0 -611
  441. package/script/pre_publish.js +0 -207
  442. package/tutorial/Commands/README.md +0 -56
  443. package/tutorial/Commands/add-bundle-result.png +0 -0
  444. package/tutorial/Commands/add-bundle.png +0 -0
  445. package/tutorial/Commands/delete-bundle.png +0 -0
  446. package/tutorial/Commands/help.png +0 -0
  447. package/tutorial/Commands/init-project.png +0 -0
  448. package/tutorial/Commands/start-bundle-result.png +0 -0
  449. package/tutorial/Commands/start-bundle-stop.png +0 -0
  450. package/tutorial/Commands/start-bundle.png +0 -0
  451. package/tutorial/Commands/version.png +0 -0
  452. package/tutorial/ETC/README.md +0 -74
  453. package/tutorial/ETC/add-bundle-result.png +0 -0
  454. package/tutorial/ETC/add-bundle.png +0 -0
  455. package/tutorial/ETC/init-project.png +0 -0
  456. package/tutorial/Install/README.md +0 -54
  457. package/tutorial/Install/git-get.png +0 -0
  458. package/tutorial/Install/git-install-end.png +0 -0
  459. package/tutorial/Install/git-install-result.png +0 -0
  460. package/tutorial/Install/git-install-start.png +0 -0
  461. package/tutorial/Install/install-end.png +0 -0
  462. package/tutorial/Install/install-result.png +0 -0
  463. package/tutorial/Install/install-start.png +0 -0
  464. package/tutorial/WebStorm/README.md +0 -30
  465. package/tutorial/WebStorm/closure-compiler.png +0 -0
  466. package/tutorial/WebStorm/sass.png +0 -0
@@ -1,12 +1,13 @@
1
1
  /*
2
2
  * This file is part of the gina package.
3
- * Copyright (c) 2016 Rhinostone <gina@rhinostone.com>
3
+ * Copyright (c) 2009-2022 Rhinostone <contact@gina.io>
4
4
  *
5
5
  * For the full copyright and license information, please view the LICENSE
6
6
  * file that was distributed with this source code.
7
7
  */
8
8
 
9
9
  var fs = require('fs');
10
+ var util = require('util');
10
11
  var Events = require('events');
11
12
  var Path = require('path');
12
13
 
@@ -23,7 +24,7 @@ e.setMaxListeners(100);
23
24
  * PathHelper
24
25
  *
25
26
  * @package Gina.Utils.Helpers
26
- * @author Rhinzostone <gina@rhinostone.com>
27
+ * @author Rhinzostone <contact@gina.io>
27
28
  * @api public
28
29
  *
29
30
  * TODO - Put debug logs
@@ -43,17 +44,24 @@ function PathHelper() {
43
44
  * @param {string} path - Path to convert
44
45
  * @param {boolean} [force] - Force conversion to match platform style (Only for string conversion)
45
46
  *
46
- * @return {string|object} converted
47
+ * @returns {string|object} converted
47
48
  * */
48
49
 
49
50
  _ = function(path, force) {
51
+
52
+ if ( typeof(path) == 'undefined' || !path || path == '' || path.length <=2 ) {
53
+ throw new Error('This source cannot be used: `'+ path +'`')
54
+ }
55
+
50
56
  if ( typeof(force) == undefined) {
51
57
  force = _this.force = false
52
58
  }
59
+ // Attention : _('/my/path/../folder/file.ext') will output -> /my/folder/file.ext
53
60
  path = Path.normalize(path);
54
- var isConstructor = false;
55
- if (this instanceof _ // <- You could use arguments.callee instead of _ here,
56
- // except in in EcmaScript 5 strict mode.
61
+ var isConstructor = false, p = null;
62
+ if (
63
+ this instanceof _ // <- You could use arguments.callee instead of _ here,
64
+ // except in in EcmaScript 5 strict mode.
57
65
  && !this.previouslyConstructedBy_) {
58
66
  isConstructor = true;
59
67
  this.previouslyConstructedBy_ = true
@@ -62,16 +70,13 @@ function PathHelper() {
62
70
  if ( typeof(path) != 'undefined' && path != '' ) {
63
71
 
64
72
  if (isConstructor) {
65
- var self = _;
66
-
67
73
  //console.debug("creating path record: ", path, isConstructor );
68
74
  this.path = path;
69
75
  if (process.platform == "win32") {
70
76
  //In case of mixed slashes.
71
- //this.value = path.replace(/\//g, "\\");
72
77
  this.value = path.replace(/\\/g, "/");// Make it unix like.
73
78
 
74
- var p = this.value;
79
+ p = this.value;
75
80
 
76
81
  this.isWindowsStyle = true;
77
82
  this.key = path;
@@ -80,9 +85,9 @@ function PathHelper() {
80
85
  }
81
86
  } else {
82
87
  //console.debug("linux style");
83
- //we don't want empty spaces..
88
+ //we don't want empty spaces
84
89
  this.value = path.replace(/\\/g, "/");
85
- var p = this.value;
90
+ p = this.value;
86
91
  //console.debug("path ", p);
87
92
  this.key = path;
88
93
  if (_this.paths.indexOf(path) < 0 ) {
@@ -112,18 +117,20 @@ function PathHelper() {
112
117
  _this.paths.push(path)
113
118
  }
114
119
  }
120
+
115
121
  return path
116
122
  }
117
123
  }
118
124
  return null
119
125
  };
120
126
 
127
+
121
128
  _.prototype.sep = Path.sep;
122
129
  _.prototype.start = (process.platform != "win32") ? "/" : "";
123
130
 
124
131
  /**
125
132
  * _.toString() Convert path object to string
126
- * @return {String} path
133
+ * @returns {String} path
127
134
  *
128
135
  * Usage:
129
136
  * var myPathObj = new _("my/path/string");
@@ -140,7 +147,7 @@ function PathHelper() {
140
147
 
141
148
  /**
142
149
  * _.toArray() Convert path object to array
143
- * @return {Array} path
150
+ * @returns {Array} path
144
151
  *
145
152
  * Usage:
146
153
  * var myPathObj = new _("my/path/string");
@@ -157,7 +164,7 @@ function PathHelper() {
157
164
  }
158
165
 
159
166
  arr.index = function(i) {
160
- if ( typeof(arr[i]) != 'undefiend')
167
+ if ( typeof(arr[i]) != 'undefined' )
161
168
  return arr[i];
162
169
  else
163
170
  return undefined;
@@ -196,7 +203,7 @@ function PathHelper() {
196
203
  }
197
204
 
198
205
  arr.index = function(i) {
199
- if ( typeof(arr[i]) != 'undefiend')
206
+ if ( typeof(arr[i]) != 'undefined')
200
207
  return arr[i];
201
208
  else
202
209
  return undefined;
@@ -219,14 +226,71 @@ function PathHelper() {
219
226
  return self
220
227
  }
221
228
 
229
+ var existsSync = function(value) {
230
+ if ( typeof(fs.accessSync) != 'undefined' ) {
231
+ try {
232
+ fs.accessSync(value, fs.constants.F_OK);
233
+ return true;
234
+ } catch (err) {
235
+ return false;
236
+ }
237
+ } else { // support for old version of nodejs
238
+ return fs.existsSync(value);
239
+ }
240
+ }
222
241
  _.prototype.existsSync = function() {
223
- return fs.existsSync(this.value)
242
+ return existsSync(this.value);
224
243
  }
225
244
 
245
+ var exists = function(value, callback) {
246
+ if ( typeof(fs.access) != 'undefined' ) {
247
+ fs.access(value, fs.constants.F_OK, (err) => {
248
+ callback( (err) ? false: true )
249
+ });
250
+ } else { // support for old version of nodejs
251
+ fs.exists(value, function(found) {
252
+ callback(found)
253
+ })
254
+ }
255
+ }
226
256
  _.prototype.exists = function(callback) {
227
- fs.exists(this.value, function(exists) {
228
- callback(exists)
229
- })
257
+ exists(this.value, callback);
258
+ }
259
+
260
+ _.prototype.isWritableSync = function() {
261
+
262
+ if ( typeof(fs.accessSync) != 'undefined' ) {
263
+ try {
264
+ fs.accessSync(this.value, fs.constants.W_OK);
265
+ return true
266
+ } catch (err) {
267
+ return false
268
+ }
269
+ } else { // support for old version of nodejs
270
+ var canWrite = false
271
+ try {
272
+ canWrite = (fs.statSync(this.value).mode & (fs.constants.S_IRUSR | fs.constants.S_IRGRP | fs.constants.S_IROTH));
273
+ } catch (err) {
274
+ canWrite = false
275
+ }
276
+ return canWrite
277
+ }
278
+ }
279
+
280
+ _.prototype.isWritable = function(callback) {
281
+ if ( typeof(fs.access) != 'undefined' ) {
282
+ fs.access(this.value, fs.constants.F_OK, (err) => {
283
+ callback( (err) ? false: true )
284
+ });
285
+ } else { // support for old version of nodejs
286
+ fs.stat(this.value, function(err, stats) {
287
+ var canWrite = false;
288
+ if (!err && stats.mode & (fs.constants.S_IRUSR | fs.constants.S_IRGRP | fs.constants.S_IROTH)) {
289
+ canWrite = true;
290
+ }
291
+ callback( canWrite )
292
+ })
293
+ }
230
294
  }
231
295
 
232
296
  /**
@@ -264,20 +328,20 @@ function PathHelper() {
264
328
  *
265
329
  * @param {string} permission Folder permission
266
330
  * */
267
- _.prototype.mkdirSync = function(permission) {
331
+ _.prototype.mkdirSync = function(permission, pathArr) {
268
332
 
269
- if ( fs.existsSync(this.value) ) {
333
+ if ( existsSync(this.value) ) {
270
334
  return this // always return the instance for sync
271
335
  }
272
336
  cleanSlashes(this);
273
337
 
274
338
  //by default.
275
339
  if ( typeof(permission) == 'undefined' ) {
276
- var permission = 0775
340
+ permission = 0775
277
341
  }
278
342
 
279
343
  if ( typeof(pathArr) == 'undefined' ) {
280
- var pathArr = toArray(this)
344
+ pathArr = toArray(this)
281
345
  }
282
346
 
283
347
  try {
@@ -303,13 +367,13 @@ function PathHelper() {
303
367
  if (i+1 < pathArr.length) {
304
368
 
305
369
  if ( typeof(path) == 'undefined') {
306
- var path = self.start + pathArr[0]
370
+ path = self.start + pathArr[0]
307
371
  } else {
308
372
  ++i;
309
373
  path += '/' + pathArr[i]
310
374
  }
311
375
 
312
- if ( !fs.existsSync(path) ) {
376
+ if ( !existsSync(path) ) {
313
377
  addFolder(self, permission, pathArr, i, path)
314
378
  } else {
315
379
  mkdirSync(self, permission, pathArr, i, path)
@@ -327,15 +391,15 @@ function PathHelper() {
327
391
  * */
328
392
  _.prototype.mkdir = function(permission, callback) {
329
393
  if ( typeof(permission) == "function") {
330
- var callback = permission;
331
- var permission = 0775
394
+ callback = permission;
395
+ permission = 0775
332
396
  }
333
397
  var self = this;
334
398
  self = cleanSlashes(self);
335
399
 
336
400
  //Enter dir & start rm.
337
- fs.exists(self.value, function(exists) {
338
- if (exists) {
401
+ exists(self.value, function(found) {
402
+ if (found) {
339
403
  callback(false, self.value)
340
404
  } else {
341
405
  var p = self.value;
@@ -344,9 +408,7 @@ function PathHelper() {
344
408
  .onComplete( function(err, path){
345
409
  //Avoid collisions.
346
410
  if (err) {
347
- console.error("Debug needed mkdir on existing folder !! ", err);
348
- // console.warn("MKDIR ERR: silently ignored.. ", path);
349
- //callback("MKDIR ERR: silently ignored.. ");
411
+ console.crit("debug needed mkdir for targeted folder !! ", err);
350
412
  process.exit(1)
351
413
  } else {
352
414
 
@@ -386,28 +448,28 @@ function PathHelper() {
386
448
 
387
449
  //by default.
388
450
  if ( typeof(permission) == 'undefined' ) {
389
- var permission = 0775
451
+ permission = 0775
390
452
  }
391
453
 
392
454
  if ( typeof(pathArr) == 'undefined' ) {
393
- var pathArr = toArray(self)
455
+ pathArr = toArray(self)
394
456
  }
395
457
 
396
458
  if ( typeof(i) == 'undefined' ) {
397
- var i = 0
459
+ i = 0
398
460
  }
399
461
 
400
462
  if (i+1 < pathArr.length) {
401
463
 
402
464
  if ( typeof(path) == 'undefined') {
403
- var path = self.start + pathArr[0]
465
+ path = self.start + pathArr[0]
404
466
  } else {
405
467
  ++i;
406
468
  path += '/' + pathArr[i]
407
469
  }
408
470
 
409
- fs.exists(path, function(exists) {
410
- if (!exists) {
471
+ exists(path, function(found) {
472
+ if (!found) {
411
473
  addFolder(self, permission, pathArr, i, path)
412
474
  } else {
413
475
  mkdir(self, permission, pathArr, i, path)
@@ -436,6 +498,86 @@ function PathHelper() {
436
498
  }
437
499
  }
438
500
 
501
+ /**
502
+ * symlinkSync
503
+ *
504
+ * @param {string} source
505
+ * @param {string} destination
506
+ * @param {string} type - Only available from node v12.0.0 & only available on Windows and ignored on other platforms
507
+ */
508
+ var symlinkSync = function(source, destination, type) {
509
+ // About junstion for windows (only):
510
+ // reminders: creating a symbolic link requires special privilege (by default, only available to elevated processes) whereas creating a junction only requires access to the file system.
511
+ // https://docs.microsoft.com/en-us/sysinternals/downloads/junction
512
+ // https://superuser.com/questions/343074/directory-junction-vs-directory-symbolic-link
513
+ if ( !existsSync(source) ) {
514
+ throw new Error('Cannot complete symlinkSync from `'+ source +'`: the path does not exist.');
515
+ }
516
+ var nodeVersion = process.version.replace(/v/, '').split(/\./g)[0];
517
+
518
+ if (
519
+ process.platform == "win32"
520
+ && ~~nodeVersion >= 12
521
+ && typeof(type) == 'undefined'
522
+ ||
523
+ process.platform == "win32"
524
+ && ~~nodeVersion >= 12
525
+ && !type
526
+ ||
527
+ process.platform == "win32"
528
+ && ~~nodeVersion >= 12
529
+ && type == ''
530
+ ) {
531
+ // check source type
532
+ if ( fs.lstatSync( source ).isDirectory() ) {
533
+ type = 'dir';
534
+ }
535
+ else {
536
+ type = 'file'
537
+ }
538
+ }
539
+
540
+ if (
541
+ process.platform == "win32"
542
+ && ~~nodeVersion >= 12
543
+ && typeof(type) != 'undefined'
544
+ && type != 'null'
545
+ && type != ''
546
+ ) { // can use type
547
+
548
+ if ( ['dir', 'file', 'junction'].indexOf(type) < 0 ) {
549
+ throw new Error('Wrong symlink type: '+ type);
550
+ }
551
+ }
552
+
553
+ fs.symlinkSync(source, destination, type);
554
+ }
555
+ _.prototype.symlinkSync = function(destination, type) {
556
+ var self = this;
557
+ var source = self.value;
558
+
559
+ // if ( !existsSync(source) ) {
560
+ // throw new Error('Cannot complete symlink from `'+ source +'`: the path does not exist.');
561
+ // }
562
+ symlinkSync(source, destination, type);
563
+
564
+ }
565
+
566
+ _.prototype.renameSync = function(destination) {
567
+ var self = this;
568
+ var source = self.value;
569
+
570
+ if ( !existsSync(source) ) {
571
+ throw new Error('Cannot complete rename from `'+ source +'`: the path does not exist.');
572
+ }
573
+
574
+ try {
575
+ fs.renameSync(source, destination);
576
+ } catch (err) {
577
+ throw err
578
+ }
579
+ }
580
+
439
581
 
440
582
  /**
441
583
  * copy, file or entire folder
@@ -446,7 +588,7 @@ function PathHelper() {
446
588
  * var sourceToCopy = new _(stringPath);
447
589
  * var target = _(stringPath);
448
590
  *
449
- * sourceToCopy.cp(target, function(err){
591
+ * sourceToCopy.cp(target, function(err, destination){
450
592
  *
451
593
  * })
452
594
  *
@@ -459,25 +601,36 @@ function PathHelper() {
459
601
  * */
460
602
 
461
603
  _.prototype.cp = function(target, excluded, cb) {
604
+
605
+ if ( typeof(target) == 'undefined' || !target || target == '' || target.length <=2 ) {
606
+ cb( new Error('This target cannot be used: `'+ target +'`'));
607
+ return;
608
+ }
609
+
462
610
  if ( typeof(excluded) == 'function') {
463
- var cb = excluded;
611
+ cb = excluded;
464
612
  excluded = undefined
465
613
  }
466
614
  var self = this;
467
615
  //Enter dir & start rm.
468
616
  var p = self.value;
469
617
  //console.debug("starting copying ", p, " => ", target);
618
+
470
619
  cp(p, target, excluded)
471
620
  .onComplete( function(err, destination, method) {
472
- cb(err);
621
+ cb(err, destination);
473
622
  });
474
623
 
475
624
  }
476
625
 
477
626
  var cp = function(source, destination, excluded) {
478
627
 
628
+ if ( !existsSync(source) ) {
629
+ throw new Error('Cannot complete copy from `'+ source +'`: the path does not exist.');
630
+ }
631
+
479
632
  /**
480
- * BO Targeting folder content..
633
+ * BO Targeting folder content
481
634
  * This only matters when copy is done Folder To Folder.
482
635
  *
483
636
  * TODO - Need to br [optimized] by not having to create new path object.
@@ -505,16 +658,31 @@ function PathHelper() {
505
658
  childElementsOnly['destination'] = false
506
659
  }
507
660
  /**
508
- * EO Targeting folder content..
661
+ * EO Targeting folder content
509
662
  * */
510
663
 
511
- //Define strategy.
664
+ //Define strategy.
512
665
  fs.lstat(source, function(err, stats) {
513
666
  // 1) File => Dir (add if exist else, throw error).
514
667
  // 2) File => File (create or replace if exists).
515
668
  // 3) Dir => Dir (create or replace if exists).
516
669
 
517
- if ( !stats.isDirectory() ) {
670
+ if (err) {
671
+ e.emit("cp#complete", err);
672
+ return;
673
+ }
674
+
675
+ if ( stats.isSymbolicLink() ) {
676
+ //console.debug('#1 ('+process.version+') Found symlink: '+ source,'\n', JSON.stringify(stats, null, 4));
677
+ try {
678
+ symlinkSync(fs.realpathSync(source), destination);
679
+ } catch (realPathError) {
680
+ e.emit("cp#complete", realPathError, destination);
681
+ return;
682
+ }
683
+
684
+ e.emit("cp#complete", err, destination)
685
+ } else if ( !stats.isDirectory() ) {
518
686
  // 1) & 2) File => Dir (add if exist else, throw error).
519
687
  copyFileToFile(source, destination, 0, function(err) {
520
688
  e.emit("cp#complete", err, destination)
@@ -579,7 +747,7 @@ function PathHelper() {
579
747
  }
580
748
  }
581
749
  if (!isExcluded) {
582
- var target = new _(destination).mkdir( function(err, path) {
750
+ target = new _(destination).mkdir( function(err, path) {
583
751
 
584
752
  browseCopy(source, path, excluded, function(err) {
585
753
  //console.debug("copy Dir to Dir done");
@@ -622,9 +790,9 @@ function PathHelper() {
622
790
  };
623
791
 
624
792
  var d = _(destination);
625
- fs.exists(d, function(exists){
793
+ exists(d, function(found){
626
794
  //console.debug("about to remove !! ", d, exists);
627
- if (exists) {
795
+ if (found) {
628
796
  rm(d).onComplete( onRemoved )
629
797
  } else {
630
798
  onRemoved(false, d)
@@ -707,16 +875,38 @@ function PathHelper() {
707
875
  }
708
876
 
709
877
  var browseCopy = function(sourceDir, destinationDir, excluded, callback, list, listTo, i) {
710
- var list = ( typeof(list) != 'undefined' ) ? list : [];
711
- var listTo = ( typeof(listTo) != 'undefined' ) ? listTo : [];
712
- var i = ( typeof(i) != 'undefined' ) ? i : 0;
713
-
714
- if (sourceDir == undefined || destinationDir == undefined) {
715
- end(callback, false)
878
+ list = ( typeof(list) != 'undefined' ) ? list : [];
879
+ listTo = ( typeof(listTo) != 'undefined' ) ? listTo : [];
880
+ i = ( typeof(i) != 'undefined' ) ? i : 0;
881
+
882
+ //console.debug('[browseCopy]', list.length, i, sourceDir, destinationDir);
883
+ if (
884
+ sourceDir == undefined
885
+ || sourceDir == ''
886
+ || destinationDir == undefined
887
+ || destinationDir == ''
888
+ ) {
889
+ var copyError = false;
890
+ // is it the list the last file ?
891
+ if (list.length != i) {
892
+ copyError = new Error('cp() encountred a fatal error. You have to check your paths.\nSource: '+ sourceDir +'\nDestination: ' + destinationDir);
893
+ }
894
+ end(callback, copyError);
716
895
  } else {
717
- fs.stat(sourceDir, function(err, stats) {
896
+ fs.lstat(sourceDir, function(err, stats) {
897
+
898
+ if ( stats.isSymbolicLink() ) {
899
+ //console.debug('real path: ', fs.realpathSync(list[i]));
900
+ //console.debug('#2 ('+process.version+') Found symlink: '+ sourceDir,'\n', JSON.stringify(stats, null, 4));
901
+ try {
902
+ symlinkSync(fs.realpathSync(list[i]), listTo[i]);
903
+ } catch (realPathError) {
904
+ throw realPathError;
905
+ }
718
906
 
719
- if ( stats.isDirectory() ) {
907
+ ++i;
908
+ browseCopy(list[i], listTo[i], excluded, callback, list, listTo, i)
909
+ } else if ( stats.isDirectory() ) {
720
910
 
721
911
  var isExcluded = false;
722
912
  if ( typeof(sourceDir) != 'undefined' && excluded != undefined) {
@@ -819,7 +1009,7 @@ function PathHelper() {
819
1009
  destination += path
820
1010
  }
821
1011
 
822
- fs.exists(destination, function(replaceFlag) {
1012
+ exists(destination, function(replaceFlag) {
823
1013
  if (replaceFlag) {
824
1014
  fs.unlink(destination, function(err) {
825
1015
  //TODO - log error.
@@ -884,13 +1074,21 @@ function PathHelper() {
884
1074
  var self = this;
885
1075
  //Enter dir & start rm.
886
1076
  var p = self.value;
887
-
888
- fs.exists(p, function(exists){
889
- if ( !exists ) {
890
- callback( new Error(' mv() - source [ '+p+' ] does not exists !') )
1077
+ exists(p, function(found){
1078
+ if ( !found ) {
1079
+ var err = new Error(' mv() - source [ '+p+' ] does not exists !');
1080
+ console.error(err);
1081
+ if ( !callback ) {
1082
+ throw err
1083
+ }
1084
+ callback(err)
891
1085
  } else {
892
1086
  mv(self, target)
893
1087
  .onComplete( function(err, path){
1088
+ if (err) {
1089
+ console.error(err);
1090
+ return callback(err)
1091
+ }
894
1092
  if (p == path && typeof(callback) != 'undefined') {
895
1093
  callback(err)
896
1094
  }
@@ -900,17 +1098,21 @@ function PathHelper() {
900
1098
  }
901
1099
 
902
1100
  var mv = function(self, target) {
903
- //console.debug("starting mv/copy from ", self.value, " to ", target);
904
- var task = new _(self.value);
905
- task.cp(target, function(err) {
906
- if (err) console.error(err);
907
-
908
- //console.debug("cp done... now unlinking source ", self.value);
909
- rm(self.value).onComplete( function(err, path){
910
- //console.debug('rm() complete');
911
- e.emit('mv#complete', err, path)
1101
+ console.debug("starting mv/copy from ", self.value, " to ", target);
1102
+ cp(self.value, target)
1103
+ .onComplete(function onCpMv(err) {
1104
+ console.debug("cp done... now unlinking source ", self.value);
1105
+ if (err) {
1106
+ e.emit('mv#complete', err);
1107
+ return;
1108
+ }
1109
+
1110
+
1111
+ rm(self.value).onComplete( function(err, path){
1112
+ console.debug('rm() complete');
1113
+ e.emit('mv#complete', err, path)
1114
+ })
912
1115
  })
913
- });
914
1116
 
915
1117
  return {
916
1118
  /**
@@ -940,12 +1142,17 @@ function PathHelper() {
940
1142
  * */
941
1143
  _.prototype.rmSync = function() {
942
1144
 
943
- if ( !fs.existsSync(this.value) ) {
1145
+ if ( !existsSync(this.value) ) {
944
1146
  return this // always return the instance for sync
945
1147
  }
946
1148
  cleanSlashes(this);
947
1149
 
948
1150
  try {
1151
+
1152
+ if ( fs.lstatSync(this.value).isSymbolicLink() ) {
1153
+ fs.unlinkSync(this.value);
1154
+ return this;
1155
+ }
949
1156
  browseRemoveSync(this.value);
950
1157
  return this // always return the instance for sync
951
1158
  } catch (err) {
@@ -954,7 +1161,7 @@ function PathHelper() {
954
1161
  }
955
1162
 
956
1163
  var removeFoldersSync = function(list, l, i) {
957
- var i = i || 0;
1164
+ i = i || 0;
958
1165
  if ( typeof(list[l]) == "undefined") {
959
1166
  return list[l-1][list[l-1].length -1]
960
1167
  } else {
@@ -991,9 +1198,10 @@ function PathHelper() {
991
1198
  }
992
1199
 
993
1200
  var browseRemoveSync = function(source, list, folders, i) {
994
- var list = ( typeof(list) != 'undefined' ) ? list : [];
995
- var folders = ( typeof(folders) != 'undefined' ) ? folders : [];
996
- var i = ( typeof(i) != 'undefined' ) ? i : 0;
1201
+ list = ( typeof(list) != 'undefined' ) ? list : [];
1202
+ folders = ( typeof(folders) != 'undefined' ) ? folders : [];
1203
+ i = ( typeof(i) != 'undefined' ) ? i : 0;
1204
+ var err = false;
997
1205
 
998
1206
  if (list.length === 0) {
999
1207
  list.push(source)
@@ -1012,7 +1220,14 @@ function PathHelper() {
1012
1220
  if (stats instanceof Error)
1013
1221
  return stats;
1014
1222
 
1015
- if ( stats.isDirectory() ) {
1223
+ if ( stats.isSymbolicLink() ) {
1224
+ err = removeFileSync(source);
1225
+ if (err instanceof Error)
1226
+ return err;
1227
+
1228
+ ++i;
1229
+ browseRemoveSync(list[i], list, folders, i)
1230
+ } else if ( stats.isDirectory() ) {
1016
1231
 
1017
1232
  if (folders.length == 0) {
1018
1233
  folders[0] = [];
@@ -1044,7 +1259,7 @@ function PathHelper() {
1044
1259
  browseRemoveSync(list[i], list, folders, i)
1045
1260
 
1046
1261
  } else {
1047
- var err = removeFileSync(source);
1262
+ err = removeFileSync(source);
1048
1263
  if (err instanceof Error)
1049
1264
  return err;
1050
1265
 
@@ -1066,11 +1281,11 @@ function PathHelper() {
1066
1281
  //Enter dir & start rm.
1067
1282
  self = cleanSlashes(self);
1068
1283
  var p = self.value;
1069
- fs.exists(p, function(exists) {
1284
+ exists(p, function(found) {
1070
1285
  //console.debug(" does it exists ? ", p, exists );
1071
- if (!exists) {
1286
+ if (!found) {
1072
1287
  //console.debug("done removing ", p);
1073
- callback(new Error('`'+p+'` does not found'), p)
1288
+ callback(new Error('`'+p+'` not found'), p)
1074
1289
 
1075
1290
  } else {
1076
1291
  rm(p).onComplete( function(err, path) {
@@ -1128,7 +1343,7 @@ function PathHelper() {
1128
1343
  * */
1129
1344
 
1130
1345
  var removeFolders = function(list, l, i, callback) {
1131
- var i = i || 0
1346
+ i = i || 0
1132
1347
  if ( typeof(list[l]) == "undefined") {
1133
1348
  callback(false, list[l-1][list[l-1].length -1])
1134
1349
  } else {
@@ -1169,9 +1384,9 @@ function PathHelper() {
1169
1384
  }
1170
1385
 
1171
1386
  var browseRemove = function(source, callback, list, folders, i) {
1172
- var list = ( typeof(list) != 'undefined' ) ? list : [];
1173
- var folders = ( typeof(folders) != 'undefined' ) ? folders : [];
1174
- var i = ( typeof(i) != 'undefined' ) ? i : 0;
1387
+ list = ( typeof(list) != 'undefined' ) ? list : [];
1388
+ folders = ( typeof(folders) != 'undefined' ) ? folders : [];
1389
+ i = ( typeof(i) != 'undefined' ) ? i : 0;
1175
1390
 
1176
1391
  if (list.length === 0) {
1177
1392
  list.push(source)
@@ -1273,7 +1488,7 @@ function PathHelper() {
1273
1488
  * /data/folder/other file ( "/data/folder/other\ file" )
1274
1489
  * \\192.168.0.1\folder\file ( "\\\\192.168.0.1\\folder\\file" )
1275
1490
  *
1276
- * @return {boolean} isReal
1491
+ * @returns {boolean} isReal
1277
1492
  *
1278
1493
  * @callback [ cb ]
1279
1494
  * @param {boolean} isReal
@@ -1290,38 +1505,11 @@ function PathHelper() {
1290
1505
  }
1291
1506
  }
1292
1507
 
1293
- /**
1294
- * Set path by name
1295
- * @param {String} name Path name
1296
- * @return {String}
1297
- * */
1298
- // TODO - remove this
1299
- // setPath = function(name, path) {
1300
- //
1301
- // if ( typeof(name) == 'object') {
1302
- // var paths = getContext('paths');
1303
- // for (var n in name) {
1304
- // _this.userPaths[n] = _(name[n]);
1305
- // merge(paths, _this.userPaths, true)
1306
- // }
1307
- // setContext("paths", paths)
1308
- //
1309
- // } else {
1310
- // if ( typeof(_this.userPaths) == "undefined" || typeof(_this.userPaths[name]) == "undefined" ) {
1311
- // _this.userPaths[name] = _(path);
1312
- // //PathHelper.userPaths = _this.userPaths;
1313
- // //console.debug("what is this ", Helpers, " VS ", _this.userPaths);
1314
- // var paths = getContext('paths');
1315
- // //console.info(" 1) got config paths " + paths + " VS "+ _this.userPaths, __stack);
1316
- // merge(paths, _this.userPaths, true);
1317
- // setContext("paths", paths)
1318
- // }
1319
- // }
1320
- // }
1508
+
1321
1509
 
1322
1510
  var parseCtxObject = function (o, obj) {
1323
1511
 
1324
- for (var i in o) {
1512
+ for (let i in o) {
1325
1513
  if (o[i] !== null && typeof(o[i]) == 'object') {
1326
1514
  parseCtxObject(o[i], obj);
1327
1515
  } else if (o[i] == '_content_'){
@@ -1332,22 +1520,41 @@ function PathHelper() {
1332
1520
  return o
1333
1521
  }
1334
1522
 
1523
+ /**
1524
+ * setPath
1525
+ * Set path by name
1526
+ *
1527
+ * @param {String} name - Path name
1528
+ * @returns {String} path
1529
+ * */
1335
1530
  setPath = function(name, path) {
1336
1531
 
1532
+ if ( !path || typeof(path) == 'undefined' || path == '' ) {
1533
+ throw new Error('setPath(name, path): path cannot be empty or undefined')
1534
+ }
1535
+ // check if symlink to get realpath
1536
+ // var stats = fs.lstatSync(path);
1537
+ // if (stats instanceof Error) {
1538
+ // throw new stats
1539
+ // }
1540
+ // if ( stats.isSymbolicLink() ) {
1541
+ // path = fs.realpathSync(path)
1542
+ // }
1543
+ var paths = null;
1337
1544
  if ( typeof(name) == 'string' && /\./.test(name) ) {
1338
1545
  var keys = name.split(/\./g)
1339
1546
  , newObj = {}
1340
1547
  , str = '{'
1341
1548
  , _count = 0;
1342
1549
 
1343
- for (var k = 0, len = keys.length; k<len; ++k) {
1550
+ for (let k = 0, len = keys.length; k<len; ++k) {
1344
1551
  str += "\""+ keys.splice(0,1)[0] + "\":{";
1345
1552
 
1346
1553
  ++_count;
1347
1554
  if (k == len-1) {
1348
1555
  str = str.substr(0, str.length-1);
1349
1556
  str += "\"_content_\"";
1350
- for (var c = 0; c<_count; ++c) {
1557
+ for (let c = 0; c<_count; ++c) {
1351
1558
  str += "}"
1352
1559
  }
1353
1560
  }
@@ -1355,17 +1562,17 @@ function PathHelper() {
1355
1562
 
1356
1563
  newObj = parseCtxObject(JSON.parse(str), path);
1357
1564
 
1358
- var paths = getContext('paths');
1565
+ paths = getContext('paths');
1359
1566
  paths = merge(paths, newObj);
1360
1567
  setContext("paths", paths)
1361
1568
 
1362
1569
  } else {
1363
1570
  // normal case
1364
- var paths = getContext('paths');
1571
+ paths = getContext('paths');
1365
1572
 
1366
1573
  var userPaths = {};
1367
1574
  if ( typeof(name) == 'object') {
1368
- for (var n in name) {
1575
+ for (let n in name) {
1369
1576
  if ( typeof(name) == 'string' && /\./.test(name) ) {
1370
1577
  setPath(n, name[n])
1371
1578
  } else {
@@ -1373,11 +1580,11 @@ function PathHelper() {
1373
1580
  merge(paths, userPaths, true)
1374
1581
  }
1375
1582
  }
1376
- setContext("paths", paths)
1583
+ setContext('paths', paths)
1377
1584
 
1378
1585
  } else {
1379
1586
  paths[name] = path;
1380
- setContext("paths", paths)
1587
+ setContext('paths', paths)
1381
1588
  }
1382
1589
  }
1383
1590
  }
@@ -1387,14 +1594,14 @@ function PathHelper() {
1387
1594
  /**
1388
1595
  * Get path by name
1389
1596
  * @param {String} name Path name
1390
- * @return {String} path
1597
+ * @returns {String} path
1391
1598
  * */
1392
1599
  getPath = function(name) {
1393
1600
  var paths = getContext('paths');
1394
1601
  if ( typeof(paths[name]) != "undefined" ) {
1395
1602
  return paths[name]
1396
1603
  } else {
1397
- return undefined
1604
+ throw new Error('Path `'+ name+'` not found. Check the spelling or add a new one using setPath("'+name+'", "\/your\/new\/pathname")')
1398
1605
  }
1399
1606
  }
1400
1607
 
@@ -1406,6 +1613,6 @@ function PathHelper() {
1406
1613
  return getContext("paths")
1407
1614
  }
1408
1615
 
1409
- };//EO PathHelper.
1616
+ }//EO PathHelper.
1410
1617
 
1411
1618
  module.exports = PathHelper