get-min.js revision 74ead59e93c5200ec17d94b912efc72d0d5605a0
YUI.add("get",function(a){var j=require("path"),b=require("vm"),e=require("fs"),f=require("url"),h=require("http"),i=require("https");a.Get=function(){};a.config.base=j.join(__dirname,"../");a.Get.urlInfoPort=function(k){return k.port?parseInt(k.port,10):k.protocol==="http:"?80:443;};a.Get._exec=function(p,m,k){var n="(function(YUI) { "+p+";return YUI; })";var l=b.createScript(n,m);var o=l.runInThisContext(n);YUI=o(YUI);k(null);};a.Get._include=function(n,k){if(n.match(/^https?:\/\//)){var m=f.parse(n,parseQueryString=false),r=a.Get.urlInfoPort(m),l=m.pathname;if(m.search){l+=m.search;}var q=h;if(r===443||m.protocol==="https:"){q=i;}q.get({host:m.hostname,port:r,path:l},function(s){var p="";s.setEncoding("utf8");s.on("data",function(t){p+=t;});s.on("end",function(){a.Get._exec(p,n,k);});});}else{if(a.config.useSync){var o=e.readFileSync(n,"utf8");a.Get._exec(o,n,k);}else{e.readFile(n,"utf8",function(s,p){a.Get._exec(p,n,k);});}}};var d=function(l,m,k){if(a.Lang.isFunction(l.onEnd)){l.onEnd.call(a,m,k);}},g=function(k){if(a.Lang.isFunction(k.onSuccess)){k.onSuccess.call(a,k);}d(k,"success","success");},c=function(k,l){if(a.Lang.isFunction(k.onFailure)){k.onFailure.call(a,l,k);}d(k,l,"fail");};a.Get.script=function(q,m){var k=a.Array,r=k(q),o,p,n=r.length;for(p=0;p<n;p++){o=r[p];o=o.replace(/'/g,"%27");a.Get._include(o,function(l){if(!a.config){a.config={debug:true};}if(l){if(l.stack){k.each(l.stack.split("\n"),function(s){});}else{console.log(l);}}else{g(m);}});}};},"@VERSION@",{requires:["yui-base"]});