resin 0.0.1

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.
Files changed (83) hide show
  1. data/README.markdown +52 -0
  2. data/amber/css/amber.css +519 -0
  3. data/amber/css/documentation.css +84 -0
  4. data/amber/css/profstef.css +75 -0
  5. data/amber/css/style.css +313 -0
  6. data/amber/images/amber.png +0 -0
  7. data/amber/images/amber_small.png +0 -0
  8. data/amber/images/off.png +0 -0
  9. data/amber/images/offHover.png +0 -0
  10. data/amber/images/presentation.png +0 -0
  11. data/amber/images/profstef.png +0 -0
  12. data/amber/images/sprite.png +0 -0
  13. data/amber/images/tinylogo.png +0 -0
  14. data/amber/images/twitterwall.png +0 -0
  15. data/amber/js/Additional-Examples.deploy.js +15 -0
  16. data/amber/js/Additional-Examples.js +21 -0
  17. data/amber/js/Benchfib.deploy.js +132 -0
  18. data/amber/js/Benchfib.js +167 -0
  19. data/amber/js/Canvas.deploy.js +1304 -0
  20. data/amber/js/Canvas.js +1885 -0
  21. data/amber/js/Compiler.deploy.js +1871 -0
  22. data/amber/js/Compiler.js +2616 -0
  23. data/amber/js/Documentation.deploy.js +961 -0
  24. data/amber/js/Documentation.js +1376 -0
  25. data/amber/js/Examples.deploy.js +53 -0
  26. data/amber/js/Examples.js +73 -0
  27. data/amber/js/IDE.deploy.js +3468 -0
  28. data/amber/js/IDE.js +4883 -0
  29. data/amber/js/Kernel-Announcements.deploy.js +107 -0
  30. data/amber/js/Kernel-Announcements.js +152 -0
  31. data/amber/js/Kernel-Classes.deploy.js +675 -0
  32. data/amber/js/Kernel-Classes.js +956 -0
  33. data/amber/js/Kernel-Collections.deploy.js +3273 -0
  34. data/amber/js/Kernel-Collections.js +4644 -0
  35. data/amber/js/Kernel-Exceptions.deploy.js +244 -0
  36. data/amber/js/Kernel-Exceptions.js +349 -0
  37. data/amber/js/Kernel-Methods.deploy.js +510 -0
  38. data/amber/js/Kernel-Methods.js +739 -0
  39. data/amber/js/Kernel-Objects.deploy.js +2698 -0
  40. data/amber/js/Kernel-Objects.js +3858 -0
  41. data/amber/js/Kernel-Tests.deploy.js +1419 -0
  42. data/amber/js/Kernel-Tests.js +1929 -0
  43. data/amber/js/Kernel-Transcript.deploy.js +142 -0
  44. data/amber/js/Kernel-Transcript.js +202 -0
  45. data/amber/js/SUnit.deploy.js +351 -0
  46. data/amber/js/SUnit.js +501 -0
  47. data/amber/js/amber.js +250 -0
  48. data/amber/js/boot.js +587 -0
  49. data/amber/js/compat.js +22 -0
  50. data/amber/js/init.js +8 -0
  51. data/amber/js/lib/CodeMirror/LICENSE +19 -0
  52. data/amber/js/lib/CodeMirror/amber.css +21 -0
  53. data/amber/js/lib/CodeMirror/codemirror.css +67 -0
  54. data/amber/js/lib/CodeMirror/codemirror.js +2144 -0
  55. data/amber/js/lib/CodeMirror/smalltalk.js +134 -0
  56. data/amber/js/lib/jQuery/jquery-1.4.4.min.js +167 -0
  57. data/amber/js/lib/jQuery/jquery-1.6.4.min.js +4 -0
  58. data/amber/js/lib/jQuery/jquery-ui-1.8.16.custom.min.js +791 -0
  59. data/amber/js/lib/jQuery/jquery.textarea.js +267 -0
  60. data/amber/js/lib/peg-0.6.2.min.js +2 -0
  61. data/amber/js/lib/showdown.js +419 -0
  62. data/amber/js/parser.js +4005 -0
  63. data/amber/js/parser.pegjs +220 -0
  64. data/amber/st/Benchfib.st +124 -0
  65. data/amber/st/Canvas.st +556 -0
  66. data/amber/st/Compiler.st +1425 -0
  67. data/amber/st/Documentation.st +758 -0
  68. data/amber/st/Examples.st +38 -0
  69. data/amber/st/IDE.st +2336 -0
  70. data/amber/st/Kernel-Announcements.st +61 -0
  71. data/amber/st/Kernel-Classes.st +403 -0
  72. data/amber/st/Kernel-Collections.st +1673 -0
  73. data/amber/st/Kernel-Exceptions.st +124 -0
  74. data/amber/st/Kernel-Methods.st +287 -0
  75. data/amber/st/Kernel-Objects.st +1489 -0
  76. data/amber/st/Kernel-Tests.st +892 -0
  77. data/amber/st/Kernel-Transcript.st +70 -0
  78. data/amber/st/SUnit.st +172 -0
  79. data/bin/runresin +12 -0
  80. data/lib/resin.rb +0 -0
  81. data/lib/resin/app/app.rb +121 -0
  82. data/lib/resin/app/views/index.haml +10 -0
  83. metadata +216 -0
@@ -0,0 +1,61 @@
1
+ Smalltalk current createPackage: 'Kernel-Announcements' properties: #{}!
2
+ Object subclass: #Announcer
3
+ instanceVariableNames: 'registry subscriptions'
4
+ category: 'Kernel-Announcements'!
5
+
6
+ !Announcer methodsFor: 'announcing'!
7
+
8
+ announce: anAnnouncement
9
+ subscriptions do: [:each |
10
+ each deliver: anAnnouncement]
11
+ ! !
12
+
13
+ !Announcer methodsFor: 'initialization'!
14
+
15
+ initialize
16
+ super initialize.
17
+ subscriptions := OrderedCollection new
18
+ ! !
19
+
20
+ !Announcer methodsFor: 'subscribing'!
21
+
22
+ on: aClass do: aBlock
23
+ subscriptions add: (AnnouncementSubscription new
24
+ block: aBlock;
25
+ announcementClass: aClass;
26
+ yourself)
27
+ ! !
28
+
29
+ Object subclass: #AnnouncementSubscription
30
+ instanceVariableNames: 'block announcementClass'
31
+ category: 'Kernel-Announcements'!
32
+
33
+ !AnnouncementSubscription methodsFor: 'accessing'!
34
+
35
+ announcementClass
36
+ ^announcementClass
37
+ !
38
+
39
+ announcementClass: aClass
40
+ announcementClass := aClass
41
+ !
42
+
43
+ block
44
+ ^block
45
+ !
46
+
47
+ block: aBlock
48
+ block := aBlock
49
+ ! !
50
+
51
+ !AnnouncementSubscription methodsFor: 'announcing'!
52
+
53
+ deliver: anAnnouncement
54
+ (self handlesAnnouncement: anAnnouncement)
55
+ ifTrue: [self block value: anAnnouncement]
56
+ !
57
+
58
+ handlesAnnouncement: anAnnouncement
59
+ ^anAnnouncement isKindOf: self announcementClass
60
+ ! !
61
+
@@ -0,0 +1,403 @@
1
+ Smalltalk current createPackage: 'Kernel-Classes' properties: #{}!
2
+ Object subclass: #Behavior
3
+ instanceVariableNames: ''
4
+ category: 'Kernel-Classes'!
5
+ !Behavior commentStamp!
6
+ Behavior is the superclass of all class objects.
7
+
8
+ It defines the protocol for creating instances of a class with `#basicNew` and `#new` (see `boot.js` for class constructors details).
9
+ Instances know about the subclass/superclass relationships between classes, contain the description that instances are created from,
10
+ and hold the method dictionary that's associated with each class.
11
+
12
+ Behavior also provides methods for compiling methods, examining the method dictionary, and iterating over the class hierarchy.!
13
+
14
+ !Behavior methodsFor: 'accessing'!
15
+
16
+ name
17
+ <return self.className || nil>
18
+ !
19
+
20
+ superclass
21
+ <return self.superclass || nil>
22
+ !
23
+
24
+ subclasses
25
+ <return smalltalk.subclasses(self)>
26
+ !
27
+
28
+ allSubclasses
29
+ | result |
30
+ result := self subclasses.
31
+ self subclasses do: [:each |
32
+ result addAll: each allSubclasses].
33
+ ^result
34
+ !
35
+
36
+ withAllSubclasses
37
+ ^(Array with: self) addAll: self allSubclasses; yourself
38
+ !
39
+
40
+ prototype
41
+ <return self.fn.prototype>
42
+ !
43
+
44
+ methodDictionary
45
+ <var dict = smalltalk.HashedCollection._new();
46
+ var methods = self.fn.prototype.methods;
47
+ for(var i in methods) {
48
+ if(methods[i].selector) {
49
+ dict._at_put_(methods[i].selector, methods[i]);
50
+ }
51
+ };
52
+ return dict>
53
+ !
54
+
55
+ methodsFor: aString
56
+ ^ClassCategoryReader new
57
+ class: self category: aString;
58
+ yourself
59
+ !
60
+
61
+ instanceVariableNames
62
+ <return self.iVarNames>
63
+ !
64
+
65
+ comment
66
+ ^(self basicAt: 'comment') ifNil: ['']
67
+ !
68
+
69
+ comment: aString
70
+ self basicAt: 'comment' put: aString
71
+ !
72
+
73
+ commentStamp
74
+ ^ClassCommentReader new
75
+ class: self;
76
+ yourself
77
+ !
78
+
79
+ protocols
80
+ | protocols |
81
+ protocols := Array new.
82
+ self methodDictionary do: [:each |
83
+ (protocols includes: each category) ifFalse: [
84
+ protocols add: each category]].
85
+ ^protocols sort
86
+ !
87
+
88
+ protocolsDo: aBlock
89
+ "Execute aBlock for each method category with
90
+ its collection of methods in the sort order of category name."
91
+
92
+ | methodsByCategory |
93
+ methodsByCategory := HashedCollection new.
94
+ self methodDictionary values do: [:m |
95
+ (methodsByCategory at: m category ifAbsentPut: [Array new])
96
+ add: m].
97
+ self protocols do: [:category |
98
+ aBlock value: category value: (methodsByCategory at: category)]
99
+ !
100
+
101
+ allInstanceVariableNames
102
+ | result |
103
+ result := self instanceVariableNames copy.
104
+ self superclass ifNotNil: [
105
+ result addAll: self superclass allInstanceVariableNames].
106
+ ^result
107
+ !
108
+
109
+ methodAt: aString
110
+ <return smalltalk.methods(self)[aString]>
111
+ !
112
+
113
+ methodsFor: aString stamp: aStamp
114
+ "Added for compatibility, right now ignores stamp."
115
+ ^self methodsFor: aString
116
+ !
117
+
118
+ commentStamp: aStamp prior: prior
119
+ ^self commentStamp
120
+ ! !
121
+
122
+ !Behavior methodsFor: 'compiling'!
123
+
124
+ addCompiledMethod: aMethod
125
+ <smalltalk.addMethod(aMethod.selector._asSelector(), aMethod, self)>
126
+ !
127
+
128
+ removeCompiledMethod: aMethod
129
+ <delete self.fn.prototype[aMethod.selector._asSelector()];
130
+ delete self.fn.prototype.methods[aMethod.selector];
131
+ smalltalk.init(self);>
132
+ !
133
+
134
+ compile: aString
135
+ self compile: aString category: ''
136
+ !
137
+
138
+ compile: aString category: anotherString
139
+ | method |
140
+ method := Compiler new load: aString forClass: self.
141
+ method category: anotherString.
142
+ self addCompiledMethod: method
143
+ ! !
144
+
145
+ !Behavior methodsFor: 'instance creation'!
146
+
147
+ new
148
+ ^self basicNew initialize
149
+ !
150
+
151
+ basicNew
152
+ <return new self.fn()>
153
+ ! !
154
+
155
+ !Behavior methodsFor: 'testing'!
156
+
157
+ inheritsFrom: aClass
158
+ ^aClass allSubclasses includes: self
159
+ ! !
160
+
161
+ Behavior subclass: #Class
162
+ instanceVariableNames: ''
163
+ category: 'Kernel-Classes'!
164
+ !Class commentStamp!
165
+ Class is __the__ class object.
166
+
167
+ Instances are the classes of the system.
168
+ Class creation is done throught a `ClassBuilder`!
169
+
170
+ !Class methodsFor: 'accessing'!
171
+
172
+ category
173
+ ^self package ifNil: ['Unclassified'] ifNotNil: [self package name]
174
+ !
175
+
176
+ rename: aString
177
+ <
178
+ smalltalk[aString] = self;
179
+ delete smalltalk[self.className];
180
+ self.className = aString;
181
+ >
182
+ !
183
+
184
+ package
185
+ <return self.pkg>
186
+ !
187
+
188
+ package: aPackage
189
+ <self.pkg = aPackage>
190
+ ! !
191
+
192
+ !Class methodsFor: 'class creation'!
193
+
194
+ subclass: aString instanceVariableNames: anotherString
195
+ "Kept for compatibility."
196
+ ^self subclass: aString instanceVariableNames: anotherString package: nil
197
+ !
198
+
199
+ subclass: aString instanceVariableNames: aString2 category: aString3
200
+ "Kept for compatibility."
201
+ self deprecatedAPI.
202
+ ^self subclass: aString instanceVariableNames: aString2 package: aString3
203
+ !
204
+
205
+ subclass: aString instanceVariableNames: aString2 classVariableNames: classVars poolDictionaries: pools category: aString3
206
+ "Just ignore class variables and pools. Added for compatibility."
207
+ ^self subclass: aString instanceVariableNames: aString2 package: aString3
208
+ !
209
+
210
+ subclass: aString instanceVariableNames: aString2 package: aString3
211
+ ^ClassBuilder new
212
+ superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3
213
+ ! !
214
+
215
+ !Class methodsFor: 'printing'!
216
+
217
+ printString
218
+ ^self name
219
+ ! !
220
+
221
+ !Class methodsFor: 'testing'!
222
+
223
+ isClass
224
+ ^true
225
+ ! !
226
+
227
+ Behavior subclass: #Metaclass
228
+ instanceVariableNames: ''
229
+ category: 'Kernel-Classes'!
230
+ !Metaclass commentStamp!
231
+ Metaclass is the root of the class hierarchy.
232
+
233
+ Metaclass instances are metaclasses, one for each real class.
234
+ Metaclass instances have a single instance, which they hold onto, which is the class that they are the metaclass of.!
235
+
236
+ !Metaclass methodsFor: 'accessing'!
237
+
238
+ instanceClass
239
+ <return self.instanceClass>
240
+ !
241
+
242
+ instanceVariableNames: aCollection
243
+ ClassBuilder new
244
+ class: self instanceVariableNames: aCollection
245
+ ! !
246
+
247
+ !Metaclass methodsFor: 'printing'!
248
+
249
+ printString
250
+ ^self instanceClass name, ' class'
251
+ ! !
252
+
253
+ !Metaclass methodsFor: 'testing'!
254
+
255
+ isMetaclass
256
+ ^true
257
+ ! !
258
+
259
+ Object subclass: #ClassBuilder
260
+ instanceVariableNames: ''
261
+ category: 'Kernel-Classes'!
262
+ !ClassBuilder commentStamp!
263
+ ClassBuilder is responsible for compiling new classes or modifying existing classes in the system.
264
+
265
+ Rather than using ClassBuilder directly to compile a class, use `Class >> subclass:instanceVariableNames:package:`.!
266
+
267
+ !ClassBuilder methodsFor: 'class creation'!
268
+
269
+ superclass: aClass subclass: aString
270
+ ^self superclass: aClass subclass: aString instanceVariableNames: '' package: nil
271
+ !
272
+
273
+ class: aClass instanceVariableNames: aString
274
+ aClass isMetaclass ifFalse: [self error: aClass name, ' is not a metaclass'].
275
+ aClass basicAt: 'iVarNames' put: (self instanceVariableNamesFor: aString).
276
+ self setupClass: aClass
277
+ !
278
+
279
+ superclass: aClass subclass: aString instanceVariableNames: aString2 package: aString3
280
+ | newClass |
281
+ newClass := self addSubclassOf: aClass
282
+ named: aString instanceVariableNames: (self instanceVariableNamesFor: aString2)
283
+ package: (aString3 ifNil: ['unclassified']).
284
+ self setupClass: newClass.
285
+ ^newClass
286
+ ! !
287
+
288
+ !ClassBuilder methodsFor: 'private'!
289
+
290
+ instanceVariableNamesFor: aString
291
+ ^(aString tokenize: ' ') reject: [:each | each isEmpty]
292
+ !
293
+
294
+ addSubclassOf: aClass named: aString instanceVariableNames: aCollection
295
+ <smalltalk.addClass(aString, aClass, aCollection);
296
+ return smalltalk[aString]>
297
+ !
298
+
299
+ setupClass: aClass
300
+ <smalltalk.init(aClass);>
301
+ !
302
+
303
+ addSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName
304
+ <smalltalk.addClass(aString, aClass, aCollection, packageName);
305
+ return smalltalk[aString]>
306
+ !
307
+
308
+ copyClass: aClass named: aString
309
+ | newClass |
310
+
311
+ newClass := self
312
+ addSubclassOf: aClass superclass
313
+ named: aString
314
+ instanceVariableNames: aClass instanceVariableNames
315
+ package: aClass package name.
316
+
317
+ self setupClass: newClass.
318
+
319
+ aClass methodDictionary values do: [:each |
320
+ newClass addCompiledMethod: (Compiler new load: each source forClass: newClass).
321
+ (newClass methodDictionary at: each selector) category: each category].
322
+
323
+ aClass class methodDictionary values do: [:each |
324
+ newClass class addCompiledMethod: (Compiler new load: each source forClass: newClass class).
325
+ (newClass class methodDictionary at: each selector) category: each category].
326
+
327
+ self setupClass: newClass.
328
+ ^newClass
329
+ ! !
330
+
331
+ Object subclass: #ClassCategoryReader
332
+ instanceVariableNames: 'class category chunkParser'
333
+ category: 'Kernel-Classes'!
334
+ !ClassCategoryReader commentStamp!
335
+ ClassCategoryReader represents a mechanism for retrieving class descriptions stored on a file.!
336
+
337
+ !ClassCategoryReader methodsFor: 'accessing'!
338
+
339
+ class: aClass category: aString
340
+ class := aClass.
341
+ category := aString
342
+ ! !
343
+
344
+ !ClassCategoryReader methodsFor: 'fileIn'!
345
+
346
+ scanFrom: aChunkParser
347
+ | chunk |
348
+ [chunk := aChunkParser nextChunk.
349
+ chunk isEmpty] whileFalse: [
350
+ self compileMethod: chunk]
351
+ ! !
352
+
353
+ !ClassCategoryReader methodsFor: 'initialization'!
354
+
355
+ initialize
356
+ super initialize.
357
+ chunkParser := ChunkParser new.
358
+ ! !
359
+
360
+ !ClassCategoryReader methodsFor: 'private'!
361
+
362
+ compileMethod: aString
363
+ | method |
364
+ method := Compiler new load: aString forClass: class.
365
+ method category: category.
366
+ class addCompiledMethod: method
367
+ ! !
368
+
369
+ Object subclass: #ClassCommentReader
370
+ instanceVariableNames: 'class chunkParser'
371
+ category: 'Kernel-Classes'!
372
+ !ClassCommentReader commentStamp!
373
+ ClassCommentReader represents a mechanism for retrieving class descriptions stored on a file.
374
+ See `ClassCategoryReader` too.!
375
+
376
+ !ClassCommentReader methodsFor: 'accessing'!
377
+
378
+ class: aClass
379
+ class := aClass
380
+ ! !
381
+
382
+ !ClassCommentReader methodsFor: 'fileIn'!
383
+
384
+ scanFrom: aChunkParser
385
+ | chunk |
386
+ chunk := aChunkParser nextChunk.
387
+ chunk isEmpty ifFalse: [
388
+ self setComment: chunk].
389
+ ! !
390
+
391
+ !ClassCommentReader methodsFor: 'initialization'!
392
+
393
+ initialize
394
+ super initialize.
395
+ chunkParser := ChunkParser new.
396
+ ! !
397
+
398
+ !ClassCommentReader methodsFor: 'private'!
399
+
400
+ setComment: aString
401
+ class comment: aString
402
+ ! !
403
+