2017-07-03 22:12:09 +00:00
|
|
|
"
|
|
|
|
I model a documentation object for Grafoscopio.
|
|
|
|
Documents are stored in a fossil repository and have
|
|
|
|
relative paths to it.
|
|
|
|
"
|
|
|
|
Class {
|
|
|
|
#name : #GrafoscopioDocumentation,
|
|
|
|
#superclass : #Object,
|
|
|
|
#instVars : [
|
|
|
|
'repository',
|
|
|
|
'documents',
|
2017-07-04 14:24:31 +00:00
|
|
|
'localPlace',
|
|
|
|
'name'
|
2017-07-03 22:12:09 +00:00
|
|
|
],
|
|
|
|
#category : #'Grafoscopio-Utils'
|
|
|
|
}
|
|
|
|
|
|
|
|
{ #category : #queries }
|
|
|
|
GrafoscopioDocumentation class >> current [
|
|
|
|
"I model the important documents that belong to the Grafoscopio documentation.
|
|
|
|
When more documents become more mature and usable, I will include them."
|
|
|
|
|
|
|
|
| gfcDocumentation |
|
|
|
|
gfcDocumentation := self new.
|
|
|
|
gfcDocumentation repository: (FossilRepo new remote: 'http://mutabit.com/repos.fossil/grafoscopio').
|
|
|
|
gfcDocumentation documents
|
|
|
|
add: 'Docs/Es/Tutoriales/tutorial.ston';
|
|
|
|
add: 'Docs/En/Books/Manual/manual.ston';
|
|
|
|
add: 'Docs/En/dev-notes.ston';
|
|
|
|
add: 'Docs/En/Books/Manual/manual.pdf'.
|
|
|
|
gfcDocumentation localPlace.
|
|
|
|
^ gfcDocumentation
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #operation }
|
|
|
|
GrafoscopioDocumentation class >> dataviz [
|
|
|
|
"I model the important documents that belong to the Grafoscopio documentation.
|
|
|
|
When more documents become more mature and usable, I will include them."
|
|
|
|
|
|
|
|
| gfcDocumentation |
|
|
|
|
gfcDocumentation := self new.
|
|
|
|
gfcDocumentation repository: (FossilRepo new remote: 'http://mutabit.com/repos.fossil/grafoscopio').
|
|
|
|
gfcDocumentation documents
|
|
|
|
add: 'Packages/Dataviz/dataviz.ston'.
|
|
|
|
gfcDocumentation localPlace.
|
|
|
|
^ gfcDocumentation
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #updating }
|
|
|
|
GrafoscopioDocumentation class >> initialize [
|
|
|
|
self
|
|
|
|
update: 'current';
|
|
|
|
update: 'dataviz'
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #updating }
|
|
|
|
GrafoscopioDocumentation class >> listOutdatedDocsIn: aDocumentsListName [
|
|
|
|
"I return the list of all documentent where the local copy and the remote copy doesn't match"
|
|
|
|
aDocumentsListName ifNil: [ ^ self ].
|
|
|
|
aDocumentsListName ifEmpty: [ ^ self ].
|
|
|
|
^ (self perform: aDocumentsListName asSymbol) documents reject: [ :doc | (self isFileUpdatedFor: doc) ]
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #updating }
|
|
|
|
GrafoscopioDocumentation class >> listOutdatedIn: aGrafoscopioDocumentation [
|
|
|
|
"I return the list of all documentent where the local copy and the remote copy doesn't match"
|
|
|
|
self listOutdatedDocsIn: (self perform: aGrafoscopioDocumentation) documents
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #operation }
|
|
|
|
GrafoscopioDocumentation class >> openDatavizIntro [
|
|
|
|
self openNotebookFrom: 'dataviz' At: 1
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #operation }
|
|
|
|
GrafoscopioDocumentation class >> openDevNotes [
|
|
|
|
self openNotebookFrom: 'current' At: 3
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #operation }
|
|
|
|
GrafoscopioDocumentation class >> openManual [
|
|
|
|
"I open the proper notebook in the adecuate documentation."
|
|
|
|
self openNotebookFrom: 'current' At: 2
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #operation }
|
|
|
|
GrafoscopioDocumentation class >> openNotebookFrom: aDocumentation At: index [
|
|
|
|
"I open a notebook included with the documentation, located at a given index"
|
|
|
|
| notebookTemp gfcDocs |
|
|
|
|
gfcDocs := self perform: aDocumentation asSymbol.
|
|
|
|
(index between: 1 and: gfcDocs documents size)
|
|
|
|
ifFalse: [ ^ self ]
|
|
|
|
ifTrue: [
|
|
|
|
notebookTemp := (gfcDocs localPlace fullName, '/', (gfcDocs documents at: index)) asFileReference.
|
|
|
|
notebookTemp exists
|
|
|
|
ifTrue: [GrafoscopioNotebook new openFromFile: notebookTemp]
|
|
|
|
ifFalse: [ self updateUIFor: aDocumentation ]]
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #operation }
|
|
|
|
GrafoscopioDocumentation class >> openPDFManual [
|
|
|
|
"I open the documentation in PDF format. I only work on Unix right now, but in the future my creator hopes to be able
|
|
|
|
to have truly multiplatform support"
|
|
|
|
| pdfManual docs |
|
|
|
|
docs := self current.
|
|
|
|
pdfManual := docs documents at: 4.
|
|
|
|
WebBrowser openOn: (docs localPlace / pdfManual) fullName.
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #operation }
|
|
|
|
GrafoscopioDocumentation class >> openTutorial [
|
|
|
|
"I open the proper notebook in the adecuate documentation."
|
|
|
|
self openNotebookFrom: 'current' At: 1
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #updating }
|
|
|
|
GrafoscopioDocumentation class >> update: aDocumentationName [
|
|
|
|
(self listOutdatedDocsIn: aDocumentationName)
|
|
|
|
ifEmpty: [
|
|
|
|
self inform: 'All documents in the ', aDocumentationName,' collection are already updated'.
|
|
|
|
^ self ]
|
|
|
|
ifNotEmpty: [:outdatedDocs |
|
|
|
|
outdatedDocs do: [ :eachDoc | self download: eachDoc].
|
|
|
|
self inform: 'Updating of ', aDocumentationName,' documentation finished.' ]
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #operation }
|
|
|
|
GrafoscopioDocumentation class >> updateAll [
|
|
|
|
self
|
|
|
|
update: 'current';
|
|
|
|
update: 'dataviz'
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #updating }
|
|
|
|
GrafoscopioDocumentation class >> updateAllUI [
|
|
|
|
"Updates documentation (manual, tutorials) from the official repository for a given documentation."
|
|
|
|
| update |
|
|
|
|
update := (UIManager default
|
|
|
|
confirm: 'Do you wish to update the documentation?'
|
|
|
|
label: 'Update documentation').
|
|
|
|
update
|
|
|
|
ifTrue: [ self updateAll ]
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #updating }
|
|
|
|
GrafoscopioDocumentation class >> updateDocsPlaceUI [
|
|
|
|
self current localPlace: (UIManager default chooseDirectory: 'Path to the documentation folder')
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #updating }
|
|
|
|
GrafoscopioDocumentation class >> updateUIFor: aDocumentationName [
|
|
|
|
"Updates documentation (manual, tutorials) from the official repository for a given documentation."
|
|
|
|
| update |
|
|
|
|
update := (UIManager default
|
|
|
|
confirm: 'Do you wish to update the ', aDocumentationName,' documentation?'
|
|
|
|
label: 'Update ', aDocumentationName, ' documentation').
|
|
|
|
update ifTrue: [ self update: aDocumentationName ]
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioDocumentation >> documents [
|
|
|
|
^ documents ifNil: [ documents := OrderedCollection new ]
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioDocumentation >> documents: anObject [
|
|
|
|
documents := anObject
|
|
|
|
]
|
|
|
|
|
2017-07-04 14:24:31 +00:00
|
|
|
{ #category : #updating }
|
|
|
|
GrafoscopioDocumentation >> download: fileNameWithRelativePath [
|
|
|
|
| fileName relativePathFolders newPath 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 ].
|
|
|
|
GrafoscopioUtils
|
|
|
|
downloadingFrom: self repository remote asString, '/doc/tip/', fileNameWithRelativePath
|
|
|
|
withMessage: 'Downloading ', fileName
|
|
|
|
into: parentFolder
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #updating }
|
|
|
|
GrafoscopioDocumentation >> isFileUpdatedFor: relativeFilePath [
|
|
|
|
"I compare if the local and remote copies of a relativeFilePath are updated for the current
|
|
|
|
documentation and return true if they are and false in any other case"
|
|
|
|
| localFile |
|
|
|
|
localFile := self localPlace / relativeFilePath.
|
|
|
|
localFile exists
|
|
|
|
ifFalse: [ ^ false ]
|
|
|
|
ifTrue: [
|
|
|
|
^ ExternalApp
|
|
|
|
compareHashFor: localFile
|
|
|
|
with: (self repository lastHashNumberFor: relativeFilePath) ]
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #updating }
|
|
|
|
GrafoscopioDocumentation >> listOutdatedDocs [
|
|
|
|
"I return the list of all documentent where the local copy and the remote copy doesn't match"
|
|
|
|
^ self documents reject: [ :doc | (self isFileUpdatedFor: doc) ]
|
|
|
|
]
|
|
|
|
|
2017-07-03 22:12:09 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioDocumentation >> localPlace [
|
|
|
|
^ localPlace ifNil: [
|
2017-07-04 14:24:31 +00:00
|
|
|
localPlace := FileLocator workingDirectory asFileReference / 'Grafoscopio' ].
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioDocumentation >> localPlace: aFileDirectory [
|
|
|
|
localPlace := aFileDirectory.
|
|
|
|
self localPlace exists ifFalse: [ self localPlace ensureCreateDirectory ].
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioDocumentation >> name [
|
|
|
|
^ name
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioDocumentation >> name: anObject [
|
|
|
|
name := anObject
|
2017-07-03 22:12:09 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
2017-07-04 14:24:31 +00:00
|
|
|
GrafoscopioDocumentation >> openNotebookAt: index [
|
|
|
|
"I open a notebook included with the documentation, located at a given index (anInteger)"
|
|
|
|
| notebookTemp |
|
|
|
|
(index between: 1 and: self documents size)
|
|
|
|
ifFalse: [ ^ self ]
|
|
|
|
ifTrue: [
|
|
|
|
notebookTemp := (self localPlace fullName, '/', (self documents at: index)) asFileReference.
|
|
|
|
notebookTemp exists
|
|
|
|
ifTrue: [GrafoscopioNotebook new openFromFile: notebookTemp]
|
|
|
|
ifFalse: [ self updateUI ]]
|
2017-07-03 22:12:09 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioDocumentation >> repository [
|
|
|
|
^ repository
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
GrafoscopioDocumentation >> repository: anObject [
|
|
|
|
repository := anObject
|
|
|
|
]
|
2017-07-04 14:24:31 +00:00
|
|
|
|
|
|
|
{ #category : #updating }
|
|
|
|
GrafoscopioDocumentation >> update [
|
|
|
|
(self listOutdatedDocs)
|
|
|
|
ifEmpty: [
|
|
|
|
self inform: 'All documents in the ', self name,' collection are already updated'.
|
|
|
|
^ self ]
|
|
|
|
ifNotEmpty: [:outdatedDocs |
|
|
|
|
outdatedDocs do: [ :eachDoc | self download: eachDoc].
|
|
|
|
self inform: 'Updating of ', self name,' documentation finished.' ]
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #updating }
|
|
|
|
GrafoscopioDocumentation >> updateUI [
|
|
|
|
"Updates documentation (manual, tutorials) from the official repository for a given documentation."
|
|
|
|
| update |
|
|
|
|
update := (UIManager default
|
|
|
|
confirm: 'Do you wish to update the ', self name,' documentation?'
|
|
|
|
label: 'Update ', self name, ' documentation').
|
|
|
|
update ifTrue: [ self update ]
|
|
|
|
]
|