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: [ ifTrue: [
packageUrl := 'http://sqlite.org/2016/sqlite-tools-osx-x86-3110100.zip'. packageUrl := 'http://sqlite.org/2016/sqlite-tools-osx-x86-3110100.zip'.
sha1 := 'c78b3b92bd37554694d2f73dbecfef1902c15ba7']. sha1 := 'c78b3b92bd37554694d2f73dbecfef1902c15ba7'].
self isSQLite32BitsInstalled
ifTrue: [ self inform: 'SQLite ya está instalado en el sistema' ]
ifFalse: [
GrafoscopioBrowser GrafoscopioBrowser
downloadingFrom: packageUrl downloadingFrom: packageUrl
withMessage: 'Descargando SQLite...' withMessage: 'Descargando SQLite...'
into: localPath asFileReference. into: localPath asFileReference.
packageZipName := (packageUrl splitOn: '/') last. packageZipName := (packageUrl splitOn: '/') last.
sha1 = (SHA1 new hashMessage: (localPath / packageZipName) asFileReference binaryReadStream contents) hex 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' ] ifFalse: [ self inform: 'SQLite: Descarga no exitosa.
Por favor intente el procedimiento de nuevo o manualmente']
ifTrue: [ ifTrue: [
ZipArchive new ZipArchive new
readFrom: (localPath / packageZipName); readFrom: (localPath / packageZipName);
extractAllTo: localPath asFileReference. extractAllTo: localPath asFileReference.
unzippedFolder := packageZipName copyReplaceAll: '.zip' with: ''. unzippedFolder := packageZipName copyReplaceAll: '.zip' with: ''.
(localPath / unzippedFolder ) children do: [:file | file moveTo: (localPath / file basenameWithIndicator)]. (localPath / unzippedFolder ) children do:
[:file | file moveTo: (localPath / file basenameWithIndicator)].
(localPath / 'sqlite3') copyTo: (localPath / 'libsqlite3.so'). (localPath / 'sqlite3') copyTo: (localPath / 'libsqlite3.so').
(localPath / unzippedFolder ) deleteAll. (localPath / unzippedFolder ) deleteAll.
self inform: 'SQLite instalado existosammente!' self inform: 'SQLite instalado existosammente!'
]. ].
"Cleaning leftovers" "Cleaning leftovers"
(localPath / packageZipName) delete. (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 := MenuMorph new.
updateMenu updateMenu
add: 'Grafoscopio' target: GrafoscopioBrowser selector: #updateGrafoscopio; add: 'Grafoscopio' target: GrafoscopioBrowser selector: #updateGrafoscopioUI;
add: 'Documentación' target: GrafoscopioBrowser selector: #updateDocumentation; add: 'Documentación' target: GrafoscopioBrowser selector: #updateDocumentationUI;
add: 'Paquete DataViz' target: GrafoscopioBrowser selector: #updateDataviz; add: 'Paquete DataViz' target: GrafoscopioBrowser selector: #updateDatavizUI;
add: 'Base de datos' target: ExternalApp selector: #installSQLite32Bits; add: 'Base de datos' target: ExternalApp selector: #installSQLite32BitsUI;
add: 'Ruta a pandoc' target: ExternalApp selector: #configurePandoc; add: 'Ruta a pandoc' target: ExternalApp selector: #configurePandoc;
add: 'Ruta a fossil' target: ExternalApp selector: #configureFossil; add: 'Ruta a fossil' target: ExternalApp selector: #configureFossil;
add: 'Todo el sistema' target: GrafoscopioBrowser selector: #updateSystem. add: 'Todo el sistema' target: GrafoscopioBrowser selector: #updateSystem.
@ -347,8 +347,18 @@ GrafoscopioBrowser class >> startDockingBar [
{ #category : #updating } { #category : #updating }
GrafoscopioBrowser class >> updateDataviz [ GrafoscopioBrowser class >> updateDataviz [
"Updates Dataviz package with new versions of itself take from the source code repository and "I'm update the Dataviz package with new versions of itself take from the source code repository.
the User Interface" 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 |
update := (UIManager default update := (UIManager default
@ -356,59 +366,42 @@ GrafoscopioBrowser class >> updateDataviz [
title: 'Actualizar paquete Dataviz'). title: 'Actualizar paquete Dataviz').
update ifNotNil: [ update ifNotNil: [
update update
ifTrue: [ ifTrue: [self updateDataviz]
"Data visualization helpers" ifFalse: [self inform: 'Actualización del paquete dataviz no realizada']]
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']]
] ]
{ #category : #updating } { #category : #updating }
GrafoscopioBrowser class >> updateDocumentation [ GrafoscopioBrowser class >> updateDocumentation [
"Updates documentation (manual, tutorials) from official repository" "Updates documentation (manual, tutorials) from official repository"
| update docs unnecessaryUpdate | | docs |
docs := #('tutorial' 'manual'). docs := #('tutorial' 'manual').
update := (UIManager default
confirm: '¿Desea actualizar la documentación?'
label: 'Actualizar documentación').
update
ifTrue: [
docs do: [ :eachDoc | docs do: [ :eachDoc |
(self isDocUpdatedFor: eachDoc) (self isDocUpdatedFor: eachDoc)
ifFalse: [ self docDownloadFor: eachDoc] ifFalse: [ self docDownloadFor: eachDoc]
ifTrue: [ ifTrue: [
unnecessaryUpdate := UIManager default self inform:
abort: 'El ', eachDoc,' ya se encuentra en su versión más reciente.' 'NADA QUE ACTUALIZAR!', String cr,
title: 'Nada que actualizar!' '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 |
update := (UIManager default
confirm: '¿Desea actualizar la documentación?'
label: 'Actualizar documentación').
update ifTrue: [self updateDocumentation]
]
{ #category : #updating } { #category : #updating }
GrafoscopioBrowser class >> updateGrafoscopio [ 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 "Updates Grafoscopio with new versions of itself take from the source code repository and
the User Interface" the User Interface"
Gofer new Gofer new
@ -419,21 +412,20 @@ GrafoscopioBrowser class >> updateGrafoscopioScript [
] ]
{ #category : #updating } { #category : #updating }
GrafoscopioBrowser class >> updatePrerrequisites [ GrafoscopioBrowser class >> updateGrafoscopioUI [
"Updates the system prerequisites with new versions of itself take from the source code repository" "Updates Grafoscopio with new versions of itself take from the source code repository and
the User Interface"
| update | | update |
update := (UIManager default update := (UIManager default
question: '¿Desea actualizar los prerrequisitos de grafoscopio?' question: '¿Desea actualizar grafoscopio?'
title: 'Actualizar prerrequisitos de grafoscopio'). title: 'Actualizar grafoscopio').
update ifNotNil: [ update ifNotNil: [
update update
ifTrue: [ ifTrue: [
self updatePrerrequisitesScript. self updateGrafoscopio.
self inform: 'Actualización de prerrequisitos terminada' self inform: 'Actualización de grafoscopio terminada']
] ifFalse: [self inform: 'Actualización de grafoscopio no realizada']]
ifFalse: [ self inform: 'Actualización de prerrequisitos NO realizada' ]
]
] ]
{ #category : #updating } { #category : #updating }
@ -522,21 +514,21 @@ GrafoscopioBrowser class >> updateSystem [
title: 'Actualizar grafoscopio'). title: 'Actualizar grafoscopio').
update ifNotNil: [ update ifNotNil: [
update update
ifFalse: [ self inform: 'Actualización de todo el sistema NO realizada.' ]
ifTrue: [ ifTrue: [
self updatePrerrequisitesScript. self
self updateGrafoscopioScript. updateGrafoscopio;
updateDocumentation;
updateDataviz.
ExternalApp installSQLite32Bits.
self inform: 'Actualización de todo el sistema terminada.'] self inform: 'Actualización de todo el sistema terminada.']
ifFalse: [
self inform: 'Actualización de todo el sistema NO realizada.' ]
] ]
] ]
{ #category : #updating } { #category : #updating }
GrafoscopioBrowser class >> updateUI [ GrafoscopioBrowser class >> updateUI [
"Updates the User Interface (UI) with new versions of the docking bar or logos where available. Helpful while testing new functionality "I update the User Interface (UI) with new versions of the docking bar or logos where available.
that should be expossed to the user via the UI" I'm helpful while testing new functionality that should be expossed to the user via the UI"
dockingBar delete. dockingBar delete.
self startDockingBar. self startDockingBar.