New example.

This commit is contained in:
Offray Luna 2017-09-05 17:08:15 +00:00
parent 245b4a439e
commit 8bdb216c66

View File

@ -13,11 +13,20 @@ Class {
} }
{ #category : #utility } { #category : #utility }
BreaWebsite class >> downloadDemoFiles [ BreaWebsite class >> demoFolder [
| remoteUrl demoFolder templatesFile | ^ FileLocator temp asFileReference / 'BreaDemo'.
demoFolder := FileLocator temp asFileReference / 'BreaDemo'. ]
demoFolder ensureDeleteAll.
demoFolder ensureCreateDirectory. { #category : #utility }
BreaWebsite class >> downloadTemplateFiles [
self downloadTemplateFilesInto: self demoFolder.
]
{ #category : #utility }
BreaWebsite class >> downloadTemplateFilesInto: aDirectory [
| remoteUrl templatesFile |
aDirectory ensureDeleteAll.
aDirectory ensureCreateDirectory.
remoteUrl := 'https://code.getmdl.io/1.3.0/mdl-template-portfolio.zip'. remoteUrl := 'https://code.getmdl.io/1.3.0/mdl-template-portfolio.zip'.
GrafoscopioUtils GrafoscopioUtils
downloadingFrom: remoteUrl downloadingFrom: remoteUrl
@ -26,7 +35,7 @@ BreaWebsite class >> downloadDemoFiles [
templatesFile := FileLocator temp asFileReference / (remoteUrl splitOn: '/') last. templatesFile := FileLocator temp asFileReference / (remoteUrl splitOn: '/') last.
ZipArchive new ZipArchive new
readFrom: templatesFile; readFrom: templatesFile;
extractAllTo: demoFolder extractAllTo: aDirectory
] ]
{ #category : #example } { #category : #example }
@ -35,17 +44,32 @@ BreaWebsite class >> example [
After runing me, go to http://localhost:8080/demo . After runing me, go to http://localhost:8080/demo .
Notice that one part of the template in the website has been replaced by dynamic content Notice that one part of the template in the website has been replaced by dynamic content
produce by Brea." produce by Brea."
self downloadDemoFiles. self downloadTemplateFiles.
self replaceDefaultTemplates.
self new self new
local: FileLocator temp asFileReference / 'BreaDemo'; local: FileLocator temp asFileReference / 'BreaDemo';
start start
] ]
{ #category : #utility }
BreaWebsite class >> replaceDefaultTemplates [
"I replace default templates with versioned files, that contains Mustache tags used
for examples."
| remoteRepoUrl files |
remoteRepoUrl := 'http://mutabit.com/repos.fossil/gig/'.
files := #('index.html' 'styles.css').
files do: [ :file |
GrafoscopioUtils
downloadingFrom: remoteRepoUrl, 'doc/tip/', file
withMessage: 'Replacing ', file
into: self demoFolder ]
]
{ #category : #'server handling' } { #category : #'server handling' }
BreaWebsite class >> stopAll [ BreaWebsite class >> stopAll [
"I stop the server" "I stop the server"
self server class stopAll Teapot stopAll
] ]
{ #category : #accessing } { #category : #accessing }