From 8d5a241d81cfcd3c213fc0685290b4117dbe435f Mon Sep 17 00:00:00 2001 From: Ruidajo Date: Fri, 4 Feb 2022 11:12:34 -0500 Subject: [PATCH] Improving automation for versioning tiddlywikis. --- repository/Fossil/FossilRepo.class.st | 54 +++++++++++---------------- 1 file changed, 21 insertions(+), 33 deletions(-) diff --git a/repository/Fossil/FossilRepo.class.st b/repository/Fossil/FossilRepo.class.st index 437ee5b..6aff7ed 100644 --- a/repository/Fossil/FossilRepo.class.st +++ b/repository/Fossil/FossilRepo.class.st @@ -67,29 +67,20 @@ FossilRepo >> add: fileRelativePath [ ] { #category : #accessing } -FossilRepo >> addRecentChangesFromWiki: aTiddlywikiFileLocator [ +FossilRepo >> addFiles: aCollection [ - | wiki created modified recent docsSton docsStonSanitized tiddlersFolder | - "Declaring the wiki, exporting tiddlers.json file and importing tiddlers as objects" - wiki := TiddlyWiki new - file: aTiddlywikiFileLocator. - wiki exportJSONFile; importJSONFile. - - "Filtering created and modified tiddlers after checkout repo and exporting as .ston files" - created := wiki withoutImages withoutPDFs contentTiddlers - select: [:tiddler | tiddler created > (self checkoutAsZTimestamp)]. - modified := wiki withoutImages withoutPDFs contentTiddlers - select: [:tiddler | tiddler modified isNotNil - and: [ tiddler modified > (self checkoutAsZTimestamp)]]. - recent := OrderedCollection new. - recent addAll: created; addAll: modified; yourself. - docsSton := recent collect: [:each | each exportSTONFile]. - + aCollection do: [ :each | self add: each ]. +] + +{ #category : #accessing } +FossilRepo >> addRecentChangesFromWiki: aTiddlywiki [ + + | docsSton docsStonSanitized recentTiddlers | + recentTiddlers := aTiddlywiki changesAfter: self checkoutDateAndTime. + docsSton := recentTiddlers collect: [:each | each exportSTONFile]. "Collecting tiddlers file reference as string and adding to the repo" - tiddlersFolder := aTiddlywikiFileLocator / 'tiddlers'. docsStonSanitized := docsSton collect: [ :each | - (each fullName removePrefix: - (tiddlersFolder parent parent absolutePath fullName)) allButFirst ]. + (each fullName removePrefix: self localRoot) allButFirst ]. docsStonSanitized do: [ :each | self add: each ]. ^ self status ] @@ -124,16 +115,13 @@ FossilRepo >> checkinsFor: relativeFilePath [ ] { #category : #accessing } -FossilRepo >> checkoutAsZTimestamp [ +FossilRepo >> checkoutDateAndTime [ - | date time dateTime | - date := ((self status lines detect: [ :line | line beginsWith: 'checkout:' ]) - splitOn: ' ') at: 7. - time := ((self status lines detect: [ :line | line beginsWith: 'checkout:' ]) - splitOn: ' ') at: 8. - dateTime := OrderedCollection new. - dateTime addAll: date; addAll: time. - ^ ('' join: dateTime) asZTimestamp + | date time dateTime splitedCheckout | + splitedCheckout := (self status lines detect: [ :line | line beginsWith: 'checkout:' ])splitOn: ' '. + date := splitedCheckout at: 7. + time := splitedCheckout at: 8. + ^ (date, time) asZTimestamp ] { #category : #accessing } @@ -205,7 +193,7 @@ FossilRepo >> fetchPage: pageName [ ] { #category : #accessing } -FossilRepo >> fossilUv: anArgument arg2: aSecondArgument [ +FossilRepo >> fossilUv: anArgument and: aSecondArgument [ OSSUnixSubprocess new command: 'fossil'; @@ -358,7 +346,7 @@ FossilRepo >> open [ ] { #category : #accessing } -FossilRepo >> openUpdate [ +FossilRepo >> openAndUpdate [ ^ self open; update ] @@ -420,14 +408,14 @@ FossilRepo >> update [ { #category : #accessing } FossilRepo >> uvAdd: aFileRelativePath [ - ^ self fossilUv: 'add' arg2: aFileRelativePath + ^ self fossilUv: 'add' and: aFileRelativePath ] { #category : #accessing } FossilRepo >> uvSync [ - ^ self fossilUv: 'sync' arg2: '-v' + ^ self fossilUv: 'sync' and: '-v' ]