Ver código fonte

Merge pull request #19 from mkroehnert/grunt

Add support for building most examples with Grunt.js
Nicolas Petton 11 anos atrás
pai
commit
dde2898548

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+node_modules

+ 16 - 0
README.md

@@ -19,3 +19,19 @@ and point your browser to
 
 http://localhost:4000/
 
+Using Grunt.js
+==============
+
+Since Amber 0.10.0 Grunt.js is used as commandline build system.
+To use it with the examples it is first necessary to install all dependencies with
+
+* install grunt-cli globally if not already present: `npm install -g grunt-cli`
+* `cd amber-examples`
+* `npm install`
+
+Afterwards the examples can be built/recompiled by running the following command in
+the subdirectory of each example:
+
+`grunt`
+
+The subdirectories might contain additional README files which might contain additional information.

+ 0 - 16
myproject/index.html

@@ -1,16 +0,0 @@
-<html>
-<head>
-<title>My Project</title>
-<script src="../vendor/amber/js/amber.js" type="text/javascript"></script>
-</head>
-<body>
-<script type="text/javascript"> 
-	loadAmber({
-		files: ['Banana'],
-		packageHome: './',
-		ready: function() {
-			smalltalk.Browser._open();
-		}}); 
-</script>
-</body>
-</html>

+ 14 - 0
package.json

@@ -0,0 +1,14 @@
+{
+    "name": "amber-examples",
+    "version": "0.1.0",
+    "description": "Amber Examples",
+    "homepage": "http://amber-lang.net",
+    "keywords": [ "javascript", "smalltalk", "language", "compiler", "web" ],
+    "engines": {
+        "node": "0.8.x"
+    },
+    "devDependencies": {
+        "pegjs": "~0.7.0",
+        "grunt": "~0.4.0"
+    }
+}

+ 21 - 0
presentation/Gruntfile.js

@@ -0,0 +1,21 @@
+module.exports = function(grunt) {
+  grunt.loadTasks('../vendor/amber/grunt/tasks/');
+
+  grunt.registerTask('default', ['amberc:presentation']);
+
+  grunt.initConfig({
+    pkg: grunt.file.readJSON('../package.json'),
+
+    amberc: {  
+      _config: {
+        amber_dir: '../vendor/amber',
+        closure_jar: ''
+      },
+      presentation: {
+        src: ['st/Presentation.st'],
+        output_dir: 'js'
+      }
+    }
+  });
+
+}

Diferenças do arquivo suprimidas por serem muito extensas
+ 298 - 156
presentation/js/Presentation.js


+ 0 - 1
presentation/st/Presentation.st

@@ -1647,7 +1647,6 @@ cssClass
 !FOSDEMCanvasSlide methodsFor: 'drawing'!
 
 drawOnCanvas
-	|c2d|
 	c2d := canvas element getContext: '2d'.
 	c2d 
 		clearRect: 0 

+ 21 - 0
processing/Gruntfile.js

@@ -0,0 +1,21 @@
+module.exports = function(grunt) {
+  grunt.loadTasks('../vendor/amber/grunt/tasks/');
+
+  grunt.registerTask('default', ['amberc:processing']);
+
+  grunt.initConfig({
+    pkg: grunt.file.readJSON('../package.json'),
+
+    amberc: {  
+      _config: {
+        amber_dir: '../vendor/amber',
+        closure_jar: ''
+      },
+      processing: {
+        src: ['st/Processing-Examples.st'],
+        output_dir: 'js'
+      }
+    }
+  });
+
+}

+ 34 - 29
processing/js/Processing-Examples.js

@@ -1,32 +1,34 @@
-smalltalk.addPackage('Processing-Examples', {});
+smalltalk.addPackage('Processing-Examples');
 smalltalk.addClass('ProcessingClock', smalltalk.Object, ['processing', 'centerX', 'centerY', 'maxArmLength'], 'Processing-Examples');
 smalltalk.addMethod(
-"_draw",
 smalltalk.method({
 selector: "draw",
 category: 'not yet classified',
 fn: function (){
 var self=this;
 var drawBlock;
-return smalltalk.withContext(function($ctx1) { 
var $1;
+function $Date(){return smalltalk.Date||(typeof Date=="undefined"?nil:Date)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
 drawBlock=(function(){
 var now,hoursPosition,minutesPosition,secondsPosition;
-return smalltalk.withContext(function($ctx2) {
_st(self["@processing"])._background_((224));
-now=_st((smalltalk.Date || Date))._new();
+return smalltalk.withContext(function($ctx2) {
+_st(self["@processing"])._background_((224));
+now=_st($Date())._new();
 now;
 hoursPosition=_st(_st(_st(_st(_st(now)._hours()).__backslash_backslash((12))).__plus(_st(now)._minutes())).__slash((60))).__slash((12));
 hoursPosition;
-_st(self)._drawArm_lengthScale_weight_(hoursPosition,(0.5),(5));
+self._drawArm_lengthScale_weight_(hoursPosition,(0.5),(5));
 minutesPosition=_st(_st(_st(_st(now)._minutes()).__plus(_st(now)._seconds())).__slash((60))).__slash((60));
 minutesPosition;
-_st(self)._drawArm_lengthScale_weight_(minutesPosition,(0.8),(3));
+self._drawArm_lengthScale_weight_(minutesPosition,(0.8),(3));
 secondsPosition=_st(_st(now)._seconds()).__slash((60));
 secondsPosition;
-return _st(self)._drawArm_lengthScale_weight_(secondsPosition,(0.9),(1));
+return self._drawArm_lengthScale_weight_(secondsPosition,(0.9),(1));
 }, function($ctx2) {$ctx2.fillBlock({now:now,hoursPosition:hoursPosition,minutesPosition:minutesPosition,secondsPosition:secondsPosition},$ctx1)})});
 $1=drawBlock;
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"draw",{drawBlock:drawBlock}, smalltalk.ProcessingClock)})},
+}, function($ctx1) {$ctx1.fill(self,"draw",{drawBlock:drawBlock},smalltalk.ProcessingClock)})},
 args: [],
 source: "draw\x0a| drawBlock |\x0a\x0adrawBlock := [\x0a  | now hoursPosition minutesPosition secondsPosition |  \x0a  processing background: 224.\x0a  \x0a  now := Date new.\x0a  \x0a  \x22Moving hours arm by small increments\x22\x0a   hoursPosition := now hours \x5c\x5c 12 + now minutes / 60 / 12.\x0a   self drawArm: hoursPosition lengthScale: 0.5 weight: 5.\x0a   \x0a   \x22Moving minutes arm by small increments\x22\x0a    minutesPosition := now minutes + now seconds / 60 / 60.\x0a    self drawArm: minutesPosition lengthScale: 0.80 weight: 3.\x0a\x0a    \x22Moving hour arm by second increments\x22\x0a    secondsPosition := now seconds / 60.\x0a    self drawArm: secondsPosition lengthScale: 0.90 weight: 1.\x0a  ].\x0a\x0a^drawBlock",
 messageSends: ["background:", "new", "/", "+", "minutes", "\x5c\x5c", "hours", "drawArm:lengthScale:weight:", "seconds"],
@@ -35,18 +37,19 @@ referencedClasses: ["Date"]
 smalltalk.ProcessingClock);
 
 smalltalk.addMethod(
-"_drawArm_lengthScale_weight_",
 smalltalk.method({
 selector: "drawArm:lengthScale:weight:",
 category: 'not yet classified',
 fn: function (aPosition,aLengthScale,aWeight){
 var self=this;
 var myDX,myDY;
-return smalltalk.withContext(function($ctx1) { 
_st(self["@processing"])._strokeWeight_(aWeight);
-myDX=_st(self["@centerX"]).__plus(_st(_st(_st((smalltalk.Math || Math))._sin_(_st(_st(aPosition).__star((2))).__star(_st((smalltalk.Math || Math))._PI()))).__star(aLengthScale)).__star(self["@maxArmLength"]));
-myDY=_st(self["@centerY"]).__minus(_st(_st(_st((smalltalk.Math || Math))._cos_(_st(_st(aPosition).__star((2))).__star(_st((smalltalk.Math || Math))._PI()))).__star(aLengthScale)).__star(self["@maxArmLength"]));
+function $Math(){return smalltalk.Math||(typeof Math=="undefined"?nil:Math)}
+return smalltalk.withContext(function($ctx1) { 
+_st(self["@processing"])._strokeWeight_(aWeight);
+myDX=_st(self["@centerX"]).__plus(_st(_st(_st($Math())._sin_(_st(_st(aPosition).__star((2))).__star(_st($Math())._PI()))).__star(aLengthScale)).__star(self["@maxArmLength"]));
+myDY=_st(self["@centerY"]).__minus(_st(_st(_st($Math())._cos_(_st(_st(aPosition).__star((2))).__star(_st($Math())._PI()))).__star(aLengthScale)).__star(self["@maxArmLength"]));
 _st(self["@processing"])._line_y_dX_dy_(self["@centerX"],self["@centerY"],myDX,myDY);
-return self}, function($ctx1) {$ctx1.fill(self,"drawArm:lengthScale:weight:",{aPosition:aPosition,aLengthScale:aLengthScale,aWeight:aWeight,myDX:myDX,myDY:myDY}, smalltalk.ProcessingClock)})},
+return self}, function($ctx1) {$ctx1.fill(self,"drawArm:lengthScale:weight:",{aPosition:aPosition,aLengthScale:aLengthScale,aWeight:aWeight,myDX:myDX,myDY:myDY},smalltalk.ProcessingClock)})},
 args: ["aPosition", "aLengthScale", "aWeight"],
 source: "drawArm: aPosition lengthScale: aLengthScale weight: aWeight\x0a| myDX myDY |\x0aprocessing strokeWeight: aWeight.\x0amyDX := centerX \x0a\x09\x09\x09+ ((Math sin: (aPosition * 2 * Math PI))\x0a\x09\x09\x09* aLengthScale * maxArmLength).\x0amyDY := centerY \x0a\x09\x09\x09- ((Math cos: (aPosition * 2 * Math PI))\x0a\x09\x09\x09* aLengthScale * maxArmLength).\x0a\x0aprocessing line: centerX y: centerY dX: myDX dy: myDY.",
 messageSends: ["strokeWeight:", "+", "*", "sin:", "PI", "-", "cos:", "line:y:dX:dy:"],
@@ -55,14 +58,14 @@ referencedClasses: ["Math"]
 smalltalk.ProcessingClock);
 
 smalltalk.addMethod(
-"_firstProcessingInstance",
 smalltalk.method({
 selector: "firstProcessingInstance",
 category: 'not yet classified',
 fn: function (){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
return Processing.instances[0];
-return self}, function($ctx1) {$ctx1.fill(self,"firstProcessingInstance",{}, smalltalk.ProcessingClock)})},
+return smalltalk.withContext(function($ctx1) { 
+return Processing.instances[0];
+return self}, function($ctx1) {$ctx1.fill(self,"firstProcessingInstance",{},smalltalk.ProcessingClock)})},
 args: [],
 source: "firstProcessingInstance\x0a\x0a\x09<return Processing.instances[0]>",
 messageSends: [],
@@ -71,35 +74,36 @@ referencedClasses: []
 smalltalk.ProcessingClock);
 
 smalltalk.addMethod(
-"_initialize",
 smalltalk.method({
 selector: "initialize",
 category: 'not yet classified',
 fn: function (){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
self["@processing"]=_st(self)._firstProcessingInstance();
+function $Math(){return smalltalk.Math||(typeof Math=="undefined"?nil:Math)}
+return smalltalk.withContext(function($ctx1) { 
+self["@processing"]=self._firstProcessingInstance();
 self["@centerX"]=_st(_st(self["@processing"])._width()).__slash((2));
 self["@centerY"]=_st(_st(self["@processing"])._height()).__slash((2));
-self["@maxArmLength"]=_st((smalltalk.Math || Math))._min_or_(self["@centerX"],self["@centerY"]);
-return self}, function($ctx1) {$ctx1.fill(self,"initialize",{}, smalltalk.ProcessingClock)})},
+self["@maxArmLength"]=_st($Math())._min_or_(self["@centerX"],self["@centerY"]);
+return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ProcessingClock)})},
 args: [],
-source: "initialize\x0aprocessing := self firstProcessingInstance.\x0acenterX := processing width / 2.\x0acenterY := processing height / 2.\x0amaxArmLength := Math min: centerX or: centerY. ",
+source: "initialize\x0aprocessing := self firstProcessingInstance.\x0acenterX := processing width / 2.\x0acenterY := processing height / 2.\x0amaxArmLength := Math min: centerX or: centerY.",
 messageSends: ["firstProcessingInstance", "/", "width", "height", "min:or:"],
 referencedClasses: ["Math"]
 }),
 smalltalk.ProcessingClock);
 
 smalltalk.addMethod(
-"_processing",
 smalltalk.method({
 selector: "processing",
 category: 'not yet classified',
 fn: function (){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
 $1=self["@processing"];
 return $1;
-}, function($ctx1) {$ctx1.fill(self,"processing",{}, smalltalk.ProcessingClock)})},
+}, function($ctx1) {$ctx1.fill(self,"processing",{},smalltalk.ProcessingClock)})},
 args: [],
 source: "processing\x0a^processing",
 messageSends: [],
@@ -109,20 +113,21 @@ smalltalk.ProcessingClock);
 
 
 smalltalk.addMethod(
-"_init",
 smalltalk.method({
 selector: "init",
 category: 'not yet classified',
 fn: function (){
 var self=this;
 var clock,processing,block;
-return smalltalk.withContext(function($ctx1) { 
clock=_st((smalltalk.ProcessingClock || ProcessingClock))._new();
+function $ProcessingClock(){return smalltalk.ProcessingClock||(typeof ProcessingClock=="undefined"?nil:ProcessingClock)}
+return smalltalk.withContext(function($ctx1) { 
+clock=_st($ProcessingClock())._new();
 processing=_st(clock)._processing();
 block=_st(clock)._draw();
 _st(processing)._at_put_("draw",block);
-return self}, function($ctx1) {$ctx1.fill(self,"init",{clock:clock,processing:processing,block:block}, smalltalk.ProcessingClock.klass)})},
+return self}, function($ctx1) {$ctx1.fill(self,"init",{clock:clock,processing:processing,block:block},smalltalk.ProcessingClock.klass)})},
 args: [],
-source: "init\x0a| clock processing block |\x0aclock := ProcessingClock new .\x0aprocessing := clock processing.\x0ablock := clock draw.\x0aprocessing at: 'draw' put: block\x0a ",
+source: "init\x0a| clock processing block |\x0aclock := ProcessingClock new .\x0aprocessing := clock processing.\x0ablock := clock draw.\x0aprocessing at: 'draw' put: block",
 messageSends: ["new", "processing", "draw", "at:put:"],
 referencedClasses: ["ProcessingClock"]
 }),

+ 21 - 0
trysmalltalk/Gruntfile.js

@@ -0,0 +1,21 @@
+module.exports = function(grunt) {
+  grunt.loadTasks('../vendor/amber/grunt/tasks/');
+
+  grunt.registerTask('default', ['amberc:trysmalltalk']);
+
+  grunt.initConfig({
+    pkg: grunt.file.readJSON('../package.json'),
+
+    amberc: {  
+      _config: {
+        amber_dir: '../vendor/amber',
+        closure_jar: ''
+      },
+      trysmalltalk: {
+        src: ['st/TrySmalltalk.st'],
+        output_dir: 'js'
+      }
+    }
+  });
+
+}

Diferenças do arquivo suprimidas por serem muito extensas
+ 299 - 158
trysmalltalk/js/TrySmalltalk.js


+ 21 - 0
twitterwall/Gruntfile.js

@@ -0,0 +1,21 @@
+module.exports = function(grunt) {
+  grunt.loadTasks('../vendor/amber/grunt/tasks/');
+
+  grunt.registerTask('default', ['amberc:twitterwall']);
+
+  grunt.initConfig({
+    pkg: grunt.file.readJSON('../package.json'),
+
+    amberc: {  
+      _config: {
+        amber_dir: '../vendor/amber',
+        closure_jar: ''
+      },
+      twitterwall: {
+        src: ['st/TwitterWall.st'],
+        output_dir: 'js'
+      }
+    }
+  });
+
+}

+ 47 - 53
twitterwall/js/TwitterWall.deploy.js

@@ -1,9 +1,30 @@
-smalltalk.addPackage('TwitterWall', {});
+smalltalk.addPackage('TwitterWall');
 smalltalk.addClass('Tweet', smalltalk.Widget, ['json'], 'TwitterWall');
 smalltalk.addMethod(
-'_renderOn_',
 smalltalk.method({
-selector: 'renderOn:',
+selector: "json",
+fn: function () {
+    var self = this;
+    return self['@json'];
+    return self;
+},
+messageSends: []}),
+smalltalk.Tweet);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "json:",
+fn: function (aJson) {
+    var self = this;
+    self['@json'] = aJson;
+    return self;
+},
+messageSends: []}),
+smalltalk.Tweet);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "renderOn:",
 fn: function (tr) {
     var self = this;
     var tdUser = nil;
@@ -33,39 +54,14 @@ fn: function (tr) {
     smalltalk.send(pDate, "_append_", [smalltalk.send(self['@json'], "_at_", ["created_at"])]);
     smalltalk.send(tdMessage, "_append_", [pDate]);
     return self;
-}
-}),
-smalltalk.Tweet);
-
-smalltalk.addMethod(
-'_json',
-smalltalk.method({
-selector: 'json',
-fn: function () {
-    var self = this;
-    return self['@json'];
-    return self;
-}
-}),
-smalltalk.Tweet);
-
-smalltalk.addMethod(
-'_json_',
-smalltalk.method({
-selector: 'json:',
-fn: function (aJson) {
-    var self = this;
-    self['@json'] = aJson;
-    return self;
-}
-}),
+},
+messageSends: ["td", "new", "id:", "element", "append:", "src:", "img", "at:", "title:", "longDesc:", ",", "href:", "a", "p"]}),
 smalltalk.Tweet);
 
 
 smalltalk.addMethod(
-'_openAt_with_',
 smalltalk.method({
-selector: 'openAt:with:',
+selector: "openAt:with:",
 fn: function (tr, aJson) {
     var self = this;
     var tweet = nil;
@@ -74,16 +70,29 @@ fn: function (tr, aJson) {
     smalltalk.send(tweet, "_renderOn_", [tr]);
     return tr;
     return self;
-}
-}),
+},
+messageSends: ["new", "json:", "renderOn:"]}),
 smalltalk.Tweet.klass);
 
 
-smalltalk.addClass('TwitterSearch', smalltalk.Object, ['queryString'], 'TwitterWall');
+smalltalk.addClass('TwitterSearch', smalltalk.Object, [], 'TwitterWall');
 smalltalk.addMethod(
-'_success_',
 smalltalk.method({
-selector: 'success:',
+selector: "query",
+fn: function () {
+    var self = this;
+    var result = nil;
+    var queryString = nil;
+    self['@queryString'] = smalltalk.send(smalltalk.send(smalltalk.send(unescape("%23searchQuery"), "_asJQuery", []), "_val", []), "_replace_with_", [unescape("%23"), unescape("%2523")]);
+    result = smalltalk.send(typeof jQuery == "undefined" ? nil : jQuery, "_ajax_options_", [smalltalk.send(unescape("http%3A//search.twitter.com/search.json%3Frpp%3D5%26q%3D"), "__comma", [self['@queryString']]), smalltalk.HashedCollection._fromPairs_([smalltalk.send("type", "__minus_gt", ["GET"]), smalltalk.send("success", "__minus_gt", [function (tmp) {return smalltalk.send(self, "_success_", [smalltalk.send(tmp, "_results", [])]);}]), smalltalk.send("error", "__minus_gt", [function () {return smalltalk.send(typeof window == "undefined" ? nil : window, "_alert_", ["error"]);}]), smalltalk.send("dataType", "__minus_gt", ["jsonp"])])]);
+    return self;
+},
+messageSends: ["replace:with:", "val", "asJQuery", "ajax:options:", ",", "->", "success:", "results", "alert:"]}),
+smalltalk.TwitterSearch);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "success:",
 fn: function (tweets) {
     var self = this;
     var playground = nil;
@@ -93,23 +102,8 @@ fn: function (tweets) {
     smalltalk.send(playground, "_empty", []);
     smalltalk.send(function (html) {table = smalltalk.send(html, "_table", []);smalltalk.send(smalltalk.send(table, "_element", []), "_id_", ["twitterwall"]);return smalltalk.send(tweets, "_do_", [function (tweet) {tr = smalltalk.send(html, "_tr", []);smalltalk.send(table, "_append_", [tr]);return smalltalk.send(smalltalk.Tweet || Tweet, "_openAt_with_", [tr, tweet]);}]);}, "_appendToJQuery_", [playground]);
     return self;
-}
-}),
-smalltalk.TwitterSearch);
-
-smalltalk.addMethod(
-'_query',
-smalltalk.method({
-selector: 'query',
-fn: function () {
-    var self = this;
-    var result = nil;
-    var queryString = nil;
-    self['@queryString'] = smalltalk.send(smalltalk.send(smalltalk.send(unescape("%23searchQuery"), "_asJQuery", []), "_val", []), "_replace_with_", [unescape("%23"), unescape("%2523")]);
-    result = smalltalk.send(typeof jQuery == "undefined" ? nil : jQuery, "_ajax_options_", [smalltalk.send(unescape("http%3A//search.twitter.com/search.json%3Frpp%3D5%26q%3D"), "__comma", [self['@queryString']]), smalltalk.HashedCollection._fromPairs_([smalltalk.send("type", "__minus_gt", ["GET"]), smalltalk.send("success", "__minus_gt", [function (tmp) {return smalltalk.send(self, "_success_", [smalltalk.send(tmp, "_results", [])]);}]), smalltalk.send("error", "__minus_gt", [function () {return smalltalk.send(typeof window == "undefined" ? nil : window, "_alert_", ["error"]);}]), smalltalk.send("dataType", "__minus_gt", ["jsonp"])])]);
-    return self;
-}
-}),
+},
+messageSends: ["asJQuery", "empty", "appendToJQuery:", "table", "id:", "element", "do:", "tr", "append:", "openAt:with:"]}),
 smalltalk.TwitterSearch);
 
 

+ 111 - 101
twitterwall/js/TwitterWall.js

@@ -1,144 +1,154 @@
-smalltalk.addPackage('TwitterWall', {});
-smalltalk.addClass('Tweet', smalltalk.Widget, ['json'], 'TwitterWall');
+smalltalk.addPackage('TwitterWall');
+smalltalk.addClass('Tweet', smalltalk.nil, ['json'], 'TwitterWall');
 smalltalk.addMethod(
-unescape('_renderOn_'),
 smalltalk.method({
-selector: unescape('renderOn%3A'),
+selector: "json",
 category: 'not yet classified',
-fn: function (tr) {
-    var self = this;
-    var tdUser = nil;
-    var tdMessage = nil;
-    var img = nil;
-    var a = nil;
-    var pMessage = nil;
-    var pDate = nil;
-    tdUser = smalltalk.send(smalltalk.send(smalltalk.HTMLCanvas || HTMLCanvas, "_new", []), "_td", []);
-    smalltalk.send(smalltalk.send(tdUser, "_element", []), "_id_", ["user"]);
-    tdMessage = smalltalk.send(smalltalk.send(smalltalk.HTMLCanvas || HTMLCanvas, "_new", []), "_td", []);
-    smalltalk.send(smalltalk.send(tdMessage, "_element", []), "_id_", ["messageBox"]);
-    smalltalk.send(tr, "_append_", [tdUser]);
-    smalltalk.send(tr, "_append_", [tdMessage]);
-    img = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.HTMLCanvas || HTMLCanvas, "_new", []), "_img", []), "_src_", [smalltalk.send(self['@json'], "_at_", ["profile_image_url"])]);
-    smalltalk.send(smalltalk.send(img, "_element", []), "_title_", [smalltalk.send(self['@json'], "_at_", ["from_user"])]);
-    smalltalk.send(smalltalk.send(img, "_element", []), "_longDesc_", [smalltalk.send(unescape("http%3A//twitter.com/"), "__comma", [smalltalk.send(self['@json'], "_at_", ["from_user"])])]);
-    a = smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.HTMLCanvas || HTMLCanvas, "_new", []), "_a", []), "_href_", [smalltalk.send(unescape("http%3A//twitter.com/"), "__comma", [smalltalk.send(self['@json'], "_at_", ["from_user"])])]);
-    smalltalk.send(a, "_append_", [img]);
-    smalltalk.send(tdUser, "_append_", [a]);
-    pMessage = smalltalk.send(smalltalk.send(smalltalk.HTMLCanvas || HTMLCanvas, "_new", []), "_p", []);
-    smalltalk.send(smalltalk.send(pMessage, "_element", []), "_id_", ["message"]);
-    smalltalk.send(pMessage, "_append_", [smalltalk.send(self['@json'], "_at_", ["text"])]);
-    smalltalk.send(tdMessage, "_append_", [pMessage]);
-    pDate = smalltalk.send(smalltalk.send(smalltalk.HTMLCanvas || HTMLCanvas, "_new", []), "_p", []);
-    smalltalk.send(smalltalk.send(pDate, "_element", []), "_id_", ["date"]);
-    smalltalk.send(pDate, "_append_", [smalltalk.send(self['@json'], "_at_", ["created_at"])]);
-    smalltalk.send(tdMessage, "_append_", [pDate]);
-    return self;
-},
-args: ["tr"],
-source: unescape('renderOn%3A%20tr%0A%0A%7C%20tdUser%20tdMessage%20img%20a%20pMessage%20pDate%20%7C%0AtdUser%20%3A%3D%20HTMLCanvas%20new%20td.%0AtdUser%20element%20id%3A%20%27user%27.%0AtdMessage%20%3A%3D%20HTMLCanvas%20new%20td.%0AtdMessage%20element%20id%3A%20%27messageBox%27.%0A%0Atr%20append%3A%20tdUser.%0Atr%20append%3A%20tdMessage.%0A%0Aimg%20%3A%3D%20HTMLCanvas%20new%20img%20src%3A%20%28json%20at%3A%20%27profile_image_url%27%29%20.%0Aimg%20element%20title%3A%20%28json%20at%3A%20%27from_user%27%29.%0Aimg%20element%20longDesc%3A%20%28%27http%3A//twitter.com/%27%2C%20%28json%20at%3A%20%27from_user%27%29%29.%0A%0Aa%20%3A%3D%20HTMLCanvas%20new%20a%20href%3A%20%28%27http%3A//twitter.com/%27%2C%20%28json%20at%3A%20%27from_user%27%29%29.%0Aa%20append%3A%20img.%0A%0AtdUser%20append%3A%20a.%0A%0ApMessage%20%3A%3D%20HTMLCanvas%20new%20p.%0ApMessage%20element%20id%3A%20%27message%27.%0ApMessage%20append%3A%20%28json%20at%3A%20%27text%27%29.%0AtdMessage%20append%3A%20pMessage.%0A%0ApDate%20%3A%3D%20HTMLCanvas%20new%20p.%0ApDate%20element%20id%3A%20%27date%27.%0ApDate%20append%3A%20%28json%20at%3A%20%27created_at%27%29.%0AtdMessage%20append%3A%20pDate.'),
-messageSends: ["td", "new", "id:", "element", "append:", "src:", "img", "at:", "title:", "longDesc:", unescape("%2C"), "href:", "a", "p"],
-referencedClasses: ["HTMLCanvas"]
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=self["@json"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"json",{},smalltalk.Tweet)})},
+args: [],
+source: "json\x0a^json",
+messageSends: [],
+referencedClasses: []
 }),
 smalltalk.Tweet);
 
 smalltalk.addMethod(
-unescape('_json'),
 smalltalk.method({
-selector: unescape('json'),
+selector: "json:",
 category: 'not yet classified',
-fn: function () {
-    var self = this;
-    return self['@json'];
-    return self;
-},
-args: [],
-source: unescape('json%0A%5Ejson'),
+fn: function (aJson){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self["@json"]=aJson;
+return self}, function($ctx1) {$ctx1.fill(self,"json:",{aJson:aJson},smalltalk.Tweet)})},
+args: ["aJson"],
+source: "json: aJson\x0ajson := aJson",
 messageSends: [],
 referencedClasses: []
 }),
 smalltalk.Tweet);
 
 smalltalk.addMethod(
-unescape('_json_'),
 smalltalk.method({
-selector: unescape('json%3A'),
+selector: "renderOn:",
 category: 'not yet classified',
-fn: function (aJson) {
-    var self = this;
-    self['@json'] = aJson;
-    return self;
-},
-args: ["aJson"],
-source: unescape('json%3A%20aJson%0Ajson%20%3A%3D%20aJson'),
-messageSends: [],
-referencedClasses: []
+fn: function (tr){
+var self=this;
+var tdUser,tdMessage,img,a,pMessage,pDate;
+function $HTMLCanvas(){return smalltalk.HTMLCanvas||(typeof HTMLCanvas=="undefined"?nil:HTMLCanvas)}
+return smalltalk.withContext(function($ctx1) { 
+tdUser=_st(_st($HTMLCanvas())._new())._td();
+_st(_st(tdUser)._element())._id_("user");
+tdMessage=_st(_st($HTMLCanvas())._new())._td();
+_st(_st(tdMessage)._element())._id_("messageBox");
+_st(tr)._append_(tdUser);
+_st(tr)._append_(tdMessage);
+img=_st(_st(_st($HTMLCanvas())._new())._img())._src_(_st(self["@json"])._at_("profile_image_url"));
+_st(_st(img)._element())._title_(_st(self["@json"])._at_("from_user"));
+_st(_st(img)._element())._longDesc_("http://twitter.com/".__comma(_st(self["@json"])._at_("from_user")));
+a=_st(_st(_st($HTMLCanvas())._new())._a())._href_("http://twitter.com/".__comma(_st(self["@json"])._at_("from_user")));
+_st(a)._append_(img);
+_st(tdUser)._append_(a);
+pMessage=_st(_st($HTMLCanvas())._new())._p();
+_st(_st(pMessage)._element())._id_("message");
+_st(pMessage)._append_(_st(self["@json"])._at_("text"));
+_st(tdMessage)._append_(pMessage);
+pDate=_st(_st($HTMLCanvas())._new())._p();
+_st(_st(pDate)._element())._id_("date");
+_st(pDate)._append_(_st(self["@json"])._at_("created_at"));
+_st(tdMessage)._append_(pDate);
+return self}, function($ctx1) {$ctx1.fill(self,"renderOn:",{tr:tr,tdUser:tdUser,tdMessage:tdMessage,img:img,a:a,pMessage:pMessage,pDate:pDate},smalltalk.Tweet)})},
+args: ["tr"],
+source: "renderOn: tr\x0a\x0a| tdUser tdMessage img a pMessage pDate |\x0atdUser := HTMLCanvas new td.\x0atdUser element id: 'user'.\x0atdMessage := HTMLCanvas new td.\x0atdMessage element id: 'messageBox'.\x0a\x0atr append: tdUser.\x0atr append: tdMessage.\x0a\x0aimg := HTMLCanvas new img src: (json at: 'profile_image_url') .\x0aimg element title: (json at: 'from_user').\x0aimg element longDesc: ('http://twitter.com/', (json at: 'from_user')).\x0a\x0aa := HTMLCanvas new a href: ('http://twitter.com/', (json at: 'from_user')).\x0aa append: img.\x0a\x0atdUser append: a.\x0a\x0apMessage := HTMLCanvas new p.\x0apMessage element id: 'message'.\x0apMessage append: (json at: 'text').\x0atdMessage append: pMessage.\x0a\x0apDate := HTMLCanvas new p.\x0apDate element id: 'date'.\x0apDate append: (json at: 'created_at').\x0atdMessage append: pDate.",
+messageSends: ["td", "new", "id:", "element", "append:", "src:", "at:", "img", "title:", "longDesc:", ",", "href:", "a", "p"],
+referencedClasses: ["HTMLCanvas"]
 }),
 smalltalk.Tweet);
 
 
 smalltalk.addMethod(
-unescape('_openAt_with_'),
 smalltalk.method({
-selector: unescape('openAt%3Awith%3A'),
+selector: "openAt:with:",
 category: 'not yet classified',
-fn: function (tr, aJson) {
-    var self = this;
-    var tweet = nil;
-    tweet = smalltalk.send(self, "_new", []);
-    smalltalk.send(tweet, "_json_", [aJson]);
-    smalltalk.send(tweet, "_renderOn_", [tr]);
-    return tr;
-    return self;
-},
+fn: function (tr,aJson){
+var self=this;
+var tweet;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+tweet=self._new();
+_st(tweet)._json_(aJson);
+_st(tweet)._renderOn_(tr);
+$1=tr;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"openAt:with:",{tr:tr,aJson:aJson,tweet:tweet},smalltalk.Tweet.klass)})},
 args: ["tr", "aJson"],
-source: unescape('openAt%3A%20tr%20with%3A%20aJson%0A%7C%20tweet%20%7C%0Atweet%20%3A%3D%20self%20new.%0Atweet%20json%3A%20aJson.%0Atweet%20renderOn%3A%20tr.%0A%5Etr'),
+source: "openAt: tr with: aJson\x0a| tweet |\x0atweet := self new.\x0atweet json: aJson.\x0atweet renderOn: tr.\x0a^tr",
 messageSends: ["new", "json:", "renderOn:"],
 referencedClasses: []
 }),
 smalltalk.Tweet.klass);
 
 
-smalltalk.addClass('TwitterSearch', smalltalk.Object, ['queryString'], 'TwitterWall');
+smalltalk.addClass('TwitterSearch', smalltalk.Object, [], 'TwitterWall');
 smalltalk.addMethod(
-unescape('_success_'),
 smalltalk.method({
-selector: unescape('success%3A'),
+selector: "query",
 category: 'not yet classified',
-fn: function (tweets) {
-    var self = this;
-    var playground = nil;
-    var table = nil;
-    var tr = nil;
-    playground = smalltalk.send(unescape("%23playground"), "_asJQuery", []);
-    smalltalk.send(playground, "_empty", []);
-    smalltalk.send(function (html) {table = smalltalk.send(html, "_table", []);smalltalk.send(smalltalk.send(table, "_element", []), "_id_", ["twitterwall"]);return smalltalk.send(tweets, "_do_", [function (tweet) {tr = smalltalk.send(html, "_tr", []);smalltalk.send(table, "_append_", [tr]);return smalltalk.send(smalltalk.Tweet || Tweet, "_openAt_with_", [tr, tweet]);}]);}, "_appendToJQuery_", [playground]);
-    return self;
-},
-args: ["tweets"],
-source: unescape('success%3A%20tweets%0A%7C%20playground%20table%20tr%20%7C%0Aplayground%20%3A%3D%20%27%23playground%27%20asJQuery.%0Aplayground%20empty.%0A%20%5B%3Ahtml%20%7C%20%0A%09table%20%3A%3D%20html%20table.%0A%09table%20element%20id%3A%20%27twitterwall%27.%0A%0A%09tweets%20do%3A%20%5B%20%3Atweet%20%7C%20%0A%20%20%20%20%20%20%20%20%09%20%20%20tr%20%3A%3D%20html%20tr.%0A%09%20%20%20%20%20%20%20%20%20%20%20table%20append%3A%20tr.%0A%20%20%20%20%20%20%20%20%09%20%20%20Tweet%20openAt%3A%20tr%20with%3A%20tweet%0A%20%20%20%20%20%20%20%20%5D%0A%5D%20appendToJQuery%3A%20playground.'),
-messageSends: ["asJQuery", "empty", "appendToJQuery:", "table", "id:", "element", "do:", "tr", "append:", "openAt:with:"],
-referencedClasses: ["Tweet"]
+fn: function (){
+var self=this;
+var result,queryString;
+return smalltalk.withContext(function($ctx1) { 
+queryString=_st(_st("#searchQuery"._asJQuery())._val())._replace_with_("#","%23");
+result=_st(jQuery)._ajax_options_("http://search.twitter.com/search.json?rpp=5&q=".__comma(queryString),smalltalk.HashedCollection._fromPairs_(["type".__minus_gt("GET"),"success".__minus_gt((function(tmp){
+return smalltalk.withContext(function($ctx2) {
+return self._success_(_st(tmp)._results());
+}, function($ctx2) {$ctx2.fillBlock({tmp:tmp},$ctx1)})})),"error".__minus_gt((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(window)._alert_("error");
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})})),"dataType".__minus_gt("jsonp")]));
+return self}, function($ctx1) {$ctx1.fill(self,"query",{result:result,queryString:queryString},smalltalk.TwitterSearch)})},
+args: [],
+source: "query\x0a| result queryString |\x0aqueryString := ('#searchQuery'  asJQuery val) replace: '#' with: '%23'.\x0aresult := jQuery \x0a\x09\x09\x09ajax: 'http://search.twitter.com/search.json?rpp=5&q=', queryString\x0a\x09\x09\x09options: #{\x0a\x09\x09\x09\x09'type' -> 'GET'.\x0a\x09\x09\x09\x09'success' -> [ :tmp | self success: (tmp results)].\x0a\x09\x09\x09\x09'error' -> [window alert: 'error'].\x0a\x09\x09\x09\x09'dataType' -> 'jsonp'\x0a\x09\x09\x09}.",
+messageSends: ["replace:with:", "val", "asJQuery", "ajax:options:", ",", "->", "success:", "results", "alert:"],
+referencedClasses: []
 }),
 smalltalk.TwitterSearch);
 
 smalltalk.addMethod(
-unescape('_query'),
 smalltalk.method({
-selector: unescape('query'),
+selector: "success:",
 category: 'not yet classified',
-fn: function () {
-    var self = this;
-    var result = nil;
-    var queryString = nil;
-    self['@queryString'] = smalltalk.send(smalltalk.send(smalltalk.send(unescape("%23searchQuery"), "_asJQuery", []), "_val", []), "_replace_with_", [unescape("%23"), unescape("%2523")]);
-    result = smalltalk.send(typeof jQuery == "undefined" ? nil : jQuery, "_ajax_options_", [smalltalk.send(unescape("http%3A//search.twitter.com/search.json%3Frpp%3D5%26q%3D"), "__comma", [self['@queryString']]), smalltalk.HashedCollection._fromPairs_([smalltalk.send("type", "__minus_gt", ["GET"]), smalltalk.send("success", "__minus_gt", [function (tmp) {return smalltalk.send(self, "_success_", [smalltalk.send(tmp, "_results", [])]);}]), smalltalk.send("error", "__minus_gt", [function () {return smalltalk.send(typeof window == "undefined" ? nil : window, "_alert_", ["error"]);}]), smalltalk.send("dataType", "__minus_gt", ["jsonp"])])]);
-    return self;
-},
-args: [],
-source: unescape('query%0A%7C%20result%20queryString%20%7C%0AqueryString%20%3A%3D%20%28%27%23searchQuery%27%20%20asJQuery%20val%29%20replace%3A%20%27%23%27%20with%3A%20%27%2523%27.%0Aresult%20%3A%3D%20jQuery%20%0A%09%09%09ajax%3A%20%27http%3A//search.twitter.com/search.json%3Frpp%3D5%26q%3D%27%2C%20queryString%0A%09%09%09options%3A%20%23%7B%0A%09%09%09%09%27type%27%20-%3E%20%27GET%27.%0A%09%09%09%09%27success%27%20-%3E%20%5B%20%3Atmp%20%7C%20self%20success%3A%20%28tmp%20results%29%5D.%0A%09%09%09%09%27error%27%20-%3E%20%5Bwindow%20alert%3A%20%27error%27%5D.%0A%09%09%09%09%27dataType%27%20-%3E%20%27jsonp%27%0A%09%09%09%7D.'),
-messageSends: ["replace:with:", "val", "asJQuery", "ajax:options:", unescape("%2C"), unescape("-%3E"), "success:", "results", "alert:"],
-referencedClasses: []
+fn: function (tweets){
+var self=this;
+var playground,table,tr;
+function $Tweet(){return smalltalk.Tweet||(typeof Tweet=="undefined"?nil:Tweet)}
+return smalltalk.withContext(function($ctx1) { 
+playground="#playground"._asJQuery();
+_st(playground)._empty();
+_st((function(html){
+return smalltalk.withContext(function($ctx2) {
+table=_st(html)._table();
+table;
+_st(_st(table)._element())._id_("twitterwall");
+return _st(tweets)._do_((function(tweet){
+return smalltalk.withContext(function($ctx3) {
+tr=_st(html)._tr();
+tr;
+_st(table)._append_(tr);
+return _st($Tweet())._openAt_with_(tr,tweet);
+}, function($ctx3) {$ctx3.fillBlock({tweet:tweet},$ctx2)})}));
+}, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(playground);
+return self}, function($ctx1) {$ctx1.fill(self,"success:",{tweets:tweets,playground:playground,table:table,tr:tr},smalltalk.TwitterSearch)})},
+args: ["tweets"],
+source: "success: tweets\x0a| playground table tr |\x0aplayground := '#playground' asJQuery.\x0aplayground empty.\x0a [:html | \x0a\x09table := html table.\x0a\x09table element id: 'twitterwall'.\x0a\x0a\x09tweets do: [ :tweet | \x0a        \x09   tr := html tr.\x0a\x09           table append: tr.\x0a        \x09   Tweet openAt: tr with: tweet\x0a        ]\x0a] appendToJQuery: playground.",
+messageSends: ["asJQuery", "empty", "appendToJQuery:", "table", "id:", "element", "do:", "tr", "append:", "openAt:with:"],
+referencedClasses: ["Tweet"]
 }),
 smalltalk.TwitterSearch);
 

+ 24 - 24
twitterwall/st/TwitterWall.st

@@ -1,10 +1,18 @@
 Smalltalk current createPackage: 'TwitterWall'!
 Widget subclass: #Tweet
 	instanceVariableNames: 'json'
-	category: 'TwitterWall'!
+	package: 'TwitterWall'!
 
 !Tweet methodsFor: 'not yet classified'!
 
+json
+^json
+!
+
+json: aJson
+json := aJson
+!
+
 renderOn: tr
 
 | tdUser tdMessage img a pMessage pDate |
@@ -34,14 +42,6 @@ pDate := HTMLCanvas new p.
 pDate element id: 'date'.
 pDate append: (json at: 'created_at').
 tdMessage append: pDate.
-!
-
-json
-^json
-!
-
-json: aJson
-json := aJson
 ! !
 
 !Tweet class methodsFor: 'not yet classified'!
@@ -55,11 +55,24 @@ tweet renderOn: tr.
 ! !
 
 Object subclass: #TwitterSearch
-	instanceVariableNames: 'queryString'
-	category: 'TwitterWall'!
+	instanceVariableNames: ''
+	package: 'TwitterWall'!
 
 !TwitterSearch methodsFor: 'not yet classified'!
 
+query
+| result queryString |
+queryString := ('#searchQuery'  asJQuery val) replace: '#' with: '%23'.
+result := jQuery 
+			ajax: 'http://search.twitter.com/search.json?rpp=5&q=', queryString
+			options: #{
+				'type' -> 'GET'.
+				'success' -> [ :tmp | self success: (tmp results)].
+				'error' -> [window alert: 'error'].
+				'dataType' -> 'jsonp'
+			}.
+!
+
 success: tweets
 | playground table tr |
 playground := '#playground' asJQuery.
@@ -74,18 +87,5 @@ playground empty.
         	   Tweet openAt: tr with: tweet
         ]
 ] appendToJQuery: playground.
-!
-
-query
-| result queryString |
-queryString := ('#searchQuery'  asJQuery val) replace: '#' with: '%23'.
-result := jQuery 
-			ajax: 'http://search.twitter.com/search.json?rpp=5&q=', queryString
-			options: #{
-				'type' -> 'GET'.
-				'success' -> [ :tmp | self success: (tmp results)].
-				'error' -> [window alert: 'error'].
-				'dataType' -> 'jsonp'
-			}.
 ! !
 

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff