From 33407ef7ddda94039efe0eeb8926a3918d5271bd Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Wed, 5 Jul 2017 11:48:51 +0000 Subject: [PATCH] Moving GrafoscopioDocumentation to Grafoscopio-Utils package, to improve modularity and usability. --- repository/Grafoscopio/ExternalApp.class.st | 201 ------------------ .../GrafoscopioDockingBar.class.st | 2 +- .../Grafoscopio/GrafoscopioDocs.class.st | 67 ++++++ .../Grafoscopio/GrafoscopioNode.class.st | 2 +- .../Grafoscopio/GrafoscopioNotebook.class.st | 1 - 5 files changed, 69 insertions(+), 204 deletions(-) delete mode 100644 repository/Grafoscopio/ExternalApp.class.st create mode 100644 repository/Grafoscopio/GrafoscopioDocs.class.st diff --git a/repository/Grafoscopio/ExternalApp.class.st b/repository/Grafoscopio/ExternalApp.class.st deleted file mode 100644 index cce5762..0000000 --- a/repository/Grafoscopio/ExternalApp.class.st +++ /dev/null @@ -1,201 +0,0 @@ -" -I provide support for external helper apps for Grafoscopio, publishing, collaboration -and data management. -" -Class { - #name : #ExternalApp, - #superclass : #Object, - #instVars : [ - 'name', - 'url', - 'downloadUrl', - 'description', - 'sha1', - 'md5', - 'binaryLocation' - ], - #category : #'Grafoscopio-Model' -} - -{ #category : #installation } -ExternalApp class >> compareHashFor: aFileName with: aSHAString [ - - aSHAString = (SHA1 new hashMessage: aFileName asFileReference binaryReadStream contents) hex - ifFalse: [ ^ false ] - ifTrue: [ ^ true ]. -] - -{ #category : #configuration } -ExternalApp class >> configureFossil [ - "Stablish where is located fossil according to the operative system and/or the input of the user" - | fileStream fossil | - - fileStream := UIManager default fileOpen: 'Path to the fossil program binary'. - fileStream isNil ifTrue: [ ^nil ]. - fossil := fileStream name asFileReference fullName. - -] - -{ #category : #configuration } -ExternalApp class >> configurePandoc [ - "Stablish where is located pandoc according to the operative system and/or the input of the user" - | fileStream pandoc | - - fileStream := UIManager default fileOpen: 'Path to pandoc program binary'. - fileStream isNil ifTrue: [ ^nil ]. - pandoc := fileStream name asFileReference fullName. - -] - -{ #category : #installation } -ExternalApp class >> installSQLite32Bits [ - "I dowload the SQLite binary for the hosting platform, uncompress it and made it available as with the name - NBSQLite is wating for" - - | packageUrl sha1 localPath packageZipName unzippedFolder | - - localPath := FileSystem disk workingDirectory parent / 'bin'. - Smalltalk platform name = 'unix' - ifTrue: [ - packageUrl := 'http://sqlite.org/2016/sqlite-tools-linux-x86-3110100.zip'. - sha1 := '21a80cefa91d5de50256996fc55990a027c350fd']. - Smalltalk platform name = 'Win32' - ifTrue: [ - packageUrl := 'http://sqlite.org/2016/sqlite-dll-win32-x86-3110100.zip'. - sha1 := 'cfd6f64ba1fb5de1ccf8321e29764c690c25e0a0']. - Smalltalk platform name = 'Mac OS' - ifTrue: [ - packageUrl := 'http://sqlite.org/2016/sqlite-tools-osx-x86-3110100.zip'. - sha1 := 'c78b3b92bd37554694d2f73dbecfef1902c15ba7']. - self isSQLite32BitsInstalled - ifTrue: [ self inform: 'SQLite ya está instalado en el sistema' ] - ifFalse: [ - GrafoscopioBrowser - downloadingFrom: packageUrl - withMessage: 'Descargando SQLite...' - into: localPath asFileReference. - packageZipName := (packageUrl splitOn: '/') last. - sha1 = (SHA1 new hashMessage: (localPath / packageZipName) asFileReference binaryReadStream contents) hex - ifFalse: [ self inform: 'SQLite: Descarga no exitosa. - Por favor intente el procedimiento de nuevo o manualmente'] - ifTrue: [ - ZipArchive new - readFrom: (localPath / packageZipName); - extractAllTo: localPath asFileReference. - unzippedFolder := packageZipName copyReplaceAll: '.zip' with: ''. - (localPath / unzippedFolder ) children do: - [:file | file moveTo: (localPath / file basenameWithIndicator)]. - (localPath / 'sqlite3') copyTo: (localPath / 'libsqlite3.so'). - (localPath / unzippedFolder ) deleteAll. - self inform: 'SQLite instalado existosammente!' - ]. - "Cleaning leftovers" - (localPath / packageZipName) delete - ] -] - -{ #category : #configuration } -ExternalApp class >> installSQLite32BitsUI [ - "I verify if SQLite for 32 bits is installed in the proper location. If yes, I inform that. If not, - I made the installation" - | install | - install := (UIManager default - confirm: '¿Desea instalar el motor de base de datos (SQLite)?' - label: 'Instalar base de datos?'). - install ifTrue: [self installSQLite32Bits] - -] - -{ #category : #installation } -ExternalApp class >> isSQLite32BitsInstalled [ - "I verify if the SQLite binary for the hosting platform is installed" - - ^ (FileSystem disk workingDirectory parent / 'bin' / 'libsqlite3.so') asFileReference exists - -] - -{ #category : #configuration } -ExternalApp class >> pandoc [ - "I define where the pandoc external app is located" - | app | - app := ExternalApp new - name: 'pandoc'; - url: 'http://pandoc.org'; - description: 'Pandoc is a free and open-source software document converter, widely used as a writing tool (especially by scholars) and as a basis for publishing workflows. It was originally created by John MacFarlane, a philosophy professor at the University of California, Berkeley. (from https://en.wikipedia.org/wiki/Pandoc)'. - app binaryLocation: '/usr/bin/pandoc' asFileReference. - ^ app - - - - -] - -{ #category : #accessing } -ExternalApp >> binaryLocation [ - ^ binaryLocation -] - -{ #category : #accessing } -ExternalApp >> binaryLocation: anObject [ - binaryLocation := anObject -] - -{ #category : #accessing } -ExternalApp >> description [ - ^ description -] - -{ #category : #accessing } -ExternalApp >> description: anObject [ - description := anObject -] - -{ #category : #accessing } -ExternalApp >> downloadUrl [ - ^ downloadUrl -] - -{ #category : #accessing } -ExternalApp >> downloadUrl: anObject [ - downloadUrl := anObject -] - -{ #category : #accessing } -ExternalApp >> md5 [ - ^ md5 -] - -{ #category : #accessing } -ExternalApp >> md5: anObject [ - md5 := anObject -] - -{ #category : #accessing } -ExternalApp >> name [ - ^ name -] - -{ #category : #accessing } -ExternalApp >> name: anObject [ - name := anObject -] - -{ #category : #accessing } -ExternalApp >> sha1 [ - ^ sha1 -] - -{ #category : #accessing } -ExternalApp >> sha1: anObject [ - sha1 := anObject -] - -{ #category : #accessing } -ExternalApp >> url [ - ^ url -] - -{ #category : #accessing } -ExternalApp >> url: anObject [ - url := anObject -] diff --git a/repository/Grafoscopio/GrafoscopioDockingBar.class.st b/repository/Grafoscopio/GrafoscopioDockingBar.class.st index b896725..0326909 100644 --- a/repository/Grafoscopio/GrafoscopioDockingBar.class.st +++ b/repository/Grafoscopio/GrafoscopioDockingBar.class.st @@ -434,7 +434,7 @@ GrafoscopioDockingBar class >> start [ add: 'Tutorial (Spanish)' target: GrafoscopioDocumentation selector: #openTutorial; add: 'Manual' target: GrafoscopioDocumentation selector: #openManual; add: 'Manual (PDF)' target: GrafoscopioDocumentation selector: #openPDFManual; - add: 'Dataviz' target: GrafoscopioDocumentation selector: #openDatavizIntro; + add: 'Dataviz' target: (DatavizDocs new) selector: #openIntroNotebook; add: 'Dev''s notes' target: GrafoscopioDocumentation selector: #openDevNotes; add: 'About Grafoscopio' target: self selector: #messageAbout. diff --git a/repository/Grafoscopio/GrafoscopioDocs.class.st b/repository/Grafoscopio/GrafoscopioDocs.class.st new file mode 100644 index 0000000..9c14f4d --- /dev/null +++ b/repository/Grafoscopio/GrafoscopioDocs.class.st @@ -0,0 +1,67 @@ +" +I define the documentation for the Grafoscopio package. +" +Class { + #name : #GrafoscopioDocs, + #superclass : #Object, + #category : #Grafoscopio +} + +{ #category : #initialization } +GrafoscopioDocs class >> defineDocumentation [ + "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 := GrafoscopioDocumentation new. + gfcDocumentation + name: 'grafoscopio'; + repository: (FossilRepo new remote: 'http://mutabit.com/repos.fossil/grafoscopio'); + localPlace: FileLocator workingDirectory asFileReference /'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 +] + +{ #category : #initialization } +GrafoscopioDocs class >> initialize [ + self defineDocumentation +] + +{ #category : #operation } +GrafoscopioDocs class >> openDevNotes [ + "I'm just an alias to ease the operation. I need to know wich is the index of the notebook + I want to open, as defined on defineDocumentation method." + | docs | + docs := self defineDocumentation. + docs openNotebookAt: 3 +] + +{ #category : #operation } +GrafoscopioDocs class >> openManual [ + "I'm just an alias to ease the operation. I need to know wich is the index of the notebook + I want to open, as defined on defineDocumentation method." + | docs | + docs := self defineDocumentation. + docs openNotebookAt: 2 +] + +{ #category : #operation } +GrafoscopioDocs class >> openPDFManual [ + "I open the documentation in PDF format." + | pdfManual docs | + docs := self defineDocumentation. + pdfManual := docs documents at: 4. + WebBrowser openOn: (docs localPlace / pdfManual) fullName. +] + +{ #category : #operation } +GrafoscopioDocs class >> openTutorial [ + "I open the proper notebook in the adecuate documentation." + | docs | + docs := self defineDocumentation. + docs openNotebookAt: 1 +] diff --git a/repository/Grafoscopio/GrafoscopioNode.class.st b/repository/Grafoscopio/GrafoscopioNode.class.st index 11db8e6..ee5507b 100644 --- a/repository/Grafoscopio/GrafoscopioNode.class.st +++ b/repository/Grafoscopio/GrafoscopioNode.class.st @@ -520,7 +520,7 @@ GrafoscopioNode >> icon: aSymbol [ { #category : #initialization } GrafoscopioNode >> initialize [ - "Creates a empty new node" + "I create a empty new node" super initialize. self diff --git a/repository/Grafoscopio/GrafoscopioNotebook.class.st b/repository/Grafoscopio/GrafoscopioNotebook.class.st index 089357d..4f1aee9 100644 --- a/repository/Grafoscopio/GrafoscopioNotebook.class.st +++ b/repository/Grafoscopio/GrafoscopioNotebook.class.st @@ -34,7 +34,6 @@ GrafoscopioNotebook class >> SHA1For: aFile is: aSHA1String [ { #category : #specs } GrafoscopioNotebook class >> defaultSpec [ - "comment stating purpose of message" ^ SpecLayout composed newColumn: [:tcol|