Improving automation for versioning tiddlywikis.

This commit is contained in:
Ruidajo 2022-02-04 11:12:34 -05:00
parent d691b79e6e
commit 8d5a241d81

View File

@ -67,29 +67,20 @@ FossilRepo >> add: fileRelativePath [
] ]
{ #category : #accessing } { #category : #accessing }
FossilRepo >> addRecentChangesFromWiki: aTiddlywikiFileLocator [ FossilRepo >> addFiles: aCollection [
| wiki created modified recent docsSton docsStonSanitized tiddlersFolder | aCollection do: [ :each | self add: each ].
"Declaring the wiki, exporting tiddlers.json file and importing tiddlers as objects" ]
wiki := TiddlyWiki new
file: aTiddlywikiFileLocator. { #category : #accessing }
wiki exportJSONFile; importJSONFile. FossilRepo >> addRecentChangesFromWiki: aTiddlywiki [
"Filtering created and modified tiddlers after checkout repo and exporting as .ston files" | docsSton docsStonSanitized recentTiddlers |
created := wiki withoutImages withoutPDFs contentTiddlers recentTiddlers := aTiddlywiki changesAfter: self checkoutDateAndTime.
select: [:tiddler | tiddler created > (self checkoutAsZTimestamp)]. docsSton := recentTiddlers collect: [:each | each exportSTONFile].
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].
"Collecting tiddlers file reference as string and adding to the repo" "Collecting tiddlers file reference as string and adding to the repo"
tiddlersFolder := aTiddlywikiFileLocator / 'tiddlers'.
docsStonSanitized := docsSton collect: [ :each | docsStonSanitized := docsSton collect: [ :each |
(each fullName removePrefix: (each fullName removePrefix: self localRoot) allButFirst ].
(tiddlersFolder parent parent absolutePath fullName)) allButFirst ].
docsStonSanitized do: [ :each | self add: each ]. docsStonSanitized do: [ :each | self add: each ].
^ self status ^ self status
] ]
@ -124,16 +115,13 @@ FossilRepo >> checkinsFor: relativeFilePath [
] ]
{ #category : #accessing } { #category : #accessing }
FossilRepo >> checkoutAsZTimestamp [ FossilRepo >> checkoutDateAndTime [
| date time dateTime | | date time dateTime splitedCheckout |
date := ((self status lines detect: [ :line | line beginsWith: 'checkout:' ]) splitedCheckout := (self status lines detect: [ :line | line beginsWith: 'checkout:' ])splitOn: ' '.
splitOn: ' ') at: 7. date := splitedCheckout at: 7.
time := ((self status lines detect: [ :line | line beginsWith: 'checkout:' ]) time := splitedCheckout at: 8.
splitOn: ' ') at: 8. ^ (date, time) asZTimestamp
dateTime := OrderedCollection new.
dateTime addAll: date; addAll: time.
^ ('' join: dateTime) asZTimestamp
] ]
{ #category : #accessing } { #category : #accessing }
@ -205,7 +193,7 @@ FossilRepo >> fetchPage: pageName [
] ]
{ #category : #accessing } { #category : #accessing }
FossilRepo >> fossilUv: anArgument arg2: aSecondArgument [ FossilRepo >> fossilUv: anArgument and: aSecondArgument [
OSSUnixSubprocess new OSSUnixSubprocess new
command: 'fossil'; command: 'fossil';
@ -358,7 +346,7 @@ FossilRepo >> open [
] ]
{ #category : #accessing } { #category : #accessing }
FossilRepo >> openUpdate [ FossilRepo >> openAndUpdate [
^ self open; update ^ self open; update
] ]
@ -420,14 +408,14 @@ FossilRepo >> update [
{ #category : #accessing } { #category : #accessing }
FossilRepo >> uvAdd: aFileRelativePath [ FossilRepo >> uvAdd: aFileRelativePath [
^ self fossilUv: 'add' arg2: aFileRelativePath ^ self fossilUv: 'add' and: aFileRelativePath
] ]
{ #category : #accessing } { #category : #accessing }
FossilRepo >> uvSync [ FossilRepo >> uvSync [
^ self fossilUv: 'sync' arg2: '-v' ^ self fossilUv: 'sync' and: '-v'
] ]