Improving automation for versioning tiddlywikis.

This commit is contained in:
Ruidajo 2022-02-04 11:12:34 -05:00
parent d691b79e6e
commit 8d5a241d81
1 changed files with 21 additions and 33 deletions

View File

@ -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'
]