Creating automation for versioning tiddlywikis.
This commit is contained in:
parent
46e5f25e76
commit
d691b79e6e
@ -66,6 +66,34 @@ FossilRepo >> add: fileRelativePath [
|
||||
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FossilRepo >> addRecentChangesFromWiki: aTiddlywikiFileLocator [
|
||||
|
||||
| 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].
|
||||
|
||||
"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 ].
|
||||
docsStonSanitized do: [ :each | self add: each ].
|
||||
^ self status
|
||||
]
|
||||
|
||||
{ #category : #authentication }
|
||||
FossilRepo >> authTokenFor: anUserName withPassword: passwordString [
|
||||
^ ((self loginAs: anUserName withPassword: passwordString) at: 'payload') at: 'authToken'
|
||||
@ -95,6 +123,19 @@ FossilRepo >> checkinsFor: relativeFilePath [
|
||||
^ payload at: 'checkins'
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FossilRepo >> checkoutAsZTimestamp [
|
||||
|
||||
| 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
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FossilRepo >> command: aCommandArgument [
|
||||
|
||||
@ -146,6 +187,12 @@ FossilRepo >> createPage: pageName [
|
||||
^ NeoJSONReader fromString: (self jsonWikiDataFor: 'create/', pageName)
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FossilRepo >> diff [
|
||||
|
||||
^ self command: 'diff'
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FossilRepo >> extra [
|
||||
|
||||
@ -298,6 +345,24 @@ FossilRepo >> loginUrlWithName: aUser andPassword: passwd [
|
||||
queryAt: 'password' put: passwd.
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FossilRepo >> open [
|
||||
|
||||
OSSUnixSubprocess new
|
||||
command: 'fossil';
|
||||
arguments: { 'open' . self repository. '-f' };
|
||||
workingDirectory: self localRoot;
|
||||
redirectStdout;
|
||||
redirectStderr;
|
||||
runAndWaitOnExitDo: [ :process :outString | ^ outString ]
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
FossilRepo >> openUpdate [
|
||||
|
||||
^ self open; update
|
||||
]
|
||||
|
||||
{ #category : #wiki }
|
||||
FossilRepo >> pageList [
|
||||
^ NeoJSONReader fromString: (self jsonWikiDataFor: 'list')
|
||||
|
Loading…
Reference in New Issue
Block a user