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 ]
|
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 }
|
{ #category : #authentication }
|
||||||
FossilRepo >> authTokenFor: anUserName withPassword: passwordString [
|
FossilRepo >> authTokenFor: anUserName withPassword: passwordString [
|
||||||
^ ((self loginAs: anUserName withPassword: passwordString) at: 'payload') at: 'authToken'
|
^ ((self loginAs: anUserName withPassword: passwordString) at: 'payload') at: 'authToken'
|
||||||
@ -95,6 +123,19 @@ FossilRepo >> checkinsFor: relativeFilePath [
|
|||||||
^ payload at: 'checkins'
|
^ 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 }
|
{ #category : #accessing }
|
||||||
FossilRepo >> command: aCommandArgument [
|
FossilRepo >> command: aCommandArgument [
|
||||||
|
|
||||||
@ -146,6 +187,12 @@ FossilRepo >> createPage: pageName [
|
|||||||
^ NeoJSONReader fromString: (self jsonWikiDataFor: 'create/', pageName)
|
^ NeoJSONReader fromString: (self jsonWikiDataFor: 'create/', pageName)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{ #category : #accessing }
|
||||||
|
FossilRepo >> diff [
|
||||||
|
|
||||||
|
^ self command: 'diff'
|
||||||
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
FossilRepo >> extra [
|
FossilRepo >> extra [
|
||||||
|
|
||||||
@ -298,6 +345,24 @@ FossilRepo >> loginUrlWithName: aUser andPassword: passwd [
|
|||||||
queryAt: 'password' put: 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 }
|
{ #category : #wiki }
|
||||||
FossilRepo >> pageList [
|
FossilRepo >> pageList [
|
||||||
^ NeoJSONReader fromString: (self jsonWikiDataFor: 'list')
|
^ NeoJSONReader fromString: (self jsonWikiDataFor: 'list')
|
||||||
|
Loading…
Reference in New Issue
Block a user