Improving automation for versioning tiddlywikis and unversioned files management.

This commit is contained in:
ruidajo 2022-03-03 14:51:01 -05:00
parent 494112a2c8
commit cdd89138d4

View File

@ -14,7 +14,8 @@ Class {
#instVars : [ #instVars : [
'local', 'local',
'remote', 'remote',
'repository' 'repository',
'tiddlywiki'
], ],
#classInstVars : [ #classInstVars : [
'executable' 'executable'
@ -72,6 +73,22 @@ FossilRepo >> addFiles: aCollection [
aCollection do: [ :each | self add: each ]. aCollection do: [ :each | self add: each ].
] ]
{ #category : #accessing }
FossilRepo >> addRecentChangesFromSelfWiki [
| docsSton docsStonSanitized recentTiddlers |
self tiddlywiki
exportJSONFile;
importJSONFile.
recentTiddlers := self tiddlywiki changesAfter: self checkoutDateAndTime.
docsSton := recentTiddlers collect: [:each | each exportSTONFile].
"Collecting tiddlers file reference as string and adding to the repo"
docsStonSanitized := docsSton collect: [ :each |
(each fullName removePrefix: self localRoot) allButFirst ].
docsStonSanitized do: [ :each | self add: each ].
^ self status
]
{ #category : #accessing } { #category : #accessing }
FossilRepo >> addRecentChangesFromWiki: aTiddlywiki [ FossilRepo >> addRecentChangesFromWiki: aTiddlywiki [
@ -402,6 +419,18 @@ FossilRepo >> status [
^ self command: 'status' ^ self command: 'status'
] ]
{ #category : #accessing }
FossilRepo >> tiddlywiki [
^ tiddlywiki
]
{ #category : #accessing }
FossilRepo >> tiddlywiki: aTiddlyWiki [
tiddlywiki := aTiddlyWiki
]
{ #category : #accessing } { #category : #accessing }
FossilRepo >> update [ FossilRepo >> update [
@ -409,10 +438,57 @@ FossilRepo >> update [
] ]
{ #category : #accessing } { #category : #accessing }
FossilRepo >> uvAdd: aFileRelativePath [ FossilRepo >> updateAndRebuildTiddlersJSON [
^ self fossilUv: 'add' and: aFileRelativePath self update; uvExportSTON.
^ self tiddlywiki rebuildTiddlersJSON.
]
{ #category : #accessing }
FossilRepo >> uvAdd: aFileRelativePathFullname [
^ self fossilUv: 'add' and: aFileRelativePathFullname
]
{ #category : #accessing }
FossilRepo >> uvAddLargeTiddlers [
| stonfiles largeTiddlersFileReference |
stonfiles := (self tiddlywiki file parent / 'largeTiddlers') files
select: [ :each | each fullName endsWith: '.ston' ].
largeTiddlersFileReference := stonfiles
collect: [ :each | each fullName withoutPrefix: (self local fullName, '/') ].
largeTiddlersFileReference do: [ :each | self uvAdd: each ].
^ largeTiddlersFileReference
]
{ #category : #accessing }
FossilRepo >> uvExport: fileReferenceFullName [
OSSUnixSubprocess new
command: 'fossil';
arguments: { 'uv' . 'export' . fileReferenceFullName . fileReferenceFullName };
workingDirectory: self localRoot;
redirectStdout;
redirectStderr;
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
]
{ #category : #accessing }
FossilRepo >> uvExportSTON [
| stonFileReferenceFullName |
stonFileReferenceFullName := (self uvLs lines)
select: [ :each | each endsWith: '.ston' ].
stonFileReferenceFullName do: [ :each | self uvExport: each ].
^ stonFileReferenceFullName
]
{ #category : #accessing }
FossilRepo >> uvLs [
^ self fossilUv: 'ls' and: ''
] ]
{ #category : #accessing } { #category : #accessing }