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