2022-01-21 22:10:56 +00:00
|
|
|
Class {
|
|
|
|
#name : #TWSeed,
|
|
|
|
#superclass : #Object,
|
|
|
|
#instVars : [
|
|
|
|
'name',
|
|
|
|
'demo'
|
|
|
|
],
|
|
|
|
#classVars : [
|
|
|
|
'list'
|
|
|
|
],
|
|
|
|
#category : #'TiddlyWiki-Model'
|
|
|
|
}
|
|
|
|
|
2022-01-22 00:29:55 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
TWSeed class >> default [
|
|
|
|
|
2022-01-22 01:25:52 +00:00
|
|
|
^ self selectSeed: 'ProjectifyMod'
|
2022-01-22 00:29:55 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
TWSeed class >> deleteWikiFileFromFolder: folder andSubfolder: shortName [
|
|
|
|
|
|
|
|
| file |
|
|
|
|
file := folder / shortName / 'index.html'.
|
|
|
|
file exists ifFalse: [^ self].
|
|
|
|
^ file ensureDelete.
|
|
|
|
]
|
|
|
|
|
2022-01-21 22:10:56 +00:00
|
|
|
{ #category : #accessing }
|
2022-01-22 01:25:52 +00:00
|
|
|
TWSeed class >> install: seedName into: folder as: shortName [
|
2022-01-21 22:10:56 +00:00
|
|
|
|
2022-01-22 01:25:52 +00:00
|
|
|
| file url seedFile subfolder wiki |
|
|
|
|
seedFile := self selectSeed: seedName.
|
2022-01-22 00:29:55 +00:00
|
|
|
subfolder := (folder / shortName) ensureCreateDirectory.
|
|
|
|
file := subfolder / 'index.html'.
|
|
|
|
file exists
|
|
|
|
ifTrue: [ self inform: 'Index file in the wiki subfolder already exists. Please choose:
|
|
|
|
1 select another folder + shortName combination or
|
|
|
|
2 run:
|
|
|
|
self deleteWikiFileFromFolder: folder andSubfolder: shortName.'.
|
|
|
|
^ self
|
2022-01-22 01:25:52 +00:00
|
|
|
].
|
|
|
|
url := seedFile demo.
|
|
|
|
url asUrl saveContentsToFile: file.
|
|
|
|
^ wiki := TiddlyWiki new
|
|
|
|
file: file;
|
|
|
|
name: shortName.
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
TWSeed class >> installDefaultInto: folder as: shortName [
|
|
|
|
|
|
|
|
^ self install: 'ProjectifyMod' into: folder as: shortName
|
2022-01-21 22:10:56 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
TWSeed class >> list [
|
|
|
|
|
2022-01-22 00:29:55 +00:00
|
|
|
^ list
|
|
|
|
ifNil: [ self initialize.
|
|
|
|
^ self list.
|
|
|
|
]
|
|
|
|
|
2022-01-21 22:10:56 +00:00
|
|
|
]
|
|
|
|
|
2022-01-22 01:25:52 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
TWSeed class >> selectSeed: aSeedName [
|
|
|
|
|
|
|
|
^ (self list select: [ :seed | seed name = aSeedName ]) first
|
|
|
|
]
|
|
|
|
|
2022-01-21 22:10:56 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
TWSeed >> demo [
|
|
|
|
|
|
|
|
^ demo
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
TWSeed >> demo: anUrl [
|
|
|
|
|
|
|
|
demo := anUrl asZnUrl
|
|
|
|
]
|
|
|
|
|
2022-01-22 01:37:56 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
TWSeed >> initialize [
|
|
|
|
|
|
|
|
super initialize.
|
|
|
|
list := OrderedCollection new.
|
|
|
|
list
|
|
|
|
add: (self class new
|
|
|
|
name: 'ProjectifyMod';
|
|
|
|
demo: 'https://mutabit.com/repos.fossil/tiddlywiki/uv/seeds/projectify/projectify-mod.html');
|
|
|
|
add: (self class new
|
|
|
|
name: 'Wikilexias';
|
|
|
|
demo: 'https://mutabit.com/repos.fossil/tiddlywiki/uv/seeds/wikilexias/wikilexias.html');
|
|
|
|
add: (self class new
|
|
|
|
name: 'NotebookMod';
|
|
|
|
demo: '');
|
|
|
|
add: (self class new
|
|
|
|
name: 'Grafoscopedia';
|
|
|
|
demo: '');
|
|
|
|
add: (self class new
|
|
|
|
name: 'Holonica';
|
|
|
|
demo: '').
|
|
|
|
^ self
|
|
|
|
|
|
|
|
]
|
|
|
|
|
2022-01-21 22:10:56 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
TWSeed >> name [
|
|
|
|
^ name
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
TWSeed >> name: aString [
|
|
|
|
name := aString
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
TWSeed >> preview: anObject [
|
|
|
|
|
|
|
|
^ demo := anObject
|
|
|
|
]
|