forked from dalehenrich/PharoGs
-
Notifications
You must be signed in to change notification settings - Fork 5
/
exportGsEdits.tpz
62 lines (61 loc) · 1.6 KB
/
exportGsEdits.tpz
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
! If you edit in GemStone, then this script can export your edits
run
| classes environment fileStream symbolList |
classes := Array new.
environment := 2.
symbolList := System myUserProfile symbolList.
symbolList do: [:eachDict |
eachDict do: [:eachGlobal |
eachGlobal isBehavior ifTrue: [
| array |
array := Array with: eachGlobal with: eachGlobal class.
array do: [:eachBehavior |
(eachBehavior methodDictForEnv: environment) do: [:eachMethod |
| flag |
flag := eachMethod pragmas anySatisfy: [:eachPragma |
eachPragma keyword == #'PharoGs'.
].
flag ifTrue: [
fileStream ifNil: [fileStream := (Globals at: #'FileStream')
write: 'methods/' , eachGlobal name , '.gs'
mode: #'truncate'
check: false
type: #'serverText'.
].
eachBehavior
fileOutMethod: eachMethod selector
environmentId: environment
on: fileStream.
classes add: eachGlobal.
].
].
].
fileStream ifNotNil: [fileStream close. fileStream := nil].
].
].
].
fileStream := (Globals at: #'FileStream')
write: 'importGsEdits.tpz'
mode: #'truncate'
check: false
type: #'serverText'.
fileStream
nextPutAll: 'output push importGsEdits.out only'; lf;
nextPutAll: 'errorCount'; lf;
yourself.
classes := classes asIdentitySet asSortedCollection: [:a :b | a name <= b name].
classes do: [:eachClass |
fileStream
nextPutAll: 'input methods/';
nextPutAll: eachClass name;
nextPutAll: '.gs';
lf.
].
fileStream
nextPutAll: 'errorCount'; lf;
nextPutAll: 'output pop'; lf;
nextPutAll: 'errorCount'; lf;
close;
yourself.
classes size
%