109
|
1 |
"{ Package: 'stx:goodies/monticello' }"
|
|
2 |
|
1023
|
3 |
"{ NameSpace: Smalltalk }"
|
|
4 |
|
109
|
5 |
MCFileBasedRepository subclass:#MCDirectoryRepository
|
|
6 |
instanceVariableNames:'directory'
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
623
|
9 |
category:'SCM-Monticello-Repositories'
|
109
|
10 |
!
|
|
11 |
|
|
12 |
|
228
|
13 |
!MCDirectoryRepository class methodsFor:'initialization'!
|
|
14 |
|
|
15 |
new
|
|
16 |
^self basicNew initialize
|
|
17 |
! !
|
|
18 |
|
109
|
19 |
!MCDirectoryRepository class methodsFor:'instance creation'!
|
|
20 |
|
228
|
21 |
directory: aStringOrFileDirectory
|
|
22 |
|
|
23 |
^self new directory: aStringOrFileDirectory
|
|
24 |
|
|
25 |
"Created: / 16-09-2010 / 14:51:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
26 |
"Modified: / 16-09-2010 / 15:59:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
27 |
!
|
|
28 |
|
109
|
29 |
morphicConfigure
|
1023
|
30 |
| directory dialog |
|
|
31 |
|
|
32 |
dialog := UIManager isNil ifTrue:[Dialog] ifFalse:[ UIManager default ].
|
|
33 |
^ (directory := dialog chooseDirectory) ifNotNil:
|
|
34 |
[
|
|
35 |
self new directory: directory]
|
109
|
36 |
! !
|
|
37 |
|
228
|
38 |
!MCDirectoryRepository class methodsFor:'as yet unclassified'!
|
|
39 |
|
907
|
40 |
fillInTheBlankRequest
|
|
41 |
"superclass MCRepository class says that I am responsible to implement this method"
|
|
42 |
|
|
43 |
^ self shouldImplement
|
|
44 |
! !
|
|
45 |
|
|
46 |
!MCDirectoryRepository class methodsFor:'queries'!
|
|
47 |
|
228
|
48 |
creationTemplate
|
|
49 |
"superclass MCRepository class says that I am responsible to implement this method"
|
|
50 |
|
526
|
51 |
^
|
|
52 |
'MCDirectoryRepository
|
|
53 |
directory: ''%1'''
|
228
|
54 |
bindWith: (Filename currentDirectory asAbsoluteFilename / 'package-cache') asString
|
|
55 |
|
|
56 |
"Modified: / 16-09-2010 / 14:53:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
526
|
57 |
"Modified: / 01-12-2011 / 20:31:31 / cg"
|
228
|
58 |
!
|
|
59 |
|
907
|
60 |
description
|
|
61 |
^ 'directory'
|
228
|
62 |
! !
|
|
63 |
|
907
|
64 |
!MCDirectoryRepository methodsFor:'accessing'!
|
109
|
65 |
|
|
66 |
description
|
|
67 |
^ directory pathName
|
|
68 |
!
|
|
69 |
|
|
70 |
directory
|
|
71 |
^ directory
|
|
72 |
!
|
|
73 |
|
228
|
74 |
directory: aStringOrDirectory
|
|
75 |
|
|
76 |
directory := aStringOrDirectory isString
|
|
77 |
ifTrue:[FileDirectory directoryNamed: aStringOrDirectory]
|
|
78 |
ifFalse:[aStringOrDirectory].
|
|
79 |
|
|
80 |
"Modified: / 16-09-2010 / 15:58:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
907
|
81 |
! !
|
109
|
82 |
|
907
|
83 |
!MCDirectoryRepository methodsFor:'as yet unclassified'!
|
109
|
84 |
|
|
85 |
isValid
|
|
86 |
^directory exists
|
|
87 |
!
|
|
88 |
|
228
|
89 |
literalArrayEncoding
|
|
90 |
|
|
91 |
^Array
|
|
92 |
with: self class name asSymbol
|
|
93 |
with: #directory:
|
528
|
94 |
with: directory pathName "directoryName"
|
228
|
95 |
|
|
96 |
"
|
|
97 |
(MCDirectoryRepository directory: '/tmp')
|
|
98 |
literalArrayEncoding decodeAsLiteralArray
|
|
99 |
"
|
|
100 |
|
|
101 |
"Created: / 16-09-2010 / 16:01:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
528
|
102 |
"Modified: / 01-12-2011 / 21:01:25 / cg"
|
228
|
103 |
!
|
|
104 |
|
109
|
105 |
readStreamForFileNamed: aString do: aBlock
|
|
106 |
| file val |
|
228
|
107 |
file := FileStream readOnlyFileNamed: (directory fullNameFor: aString).
|
|
108 |
val := aBlock value: file.
|
109
|
109 |
file close.
|
|
110 |
^ val
|
|
111 |
!
|
|
112 |
|
|
113 |
writeStreamForFileNamed: aString replace: aBoolean do: aBlock
|
|
114 |
| file sel |
|
228
|
115 |
sel := aBoolean ifTrue: [#forceNewFileNamed:] ifFalse: [#newFileNamed:].
|
|
116 |
file := FileStream perform: sel with: (directory fullNameFor: aString).
|
109
|
117 |
aBlock value: file.
|
|
118 |
file close.
|
|
119 |
! !
|
|
120 |
|
|
121 |
!MCDirectoryRepository methodsFor:'comparing'!
|
|
122 |
|
|
123 |
hash
|
|
124 |
^ directory pathName hash
|
|
125 |
! !
|
|
126 |
|
228
|
127 |
!MCDirectoryRepository methodsFor:'displaying'!
|
|
128 |
|
|
129 |
displayString
|
|
130 |
|
528
|
131 |
^directory pathName "/ directoryName
|
228
|
132 |
|
|
133 |
"Created: / 14-09-2010 / 23:18:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
528
|
134 |
"Modified: / 01-12-2011 / 21:00:33 / cg"
|
228
|
135 |
! !
|
|
136 |
|
907
|
137 |
!MCDirectoryRepository methodsFor:'initialization'!
|
|
138 |
|
|
139 |
initialize
|
|
140 |
super initialize.
|
|
141 |
directory := FileDirectory default
|
|
142 |
! !
|
|
143 |
|
|
144 |
!MCDirectoryRepository methodsFor:'queries'!
|
|
145 |
|
|
146 |
allFileNames
|
|
147 |
^ (directory entries sortBy: [:a :b | a modificationTime >= b modificationTime]) collect: [:ea | ea name]
|
|
148 |
! !
|
|
149 |
|
109
|
150 |
!MCDirectoryRepository class methodsFor:'documentation'!
|
|
151 |
|
|
152 |
version
|
1023
|
153 |
^ '$Header$'
|
228
|
154 |
!
|
|
155 |
|
|
156 |
version_CVS
|
1023
|
157 |
^ '$Header$'
|
228
|
158 |
!
|
|
159 |
|
|
160 |
version_SVN
|
1023
|
161 |
^ '$Id$'
|
109
|
162 |
! !
|
907
|
163 |
|