Implementing TWSeed.

This commit is contained in:
Diego Ruidajo 2022-01-21 17:10:56 -05:00
parent 883cf7bf91
commit fd11bfce87
2 changed files with 83 additions and 0 deletions

View File

@ -0,0 +1,70 @@
Class {
#name : #TWSeed,
#superclass : #Object,
#instVars : [
'name',
'demo'
],
#classVars : [
'list'
],
#category : #'TiddlyWiki-Model'
}
{ #category : #accessing }
TWSeed class >> initialize [
super initialize.
"self name: (self class list at: #Wikilexias) asFileReference basenameWithoutExtension.
self preview: (self class list at: #Wikilexias) contents."
]
{ #category : #accessing }
TWSeed class >> installDefaultInto: folder as: shortName [
| url file |
url := self list first demo.
file := (folder / shortName / 'index.html') asFileReference.
url asUrl saveContentsToFile: file.
^ file asFileReference
]
{ #category : #accessing }
TWSeed class >> list [
| l |
l := OrderedCollection new.
l add: (self new
name: 'Projectify';
demo: 'https://mutabit.com/repos.fossil/tiddlywiki/uv/seeds/projectify/projectify-mod.html').
^ l
]
{ #category : #accessing }
TWSeed >> demo [
^ demo
]
{ #category : #accessing }
TWSeed >> demo: anUrl [
demo := anUrl asZnUrl
]
{ #category : #accessing }
TWSeed >> name [
^ name
]
{ #category : #accessing }
TWSeed >> name: aString [
name := aString
]
{ #category : #accessing }
TWSeed >> preview: anObject [
^ demo := anObject
]

View File

@ -0,0 +1,13 @@
Class {
#name : #TWSeedTest,
#superclass : #TestCase,
#category : #'TiddlyWiki-TiddlyWiki'
}
{ #category : #accessing }
TWSeedTest >> testListIsNotEmpty [
| seed |
seed := TWSeed list.
self assert: seed size >= 1
]