Created
May 3, 2011 02:57
-
-
Save SeanTAllen/952748 to your computer and use it in GitHub Desktop.
Ugly pharo dumping to redline format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class := TestCase. | |
aStream := String new writeStream . | |
class superclass == nil | |
ifTrue: [aStream nextPutAll: 'ProtoObject'] | |
ifFalse: [aStream nextPutAll: class superclass name]. | |
aStream | |
nextPutAll: class kindOfSubclass; | |
store: class name; | |
crlf. | |
aStream | |
tab; | |
nextPutAll: 'instanceVariableNames: '; | |
store: class instanceVariablesString; | |
crlf. | |
aStream | |
tab; | |
nextPutAll: 'classVariableNames: '; | |
store: class classVariablesString; | |
crlf. | |
aStream | |
tab; | |
nextPutAll: 'poolDictionaries: '; | |
store: class sharedPoolsString; | |
crlf. | |
aStream | |
tab; | |
nextPutAll: 'classInstanceVariableNames: '; | |
store: class class instanceVariablesString; | |
nextPut: $.; | |
crlf; | |
crlf. | |
methods := class classSide methods asSortedCollection: [ :a :b | a selector < b selector ]. | |
methods do: [ :method | | |
s := method getSource. | |
s := 'cdef ', s. | |
s := s withBlanksTrimmed. | |
s := s copyReplaceAll: String cr with: String crlf. | |
aStream | |
nextPutAll: s; | |
crlf; | |
crlf. | |
]. | |
methods := class methods asSortedCollection: [ :a :b | a selector < b selector ]. | |
methods do: [ :method | | |
s := method getSource. | |
s := 'def ', s. | |
s := s withBlanksTrimmed. | |
s := s copyReplaceAll: String cr with: String crlf. | |
aStream | |
nextPutAll: s; | |
crlf; | |
crlf. | |
]. | |
file := StandardFileStream fileNamed: class name , '.st'. | |
file nextPutAll: aStream contents. | |
file close. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment