From 8aa5b42f945b390297b2ec458672d83204529fec Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Thu, 1 Jun 2017 12:12:11 +0000 Subject: [PATCH] Moving from Grafoscopio to an external project. The dependencies for installing Grafoscopio, need to include this now. --- .project | 3 ++ repository/.properties | 3 ++ repository/Fossil/FossilRepo.class.st | 63 +++++++++++++++++++++++++++ repository/Fossil/package.st | 1 + 4 files changed, 70 insertions(+) create mode 100644 .project create mode 100644 repository/.properties create mode 100644 repository/Fossil/FossilRepo.class.st create mode 100644 repository/Fossil/package.st diff --git a/.project b/.project new file mode 100644 index 0000000..46c7795 --- /dev/null +++ b/.project @@ -0,0 +1,3 @@ +{ + 'srcDirectory' : 'repository' +} \ No newline at end of file diff --git a/repository/.properties b/repository/.properties new file mode 100644 index 0000000..ad0471d --- /dev/null +++ b/repository/.properties @@ -0,0 +1,3 @@ +{ + #format : #tonel +} \ No newline at end of file diff --git a/repository/Fossil/FossilRepo.class.st b/repository/Fossil/FossilRepo.class.st new file mode 100644 index 0000000..7fe155c --- /dev/null +++ b/repository/Fossil/FossilRepo.class.st @@ -0,0 +1,63 @@ +" +I model a fossil repository. For details about fossil see: + +http://fossil-scm.org/ +" +Class { + #name : #FossilRepo, + #superclass : #Object, + #instVars : [ + 'url' + ], + #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 : #querying } +FossilRepo >> jsonDataFor: aFileName [ + | answer | + answer := NeoJSONReader fromString: (self jsonStringFor: aFileName). + (answer keys includes: 'resultText') ifTrue: [ + (answer at: 'resultText') = 'File entry not found.' + ifTrue: [ + self inform: 'WARNING! ', (answer at: 'resultText'), + ' Verify the file path you are entering'. + ^ self] + ]. + ^ answer +] + +{ #category : #querying } +FossilRepo >> jsonStringFor: aFileName [ + | queryForJSONData | + queryForJSONData := self url 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 >> url [ + ^ url +] + +{ #category : #accessing } +FossilRepo >> url: aString [ + url := aString asUrl +] diff --git a/repository/Fossil/package.st b/repository/Fossil/package.st new file mode 100644 index 0000000..81c36eb --- /dev/null +++ b/repository/Fossil/package.st @@ -0,0 +1 @@ +Package { #name : #Fossil }