Updating System: improving it and making it more modular and user friendlier, by decoupling User Interface, from 'command line' options so the user can select between granular updates or making an unattended update.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2016-03-26 18:51:40 +00:00
parent d433a8a414
commit 41f8485124
2 changed files with 102 additions and 84 deletions

View File

@ -60,23 +60,49 @@ ExternalApp class >> installSQLite32Bits [
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.
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
]

View File

@ -318,10 +318,10 @@ GrafoscopioBrowser class >> startDockingBar [
updateMenu := MenuMorph new.
updateMenu
add: 'Grafoscopio' target: GrafoscopioBrowser selector: #updateGrafoscopio;
add: 'Documentación' target: GrafoscopioBrowser selector: #updateDocumentation;
add: 'Paquete DataViz' target: GrafoscopioBrowser selector: #updateDataviz;
add: 'Base de datos' target: ExternalApp selector: #installSQLite32Bits;
add: 'Grafoscopio' target: GrafoscopioBrowser selector: #updateGrafoscopioUI;
add: 'Documentación' target: GrafoscopioBrowser selector: #updateDocumentationUI;
add: 'Paquete DataViz' target: GrafoscopioBrowser selector: #updateDatavizUI;
add: 'Base de datos' target: ExternalApp selector: #installSQLite32BitsUI;
add: 'Ruta a pandoc' target: ExternalApp selector: #configurePandoc;
add: 'Ruta a fossil' target: ExternalApp selector: #configureFossil;
add: 'Todo el sistema' target: GrafoscopioBrowser selector: #updateSystem.
@ -347,8 +347,18 @@ GrafoscopioBrowser class >> startDockingBar [
{ #category : #updating }
GrafoscopioBrowser class >> updateDataviz [
"Updates Dataviz package with new versions of itself take from the source code repository and
the User Interface"
"I'm update the Dataviz package with new versions of itself take from the source code repository.
DataViz contains Data visualization helpers"
Gofer it
smalltalkhubUser: 'Offray' project: 'Dataviz';
configurationOf: 'Dataviz';
loadVersion: #stable.
self inform: 'Actualización del paquete Dataviz terminada'
]
{ #category : #updating }
GrafoscopioBrowser class >> updateDatavizUI [
"I'm the User Interface for updating the Dataviz package with new versions of itself take from the source code repository"
| update |
update := (UIManager default
@ -356,59 +366,42 @@ GrafoscopioBrowser class >> updateDataviz [
title: 'Actualizar paquete Dataviz').
update ifNotNil: [
update
ifTrue: [
"Data visualization helpers"
Gofer it
smalltalkhubUser: 'Offray' project: 'Dataviz';
configurationOf: 'Dataviz';
loadVersion: #stable.
self inform: 'Actualización del paquete Dataviz terminada']
ifFalse: [self inform: 'Actualización de grafoscopio no realizada']]
ifTrue: [self updateDataviz]
ifFalse: [self inform: 'Actualización del paquete dataviz no realizada']]
]
{ #category : #updating }
GrafoscopioBrowser class >> updateDocumentation [
"Updates documentation (manual, tutorials) from official repository"
| update docs unnecessaryUpdate |
| docs |
docs := #('tutorial' 'manual').
docs do: [ :eachDoc |
(self isDocUpdatedFor: eachDoc)
ifFalse: [ self docDownloadFor: eachDoc]
ifTrue: [
self inform:
'NADA QUE ACTUALIZAR!', String cr,
'El ', eachDoc,' ya se encuentra en su versión más reciente.'
]
]
]
{ #category : #updating }
GrafoscopioBrowser class >> updateDocumentationUI [
"Updates documentation (manual, tutorials) from official repository"
| update |
docs := #('tutorial' 'manual').
update := (UIManager default
confirm: '¿Desea actualizar la documentación?'
label: 'Actualizar documentación').
update
ifTrue: [
docs do: [ :eachDoc |
(self isDocUpdatedFor: eachDoc)
ifFalse: [ self docDownloadFor: eachDoc]
ifTrue: [
unnecessaryUpdate := UIManager default
abort: 'El ', eachDoc,' ya se encuentra en su versión más reciente.'
title: 'Nada que actualizar!'
]
]
]
update ifTrue: [self updateDocumentation]
]
{ #category : #updating }
GrafoscopioBrowser class >> updateGrafoscopio [
"Updates Grafoscopio with new versions of itself take from the source code repository and
the User Interface"
| update |
update := (UIManager default
question: '¿Desea actualizar grafoscopio?'
title: 'Actualizar grafoscopio').
update ifNotNil: [
update
ifTrue: [
self updateGrafoscopioScript.
self inform: 'Actualización de grafoscopio terminada']
ifFalse: [self inform: 'Actualización de grafoscopio no realizada']]
]
{ #category : #updating }
GrafoscopioBrowser class >> updateGrafoscopioScript [
"Updates Grafoscopio with new versions of itself take from the source code repository and
the User Interface"
Gofer new
@ -419,21 +412,20 @@ GrafoscopioBrowser class >> updateGrafoscopioScript [
]
{ #category : #updating }
GrafoscopioBrowser class >> updatePrerrequisites [
"Updates the system prerequisites with new versions of itself take from the source code repository"
GrafoscopioBrowser class >> updateGrafoscopioUI [
"Updates Grafoscopio with new versions of itself take from the source code repository and
the User Interface"
| update |
update := (UIManager default
question: '¿Desea actualizar los prerrequisitos de grafoscopio?'
title: 'Actualizar prerrequisitos de grafoscopio').
update ifNotNil: [
update
ifTrue: [
self updatePrerrequisitesScript.
self inform: 'Actualización de prerrequisitos terminada'
]
ifFalse: [ self inform: 'Actualización de prerrequisitos NO realizada' ]
]
question: '¿Desea actualizar grafoscopio?'
title: 'Actualizar grafoscopio').
update ifNotNil: [
update
ifTrue: [
self updateGrafoscopio.
self inform: 'Actualización de grafoscopio terminada']
ifFalse: [self inform: 'Actualización de grafoscopio no realizada']]
]
{ #category : #updating }
@ -522,21 +514,21 @@ GrafoscopioBrowser class >> updateSystem [
title: 'Actualizar grafoscopio').
update ifNotNil: [
update
ifFalse: [ self inform: 'Actualización de todo el sistema NO realizada.' ]
ifTrue: [
self updatePrerrequisitesScript.
self updateGrafoscopioScript.
self
updateGrafoscopio;
updateDocumentation;
updateDataviz.
ExternalApp installSQLite32Bits.
self inform: 'Actualización de todo el sistema terminada.']
ifFalse: [
self inform: 'Actualización de todo el sistema NO realizada.' ]
]
]
{ #category : #updating }
GrafoscopioBrowser class >> updateUI [
"Updates the User Interface (UI) with new versions of the docking bar or logos where available. Helpful while testing new functionality
that should be expossed to the user via the UI"
"I update the User Interface (UI) with new versions of the docking bar or logos where available.
I'm helpful while testing new functionality that should be expossed to the user via the UI"
dockingBar delete.
self startDockingBar.