MCSqueaksourceRepository.st
author Claus Gittinger <cg@exept.de>
Sat, 01 Sep 2018 17:32:13 +0200
changeset 1086 efc5221435a5
parent 1058 20534d93f47d
permissions -rw-r--r--
initial checkin

"{ Package: 'stx:goodies/monticello' }"

"{ NameSpace: Smalltalk }"

MCHttpRepository subclass:#MCSqueaksourceRepository
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'SCM-Monticello-RemoteRepositories'
!

MCSqueaksourceRepository comment:'I am a specialized MCHttpRepository for http://squeaksource.com.
I optimize checks for existing files by doing a head request instead of reloading the whole file list first.'
!


!MCSqueaksourceRepository class methodsFor:'accessing'!

description
	^ 'squeaksource.com'
! !

!MCSqueaksourceRepository class methodsFor:'creation template'!

baseURL
	^ 'http://squeaksource.com/'
! !

!MCSqueaksourceRepository class methodsFor:'testing'!

isResponsibleFor: aUrl
	^ aUrl includesSubstring: 'squeaksource.com/'
! !

!MCSqueaksourceRepository methodsFor:'*Komitter-Models'!

koRemote

	^ KomitSqueakSourceRemote new
		remote: self;
		yourself
! !

!MCSqueaksourceRepository methodsFor:'interface'!

includesFileNamed: aString
	
	"avoid the slower default method and simply do a head request "
	self httpClient
		numberOfRetries: 0;
		ifFail: [ :exception | 
			((exception isKindOf: ZnHttpUnsuccessful) and: [ exception response isNotFound ])
				ifTrue: [ ^ false ].
			exception pass];
		head: (self urlForFileNamed: aString).
		
	^ true
!

includesVersionNamed: aString
	"directly do a filename check since squeaksource only stores mcz"
	^ self includesFileNamed: aString, '.mcz'
! !

!MCSqueaksourceRepository class methodsFor:'documentation'!

version
    ^ '$Header$'
!

version_CVS
    ^ '$Header$'
! !