diff --git a/repository/Grafoscopio-Utils/GrafoscopioDocumentation.class.st b/repository/Grafoscopio-Utils/GrafoscopioDocumentation.class.st index 3a55990..e8aff71 100644 --- a/repository/Grafoscopio-Utils/GrafoscopioDocumentation.class.st +++ b/repository/Grafoscopio-Utils/GrafoscopioDocumentation.class.st @@ -71,17 +71,14 @@ GrafoscopioDocumentation >> documents: anObject [ { #category : #updating } GrafoscopioDocumentation >> download: fileNameWithRelativePath [ - | fileName relativePathFolders newPath parentFolder | + | fileName parentFolder | fileName := (fileNameWithRelativePath splitOn: $/) last. - relativePathFolders := (fileNameWithRelativePath splitOn: $/) allButLast. - newPath := self localPlace path. - relativePathFolders do: [ :folder | newPath := newPath / folder ]. - parentFolder := newPath asFileReference. - parentFolder exists ifFalse: [ parentFolder ensureCreateDirectory ]. + parentFolder := GrafoscopioUtils + ensureCreateDirectory: fileNameWithRelativePath into: self localPlace. GrafoscopioUtils downloadingFrom: self repository remote asString, '/doc/tip/', fileNameWithRelativePath withMessage: 'Downloading ', fileName - into: parentFolder + into: parentFolder ] { #category : #updating } diff --git a/repository/Grafoscopio-Utils/GrafoscopioUtils.class.st b/repository/Grafoscopio-Utils/GrafoscopioUtils.class.st index b85f580..b88e6c1 100644 --- a/repository/Grafoscopio-Utils/GrafoscopioUtils.class.st +++ b/repository/Grafoscopio-Utils/GrafoscopioUtils.class.st @@ -13,6 +13,17 @@ GrafoscopioUtils class >> checksumFor: aFileReference [ ^ (SHA1 new hashMessage: aFileReference binaryReadStream contents) hex. ] +{ #category : #updating } +GrafoscopioUtils class >> download: fileNameWithRelativePath from: urlString into: aFolder [ + | fileName parentFolder | + fileName := (fileNameWithRelativePath splitOn: $/) last. + parentFolder := self ensureCreateDirectory: fileNameWithRelativePath into: aFolder. + self + downloadingFrom: urlString, fileNameWithRelativePath + withMessage: 'Downloading ', fileName + into: parentFolder +] + { #category : #'graphical interface' } GrafoscopioUtils class >> downloadingFrom: downloadUrl withMessage: aString into: location [ | fileName | @@ -33,6 +44,18 @@ GrafoscopioUtils class >> downloadingFrom: downloadUrl withMessage: aString into ] asJob run. ] +{ #category : #utilities } +GrafoscopioUtils class >> ensureCreateDirectory: fileNameWithRelativePath into: aFolder [ + | relativePathFolders parentFolder newPath | + relativePathFolders := (fileNameWithRelativePath splitOn: $/) allButLast. + newPath := aFolder path. + relativePathFolders do: [ :folder | newPath := newPath / folder ]. + parentFolder := newPath asFileReference. + parentFolder ensureCreateDirectory. + ^ parentFolder + +] + { #category : #'graphical interface' } GrafoscopioUtils class >> getContentsFrom: url withMessage: aString [ | client |