Importer-Exporter.deploy.js 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889
  1. (function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Importer-Exporter');
  3. smalltalk.addClass('ChunkParser', smalltalk.Object, ['stream'], 'Importer-Exporter');
  4. smalltalk.addMethod(
  5. smalltalk.method({
  6. selector: "nextChunk",
  7. fn: function (){
  8. var self=this;
  9. var char,result,chunk;
  10. return smalltalk.withContext(function($ctx1) {
  11. var $1,$2,$3;
  12. var $early={};
  13. try {
  14. result=""._writeStream();
  15. _st((function(){
  16. return smalltalk.withContext(function($ctx2) {
  17. char=_st(self["@stream"])._next();
  18. char;
  19. return _st(char)._notNil();
  20. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileTrue_((function(){
  21. return smalltalk.withContext(function($ctx2) {
  22. $1=_st(char).__eq("!");
  23. if(smalltalk.assert($1)){
  24. $2=_st(_st(self["@stream"])._peek()).__eq("!");
  25. if(smalltalk.assert($2)){
  26. _st(self["@stream"])._next();
  27. } else {
  28. $3=_st(_st(result)._contents())._trimBoth();
  29. throw $early=[$3];
  30. };
  31. };
  32. return _st(result)._nextPut_(char);
  33. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  34. return nil;
  35. }
  36. catch(e) {if(e===$early)return e[0]; throw e}
  37. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},smalltalk.ChunkParser)})},
  38. messageSends: ["writeStream", "whileTrue:", "ifTrue:", "ifTrue:ifFalse:", "next", "trimBoth", "contents", "=", "peek", "nextPut:", "notNil"]}),
  39. smalltalk.ChunkParser);
  40. smalltalk.addMethod(
  41. smalltalk.method({
  42. selector: "stream:",
  43. fn: function (aStream){
  44. var self=this;
  45. return smalltalk.withContext(function($ctx1) {
  46. self["@stream"]=aStream;
  47. return self}, function($ctx1) {$ctx1.fill(self,"stream:",{aStream:aStream},smalltalk.ChunkParser)})},
  48. messageSends: []}),
  49. smalltalk.ChunkParser);
  50. smalltalk.addMethod(
  51. smalltalk.method({
  52. selector: "on:",
  53. fn: function (aStream){
  54. var self=this;
  55. return smalltalk.withContext(function($ctx1) {
  56. var $1;
  57. $1=_st(self._new())._stream_(aStream);
  58. return $1;
  59. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},smalltalk.ChunkParser.klass)})},
  60. messageSends: ["stream:", "new"]}),
  61. smalltalk.ChunkParser.klass);
  62. smalltalk.addClass('Exporter', smalltalk.Object, [], 'Importer-Exporter');
  63. smalltalk.addMethod(
  64. smalltalk.method({
  65. selector: "classNameFor:",
  66. fn: function (aClass){
  67. var self=this;
  68. return smalltalk.withContext(function($ctx1) {
  69. var $2,$3,$1;
  70. $2=_st(aClass)._isMetaclass();
  71. if(smalltalk.assert($2)){
  72. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(".klass");
  73. } else {
  74. $3=_st(aClass)._isNil();
  75. if(smalltalk.assert($3)){
  76. $1="nil";
  77. } else {
  78. $1=_st(aClass)._name();
  79. };
  80. };
  81. return $1;
  82. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.Exporter)})},
  83. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"]}),
  84. smalltalk.Exporter);
  85. smalltalk.addMethod(
  86. smalltalk.method({
  87. selector: "exportAll",
  88. fn: function (){
  89. var self=this;
  90. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  91. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  92. return smalltalk.withContext(function($ctx1) {
  93. var $1;
  94. $1=_st($String())._streamContents_((function(stream){
  95. return smalltalk.withContext(function($ctx2) {
  96. return _st(_st(_st($Smalltalk())._current())._packages())._do_((function(pkg){
  97. return smalltalk.withContext(function($ctx3) {
  98. return self._exportPackage_on_(pkg,stream);
  99. }, function($ctx3) {$ctx3.fillBlock({pkg:pkg},$ctx2)})}));
  100. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1)})}));
  101. return $1;
  102. }, function($ctx1) {$ctx1.fill(self,"exportAll",{},smalltalk.Exporter)})},
  103. messageSends: ["streamContents:", "do:", "exportPackage:on:", "packages", "current"]}),
  104. smalltalk.Exporter);
  105. smalltalk.addMethod(
  106. smalltalk.method({
  107. selector: "exportClass:on:",
  108. fn: function (aClass,aStream){
  109. var self=this;
  110. return smalltalk.withContext(function($ctx1) {
  111. self._exportDefinitionOf_on_(aClass,aStream);
  112. _st(self._ownMethodsOfClass_(aClass))._do_((function(each){
  113. return smalltalk.withContext(function($ctx2) {
  114. return self._exportMethod_on_(each,aStream);
  115. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  116. self._exportMetaDefinitionOf_on_(aClass,aStream);
  117. _st(self._ownMethodsOfMetaClass_(aClass))._do_((function(each){
  118. return smalltalk.withContext(function($ctx2) {
  119. return self._exportMethod_on_(each,aStream);
  120. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  121. return self}, function($ctx1) {$ctx1.fill(self,"exportClass:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  122. messageSends: ["exportDefinitionOf:on:", "do:", "exportMethod:on:", "ownMethodsOfClass:", "exportMetaDefinitionOf:on:", "ownMethodsOfMetaClass:"]}),
  123. smalltalk.Exporter);
  124. smalltalk.addMethod(
  125. smalltalk.method({
  126. selector: "exportDefinitionOf:on:",
  127. fn: function (aClass,aStream){
  128. var self=this;
  129. return smalltalk.withContext(function($ctx1) {
  130. var $1,$2,$3,$4,$5,$6,$7;
  131. $1=aStream;
  132. _st($1)._lf();
  133. _st($1)._nextPutAll_("smalltalk.addClass(");
  134. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  135. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  136. $2=_st($1)._nextPutAll_(", [");
  137. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  138. return smalltalk.withContext(function($ctx2) {
  139. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  140. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  141. return smalltalk.withContext(function($ctx2) {
  142. return _st(aStream)._nextPutAll_(", ");
  143. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  144. $3=aStream;
  145. _st($3)._nextPutAll_("], '");
  146. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  147. $4=_st($3)._nextPutAll_(");");
  148. $5=_st(_st(aClass)._comment())._notEmpty();
  149. if(smalltalk.assert($5)){
  150. $6=aStream;
  151. _st($6)._lf();
  152. _st($6)._nextPutAll_("smalltalk.");
  153. _st($6)._nextPutAll_(self._classNameFor_(aClass));
  154. _st($6)._nextPutAll_(".comment=");
  155. _st($6)._nextPutAll_(_st(_st(aClass)._comment())._asJavascript());
  156. $7=_st($6)._nextPutAll_(";");
  157. $7;
  158. };
  159. _st(aStream)._lf();
  160. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  161. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "asJavascript", "comment", "notEmpty"]}),
  162. smalltalk.Exporter);
  163. smalltalk.addMethod(
  164. smalltalk.method({
  165. selector: "exportMetaDefinitionOf:on:",
  166. fn: function (aClass,aStream){
  167. var self=this;
  168. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  169. return smalltalk.withContext(function($ctx1) {
  170. var $1,$2,$3;
  171. _st(aStream)._lf();
  172. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  173. if(! smalltalk.assert($1)){
  174. $2=aStream;
  175. _st($2)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._class())));
  176. $3=_st($2)._nextPutAll_(".iVarNames = [");
  177. $3;
  178. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  179. return smalltalk.withContext(function($ctx2) {
  180. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  181. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  182. return smalltalk.withContext(function($ctx2) {
  183. return _st(aStream)._nextPutAll_(",");
  184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  185. _st(aStream)._nextPutAll_("];".__comma(_st($String())._lf()));
  186. };
  187. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.Exporter)})},
  188. messageSends: ["lf", "ifFalse:", "nextPutAll:", ",", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "isEmpty"]}),
  189. smalltalk.Exporter);
  190. smalltalk.addMethod(
  191. smalltalk.method({
  192. selector: "exportMethod:on:",
  193. fn: function (aMethod,aStream){
  194. var self=this;
  195. return smalltalk.withContext(function($ctx1) {
  196. var $1,$2,$3,$4;
  197. $1=aStream;
  198. _st($1)._nextPutAll_("smalltalk.addMethod(");
  199. _st($1)._lf();
  200. _st($1)._nextPutAll_("smalltalk.method({");
  201. _st($1)._lf();
  202. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  203. _st($1)._lf();
  204. _st($1)._nextPutAll_(_st("category: '".__comma(_st(aMethod)._category())).__comma("',"));
  205. _st($1)._lf();
  206. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  207. _st($1)._lf();
  208. _st($1)._nextPutAll_(_st("args: ".__comma(_st(_st(aMethod)._arguments())._asJavascript())).__comma(","));
  209. _st($1)._lf();
  210. _st($1)._nextPutAll_(_st("source: ".__comma(_st(_st(aMethod)._source())._asJavascript())).__comma(","));
  211. _st($1)._lf();
  212. _st($1)._nextPutAll_(_st("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript())).__comma(","));
  213. _st($1)._lf();
  214. $2=_st($1)._nextPutAll_("referencedClasses: ".__comma(_st(_st(aMethod)._referencedClasses())._asJavascript()));
  215. $3=aStream;
  216. _st($3)._lf();
  217. _st($3)._nextPutAll_("}),");
  218. _st($3)._lf();
  219. _st($3)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
  220. _st($3)._nextPutAll_(");");
  221. _st($3)._lf();
  222. $4=_st($3)._lf();
  223. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.Exporter)})},
  224. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "category", "compiledSource", "fn", "arguments", "source", "messageSends", "referencedClasses", "classNameFor:", "methodClass"]}),
  225. smalltalk.Exporter);
  226. smalltalk.addMethod(
  227. smalltalk.method({
  228. selector: "exportPackage:on:",
  229. fn: function (package_,stream){
  230. var self=this;
  231. return smalltalk.withContext(function($ctx1) {
  232. self._exportPackagePrologueOf_on_(package_,stream);
  233. self._exportPackageDefinitionOf_on_(package_,stream);
  234. _st(self._ownClassesOfPackage_(package_))._do_((function(each){
  235. return smalltalk.withContext(function($ctx2) {
  236. return self._exportClass_on_(each,stream);
  237. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  238. _st(self._extensionMethodsOfPackage_(package_))._do_((function(each){
  239. return smalltalk.withContext(function($ctx2) {
  240. return self._exportMethod_on_(each,stream);
  241. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  242. self._exportPackageEpilogueOf_on_(package_,stream);
  243. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{package_:package_,stream:stream},smalltalk.Exporter)})},
  244. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "do:", "exportClass:on:", "ownClassesOfPackage:", "exportMethod:on:", "extensionMethodsOfPackage:", "exportPackageEpilogueOf:on:"]}),
  245. smalltalk.Exporter);
  246. smalltalk.addMethod(
  247. smalltalk.method({
  248. selector: "exportPackageDefinitionOf:on:",
  249. fn: function (package_,aStream){
  250. var self=this;
  251. return smalltalk.withContext(function($ctx1) {
  252. var $1,$2;
  253. $1=aStream;
  254. _st($1)._nextPutAll_("smalltalk.addPackage(");
  255. _st($1)._nextPutAll_(_st("'".__comma(_st(package_)._name())).__comma("');"));
  256. $2=_st($1)._lf();
  257. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{package_:package_,aStream:aStream},smalltalk.Exporter)})},
  258. messageSends: ["nextPutAll:", ",", "name", "lf"]}),
  259. smalltalk.Exporter);
  260. smalltalk.addMethod(
  261. smalltalk.method({
  262. selector: "exportPackageEpilogueOf:on:",
  263. fn: function (aPackage,aStream){
  264. var self=this;
  265. return smalltalk.withContext(function($ctx1) {
  266. var $1,$2;
  267. $1=aStream;
  268. _st($1)._nextPutAll_("})(global_smalltalk,global_nil,global__st);");
  269. $2=_st($1)._lf();
  270. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  271. messageSends: ["nextPutAll:", "lf"]}),
  272. smalltalk.Exporter);
  273. smalltalk.addMethod(
  274. smalltalk.method({
  275. selector: "exportPackagePrologueOf:on:",
  276. fn: function (aPackage,aStream){
  277. var self=this;
  278. return smalltalk.withContext(function($ctx1) {
  279. var $1,$2;
  280. $1=aStream;
  281. _st($1)._nextPutAll_("(function(smalltalk,nil,_st){");
  282. $2=_st($1)._lf();
  283. return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},smalltalk.Exporter)})},
  284. messageSends: ["nextPutAll:", "lf"]}),
  285. smalltalk.Exporter);
  286. smalltalk.addMethod(
  287. smalltalk.method({
  288. selector: "extensionMethodsOfPackage:",
  289. fn: function (package_){
  290. var self=this;
  291. var name,result;
  292. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  293. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  294. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  295. return smalltalk.withContext(function($ctx1) {
  296. var $1;
  297. name=_st(package_)._name();
  298. result=_st($OrderedCollection())._new();
  299. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  300. return smalltalk.withContext(function($ctx2) {
  301. return _st([each,_st(each)._class()])._do_((function(aClass){
  302. return smalltalk.withContext(function($ctx3) {
  303. return _st(result)._addAll_(_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  304. return smalltalk.withContext(function($ctx4) {
  305. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  306. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._select_((function(method){
  307. return smalltalk.withContext(function($ctx4) {
  308. return _st(_st(method)._category())._match_("^\x5c*".__comma(name));
  309. }, function($ctx4) {$ctx4.fillBlock({method:method},$ctx3)})})));
  310. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
  311. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  312. $1=result;
  313. return $1;
  314. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{package_:package_,name:name,result:result},smalltalk.Exporter)})},
  315. messageSends: ["name", "new", "do:", "addAll:", "select:", "match:", ",", "category", "sorted:", "<=", "selector", "values", "methodDictionary", "class", "sortedClasses:", "classes", "current"]}),
  316. smalltalk.Exporter);
  317. smalltalk.addMethod(
  318. smalltalk.method({
  319. selector: "ownClassesOfPackage:",
  320. fn: function (package_){
  321. var self=this;
  322. return smalltalk.withContext(function($ctx1) {
  323. var $1;
  324. $1=_st(_st(package_)._sortedClasses())._asSet();
  325. return $1;
  326. }, function($ctx1) {$ctx1.fill(self,"ownClassesOfPackage:",{package_:package_},smalltalk.Exporter)})},
  327. messageSends: ["asSet", "sortedClasses"]}),
  328. smalltalk.Exporter);
  329. smalltalk.addMethod(
  330. smalltalk.method({
  331. selector: "ownMethodsOfClass:",
  332. fn: function (aClass){
  333. var self=this;
  334. return smalltalk.withContext(function($ctx1) {
  335. var $1;
  336. $1=_st(_st(_st(_st(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  337. return smalltalk.withContext(function($ctx2) {
  338. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  339. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._reject_((function(each){
  340. return smalltalk.withContext(function($ctx2) {
  341. return _st(_st(each)._category())._match_("^\x5c*");
  342. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  343. return $1;
  344. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},smalltalk.Exporter)})},
  345. messageSends: ["reject:", "match:", "category", "sorted:", "<=", "selector", "values", "methodDictionary"]}),
  346. smalltalk.Exporter);
  347. smalltalk.addMethod(
  348. smalltalk.method({
  349. selector: "ownMethodsOfMetaClass:",
  350. fn: function (aClass){
  351. var self=this;
  352. return smalltalk.withContext(function($ctx1) {
  353. var $1;
  354. $1=self._ownMethodsOfClass_(_st(aClass)._class());
  355. return $1;
  356. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},smalltalk.Exporter)})},
  357. messageSends: ["ownMethodsOfClass:", "class"]}),
  358. smalltalk.Exporter);
  359. smalltalk.addClass('ChunkExporter', smalltalk.Exporter, [], 'Importer-Exporter');
  360. smalltalk.addMethod(
  361. smalltalk.method({
  362. selector: "chunkEscape:",
  363. fn: function (aString){
  364. var self=this;
  365. return smalltalk.withContext(function($ctx1) {
  366. var $1;
  367. $1=_st(_st(aString)._replace_with_("!","!!"))._trimBoth();
  368. return $1;
  369. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},smalltalk.ChunkExporter)})},
  370. messageSends: ["trimBoth", "replace:with:"]}),
  371. smalltalk.ChunkExporter);
  372. smalltalk.addMethod(
  373. smalltalk.method({
  374. selector: "classNameFor:",
  375. fn: function (aClass){
  376. var self=this;
  377. return smalltalk.withContext(function($ctx1) {
  378. var $2,$3,$1;
  379. $2=_st(aClass)._isMetaclass();
  380. if(smalltalk.assert($2)){
  381. $1=_st(_st(_st(aClass)._instanceClass())._name()).__comma(" class");
  382. } else {
  383. $3=_st(aClass)._isNil();
  384. if(smalltalk.assert($3)){
  385. $1="nil";
  386. } else {
  387. $1=_st(aClass)._name();
  388. };
  389. };
  390. return $1;
  391. }, function($ctx1) {$ctx1.fill(self,"classNameFor:",{aClass:aClass},smalltalk.ChunkExporter)})},
  392. messageSends: ["ifTrue:ifFalse:", ",", "name", "instanceClass", "isNil", "isMetaclass"]}),
  393. smalltalk.ChunkExporter);
  394. smalltalk.addMethod(
  395. smalltalk.method({
  396. selector: "exportCategory:on:",
  397. fn: function (category,aStream){
  398. var self=this;
  399. return smalltalk.withContext(function($ctx1) {
  400. var $1,$2,$3,$4;
  401. $1=aStream;
  402. _st($1)._nextPutAll_("!".__comma(self._classNameFor_(_st(category)._at_("class"))));
  403. $2=_st($1)._nextPutAll_(_st(" methodsFor: '".__comma(_st(category)._at_("name"))).__comma("'!"));
  404. _st(_st(_st(category)._at_("methods"))._sorted_((function(a,b){
  405. return smalltalk.withContext(function($ctx2) {
  406. return _st(_st(a)._selector()).__lt_eq(_st(b)._selector());
  407. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._do_((function(each){
  408. return smalltalk.withContext(function($ctx2) {
  409. return self._exportMethod_on_(each,aStream);
  410. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  411. $3=aStream;
  412. _st($3)._nextPutAll_(" !");
  413. _st($3)._lf();
  414. $4=_st($3)._lf();
  415. return self}, function($ctx1) {$ctx1.fill(self,"exportCategory:on:",{category:category,aStream:aStream},smalltalk.ChunkExporter)})},
  416. messageSends: ["nextPutAll:", ",", "classNameFor:", "at:", "do:", "exportMethod:on:", "sorted:", "<=", "selector", "lf"]}),
  417. smalltalk.ChunkExporter);
  418. smalltalk.addMethod(
  419. smalltalk.method({
  420. selector: "exportClass:on:",
  421. fn: function (aClass,aStream){
  422. var self=this;
  423. return smalltalk.withContext(function($ctx1) {
  424. self._exportDefinitionOf_on_(aClass,aStream);
  425. _st(self._ownCategoriesOfClass_(aClass))._do_((function(each){
  426. return smalltalk.withContext(function($ctx2) {
  427. return self._exportCategory_on_(each,aStream);
  428. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  429. self._exportMetaDefinitionOf_on_(aClass,aStream);
  430. _st(self._ownCategoriesOfMetaClass_(aClass))._do_((function(each){
  431. return smalltalk.withContext(function($ctx2) {
  432. return self._exportCategory_on_(each,aStream);
  433. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  434. return self}, function($ctx1) {$ctx1.fill(self,"exportClass:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  435. messageSends: ["exportDefinitionOf:on:", "do:", "exportCategory:on:", "ownCategoriesOfClass:", "exportMetaDefinitionOf:on:", "ownCategoriesOfMetaClass:"]}),
  436. smalltalk.ChunkExporter);
  437. smalltalk.addMethod(
  438. smalltalk.method({
  439. selector: "exportDefinitionOf:on:",
  440. fn: function (aClass,aStream){
  441. var self=this;
  442. return smalltalk.withContext(function($ctx1) {
  443. var $1,$2,$3,$4,$5,$6,$7;
  444. $1=aStream;
  445. _st($1)._nextPutAll_(self._classNameFor_(_st(aClass)._superclass()));
  446. _st($1)._nextPutAll_(" subclass: #".__comma(self._classNameFor_(aClass)));
  447. _st($1)._lf();
  448. _st($1)._tab();
  449. $2=_st($1)._nextPutAll_("instanceVariableNames: '");
  450. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  451. return smalltalk.withContext(function($ctx2) {
  452. return _st(aStream)._nextPutAll_(each);
  453. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  454. return smalltalk.withContext(function($ctx2) {
  455. return _st(aStream)._nextPutAll_(" ");
  456. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  457. $3=aStream;
  458. _st($3)._nextPutAll_("'");
  459. _st($3)._lf();
  460. _st($3)._tab();
  461. _st($3)._nextPutAll_(_st("package: '".__comma(_st(aClass)._category())).__comma("'!"));
  462. $4=_st($3)._lf();
  463. $5=_st(_st(aClass)._comment())._notEmpty();
  464. if(smalltalk.assert($5)){
  465. $6=aStream;
  466. _st($6)._nextPutAll_(_st("!".__comma(self._classNameFor_(aClass))).__comma(" commentStamp!"));
  467. _st($6)._lf();
  468. _st($6)._nextPutAll_(_st(self._chunkEscape_(_st(aClass)._comment())).__comma("!"));
  469. $7=_st($6)._lf();
  470. $7;
  471. };
  472. _st(aStream)._lf();
  473. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  474. messageSends: ["nextPutAll:", "classNameFor:", "superclass", ",", "lf", "tab", "do:separatedBy:", "instanceVariableNames", "category", "ifTrue:", "chunkEscape:", "comment", "notEmpty"]}),
  475. smalltalk.ChunkExporter);
  476. smalltalk.addMethod(
  477. smalltalk.method({
  478. selector: "exportMetaDefinitionOf:on:",
  479. fn: function (aClass,aStream){
  480. var self=this;
  481. return smalltalk.withContext(function($ctx1) {
  482. var $1,$2,$3,$4,$5;
  483. $1=_st(_st(_st(aClass)._class())._instanceVariableNames())._isEmpty();
  484. if(! smalltalk.assert($1)){
  485. $2=aStream;
  486. _st($2)._nextPutAll_(self._classNameFor_(_st(aClass)._class()));
  487. $3=_st($2)._nextPutAll_(" instanceVariableNames: '");
  488. $3;
  489. _st(_st(_st(aClass)._class())._instanceVariableNames())._do_separatedBy_((function(each){
  490. return smalltalk.withContext(function($ctx2) {
  491. return _st(aStream)._nextPutAll_(each);
  492. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  493. return smalltalk.withContext(function($ctx2) {
  494. return _st(aStream)._nextPutAll_(" ");
  495. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  496. $4=aStream;
  497. _st($4)._nextPutAll_("'!");
  498. _st($4)._lf();
  499. $5=_st($4)._lf();
  500. $5;
  501. };
  502. return self}, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.ChunkExporter)})},
  503. messageSends: ["ifFalse:", "nextPutAll:", "classNameFor:", "class", "do:separatedBy:", "instanceVariableNames", "lf", "isEmpty"]}),
  504. smalltalk.ChunkExporter);
  505. smalltalk.addMethod(
  506. smalltalk.method({
  507. selector: "exportMethod:on:",
  508. fn: function (aMethod,aStream){
  509. var self=this;
  510. return smalltalk.withContext(function($ctx1) {
  511. var $1,$2;
  512. $1=aStream;
  513. _st($1)._lf();
  514. _st($1)._lf();
  515. _st($1)._nextPutAll_(self._chunkEscape_(_st(aMethod)._source()));
  516. _st($1)._lf();
  517. $2=_st($1)._nextPutAll_("!");
  518. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.ChunkExporter)})},
  519. messageSends: ["lf", "nextPutAll:", "chunkEscape:", "source"]}),
  520. smalltalk.ChunkExporter);
  521. smalltalk.addMethod(
  522. smalltalk.method({
  523. selector: "exportPackage:on:",
  524. fn: function (package_,stream){
  525. var self=this;
  526. return smalltalk.withContext(function($ctx1) {
  527. self._exportPackageDefinitionOf_on_(package_,stream);
  528. _st(self._ownClassesOfPackage_(package_))._do_((function(each){
  529. return smalltalk.withContext(function($ctx2) {
  530. return self._exportClass_on_(each,stream);
  531. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  532. _st(self._extensionCategoriesOfPackage_(package_))._do_((function(each){
  533. return smalltalk.withContext(function($ctx2) {
  534. return self._exportCategory_on_(each,stream);
  535. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  536. return self}, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{package_:package_,stream:stream},smalltalk.ChunkExporter)})},
  537. messageSends: ["exportPackageDefinitionOf:on:", "do:", "exportClass:on:", "ownClassesOfPackage:", "exportCategory:on:", "extensionCategoriesOfPackage:"]}),
  538. smalltalk.ChunkExporter);
  539. smalltalk.addMethod(
  540. smalltalk.method({
  541. selector: "exportPackageDefinitionOf:on:",
  542. fn: function (package_,aStream){
  543. var self=this;
  544. return smalltalk.withContext(function($ctx1) {
  545. var $1,$2;
  546. $1=aStream;
  547. _st($1)._nextPutAll_(_st("Smalltalk current createPackage: '".__comma(_st(package_)._name())).__comma("'!"));
  548. $2=_st($1)._lf();
  549. return self}, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{package_:package_,aStream:aStream},smalltalk.ChunkExporter)})},
  550. messageSends: ["nextPutAll:", ",", "name", "lf"]}),
  551. smalltalk.ChunkExporter);
  552. smalltalk.addMethod(
  553. smalltalk.method({
  554. selector: "extensionCategoriesOfPackage:",
  555. fn: function (package_){
  556. var self=this;
  557. var name,map,result;
  558. function $OrderedCollection(){return smalltalk.OrderedCollection||(typeof OrderedCollection=="undefined"?nil:OrderedCollection)}
  559. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  560. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  561. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  562. return smalltalk.withContext(function($ctx1) {
  563. var $1,$2;
  564. name=_st(package_)._name();
  565. result=_st($OrderedCollection())._new();
  566. _st(_st($Package())._sortedClasses_(_st(_st($Smalltalk())._current())._classes()))._do_((function(each){
  567. return smalltalk.withContext(function($ctx2) {
  568. return _st([each,_st(each)._class()])._do_((function(aClass){
  569. return smalltalk.withContext(function($ctx3) {
  570. map=_st($Dictionary())._new();
  571. map;
  572. _st(aClass)._protocolsDo_((function(category,methods){
  573. return smalltalk.withContext(function($ctx4) {
  574. $1=_st(category)._match_("^\x5c*".__comma(name));
  575. if(smalltalk.assert($1)){
  576. return _st(map)._at_put_(category,methods);
  577. };
  578. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3)})}));
  579. return _st(result)._addAll_(_st(_st(_st(map)._keys())._sorted_((function(a,b){
  580. return smalltalk.withContext(function($ctx4) {
  581. return _st(a).__lt_eq(b);
  582. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3)})})))._collect_((function(category){
  583. return smalltalk.withContext(function($ctx4) {
  584. return smalltalk.HashedCollection._from_(["methods".__minus_gt(_st(map)._at_(category)),"name".__minus_gt(category),"class".__minus_gt(aClass)]);
  585. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3)})})));
  586. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2)})}));
  587. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  588. $2=result;
  589. return $2;
  590. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{package_:package_,name:name,map:map,result:result},smalltalk.ChunkExporter)})},
  591. messageSends: ["name", "new", "do:", "protocolsDo:", "ifTrue:", "at:put:", "match:", ",", "addAll:", "collect:", "->", "at:", "sorted:", "<=", "keys", "class", "sortedClasses:", "classes", "current"]}),
  592. smalltalk.ChunkExporter);
  593. smalltalk.addMethod(
  594. smalltalk.method({
  595. selector: "ownCategoriesOfClass:",
  596. fn: function (aClass){
  597. var self=this;
  598. var map;
  599. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  600. return smalltalk.withContext(function($ctx1) {
  601. var $1,$2;
  602. map=_st($Dictionary())._new();
  603. _st(aClass)._protocolsDo_((function(category,methods){
  604. return smalltalk.withContext(function($ctx2) {
  605. $1=_st(category)._match_("^\x5c*");
  606. if(! smalltalk.assert($1)){
  607. return _st(map)._at_put_(category,methods);
  608. };
  609. }, function($ctx2) {$ctx2.fillBlock({category:category,methods:methods},$ctx1)})}));
  610. $2=_st(_st(_st(map)._keys())._sorted_((function(a,b){
  611. return smalltalk.withContext(function($ctx2) {
  612. return _st(a).__lt_eq(b);
  613. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1)})})))._collect_((function(category){
  614. return smalltalk.withContext(function($ctx2) {
  615. return smalltalk.HashedCollection._from_(["methods".__minus_gt(_st(map)._at_(category)),"name".__minus_gt(category),"class".__minus_gt(aClass)]);
  616. }, function($ctx2) {$ctx2.fillBlock({category:category},$ctx1)})}));
  617. return $2;
  618. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},smalltalk.ChunkExporter)})},
  619. messageSends: ["new", "protocolsDo:", "ifFalse:", "at:put:", "match:", "collect:", "->", "at:", "sorted:", "<=", "keys"]}),
  620. smalltalk.ChunkExporter);
  621. smalltalk.addMethod(
  622. smalltalk.method({
  623. selector: "ownCategoriesOfMetaClass:",
  624. fn: function (aClass){
  625. var self=this;
  626. return smalltalk.withContext(function($ctx1) {
  627. var $1;
  628. $1=self._ownCategoriesOfClass_(_st(aClass)._class());
  629. return $1;
  630. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},smalltalk.ChunkExporter)})},
  631. messageSends: ["ownCategoriesOfClass:", "class"]}),
  632. smalltalk.ChunkExporter);
  633. smalltalk.addClass('StrippedExporter', smalltalk.Exporter, [], 'Importer-Exporter');
  634. smalltalk.addMethod(
  635. smalltalk.method({
  636. selector: "exportDefinitionOf:on:",
  637. fn: function (aClass,aStream){
  638. var self=this;
  639. return smalltalk.withContext(function($ctx1) {
  640. var $1,$2,$3,$4;
  641. $1=aStream;
  642. _st($1)._lf();
  643. _st($1)._nextPutAll_("smalltalk.addClass(");
  644. _st($1)._nextPutAll_(_st("'".__comma(self._classNameFor_(aClass))).__comma("', "));
  645. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aClass)._superclass())));
  646. $2=_st($1)._nextPutAll_(", [");
  647. _st(_st(aClass)._instanceVariableNames())._do_separatedBy_((function(each){
  648. return smalltalk.withContext(function($ctx2) {
  649. return _st(aStream)._nextPutAll_(_st("'".__comma(each)).__comma("'"));
  650. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}),(function(){
  651. return smalltalk.withContext(function($ctx2) {
  652. return _st(aStream)._nextPutAll_(", ");
  653. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  654. $3=aStream;
  655. _st($3)._nextPutAll_("], '");
  656. _st($3)._nextPutAll_(_st(_st(aClass)._category()).__comma("'"));
  657. $4=_st($3)._nextPutAll_(");");
  658. _st(aStream)._lf();
  659. return self}, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},smalltalk.StrippedExporter)})},
  660. messageSends: ["lf", "nextPutAll:", ",", "classNameFor:", "superclass", "do:separatedBy:", "instanceVariableNames", "category"]}),
  661. smalltalk.StrippedExporter);
  662. smalltalk.addMethod(
  663. smalltalk.method({
  664. selector: "exportMethod:on:",
  665. fn: function (aMethod,aStream){
  666. var self=this;
  667. return smalltalk.withContext(function($ctx1) {
  668. var $1,$2;
  669. $1=aStream;
  670. _st($1)._nextPutAll_("smalltalk.addMethod(");
  671. _st($1)._lf();
  672. _st($1)._nextPutAll_("smalltalk.method({");
  673. _st($1)._lf();
  674. _st($1)._nextPutAll_(_st("selector: ".__comma(_st(_st(aMethod)._selector())._asJavascript())).__comma(","));
  675. _st($1)._lf();
  676. _st($1)._nextPutAll_(_st("fn: ".__comma(_st(_st(aMethod)._fn())._compiledSource())).__comma(","));
  677. _st($1)._lf();
  678. _st($1)._nextPutAll_("messageSends: ".__comma(_st(_st(aMethod)._messageSends())._asJavascript()));
  679. _st($1)._nextPutAll_("}),");
  680. _st($1)._lf();
  681. _st($1)._nextPutAll_("smalltalk.".__comma(self._classNameFor_(_st(aMethod)._methodClass())));
  682. _st($1)._nextPutAll_(");");
  683. _st($1)._lf();
  684. $2=_st($1)._lf();
  685. return self}, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},smalltalk.StrippedExporter)})},
  686. messageSends: ["nextPutAll:", "lf", ",", "asJavascript", "selector", "compiledSource", "fn", "messageSends", "classNameFor:", "methodClass"]}),
  687. smalltalk.StrippedExporter);
  688. smalltalk.addClass('Importer', smalltalk.Object, [], 'Importer-Exporter');
  689. smalltalk.addMethod(
  690. smalltalk.method({
  691. selector: "import:",
  692. fn: function (aStream){
  693. var self=this;
  694. var chunk,result,parser,lastEmpty;
  695. function $ChunkParser(){return smalltalk.ChunkParser||(typeof ChunkParser=="undefined"?nil:ChunkParser)}
  696. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  697. return smalltalk.withContext(function($ctx1) {
  698. var $1,$2;
  699. parser=_st($ChunkParser())._on_(aStream);
  700. lastEmpty=false;
  701. _st((function(){
  702. return smalltalk.withContext(function($ctx2) {
  703. chunk=_st(parser)._nextChunk();
  704. chunk;
  705. return _st(chunk)._isNil();
  706. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))._whileFalse_((function(){
  707. return smalltalk.withContext(function($ctx2) {
  708. $1=_st(chunk)._isEmpty();
  709. if(smalltalk.assert($1)){
  710. lastEmpty=true;
  711. return lastEmpty;
  712. } else {
  713. result=_st(_st($Compiler())._new())._evaluateExpression_(chunk);
  714. result;
  715. $2=lastEmpty;
  716. if(smalltalk.assert($2)){
  717. lastEmpty=false;
  718. lastEmpty;
  719. return _st(result)._scanFrom_(parser);
  720. };
  721. };
  722. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
  723. return self}, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},smalltalk.Importer)})},
  724. messageSends: ["on:", "whileFalse:", "ifTrue:ifFalse:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "isEmpty", "nextChunk", "isNil"]}),
  725. smalltalk.Importer);
  726. smalltalk.addClass('PackageHandler', smalltalk.Object, [], 'Importer-Exporter');
  727. smalltalk.addMethod(
  728. smalltalk.method({
  729. selector: "ajaxPutAt:data:",
  730. fn: function (aURL,aString){
  731. var self=this;
  732. return smalltalk.withContext(function($ctx1) {
  733. _st(jQuery)._ajax_options_(aURL,smalltalk.HashedCollection._from_(["type".__minus_gt("PUT"),"data".__minus_gt(aString),"contentType".__minus_gt("text/plain;charset=UTF-8"),"error".__minus_gt((function(xhr){
  734. return smalltalk.withContext(function($ctx2) {
  735. return self._error_(_st(_st(_st("Commiting ".__comma(aURL)).__comma(" failed with reason: \x22")).__comma(_st(xhr)._responseText())).__comma("\x22"));
  736. }, function($ctx2) {$ctx2.fillBlock({xhr:xhr},$ctx1)})}))]));
  737. return self}, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:",{aURL:aURL,aString:aString},smalltalk.PackageHandler)})},
  738. messageSends: ["ajax:options:", "->", "error:", ",", "responseText"]}),
  739. smalltalk.PackageHandler);
  740. smalltalk.addMethod(
  741. smalltalk.method({
  742. selector: "commit:",
  743. fn: function (aPackage){
  744. var self=this;
  745. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  746. function $Exporter(){return smalltalk.Exporter||(typeof Exporter=="undefined"?nil:Exporter)}
  747. function $StrippedExporter(){return smalltalk.StrippedExporter||(typeof StrippedExporter=="undefined"?nil:StrippedExporter)}
  748. function $ChunkExporter(){return smalltalk.ChunkExporter||(typeof ChunkExporter=="undefined"?nil:ChunkExporter)}
  749. return smalltalk.withContext(function($ctx1) {
  750. _st([_st($Exporter()).__minus_gt(_st(_st(_st(_st(aPackage)._commitPathJs()).__comma("/")).__comma(_st(aPackage)._name())).__comma(".js")),_st($StrippedExporter()).__minus_gt(_st(_st(_st(_st(aPackage)._commitPathJs()).__comma("/")).__comma(_st(aPackage)._name())).__comma(".deploy.js")),_st($ChunkExporter()).__minus_gt(_st(_st(_st(_st(aPackage)._commitPathSt()).__comma("/")).__comma(_st(aPackage)._name())).__comma(".st"))])._do_displayingProgress_((function(commitStrategy){
  751. var fileContents;
  752. return smalltalk.withContext(function($ctx2) {
  753. fileContents=_st($String())._streamContents_((function(stream){
  754. return smalltalk.withContext(function($ctx3) {
  755. return _st(_st(_st(commitStrategy)._key())._new())._exportPackage_on_(aPackage,stream);
  756. }, function($ctx3) {$ctx3.fillBlock({stream:stream},$ctx2)})}));
  757. fileContents;
  758. return self._ajaxPutAt_data_(_st(commitStrategy)._value(),fileContents);
  759. }, function($ctx2) {$ctx2.fillBlock({commitStrategy:commitStrategy,fileContents:fileContents},$ctx1)})}),"Committing package ".__comma(_st(aPackage)._name()));
  760. return self}, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},smalltalk.PackageHandler)})},
  761. messageSends: ["do:displayingProgress:", "streamContents:", "exportPackage:on:", "new", "key", "ajaxPutAt:data:", "value", ",", "name", "->", "commitPathJs", "commitPathSt"]}),
  762. smalltalk.PackageHandler);
  763. smalltalk.addMethod(
  764. smalltalk.method({
  765. selector: "loadPackage:prefix:",
  766. fn: function (packageName,aString){
  767. var self=this;
  768. var url;
  769. return smalltalk.withContext(function($ctx1) {
  770. var $1;
  771. url=_st(_st(_st("/".__comma(aString)).__comma("/js/")).__comma(packageName)).__comma(".js");
  772. _st(jQuery)._ajax_options_(url,smalltalk.HashedCollection._from_(["type".__minus_gt("GET"),"dataType".__minus_gt("script"),"complete".__minus_gt((function(jqXHR,textStatus){
  773. return smalltalk.withContext(function($ctx2) {
  774. $1=_st(_st(jqXHR)._readyState()).__eq((4));
  775. if(smalltalk.assert($1)){
  776. return self._setupPackageNamed_prefix_(packageName,aString);
  777. };
  778. }, function($ctx2) {$ctx2.fillBlock({jqXHR:jqXHR,textStatus:textStatus},$ctx1)})})),"error".__minus_gt((function(){
  779. return smalltalk.withContext(function($ctx2) {
  780. return _st(window)._alert_("Could not load package at: ".__comma(url));
  781. }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}))]));
  782. return self}, function($ctx1) {$ctx1.fill(self,"loadPackage:prefix:",{packageName:packageName,aString:aString,url:url},smalltalk.PackageHandler)})},
  783. messageSends: [",", "ajax:options:", "->", "ifTrue:", "setupPackageNamed:prefix:", "=", "readyState", "alert:"]}),
  784. smalltalk.PackageHandler);
  785. smalltalk.addMethod(
  786. smalltalk.method({
  787. selector: "loadPackages:prefix:",
  788. fn: function (aCollection,aString){
  789. var self=this;
  790. return smalltalk.withContext(function($ctx1) {
  791. _st(aCollection)._do_((function(each){
  792. return smalltalk.withContext(function($ctx2) {
  793. return self._loadPackage_prefix_(each,aString);
  794. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1)})}));
  795. return self}, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.PackageHandler)})},
  796. messageSends: ["do:", "loadPackage:prefix:"]}),
  797. smalltalk.PackageHandler);
  798. smalltalk.addMethod(
  799. smalltalk.method({
  800. selector: "setupPackageNamed:prefix:",
  801. fn: function (packageName,aString){
  802. var self=this;
  803. function $Package(){return smalltalk.Package||(typeof Package=="undefined"?nil:Package)}
  804. return smalltalk.withContext(function($ctx1) {
  805. var $1,$2;
  806. $1=_st($Package())._named_(packageName);
  807. _st($1)._setupClasses();
  808. _st($1)._commitPathJs_(_st("/".__comma(aString)).__comma("/js"));
  809. $2=_st($1)._commitPathSt_(_st("/".__comma(aString)).__comma("/st"));
  810. return self}, function($ctx1) {$ctx1.fill(self,"setupPackageNamed:prefix:",{packageName:packageName,aString:aString},smalltalk.PackageHandler)})},
  811. messageSends: ["setupClasses", "named:", "commitPathJs:", ",", "commitPathSt:"]}),
  812. smalltalk.PackageHandler);
  813. smalltalk.addMethod(
  814. smalltalk.method({
  815. selector: "loadPackages:prefix:",
  816. fn: function (aCollection,aString){
  817. var self=this;
  818. return smalltalk.withContext(function($ctx1) {
  819. var $1;
  820. $1=_st(self._new())._loadPackages_prefix_(aCollection,aString);
  821. return $1;
  822. }, function($ctx1) {$ctx1.fill(self,"loadPackages:prefix:",{aCollection:aCollection,aString:aString},smalltalk.PackageHandler.klass)})},
  823. messageSends: ["loadPackages:prefix:", "new"]}),
  824. smalltalk.PackageHandler.klass);
  825. smalltalk.addMethod(
  826. smalltalk.method({
  827. selector: "commit",
  828. fn: function (){
  829. var self=this;
  830. function $PackageHandler(){return smalltalk.PackageHandler||(typeof PackageHandler=="undefined"?nil:PackageHandler)}
  831. return smalltalk.withContext(function($ctx1) {
  832. var $1;
  833. $1=_st(_st($PackageHandler())._new())._commit_(self);
  834. return $1;
  835. }, function($ctx1) {$ctx1.fill(self,"commit",{},smalltalk.Package)})},
  836. messageSends: ["commit:", "new"]}),
  837. smalltalk.Package);
  838. })(global_smalltalk,global_nil,global__st);