Fossil/repository/Fossil/FossilRepo.class.st

83 lines
1.9 KiB
Smalltalk
Raw Normal View History

"
I model a fossil repository. For details about fossil see:
http://fossil-scm.org/
"
Class {
#name : #FossilRepo,
#superclass : #Object,
#instVars : [
'local',
'remote'
],
#category : #Fossil
}
{ #category : #querying }
FossilRepo >> checkinsFor: relativeFilePath [
"I get all histotical checkins information for a full file name, wich includes relative path
in the repository (i.e: 'Doc/Es/Tutoriales/tutorial.ston' or 'index.html's)"
(self jsonDataFor: relativeFilePath) = self ifTrue: [
self inform:
'WARNING! Key not found, verify the file name you are looking in this repository'.
^ self ].
^ (((self jsonDataFor: relativeFilePath) at: 'payload') at: 'checkins')
]
{ #category : #wiki }
FossilRepo >> jsonDataFor: anUrlSegment [
^ ZnClient new
get: (self wikiRoot addPathSegment: anUrlSegment);
contents.
]
{ #category : #querying }
FossilRepo >> jsonStringFor: aFileName [
| queryForJSONData |
queryForJSONData := self remote addPathSegments: #('json' 'finfo').
queryForJSONData queryAt: 'name' put: aFileName.
^ (ZnEasy get: queryForJSONData) contents.
]
{ #category : #querying }
FossilRepo >> lastHashNumberFor: aFileName [
"I'm useful to see if local versions of files are updated to the last versions of the
online repository"
^ (self checkinsFor: aFileName) first at: 'uuid'
]
{ #category : #accessing }
FossilRepo >> local [
^ local
]
{ #category : #accessing }
FossilRepo >> local: aLocalFilePath [
local := aLocalFilePath
]
{ #category : #wiki }
FossilRepo >> pageList [
^ NeoJSONReader fromString: (self jsonDataFor: 'list')
]
{ #category : #accessing }
FossilRepo >> remote [
^ remote
]
{ #category : #accessing }
FossilRepo >> remote: anUrlString [
remote := anUrlString asUrl
]
{ #category : #wiki }
FossilRepo >> wikiRoot [
^ self jsonRoot addPathSegment: 'wiki'
]
{ #category : #wiki }
FossilRepo >> wikiTimeline [
^ NeoJSONReader fromString: (self jsonDataFor: 'timeline')
]