--- a/MCRepositoryBrowser.st Wed Jan 17 04:38:54 2018 +0000
+++ b/MCRepositoryBrowser.st Tue Feb 13 16:53:48 2018 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"{ Package: 'stx:goodies/monticello' }"
"{ NameSpace: Smalltalk }"
@@ -951,58 +953,61 @@
!
repositoryAdd
- |repStr rep url initialURL|
+ |repStr rep url method initialURL|
initialURL := LastAddedURLString ? 'http://www.squeaksource.com/project'.
repStr := Dialog
- request:'Repository to add (file- or HTTP-URL):'
- initialAnswer:initialURL
- initialSelection:((initialURL findString:'project') to:(initialURL size)).
+ request:'Repository to add (file- or HTTP-URL):'
+ initialAnswer:initialURL
+ initialSelection:((initialURL findString:'project') to:(initialURL size)).
repStr isEmptyOrNil ifTrue:[^ self].
(repStr startsWith:'www.') ifTrue:[
- repStr := 'http://',repStr.
+ repStr := 'http://',repStr.
].
Error handle:[:ex |
- LastAddedURLString := repStr.
- Dialog warn:'Invalid URL (',ex description,')'.
- ^ self
+ LastAddedURLString := repStr.
+ Dialog warn:'Invalid URL (',ex description,')'.
+ ^ self
] do:[
- url := URI fromString:repStr.
+ url := URI fromString:repStr.
].
url isNil ifTrue:[
- LastAddedURLString := repStr.
- Dialog warn:'Invalid URL'.
- ^ self
+ LastAddedURLString := repStr.
+ Dialog warn:'Invalid URL'.
+ ^ self
].
+ method := url method.
- url method = 'http' ifTrue:[
- rep := MCHttpRepository
- location: repStr
- user: ''
- password: ''
+ method = 'http' ifTrue:[
+ rep := MCHttpRepository location:repStr user:'' password: ''
] ifFalse:[
- url method = 'ftp' ifTrue:[
- rep := MCFtpRepository
- host: url host
- directory: url path
- user: url user
- password: (url password ? 'anonymous')
- ] ifFalse:[
- url isFileScheme ifTrue:[
- rep := MCDirectoryRepository directory:repStr.
- ].
- ]
+ method = 'ftp' ifTrue:[
+ rep := MCFtpRepository
+ host:(url host)
+ directory:(url path)
+ user:(url user) password:(url password ? 'anonymous')
+ ] ifFalse:[
+ (method isNil or:[method = 'file']) ifTrue:[
+ rep := MCDirectoryRepository directory:repStr.
+ ] ifFalse:[
+ method = 'github' ifTrue:[
+ MCGitHubRepository notNil ifTrue:[
+ rep := MCGitHubRepository directory:repStr.
+ ].
+ ].
+ ].
+ ]
].
rep isNil ifTrue:[
- LastAddedURLString := repStr.
- Dialog warn:'Cannot figure out access scheme from URL.'.
- ^ self.
+ LastAddedURLString := repStr.
+ Dialog warn:'Cannot figure out access scheme from URL.'.
+ ^ self.
].
self withWaitCursorDo:[
- self addRepository:rep
+ self addRepository:rep
].
"Created: / 29-08-2011 / 12:25:40 / cg"