Implementing TWSeed.
This commit is contained in:
parent
883cf7bf91
commit
fd11bfce87
70
repository/TiddlyWiki/TWSeed.class.st
Normal file
70
repository/TiddlyWiki/TWSeed.class.st
Normal 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
|
||||
]
|
13
repository/TiddlyWiki/TWSeedTest.class.st
Normal file
13
repository/TiddlyWiki/TWSeedTest.class.st
Normal 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
|
||||
]
|
Loading…
Reference in New Issue
Block a user