MetacelloPlatform.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 05 Sep 2012 16:35:54 +0000
changeset 7 759ff40b4754
parent 1 9e312de5f694
permissions -rw-r--r--
- stx_goodies_metacello_stx added: #extensionMethodNames changed: #classNamesAndAttributes #preRequisites
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
9e312de5f694 - Initial commit
jv
parents:
diff changeset
     1
"{ Package: 'stx:goodies/metacello' }"
9e312de5f694 - Initial commit
jv
parents:
diff changeset
     2
9e312de5f694 - Initial commit
jv
parents:
diff changeset
     3
Object subclass:#MetacelloPlatform
9e312de5f694 - Initial commit
jv
parents:
diff changeset
     4
	instanceVariableNames:'bypassProgressBars bypassGoferLoadUpdateCategories'
9e312de5f694 - Initial commit
jv
parents:
diff changeset
     5
	classVariableNames:'Current'
9e312de5f694 - Initial commit
jv
parents:
diff changeset
     6
	poolDictionaries:''
9e312de5f694 - Initial commit
jv
parents:
diff changeset
     7
	category:'Metacello-Core-Model'
9e312de5f694 - Initial commit
jv
parents:
diff changeset
     8
!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
     9
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    10
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    11
!MetacelloPlatform class methodsFor:'accessing'!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    12
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    13
current
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    14
	Current
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    15
		ifNil: [Current := MetacelloPlatform new].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    16
	^ Current
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    17
! !
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    18
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    19
!MetacelloPlatform class methodsFor:'initialize-release'!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    20
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    21
initialize
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    22
	"MetacelloPlatform initialize"
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    23
	"MetacelloGemStonePlatform initialize"
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    24
	"MetacelloPharoPlatform initialize"
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    25
	"MetacelloSqueakPlatform initialize"
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    26
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    27
	Current := self new
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    28
! !
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    29
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    30
!MetacelloPlatform methodsFor:'accessing'!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    31
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    32
bypassGoferLoadUpdateCategories
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    33
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    34
	bypassGoferLoadUpdateCategories == nil ifTrue: [ bypassGoferLoadUpdateCategories := false ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    35
	^ bypassGoferLoadUpdateCategories
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    36
!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    37
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    38
bypassGoferLoadUpdateCategories: anObject
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    39
	bypassGoferLoadUpdateCategories := anObject
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    40
!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    41
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    42
bypassProgressBars
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    43
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    44
	bypassProgressBars == nil ifTrue: [ bypassProgressBars := false ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    45
	^ bypassProgressBars
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    46
!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    47
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    48
bypassProgressBars: anObject
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    49
	bypassProgressBars := anObject
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    50
! !
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    51
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    52
!MetacelloPlatform methodsFor:'attributes'!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    53
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    54
defaultPlatformAttributes
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    55
	| versionString |
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    56
	Smalltalk at: #SystemVersion ifPresent: [:cl |
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    57
		versionString := cl current version.
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    58
		(versionString beginsWith: 'Pharo')
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    59
			ifTrue: [ ^ #(#squeakCommon #pharo ) ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    60
		(versionString beginsWith: 'Squeak')
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    61
			ifTrue: [^ #(#squeakCommon #squeak )].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    62
		"see http://code.google.com/p/metacello/issues/detail?id=146"
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    63
		(versionString includesSubString: 'Pharo')
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    64
			ifTrue: [ ^ #(#squeakCommon #pharo ) ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    65
		(versionString includesSubString: 'Squeak')
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    66
			ifTrue: [^ #(#squeakCommon #squeak )].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    67
		self error: 'Unrecognized version of Squeak/Pharo: ', versionString ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    68
	^ #(#gemstone )
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    69
! !
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    70
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    71
!MetacelloPlatform methodsFor:'caching'!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    72
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    73
clearCurrentVersionCache
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    74
	MetacelloClearStackCacheNotification signal: #(#currentVersion #currentVersionAgainst: #currentVersionInfo)
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    75
!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    76
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    77
primeStackCacheFor: cacheName doing: noArgBlock defaultDictionary: aDictionary
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    78
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    79
	self deprecated: 'use #primeStackCacheWith:doing:'.
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    80
	self 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    81
		useStackCacheDuring: [:dict | | cache |
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    82
			cache := dict at: cacheName ifAbsent: [].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    83
			cache == nil
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    84
				ifTrue: [ 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    85
					cache := Dictionary new.
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    86
					dict at: cacheName put: cache ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    87
			^noArgBlock value ] 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    88
		defaultDictionary: aDictionary
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    89
!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    90
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    91
primeStackCacheWith: aDictionary doing: noArgBlock
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    92
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    93
	self 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    94
		useStackCacheDuring: [:dict | ^noArgBlock value ] 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    95
		defaultDictionary: aDictionary
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    96
!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    97
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    98
stackCacheFor: cacheName at: key doing: aBlock
9e312de5f694 - Initial commit
jv
parents:
diff changeset
    99
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   100
	^self stackCacheFor: cacheName cacheClass: Dictionary at: key doing: aBlock
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   101
!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   102
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   103
stackCacheFor: cacheName cacheClass: cacheClass at: key doing: aBlock
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   104
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   105
	self 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   106
		useStackCacheDuring: [:dict | | cache |
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   107
			cache := dict at: cacheName ifAbsent: [].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   108
			cache ~~ nil
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   109
				ifTrue: [ | value hasEntry |
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   110
					hasEntry := true.
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   111
					value := cache at: key ifAbsent: [ hasEntry := false ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   112
					hasEntry ifTrue: [ ^value ]]
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   113
				ifFalse: [ 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   114
					cache := cacheClass new.
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   115
					dict at: cacheName put: cache ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   116
			^aBlock value: cache ] 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   117
		defaultDictionary: nil
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   118
!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   119
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   120
useStackCacheDuring: aBlock defaultDictionary: defaultDictionary
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   121
	| dict |
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   122
	dict := MetacelloStackCacheNotification signal.
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   123
	dict == nil
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   124
		ifTrue: [ 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   125
			dict := defaultDictionary == nil
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   126
				ifTrue: [ Dictionary new ]
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   127
				ifFalse: [ defaultDictionary ] ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   128
	[ ^ aBlock value: dict ]
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   129
		on: MetacelloStackCacheNotification , MetacelloClearStackCacheNotification
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   130
		do: [ :ex | 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   131
			(ex isKindOf: MetacelloStackCacheNotification)
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   132
				ifTrue: [ ex resume: dict ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   133
			(ex isKindOf: MetacelloClearStackCacheNotification)
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   134
				ifTrue: [ 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   135
					| keys |
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   136
					keys := ex cacheNames.
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   137
					keys ifNil: [ keys := dict keys ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   138
					keys
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   139
						do: [ :k | 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   140
							(dict includesKey: k)
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   141
								ifTrue: [ 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   142
									| c |
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   143
									c := dict at: k.
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   144
									c keys do: [ :ck | c removeKey: ck ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   145
									dict removeKey: k ] ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   146
					ex resume ] ]
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   147
! !
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   148
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   149
!MetacelloPlatform methodsFor:'github support'!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   150
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   151
downloadFile: url to: outputFileName
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   152
    "download from <url> into <outputFileName>"
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   153
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   154
    self subclassResponsibility
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   155
!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   156
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   157
extractRepositoryFrom: zipFile to: directory
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   158
    "unzip <zipFile> into <directory>"
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   159
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   160
    self subclassResponsibility
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   161
!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   162
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   163
fileDirectoryClass
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   164
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   165
	^FileDirectory
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   166
! !
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   167
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   168
!MetacelloPlatform methodsFor:'notification'!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   169
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   170
collection: aCollection do: aBlock displaying: aString
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   171
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   172
	aCollection do: aBlock
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   173
!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   174
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   175
do: aBlock displaying: aString
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   176
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   177
	aBlock value
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   178
! !
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   179
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   180
!MetacelloPlatform methodsFor:'reflection'!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   181
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   182
copyClass: oldClass as: newName inCategory: newCategoryName
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   183
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   184
	self subclassResponsibility
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   185
!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   186
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   187
globalNamed: globalName
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   188
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   189
	^Smalltalk at: globalName
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   190
!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   191
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   192
globalNamed: globalName ifAbsent: absentBlock
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   193
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   194
	^Smalltalk at: globalName ifAbsent: absentBlock
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   195
! !
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   196
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   197
!MetacelloPlatform methodsFor:'repository creation'!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   198
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   199
createRepository: aRepositorySpec
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   200
    | type |
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   201
    type := aRepositorySpec type.
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   202
    type = 'http'
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   203
        ifTrue: [ 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   204
            ^ MCHttpRepository
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   205
                location: aRepositorySpec description
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   206
                user: aRepositorySpec username
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   207
                password: aRepositorySpec password ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   208
    type = 'directory'
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   209
        ifTrue: [ ^ MCDirectoryRepository new directory: (FileDirectory on: aRepositorySpec description) ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   210
    Smalltalk
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   211
        at: #'MCFileTreeRepository'
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   212
        ifPresent: [ :cl | 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   213
            type = 'filetree'
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   214
                ifTrue: [ 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   215
                    | description headerSize |
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   216
                    description := aRepositorySpec description.
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   217
                    headerSize := 'filetree://' size.
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   218
                    ^ cl new
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   219
                        directory:
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   220
                            (FileDirectory on: (aRepositorySpec description copyFrom: headerSize + 1 to: description size)) ] ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   221
    Smalltalk
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   222
        at: #'MCGitHubRepository'
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   223
        ifPresent: [ :cl | 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   224
            type = 'github'
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   225
                ifTrue: [ ^ cl location: aRepositorySpec description ] ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   226
    type = 'dictionary'
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   227
        ifTrue: [ 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   228
            | description headerSize globalName |
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   229
            description := aRepositorySpec description.
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   230
            headerSize := 'dictionary://' size.
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   231
            globalName := (description copyFrom: headerSize + 1 to: description size) asSymbol.
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   232
            ^ Smalltalk
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   233
                at: globalName
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   234
                ifAbsent: [ 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   235
                    Smalltalk
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   236
                        at: globalName
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   237
                        put:
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   238
                            (MCDictionaryRepository new
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   239
                                description: description;
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   240
                                yourself) ] ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   241
    ^ nil
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   242
!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   243
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   244
extractTypeFromDescription: description
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   245
    description == nil
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   246
        ifTrue: [ ^ nil ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   247
    ((description beginsWith: '/') or: [ description second = $: ])
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   248
        ifTrue: [ ^ 'directory' ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   249
    (description beginsWith: 'dictionary://')
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   250
        ifTrue: [ ^ 'dictionary' ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   251
    (description beginsWith: 'filetree://')
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   252
        ifTrue: [ ^ 'filetree' ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   253
    (description beginsWith: 'github://')
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   254
        ifTrue: [ ^ 'github' ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   255
    ^ 'http'
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   256
! !
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   257
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   258
!MetacelloPlatform methodsFor:'scripting'!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   259
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   260
defaultRepositoryDescription
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   261
    ^ 'http://www.squeaksource.com/MetacelloRepository'
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   262
! !
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   263
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   264
!MetacelloPlatform methodsFor:'tests'!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   265
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   266
defaultTimeout
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   267
	"squeak compatability"
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   268
	^60
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   269
! !
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   270
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   271
!MetacelloPlatform methodsFor:'transactions'!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   272
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   273
transact: aBlock
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   274
	"On GemStone, we want to optionally abort before command execution and commit after 
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   275
	 common execution. Other plaforms don't need to do anything special.
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   276
	 Returning out of block, skips commit."
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   277
	
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   278
	aBlock value
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   279
! !
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   280
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   281
!MetacelloPlatform methodsFor:'user interaction'!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   282
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   283
confirm: aString
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   284
	
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   285
	^(Smalltalk hasClassNamed: #UIManager)
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   286
		ifTrue: [ (Smalltalk classNamed: #UIManager) default perform: #confirm: with: aString ]
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   287
		ifFalse: [
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   288
			"throw warning and answer true, if no way to announce"
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   289
			Warning signal: aString.
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   290
			true ]
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   291
! !
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   292
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   293
!MetacelloPlatform methodsFor:'utilities'!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   294
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   295
authorName
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   296
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   297
	Smalltalk at: #Author ifPresent: [:cl | ^cl perform: #initials ].
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   298
	^'no developer initials'
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   299
!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   300
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   301
authorName: aString
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   302
	"Primarily used for testing"
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   303
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   304
	self subclassResponsibility
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   305
!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   306
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   307
timestamp
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   308
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   309
	^DateAndTime now printString
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   310
! !
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   311
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   312
!MetacelloPlatform class methodsFor:'documentation'!
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   313
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   314
version_SVN
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   315
    ^ '$Id::                                                                                                                        $'
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   316
! !
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   317
9e312de5f694 - Initial commit
jv
parents:
diff changeset
   318
MetacelloPlatform initialize!