Updating tutorial: renaming and looking for redundant code.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2016-02-26 12:47:00 +00:00
parent d88842bc61
commit c6db8be8cd

View File

@ -244,7 +244,7 @@ GrafoscopioBrowser class >> startDockingBar [
add: 'Grafoscopio' target: GrafoscopioBrowser selector: #updateGrafoscopio;
add: 'Galeria de proyectos' target: GrafoscopioBrowser selector: #updateDataviz;
add: 'Prerrequisitos' target: GrafoscopioBrowser selector: #updatePrerrequisites;
add: 'Documentación > Tutorial' target: GrafoscopioBrowser selector: #updateDocumentationTemp;
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;
@ -528,6 +528,39 @@ GrafoscopioBrowser class >> updateSystem [
]
{ #category : #updating }
GrafoscopioBrowser class >> updateTutorial [
"I Update main tutorial from official repository"
| update filePath fileLocation client docs |
update := (UIManager default
confirm: '¿Desea actualizar la documentación?'
label: 'Actualizar documentación').
update
ifTrue: [
docs := Dictionary
with: 'tutorial' -> (Dictionary
with: 'remote' -> 'http://mutabit.com/repos.fossil/grafoscopio/doc/tip/Docs/Es/Tutoriales/tutorial.ston'
with: 'local' -> './Docs/Es/Tutoriales/'
).
docs do: [:each |
client := ZnClient new.
client get: (each at: 'remote').
client isSuccess
ifFalse: [ self inform: 'Algo salió mal. Verifique su conexión a Internet.' ]
ifTrue: [
filePath := each at: 'local'.
filePath asFileReference ensureCreateDirectory.
fileLocation := filePath, ((each at: 'remote') splitOn: '/') last.
fileLocation asFileReference
writeStreamDo: [:stream |
stream write: client contents utf8Decoded asString].
].
self inform: 'Actualización del tutorial terminada'.
]
].
]
{ #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