resin 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,53 @@
1
1
  Smalltalk current createPackage: 'Kernel-Collections' properties: #{}!
2
+ Object subclass: #Association
3
+ instanceVariableNames: 'key value'
4
+ category: 'Kernel-Collections'!
5
+
6
+ !Association methodsFor: 'accessing'!
7
+
8
+ key: aKey
9
+ key := aKey
10
+ !
11
+
12
+ key
13
+ ^key
14
+ !
15
+
16
+ value: aValue
17
+ value := aValue
18
+ !
19
+
20
+ value
21
+ ^value
22
+ ! !
23
+
24
+ !Association methodsFor: 'comparing'!
25
+
26
+ = anAssociation
27
+ ^self class = anAssociation class and: [
28
+ self key = anAssociation key and: [
29
+ self value = anAssociation value]]
30
+ !
31
+
32
+ storeOn: aStream
33
+ "Store in the format (key->value)"
34
+
35
+ "aStream nextPutAll: '('."
36
+ key storeOn: aStream.
37
+ aStream nextPutAll: '->'.
38
+ value storeOn: aStream.
39
+ "aStream nextPutAll: ')'"
40
+ ! !
41
+
42
+ !Association class methodsFor: 'instance creation'!
43
+
44
+ key: aKey value: aValue
45
+ ^self new
46
+ key: aKey;
47
+ value: aValue;
48
+ yourself
49
+ ! !
50
+
2
51
  Object subclass: #Stream
3
52
  instanceVariableNames: 'collection position streamSize'
4
53
  category: 'Kernel-Collections'!
@@ -132,55 +181,6 @@ on: aCollection
132
181
  yourself
133
182
  ! !
134
183
 
135
- Object subclass: #Association
136
- instanceVariableNames: 'key value'
137
- category: 'Kernel-Collections'!
138
-
139
- !Association methodsFor: 'accessing'!
140
-
141
- key: aKey
142
- key := aKey
143
- !
144
-
145
- key
146
- ^key
147
- !
148
-
149
- value: aValue
150
- value := aValue
151
- !
152
-
153
- value
154
- ^value
155
- ! !
156
-
157
- !Association methodsFor: 'comparing'!
158
-
159
- = anAssociation
160
- ^self class = anAssociation class and: [
161
- self key = anAssociation key and: [
162
- self value = anAssociation value]]
163
- !
164
-
165
- storeOn: aStream
166
- "Store in the format (key->value)"
167
-
168
- "aStream nextPutAll: '('."
169
- key storeOn: aStream.
170
- aStream nextPutAll: '->'.
171
- value storeOn: aStream.
172
- "aStream nextPutAll: ')'"
173
- ! !
174
-
175
- !Association class methodsFor: 'instance creation'!
176
-
177
- key: aKey value: aValue
178
- ^self new
179
- key: aKey;
180
- value: aValue;
181
- yourself
182
- ! !
183
-
184
184
  Object subclass: #RegularExpression
185
185
  instanceVariableNames: ''
186
186
  category: 'Kernel-Collections'!
@@ -265,12 +265,12 @@ asSet
265
265
  ^Set withAll: self
266
266
  !
267
267
 
268
- asJSONString
269
- ^JSON stringify: (self collect: [:each | each asJSONString])
270
- !
271
-
272
268
  asOrderedCollection
273
269
  ^self asArray
270
+ !
271
+
272
+ asJSON
273
+ ^self asArray collect: [:each | each asJSON]
274
274
  ! !
275
275
 
276
276
  !Collection methodsFor: 'copying'!
@@ -385,7 +385,11 @@ ifNotEmpty: aBlock
385
385
  !
386
386
 
387
387
  ifEmpty: aBlock
388
- self isEmpty ifTrue: aBlock.
388
+ "Evaluate the given block with the receiver as argument, answering its value if the receiver is empty, otherwise answer the receiver. Note that the fact that this method returns its argument in case the receiver is not empty allows one to write expressions like the following ones: self classifyMethodAs:
389
+ (myProtocol ifEmpty: ['As yet unclassified'])"
390
+ ^ self isEmpty
391
+ ifTrue: [ aBlock value ]
392
+ ifFalse: [ self ]
389
393
  ! !
390
394
 
391
395
  !Collection class methodsFor: 'accessing'!
@@ -505,6 +509,13 @@ indexOf: anObject startingAt: start
505
509
 
506
510
  atRandom
507
511
  ^ self at: self size atRandom
512
+ !
513
+
514
+ first: n
515
+ "Answer the first n elements of the receiver.
516
+ Raise an error if there are not enough elements."
517
+
518
+ ^ self copyFrom: 1 to: n
508
519
  ! !
509
520
 
510
521
  !SequenceableCollection methodsFor: 'adding'!
@@ -751,12 +762,12 @@ asJavaScriptSelector
751
762
  ^(self asSelector replace: '^_' with: '') replace: '_.*' with: ''.
752
763
  !
753
764
 
754
- asJSONString
755
- ^self
756
- !
757
-
758
765
  asSymbol
759
766
  ^Symbol lookup: self
767
+ !
768
+
769
+ asJSON
770
+ ^self
760
771
  ! !
761
772
 
762
773
  !String methodsFor: 'copying'!
@@ -1006,6 +1017,10 @@ asJavascript
1006
1017
 
1007
1018
  asSelector
1008
1019
  ^self asString asSelector
1020
+ !
1021
+
1022
+ asJSON
1023
+ ^self asString asJSON
1009
1024
  ! !
1010
1025
 
1011
1026
  !Symbol methodsFor: 'copying'!
@@ -1158,7 +1173,7 @@ with: anObject with: anObject2 with: anObject3
1158
1173
  withAll: aCollection
1159
1174
  | instance |
1160
1175
  instance := self new: aCollection size.
1161
- aCollection withIndexDo: [:index :each |
1176
+ aCollection withIndexDo: [:each :index |
1162
1177
  instance at: index put: each].
1163
1178
  ^instance
1164
1179
  ! !
@@ -1275,7 +1290,7 @@ with: anObject with: anObject2 with: anObject3
1275
1290
  withAll: aCollection
1276
1291
  | instance |
1277
1292
  instance := self new: aCollection size.
1278
- aCollection withIndexDo: [:index :each |
1293
+ aCollection withIndexDo: [:each :index |
1279
1294
  instance at: index put: each].
1280
1295
  ^instance
1281
1296
  ! !
@@ -1504,6 +1519,14 @@ removeKey: aKey ifAbsent: aBlock
1504
1519
 
1505
1520
  asDictionary
1506
1521
  ^Dictionary fromPairs: self associations
1522
+ !
1523
+
1524
+ asJSON
1525
+ | c |
1526
+ c := self class new.
1527
+ self keysAndValuesDo: [:key :value |
1528
+ c at: key put: value asJSON].
1529
+ ^c
1507
1530
  ! !
1508
1531
 
1509
1532
  !HashedCollection methodsFor: 'copying'!
@@ -1674,8 +1697,8 @@ asHashedCollection
1674
1697
  ^HashedCollection fromPairs: self associations
1675
1698
  !
1676
1699
 
1677
- asJSONString
1678
- ^self asHashedCollection asJSONString
1700
+ asJSON
1701
+ ^self asHashedCollection asJSON
1679
1702
  ! !
1680
1703
 
1681
1704
  !Dictionary methodsFor: 'initialization'!
@@ -114,11 +114,15 @@ asJavascript
114
114
  !
115
115
 
116
116
  asJSON
117
- ^JSON parse: self asJSONString
117
+ | variables |
118
+ variables := HashedCollection new.
119
+ self class allInstanceVariableNames do: [:each |
120
+ variables at: each put: (self instVarAt: each) asJSON].
121
+ ^variables
118
122
  !
119
123
 
120
124
  asJSONString
121
- ^JSON stringify: self
125
+ ^JSON stringify: self asJSON
122
126
  ! !
123
127
 
124
128
  !Object methodsFor: 'copying'!
@@ -823,6 +827,10 @@ to: stop by: step
823
827
  pos := pos + 1.
824
828
  value := value + step]].
825
829
  ^array
830
+ !
831
+
832
+ asJSON
833
+ ^self
826
834
  ! !
827
835
 
828
836
  !Number methodsFor: 'copying'!
@@ -1005,6 +1013,12 @@ not
1005
1013
  >
1006
1014
  ! !
1007
1015
 
1016
+ !Boolean methodsFor: 'converting'!
1017
+
1018
+ asJSON
1019
+ ^self
1020
+ ! !
1021
+
1008
1022
  !Boolean methodsFor: 'copying'!
1009
1023
 
1010
1024
  shallowCopy
@@ -1231,6 +1245,12 @@ subclass: aString instanceVariableNames: aString2 package: aString3
1231
1245
  superclass: self subclass: aString instanceVariableNames: aString2 package: aString3
1232
1246
  ! !
1233
1247
 
1248
+ !UndefinedObject methodsFor: 'converting'!
1249
+
1250
+ asJSON
1251
+ ^null
1252
+ ! !
1253
+
1234
1254
  !UndefinedObject methodsFor: 'copying'!
1235
1255
 
1236
1256
  shallowCopy
@@ -1635,6 +1655,13 @@ printString
1635
1655
  stream nextPutAll: y printString]
1636
1656
  ! !
1637
1657
 
1658
+ !Point methodsFor: 'transforming'!
1659
+
1660
+ translateBy: delta
1661
+ "Answer a Point translated by delta (an instance of Point)."
1662
+ ^(delta x + x) @ (delta y + y)
1663
+ ! !
1664
+
1638
1665
  !Point class methodsFor: 'instance creation'!
1639
1666
 
1640
1667
  x: aNumber y: anotherNumber
@@ -1,4 +1,18 @@
1
1
  Smalltalk current createPackage: 'Kernel-Tests' properties: #{}!
2
+ TestCase subclass: #ArrayTest
3
+ instanceVariableNames: ''
4
+ category: 'Kernel-Tests'!
5
+
6
+ !ArrayTest methodsFor: 'testing'!
7
+
8
+ testFirstN
9
+ self assert: {1. 2. 3} equals: ({1. 2. 3. 4. 5} first: 3).
10
+ !
11
+
12
+ testIfEmpty
13
+ self assert: 'zork' equals: ( '' ifEmpty: ['zork'] )
14
+ ! !
15
+
2
16
  TestCase subclass: #StringTest
3
17
  instanceVariableNames: ''
4
18
  category: 'Kernel-Tests'!
@@ -58,6 +72,10 @@ testSize
58
72
  testAddRemove
59
73
  self should: ['hello' add: 'a'] raise: Error.
60
74
  self should: ['hello' remove: 'h'] raise: Error
75
+ !
76
+
77
+ testAsArray
78
+ self assert: 'hello' asArray = #('h' 'e' 'l' 'l' 'o').
61
79
  ! !
62
80
 
63
81
  TestCase subclass: #DictionaryTest
@@ -467,44 +485,6 @@ testGrulCommitPathJsShouldBeServerGrulJs
467
485
  self assert: 'server/grul/js' equals: grulPackage commitPathJs
468
486
  ! !
469
487
 
470
- PackageTest subclass: #PackageWithDefaultCommitPathChangedTest
471
- instanceVariableNames: ''
472
- category: 'Kernel-Tests'!
473
-
474
- !PackageWithDefaultCommitPathChangedTest methodsFor: 'running'!
475
-
476
- setUp
477
- super setUp.
478
-
479
- Package
480
- defaultCommitPathJs: 'javascripts/';
481
- defaultCommitPathSt: 'smalltalk/'.
482
- ! !
483
-
484
- !PackageWithDefaultCommitPathChangedTest methodsFor: 'tests'!
485
-
486
- testGrulCommitPathJsShouldBeServerGrulJs
487
- self assert: 'server/grul/js' equals: grulPackage commitPathJs
488
- !
489
-
490
- testGrulCommitPathStShouldBeGrulSt
491
- self assert: 'grul/st' equals: grulPackage commitPathSt
492
- !
493
-
494
- testZorkCommitPathJsShouldBeJavascript
495
- self assert: 'javascripts/' equals: zorkPackage commitPathJs
496
- !
497
-
498
- testZorkCommitPathStShouldBeSmalltalk
499
- self assert: 'smalltalk/' equals: zorkPackage commitPathSt
500
- ! !
501
-
502
- !PackageWithDefaultCommitPathChangedTest class methodsFor: 'accessing'!
503
-
504
- shouldInheritSelectors
505
- ^ false
506
- ! !
507
-
508
488
  TestCase subclass: #BlockClosureTest
509
489
  instanceVariableNames: ''
510
490
  category: 'Kernel-Tests'!
@@ -797,6 +777,13 @@ testArithmetic
797
777
  self assert: 3@4 + (3@4 ) equals: (Point x: 6 y: 8).
798
778
  self assert: 3@4 - (3@4 ) equals: (Point x: 0 y: 0).
799
779
  self assert: 6@8 / (3@4 ) equals: (Point x: 2 y: 2)
780
+ !
781
+
782
+ testTranslateBy
783
+ self assert: 3@4 equals: (3@3 translateBy: 0@1).
784
+ self assert: 3@2 equals: (3@3 translateBy: 0@1 negated).
785
+ self assert: 5@6 equals: (3@3 translateBy: 2@3).
786
+ self assert: 0@3 equals: (3@3 translateBy: 3 negated @0).
800
787
  ! !
801
788
 
802
789
  TestCase subclass: #RandomTest
@@ -890,3 +877,41 @@ testSize
890
877
  self assert: (Set withAll: #(1 1 1 1)) size equals: 1
891
878
  ! !
892
879
 
880
+ PackageTest subclass: #PackageWithDefaultCommitPathChangedTest
881
+ instanceVariableNames: ''
882
+ category: 'Kernel-Tests'!
883
+
884
+ !PackageWithDefaultCommitPathChangedTest methodsFor: 'running'!
885
+
886
+ setUp
887
+ super setUp.
888
+
889
+ Package
890
+ defaultCommitPathJs: 'javascripts/';
891
+ defaultCommitPathSt: 'smalltalk/'.
892
+ ! !
893
+
894
+ !PackageWithDefaultCommitPathChangedTest methodsFor: 'tests'!
895
+
896
+ testGrulCommitPathJsShouldBeServerGrulJs
897
+ self assert: 'server/grul/js' equals: grulPackage commitPathJs
898
+ !
899
+
900
+ testGrulCommitPathStShouldBeGrulSt
901
+ self assert: 'grul/st' equals: grulPackage commitPathSt
902
+ !
903
+
904
+ testZorkCommitPathJsShouldBeJavascript
905
+ self assert: 'javascripts/' equals: zorkPackage commitPathJs
906
+ !
907
+
908
+ testZorkCommitPathStShouldBeSmalltalk
909
+ self assert: 'smalltalk/' equals: zorkPackage commitPathSt
910
+ ! !
911
+
912
+ !PackageWithDefaultCommitPathChangedTest class methodsFor: 'accessing'!
913
+
914
+ shouldInheritSelectors
915
+ ^ false
916
+ ! !
917
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-18 00:00:00.000000000 Z
12
+ date: 2012-03-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -24,7 +24,7 @@ dependencies:
24
24
  version_requirements: *3239880
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &3239220 !ruby/object:Gem::Requirement
27
+ requirement: &3238860 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *3239220
35
+ version_requirements: *3238860
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: shotgun
38
- requirement: &3237880 !ruby/object:Gem::Requirement
38
+ requirement: &3237980 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *3237880
46
+ version_requirements: *3237980
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &3237060 !ruby/object:Gem::Requirement
49
+ requirement: &3237260 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *3237060
57
+ version_requirements: *3237260
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rack-test
60
- requirement: &3236360 !ruby/object:Gem::Requirement
60
+ requirement: &3236440 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *3236360
68
+ version_requirements: *3236440
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: thin
71
- requirement: &3235460 !ruby/object:Gem::Requirement
71
+ requirement: &3235500 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *3235460
79
+ version_requirements: *3235500
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: haml
82
- requirement: &3234480 !ruby/object:Gem::Requirement
82
+ requirement: &3234540 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *3234480
90
+ version_requirements: *3234540
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: sinatra
93
- requirement: &3233520 !ruby/object:Gem::Requirement
93
+ requirement: &3233760 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *3233520
101
+ version_requirements: *3233760
102
102
  description:
103
103
  email: tyler@linux.com
104
104
  executables:
@@ -112,8 +112,10 @@ files:
112
112
  - lib/resin/app/app.rb
113
113
  - lib/resin.rb
114
114
  - lib/resin/app/views/index.haml
115
+ - amber/css/amber-normalize.css
115
116
  - amber/css/amber.css
116
117
  - amber/css/style.css
118
+ - amber/css/amber-normalize.less
117
119
  - amber/css/documentation.css
118
120
  - amber/css/profstef.css
119
121
  - amber/js/Kernel-Tests.js
@@ -205,7 +207,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
207
  version: '0'
206
208
  segments:
207
209
  - 0
208
- hash: 3599338579994700400
210
+ hash: -393056432692429665
209
211
  required_rubygems_version: !ruby/object:Gem::Requirement
210
212
  none: false
211
213
  requirements:
@@ -214,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
216
  version: '0'
215
217
  segments:
216
218
  - 0
217
- hash: 3599338579994700400
219
+ hash: -393056432692429665
218
220
  requirements: []
219
221
  rubyforge_project:
220
222
  rubygems_version: 1.8.10