diff --git a/repository/Grafoscopio/GrafoscopioDocumentation.class.st b/repository/Grafoscopio/GrafoscopioDocumentation.class.st index e5a4579..86e02c1 100644 --- a/repository/Grafoscopio/GrafoscopioDocumentation.class.st +++ b/repository/Grafoscopio/GrafoscopioDocumentation.class.st @@ -22,12 +22,30 @@ GrafoscopioDocumentation class >> current [ | gfcDocumentation | gfcDocumentation := self new. gfcDocumentation repository: (FossilRepo new url: 'http://mutabit.com/repos.fossil/grafoscopio'). - gfcDocumentation documents add: 'Docs/Es/Tutoriales/tutorial.ston'. + gfcDocumentation documents + add: 'Docs/Es/Tutoriales/tutorial.ston'; + add: 'Docs/Es/Manual/manual-grafoscopio.ston'; + add: 'Docs/En/dev-notes.ston'. gfcDocumentation localPlace. ^ gfcDocumentation ] +{ #category : #updating } +GrafoscopioDocumentation class >> download: fileNameWithRelativePath [ + | fileName relativePathFolders newPath parentFolder | + fileName := (fileNameWithRelativePath splitOn: $/) last. + relativePathFolders := (fileNameWithRelativePath splitOn: $/) allButLast. + newPath := self current localPlace path. + relativePathFolders do: [ :folder | newPath := newPath / folder ]. + parentFolder := newPath asFileReference. + parentFolder exists ifFalse: [ parentFolder ensureCreateDirectory ]. + GrafoscopioGUI + downloadingFrom: self current repository url asString, '/doc/tip/', fileNameWithRelativePath + withMessage: 'Downloading ', fileName + into: parentFolder +] + { #category : #updating } GrafoscopioDocumentation class >> isUpdated [ ^ (self listOutdated size > 0) ifTrue: [ ^ false ] ifFalse: [ ^ true ] @@ -50,6 +68,16 @@ GrafoscopioDocumentation class >> listOutdated [ ^ self current documents select: [ :doc | (self isUpdatedFor: doc) = false ] ] +{ #category : #updating } +GrafoscopioDocumentation class >> update [ + self isUpdated + ifTrue: [ self inform: 'All documents are already updated' ] + ifFalse: [ + self listOutdated do: [ :eachDoc | self download: eachDoc ]. + self inform: 'Documentation updating finished'] + +] + { #category : #accessing } GrafoscopioDocumentation >> documents [ ^ documents ifNil: [ documents := OrderedCollection new ] diff --git a/repository/Grafoscopio/GrafoscopioGUI.class.st b/repository/Grafoscopio/GrafoscopioGUI.class.st index 0b0e6d7..ec81918 100644 --- a/repository/Grafoscopio/GrafoscopioGUI.class.st +++ b/repository/Grafoscopio/GrafoscopioGUI.class.st @@ -301,31 +301,6 @@ GrafoscopioGUI class >> initialize [ self startDockingBar. ] -{ #category : #updating } -GrafoscopioGUI class >> isDocUpdatedFor: aDocumentType [ - "I compare the cryptografic signatures of the local copy of aDocumentType and the remote one to see if the're - the same, in which case I return True or False in any other cases. - aDocumentType is a string that can be 'tutorial' or 'manual' according to the type of document - we're querying for. - Now documentation is mainly on Spanish. When support for multiple languages be enabled this method needs - revision" - | folderLastContents lastRemoteTutorial localTutorial docInfo | - (aDocumentType = 'tutorial') ifTrue: [ docInfo := self docDataTutorial ]. - (aDocumentType = 'manual') ifTrue: [ docInfo := self docDataManual ]. - localTutorial := FileLocator documents / 'Grafoscopio', (docInfo at: 'relativePath'), (docInfo at: 'filename'). - localTutorial exists - ifFalse: [ - self docDownloadFor: 'tutorial'. - ^ true. - ] - ifTrue: [ - folderLastContents := NeoJSONReader fromString: - (ZnEasy get: (docInfo at: 'remoteRepo'), 'json/dir?ci=tip&name=', (docInfo at: 'relativePath')) contents. - lastRemoteTutorial := ((folderLastContents at: 'payload') at: 'entries') - detect: [:entry | (entry at: 'name') = (docInfo at: 'filename') ]. - ^ (lastRemoteTutorial at: 'uuid') = (SHA1 new hashMessage: (localTutorial asFileReference contents)) hex] -] - { #category : #'graphical interface' } GrafoscopioGUI class >> messageAbout [ "Shows the author, license, sponsors and main contributors to the project and point to further documentation on the web"