Debugging initializtion of seeds.

This commit is contained in:
Diego Ruidajo 2022-01-21 19:29:55 -05:00
parent 2a966e6e0d
commit 401168ac91
2 changed files with 64 additions and 12 deletions

View File

@ -11,33 +11,71 @@ Class {
#category : #'TiddlyWiki-Model' #category : #'TiddlyWiki-Model'
} }
{ #category : #accessing }
TWSeed class >> default [
^ (self list select: [ :seed | seed name = 'ProjectifyMod' ]) first
]
{ #category : #accessing }
TWSeed class >> deleteWikiFileFromFolder: folder andSubfolder: shortName [
| file |
file := folder / shortName / 'index.html'.
file exists ifFalse: [^ self].
^ file ensureDelete.
]
{ #category : #accessing } { #category : #accessing }
TWSeed class >> initialize [ TWSeed class >> initialize [
super initialize. super initialize.
"self name: (self class list at: #Wikilexias) asFileReference basenameWithoutExtension. list := OrderedCollection new.
self preview: (self class list at: #Wikilexias) contents." list
add: (self new
name: 'ProjectifyMod';
demo: 'https://mutabit.com/repos.fossil/tiddlywiki/uv/seeds/projectify/projectify-mod.html');
add: (self new
name: 'Wikilexias';
demo: '');
add: (self new
name: 'NotebookMod';
demo: '');
add: (self new
name: 'Grafoscopedia';
demo: '');
add: (self new
name: 'Holonica';
demo: '').
^ self
] ]
{ #category : #accessing } { #category : #accessing }
TWSeed class >> installDefaultInto: folder as: shortName [ TWSeed class >> installDefaultInto: folder as: shortName [
| url subfolder | | url subfolder file |
url := self list first demo. url := self default demo.
subfolder := (folder / shortName) ensureCreateDirectory. subfolder := (folder / shortName) ensureCreateDirectory.
^ url asUrl saveContentsToFile: subfolder / 'index.html'. 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
].
^ url asUrl saveContentsToFile: file.
] ]
{ #category : #accessing } { #category : #accessing }
TWSeed class >> list [ TWSeed class >> list [
| l | ^ list
l := OrderedCollection new. ifNil: [ self initialize.
l add: (self new ^ self list.
name: 'Projectify'; ]
demo: 'https://mutabit.com/repos.fossil/tiddlywiki/uv/seeds/projectify/projectify-mod.html').
^ l
] ]
{ #category : #accessing } { #category : #accessing }

View File

@ -0,0 +1,14 @@
Class {
#name : #TiddlyWikiExamples,
#superclass : #Object,
#category : #'TiddlyWiki-Model'
}
{ #category : #accessing }
TiddlyWikiExamples >> createDefaultWiki [
<gtExample>
<description: 'I create a wiki with the default seed as a temporal file.'>
TWSeed deleteWikiFileFromFolder: FileLocator temp andSubfolder: 'test'.
^ TWSeed installDefaultInto: FileLocator temp as: 'test'
]