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 }
BreaWebsite class >> downloadDemoFiles [
| remoteUrl demoFolder templatesFile |
demoFolder := FileLocator temp asFileReference / 'BreaDemo'.
demoFolder ensureDeleteAll.
demoFolder ensureCreateDirectory.
BreaWebsite class >> demoFolder [
^ FileLocator temp asFileReference / 'BreaDemo'.
]
{ #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'.
GrafoscopioUtils
downloadingFrom: remoteUrl
@ -26,7 +35,7 @@ BreaWebsite class >> downloadDemoFiles [
templatesFile := FileLocator temp asFileReference / (remoteUrl splitOn: '/') last.
ZipArchive new
readFrom: templatesFile;
extractAllTo: demoFolder
extractAllTo: aDirectory
]
{ #category : #example }
@ -35,17 +44,32 @@ BreaWebsite class >> example [
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
produce by Brea."
self downloadDemoFiles.
self downloadTemplateFiles.
self replaceDefaultTemplates.
self new
local: FileLocator temp asFileReference / 'BreaDemo';
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' }
BreaWebsite class >> stopAll [
"I stop the server"
self server class stopAll
Teapot stopAll
]
{ #category : #accessing }