107
|
1 |
"{ Package: 'stx:goodies/monticello' }"
|
|
2 |
|
|
3 |
MCDirectoryRepository subclass:#MCCacheRepository
|
|
4 |
instanceVariableNames:'packageCaches seenFiles'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
576
|
7 |
category:'SCM-Monticello-Repositories'
|
107
|
8 |
!
|
|
9 |
|
|
10 |
MCCacheRepository class instanceVariableNames:'default'
|
|
11 |
|
|
12 |
"
|
|
13 |
No other class instance variables are inherited by this class.
|
|
14 |
"
|
|
15 |
!
|
|
16 |
|
|
17 |
|
906
|
18 |
!MCCacheRepository class methodsFor:'initialization'!
|
|
19 |
|
|
20 |
initialize
|
|
21 |
self checkCacheDirectory
|
|
22 |
! !
|
|
23 |
|
|
24 |
!MCCacheRepository class methodsFor:'instance creation'!
|
|
25 |
|
|
26 |
default
|
|
27 |
self checkCacheDirectory.
|
|
28 |
^ default ifNil: [default _ self new directory: self cacheDirectory]
|
|
29 |
! !
|
|
30 |
|
|
31 |
!MCCacheRepository class methodsFor:'misc'!
|
107
|
32 |
|
|
33 |
cacheDirectory
|
|
34 |
^ (FileDirectory default directoryNamed: 'package-cache')
|
|
35 |
assureExistence;
|
|
36 |
yourself
|
|
37 |
!
|
|
38 |
|
|
39 |
checkCacheDirectory
|
|
40 |
default notNil and: [default directory exists ifFalse: [default _ nil]]
|
906
|
41 |
! !
|
107
|
42 |
|
906
|
43 |
!MCCacheRepository class methodsFor:'queries'!
|
107
|
44 |
|
|
45 |
description
|
|
46 |
^ nil
|
906
|
47 |
! !
|
107
|
48 |
|
906
|
49 |
!MCCacheRepository methodsFor:'accessing'!
|
|
50 |
|
|
51 |
seenFileNames
|
|
52 |
^ seenFiles ifNil: [seenFiles _ OrderedCollection new]
|
107
|
53 |
! !
|
|
54 |
|
|
55 |
!MCCacheRepository methodsFor:'as yet unclassified'!
|
|
56 |
|
|
57 |
cacheForPackage: aPackage
|
|
58 |
packageCaches ifNil: [packageCaches _ Dictionary new].
|
|
59 |
^ packageCaches at: aPackage ifAbsentPut: [MCPackageCache new]
|
|
60 |
!
|
|
61 |
|
|
62 |
newFileNames
|
|
63 |
^ self allFileNames difference: self seenFileNames
|
|
64 |
!
|
|
65 |
|
|
66 |
packageForFileNamed: aString
|
|
67 |
^ self packageCache at: aString ifAbsentPut: [self versionReaderForFileNamed: aString do: [:r | r package]]
|
|
68 |
!
|
|
69 |
|
|
70 |
rescan
|
|
71 |
self newFileNames do:
|
|
72 |
[:ea |
|
|
73 |
self versionReaderForFileNamed: ea do:
|
|
74 |
[:reader |
|
|
75 |
(self cacheForPackage: reader package)
|
|
76 |
recordVersionInfo: reader info
|
|
77 |
forFileNamed: ea.
|
|
78 |
self seenFileNames add: ea]]
|
|
79 |
displayingProgress: 'Scanning cache...'
|
906
|
80 |
! !
|
|
81 |
|
|
82 |
!MCCacheRepository methodsFor:'printing & storing'!
|
107
|
83 |
|
906
|
84 |
basicStoreVersion: aVersion
|
|
85 |
(aVersion isCacheable and: [self allFileNames includes: aVersion fileName])
|
|
86 |
ifFalse: [super basicStoreVersion: aVersion]
|
|
87 |
! !
|
|
88 |
|
|
89 |
!MCCacheRepository methodsFor:'queries'!
|
107
|
90 |
|
|
91 |
versionInfoForFileNamed: aString
|
|
92 |
^ self infoCache at: aString ifAbsentPut: [self versionReaderForFileNamed: aString do: [:r | r info]]
|
|
93 |
! !
|
|
94 |
|
|
95 |
!MCCacheRepository class methodsFor:'documentation'!
|
|
96 |
|
|
97 |
version
|
906
|
98 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCCacheRepository.st,v 1.3 2014-02-12 14:53:37 cg Exp $'
|
107
|
99 |
! !
|
|
100 |
|
906
|
101 |
|
107
|
102 |
MCCacheRepository initialize!
|