2017-06-01 12:12:11 +00:00
|
|
|
"
|
|
|
|
I model a fossil repository. For details about fossil see:
|
|
|
|
|
|
|
|
http://fossil-scm.org/
|
|
|
|
"
|
|
|
|
Class {
|
|
|
|
#name : #FossilRepo,
|
|
|
|
#superclass : #Object,
|
|
|
|
#instVars : [
|
2017-06-06 10:27:57 +00:00
|
|
|
'local',
|
|
|
|
'remote'
|
2017-06-01 12:12:11 +00:00
|
|
|
],
|
|
|
|
#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')
|
|
|
|
]
|
|
|
|
|
2017-06-06 10:27:57 +00:00
|
|
|
{ #category : #wiki }
|
|
|
|
FossilRepo >> jsonDataFor: anUrlSegment [
|
|
|
|
^ ZnClient new
|
|
|
|
get: (self wikiRoot addPathSegment: anUrlSegment);
|
|
|
|
contents.
|
2017-06-01 12:12:11 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #querying }
|
|
|
|
FossilRepo >> jsonStringFor: aFileName [
|
|
|
|
| queryForJSONData |
|
2017-06-06 10:27:57 +00:00
|
|
|
queryForJSONData := self remote addPathSegments: #('json' 'finfo').
|
2017-06-01 12:12:11 +00:00
|
|
|
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'
|
|
|
|
]
|
|
|
|
|
2017-06-01 15:57:15 +00:00
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo >> local [
|
|
|
|
^ local
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
|
|
|
FossilRepo >> local: aLocalFilePath [
|
|
|
|
local := aLocalFilePath
|
|
|
|
]
|
|
|
|
|
2017-06-06 10:27:57 +00:00
|
|
|
{ #category : #wiki }
|
|
|
|
FossilRepo >> pageList [
|
|
|
|
^ NeoJSONReader fromString: (self jsonDataFor: 'list')
|
|
|
|
]
|
|
|
|
|
2017-06-01 12:12:11 +00:00
|
|
|
{ #category : #accessing }
|
2017-06-06 10:27:57 +00:00
|
|
|
FossilRepo >> remote [
|
|
|
|
^ remote
|
2017-06-01 12:12:11 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #accessing }
|
2017-06-06 10:27:57 +00:00
|
|
|
FossilRepo >> remote: anUrlString [
|
|
|
|
remote := anUrlString asUrl
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #wiki }
|
|
|
|
FossilRepo >> wikiRoot [
|
|
|
|
^ self jsonRoot addPathSegment: 'wiki'
|
|
|
|
]
|
|
|
|
|
|
|
|
{ #category : #wiki }
|
|
|
|
FossilRepo >> wikiTimeline [
|
|
|
|
^ NeoJSONReader fromString: (self jsonDataFor: 'timeline')
|
2017-06-01 12:12:11 +00:00
|
|
|
]
|