get-debug.js revision 5e01848ef29b56e6a9c745c603bc0137505bb193
0c7c93f66f5b0af032703f26632682b685b26be5Dav Glass * NodeJS specific Get module used to load remote resources. It contains the same signature as the default Get module so there is no code change needed.
0c7c93f66f5b0af032703f26632682b685b26be5Dav Glass * @module get-nodejs
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * @class GetNodeJS
5e01848ef29b56e6a9c745c603bc0137505bb193Dav Glass Y.Get = function() {
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass //Setup the default config base path
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * Escape the path for Windows, they need to be double encoded when used as `__dirname` or `__filename`
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * @method escapeWinPath
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * @protected
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * @param {String} p The path to modify
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * @return {String} The encoded path
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass var escapeWinPath = function(p) {
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * Takes the raw JS files and wraps them to be executed in the YUI context so they can be loaded
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * into the YUI object
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * @method _exec
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * @param {String} data The JS to execute
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * @param {String} url The path to the file that was parsed
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * @param {Callback} cb The callback to execute when this is completed
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * @param {Error} cb.err=null Error object
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * @param {String} cb.url The URL that was just parsed
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass var mod = "(function(YUI) { var __dirname = '" + dirName + "'; "+
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass "var process = YUI.process;" +
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass "var require = function(file) {" +
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass " if (file.indexOf('./') === 0) {" +
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass " file = __dirname + file.replace('./', '/'); }" +
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass " return YUI.require(file); }; " +
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass //var mod = "(function(YUI) { " + data + ";return YUI; })";
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * Fetches the content from a remote URL or a file from disc and passes the content
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * off to `_exec` for parsing
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * @method _include
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * @param {String} url The URL/File path to fetch the content from
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * @param {Callback} cb The callback to fire once the content has been executed via `_exec`
74ead59e93c5200ec17d94b912efc72d0d5605a0Dav Glass //Needs to be in useSync
74ead59e93c5200ec17d94b912efc72d0d5605a0Dav Glass //Y.log('Get end: ' + cb.onEnd);
74ead59e93c5200ec17d94b912efc72d0d5605a0Dav Glass //Y.log('Get pass: ' + cb.onSuccess);
74ead59e93c5200ec17d94b912efc72d0d5605a0Dav Glass //Y.log('Get fail: ' + er);
74ead59e93c5200ec17d94b912efc72d0d5605a0Dav Glass * Override for Get.script for loading local or remote YUI modules.
5e01848ef29b56e6a9c745c603bc0137505bb193Dav Glass * @method js
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass * @param {Array|String} s The URL's to load into this context
5e01848ef29b56e6a9c745c603bc0137505bb193Dav Glass * @param {Object} options Transaction options
74ead59e93c5200ec17d94b912efc72d0d5605a0Dav Glass var A = Y.Array,
1f31cb648e4f86a24ec85d11aee069232bea4332Dav Glass check = function() {
1f31cb648e4f86a24ec85d11aee069232bea4332Dav Glass if (c === l) {
74ead59e93c5200ec17d94b912efc72d0d5605a0Dav Glass for (i=0; i<l; i++) {
1702fd8ca80cc30781373ff0ddf0227bf7688363Dav Glass Y.Get._include(url, function(err, url) {
5e01848ef29b56e6a9c745c603bc0137505bb193Dav Glass if (options.onProgress) {
5e01848ef29b56e6a9c745c603bc0137505bb193Dav Glass options.onProgress.call(options.context || Y, url);
5e01848ef29b56e6a9c745c603bc0137505bb193Dav Glass fail(options, err);
5e01848ef29b56e6a9c745c603bc0137505bb193Dav Glass Y.log('----------------------------------------------------------', 'error', 'get');
5e01848ef29b56e6a9c745c603bc0137505bb193Dav Glass Y.log('----------------------------------------------------------', 'error', 'get');
5e01848ef29b56e6a9c745c603bc0137505bb193Dav Glass * Alias for `Y.Get.js`
5e01848ef29b56e6a9c745c603bc0137505bb193Dav Glass * @method script
5e01848ef29b56e6a9c745c603bc0137505bb193Dav Glass Y.Get.script = Y.Get.js;
8610b4c45db9fb0a80a184b3f34fedb70d59296dDav Glass //Place holder for SS Dom access
8610b4c45db9fb0a80a184b3f34fedb70d59296dDav Glass Y.Get.css = function(s, cb) {