ExternalApp: introducing support for modelling external apps (installation, configuration, etc), starting with SQLite (then fossil and pandoc follow :-))

This commit is contained in:
Offray Vladimir Luna Cárdenas 2016-03-21 12:59:36 +00:00
parent 7d32f4eb1d
commit a6bf43ab04
2 changed files with 86 additions and 62 deletions

View File

@ -0,0 +1,82 @@
"
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'
],
#category : #'Grafoscopio-Model'
}
{ #category : #configuration }
ExternalApp class >> configureFossil [
"Stablish where is located pandoc according to the operative system and/or the input of the user"
| fileStream fossil |
fileStream := UITheme builder
fileOpen: 'Coloque la ruta de pandoc'.
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 := UITheme builder
fileOpen: 'Coloque la ruta de pandoc'.
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'].
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.
]

View File

@ -1,5 +1,5 @@
"
An UbakyeExplorer is a graphical interface for showing trees and outlines.
I am a graphical interface for showing trees, outlines and grafoscopio notebooks.
Instance Variables
browser: <Object>
@ -35,32 +35,6 @@ Class {
#category : #'Grafoscopio-UI'
}
{ #category : #configuration }
GrafoscopioBrowser class >> configureFossil [
"Stablish where is located fossil according to the operative system and the input of the user"
| fileStream |
fileStream := UITheme builder
fileOpen: 'Coloque la ruta de fossil'.
fileStream isNil ifTrue: [ ^nil ].
fossil := fileStream name asFileReference fullName.
]
{ #category : #configuration }
GrafoscopioBrowser class >> configurePandoc [
"Stablish where is located pandoc according to the operative system and/or the input of the user"
| fileStream |
fileStream := UITheme builder
fileOpen: 'Coloque la ruta de pandoc'.
fileStream isNil ifTrue: [ ^nil ].
pandoc := fileStream name asFileReference fullName.
]
{ #category : #configuration }
GrafoscopioBrowser class >> configureSettings [
"I stablish several 'global' settings according to to image location and the operative system.
@ -132,38 +106,6 @@ GrafoscopioBrowser class >> downloadingFrom: downloadUrl withMessage: aString in
] asJob run.
]
{ #category : #configuration }
GrafoscopioBrowser 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 |
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
downloadingFrom: packageUrl
withMessage: 'Descargando SQLite...'
into: localPath asFileReference.
packageZipName := (packageUrl splitOn: '/') last.
ZipArchive new
readFrom: (localPath / packageZipName);
extractAllTo: localPath asFileReference.
(localPath / (packageZipName copyReplaceAll: '.zip' with: '')) children do: [:file | file moveTo: (localPath / file basenameWithIndicator) ]
]
{ #category : #'graphical interface' }
GrafoscopioBrowser class >> messageAbout [
"Shows the author, license, sponsors and main contributors to the project and point to further documentation on the web"
@ -327,8 +269,8 @@ GrafoscopioBrowser class >> startDockingBar [
add: 'Documentación > Tutorial' target: GrafoscopioBrowser selector: #updateTutorial;
add: 'Documentación > Toda' target: GrafoscopioBrowser selector: #updateDocumentation;
add: 'Herramientas externas' target: GrafoscopioBrowser selector: #messageNotImplementedYet;
add: 'Ruta a pandoc' target: GrafoscopioBrowser selector: #configurePandoc;
add: 'Ruta a fossil' target: GrafoscopioBrowser selector: #configureFossil;
add: 'Ruta a pandoc' target: ExternalApp selector: #configurePandoc;
add: 'Ruta a fossil' target: ExternalApp selector: #configureFossil;
add: 'Todo el sistema' target: GrafoscopioBrowser selector: #updateSystem.
helpMenu := MenuMorph new.
@ -824,7 +766,7 @@ GrafoscopioBrowser >> exportAsPdf [
self inform: 'Archivo exportado como pdf en: ', pdfFileLocation.].
Smalltalk platform name = 'Win32'
ifTrue: [ OSProcess command: pandoc, ' ', markdownFileLocation , ' -o ' , pdfFileLocation ]]
ifFalse: [GrafoscopioBrowser configurePandoc ].
ifFalse: [ExternalApp configurePandoc ].
self customKeys.