190 lines
5.3 KiB
Smalltalk
190 lines
5.3 KiB
Smalltalk
"
|
|
I model a web theme.
|
|
|
|
For the Collaborators Part: State my main collaborators and one line about how I interact with them.
|
|
|
|
Public API and Key Messages
|
|
|
|
- message one
|
|
- message two
|
|
- (for bonus points) how to create instances.
|
|
|
|
One simple example is simply gorgeous.
|
|
|
|
Internal Representation and Key Implementation Points.
|
|
|
|
Instance Variables
|
|
name: <Object>
|
|
preview: <Object>
|
|
provider: <Object>
|
|
url: <Object>
|
|
|
|
|
|
Implementation Points
|
|
"
|
|
Class {
|
|
#name : #BreaTheme,
|
|
#superclass : #Object,
|
|
#instVars : [
|
|
'name',
|
|
'provider',
|
|
'url',
|
|
'preview',
|
|
'license',
|
|
'folder',
|
|
'customizations'
|
|
],
|
|
#category : #Brea
|
|
}
|
|
|
|
{ #category : #accessing }
|
|
BreaTheme class >> availablePacks [
|
|
^ self downloadLinks keys
|
|
]
|
|
|
|
{ #category : #utilities }
|
|
BreaTheme class >> downloadLinks [
|
|
"Keys are the theme names and values are the url where it can be downloaded
|
|
as a zip file.
|
|
For the moment we work only with HTML5Up themes, but more could be added
|
|
and the code should be refactored accordingly."
|
|
| result providerUrl |
|
|
result := Dictionary new.
|
|
providerUrl := 'https://html5up.net'.
|
|
result
|
|
at: 'Paradigm Shift' put: providerUrl, '/paradigm-shift/download';
|
|
at: 'Massively' put: providerUrl, '/massively/download';
|
|
at: 'Ethereal' put: providerUrl, '/ethereal/download';
|
|
at: 'Story' put: providerUrl, '/story/download';
|
|
at: 'Dimension' put: providerUrl, '/dimension/download';
|
|
at: 'Editorial' put: providerUrl, '/editorial/download';
|
|
at: 'Forty' put: providerUrl, '/forty/download';
|
|
at: 'Stellar' put: providerUrl, '/stellar/download';
|
|
at: 'Multiverse' put: providerUrl, '/multiverse/download';
|
|
at: 'Phantom' put: providerUrl, '/phantom/download';
|
|
at: 'Hyperspace' put: providerUrl, '/hyperspace/download';
|
|
at: 'Future Imperfect' put: providerUrl, '/future-imperfect/download';
|
|
at: 'Solid State' put: providerUrl, '/solid-state/download';
|
|
at: 'Identity' put: providerUrl, '/identity/download';
|
|
at: 'Lens' put: providerUrl, '/lens/download';
|
|
at: 'Fractal' put: providerUrl, '/fractal/download';
|
|
at: 'Eventually' put: providerUrl, '/eventually/download';
|
|
at: 'Spectral' put: providerUrl, '/spectral/download';
|
|
at: 'Phonon' put: providerUrl, '/photon/download';
|
|
at: 'Highlights' put: providerUrl, '/highlights/download';
|
|
at: 'Landed' put: providerUrl, '/landed/download';
|
|
at: 'Strata' put: providerUrl, '/strata/download';
|
|
at: 'Read Only' put: providerUrl, '/read-only/download';
|
|
at: 'Alpha' put: providerUrl, '/alpha/download';
|
|
at: 'Directive' put: providerUrl, '/directive/download';
|
|
at: 'Aerial' put: providerUrl, '/aerial/download';
|
|
at: 'Twenty' put: providerUrl, '/twenty/download';
|
|
at: 'Big Picture' put: providerUrl, '/big-picture/download';
|
|
at: 'Tessellate' put: providerUrl, '/tessellate/download';
|
|
at: 'Overflow' put: providerUrl, 'overflow/download';
|
|
at: 'Prologue' put: providerUrl, '/prologue/download';
|
|
at: 'Helios' put: providerUrl, '/helios/download';
|
|
at: 'Telephasic' put: providerUrl, '/telephasic/download';
|
|
at: 'Strongly Typed' put: providerUrl, '/strongly-typed/download';
|
|
at: 'Parallelism' put: providerUrl, '/parallelism/download';
|
|
at: 'Escape Velocity' put: providerUrl, '/escape-velocity/download';
|
|
at: 'Astral' put: providerUrl, '/astral/download';
|
|
at: 'Striped' put: providerUrl, '/striped/download';
|
|
at: 'Dopetrope' put: providerUrl, '/dopetrope/download';
|
|
at: 'Miniport' put: providerUrl, '/miniport/download';
|
|
at: 'TXT' put: providerUrl, '/txt/download';
|
|
at: 'Verti' put: providerUrl, '/verti/download';
|
|
at: 'Zerofour' put: providerUrl, '/zerofour/download';
|
|
at: 'Arcana' put: providerUrl, '/arcana/download';
|
|
at: 'Halcyonic' put: providerUrl, '/halcyonic/download';
|
|
at: 'Minimaxing' put: providerUrl, '/minimaxing/download'.
|
|
^ result
|
|
]
|
|
|
|
{ #category : #utilities }
|
|
BreaTheme >> dashedName [
|
|
^ self name asDashedLowercase
|
|
]
|
|
|
|
{ #category : #operation }
|
|
BreaTheme >> downloadInto: aFolder [
|
|
| tempName zippedFile |
|
|
self url ifNil: [ ^ self ].
|
|
tempName := self name.
|
|
zippedFile := aFolder / self dashedName , 'zip'.
|
|
aFolder ensureCreateDirectory.
|
|
GrafoscopioUtils
|
|
downloadingFrom: self url withMessage: 'Downloading ', tempName, '...' into: zippedFile.
|
|
self folder: aFolder.
|
|
^ zippedFile
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
BreaTheme >> folder [
|
|
^ folder
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
BreaTheme >> folder: anObject [
|
|
folder := anObject
|
|
]
|
|
|
|
{ #category : #installation }
|
|
BreaTheme >> installInto: aFolder [
|
|
| zippedFile |
|
|
self url ifNil: [ ^ self ].
|
|
zippedFile := self downloadInto: aFolder.
|
|
(ZipArchive new readFrom: zippedFile) extractAllTo: aFolder.
|
|
^ aFolder
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
BreaTheme >> license [
|
|
^ license
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
BreaTheme >> license: anObject [
|
|
license := anObject
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
BreaTheme >> name [
|
|
^ name ifNil: [ name = 'unamed' ]
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
BreaTheme >> name: anObject [
|
|
name := anObject
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
BreaTheme >> preview [
|
|
^ preview
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
BreaTheme >> preview: anObject [
|
|
preview := anObject
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
BreaTheme >> provider [
|
|
^ provider
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
BreaTheme >> provider: anObject [
|
|
provider := anObject
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
BreaTheme >> url [
|
|
^ url ifNil: [ url := self class downloadLinks at: self name. ]
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
BreaTheme >> url: anObject [
|
|
url := anObject
|
|
]
|