diff --git a/repository/TiddlyWiki/TWSeed.class.st b/repository/TiddlyWiki/TWSeed.class.st index ed94206..e32e196 100644 --- a/repository/TiddlyWiki/TWSeed.class.st +++ b/repository/TiddlyWiki/TWSeed.class.st @@ -14,7 +14,7 @@ Class { { #category : #accessing } TWSeed class >> default [ - ^ (self list select: [ :seed | seed name = 'ProjectifyMod' ]) first + ^ self selectSeed: 'ProjectifyMod' ] { #category : #accessing } @@ -37,7 +37,7 @@ TWSeed class >> initialize [ demo: 'https://mutabit.com/repos.fossil/tiddlywiki/uv/seeds/projectify/projectify-mod.html'); add: (self new name: 'Wikilexias'; - demo: ''); + demo: 'https://mutabit.com/repos.fossil/tiddlywiki/uv/seeds/wikilexias/wikilexias.html'); add: (self new name: 'NotebookMod'; demo: ''); @@ -52,10 +52,10 @@ TWSeed class >> initialize [ ] { #category : #accessing } -TWSeed class >> installDefaultInto: folder as: shortName [ +TWSeed class >> install: seedName into: folder as: shortName [ - | url subfolder file | - url := self default demo. + | file url seedFile subfolder wiki | + seedFile := self selectSeed: seedName. subfolder := (folder / shortName) ensureCreateDirectory. file := subfolder / 'index.html'. file exists @@ -64,8 +64,18 @@ TWSeed class >> installDefaultInto: folder as: shortName [ 2 run: self deleteWikiFileFromFolder: folder andSubfolder: shortName.'. ^ self - ]. - ^ url asUrl saveContentsToFile: file. + ]. + 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 ] { #category : #accessing } @@ -78,6 +88,12 @@ TWSeed class >> list [ ] +{ #category : #accessing } +TWSeed class >> selectSeed: aSeedName [ + + ^ (self list select: [ :seed | seed name = aSeedName ]) first +] + { #category : #accessing } TWSeed >> demo [ diff --git a/repository/TiddlyWiki/TWSeedTest.class.st b/repository/TiddlyWiki/TWSeedTest.class.st index 1416c36..9d93f86 100644 --- a/repository/TiddlyWiki/TWSeedTest.class.st +++ b/repository/TiddlyWiki/TWSeedTest.class.st @@ -4,6 +4,22 @@ Class { #category : #'TiddlyWiki-TiddlyWiki' } +{ #category : #accessing } +TWSeedTest >> testCreateAlternativeSeed [ + + | seed | + seed := TWSeed install: 'Wikilexias' into: FileLocator temp as: 'Wikilexias'. + self assert: seed file equals: (FileLocator temp / 'Wikilexias' / 'index.html') +] + +{ #category : #accessing } +TWSeedTest >> testDefaultIsSeed [ + + | seed | + seed := TWSeed default. + self assert: seed class equals: TWSeed +] + { #category : #accessing } TWSeedTest >> testListIsNotEmpty [