diff --git a/src/Grafoscopio/Documentation.class.st b/src/Grafoscopio/Documentation.class.st new file mode 100644 index 0000000..52d1a7b --- /dev/null +++ b/src/Grafoscopio/Documentation.class.st @@ -0,0 +1,48 @@ +" +I model a documentation object for Grafoscopio. +Documents are stored in a fossil repository and have +relative paths to it. +" +Class { + #name : #Documentation, + #superclass : #Object, + #instVars : [ + 'repository', + 'documents' + ], + #category : #'Grafoscopio-Model' +} + +{ #category : #queries } +Documentation class >> grafoscopioDocumentation [ + "I model the important documents that belong to the Grafoscopio documentation. + When more documents become more mature and usable, I will include them." + + | gfcDocumentation | + gfcDocumentation := self new. + gfcDocumentation repository: (FossilRepo new url: 'http://mutabit.com/repos.fossil/grafoscopio'). + gfcDocumentation documents: (Dictionary new + at: 'Spanish Tutorial' put: 'Docs/Es/Tutoriales/tutorial.ston'; yourself). + ^ gfcDocumentation + +] + +{ #category : #accessing } +Documentation >> documents [ + ^ documents +] + +{ #category : #accessing } +Documentation >> documents: anObject [ + documents := anObject +] + +{ #category : #accessing } +Documentation >> repository [ + ^ repository +] + +{ #category : #accessing } +Documentation >> repository: anObject [ + repository := anObject +] diff --git a/src/Grafoscopio/FossilRepo.class.st b/src/Grafoscopio/FossilRepo.class.st index 9369fdd..91753d6 100644 --- a/src/Grafoscopio/FossilRepo.class.st +++ b/src/Grafoscopio/FossilRepo.class.st @@ -12,12 +12,32 @@ Class { #category : #'Grafoscopio-Model' } -{ #category : #'as yet unclassified' } -FossilRepo >> jsonDataFor: aFileName [ - ^ NeoJSONReader fromString: (self jsonStringFor: aFileName) +{ #category : #querying } +FossilRepo >> checkinsFor: aFullFileName [ + "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: aFullFileName) at: 'payload' ifAbsent: [ + self inform: + 'WARNING! Key not found, verify the file name you are looking in this repository'. + ^ self ]. + ^ (((self jsonDataFor: aFullFileName) at: 'payload') at: 'checkins') ] -{ #category : #'as yet unclassified' } +{ #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'). @@ -25,10 +45,11 @@ FossilRepo >> jsonStringFor: aFileName [ ^ (ZnEasy get: queryForJSONData) contents. ] -{ #category : #'as yet unclassified' } +{ #category : #querying } FossilRepo >> lastHashNumberFor: aFileName [ - (self jsonDataFor: aFileName) at: 'payload' ifAbsent: [ self inform: 'Key not found, verify the file name you are looking in this repository'. ^ self ]. - ^ (((self jsonDataFor: aFileName) at: 'payload') at: 'checkins') first at: 'uuid' + "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 } diff --git a/src/Grafoscopio/ManifestGrafoscopio.class.st b/src/Grafoscopio/ManifestGrafoscopio.class.st index 41272ef..33df2f8 100644 --- a/src/Grafoscopio/ManifestGrafoscopio.class.st +++ b/src/Grafoscopio/ManifestGrafoscopio.class.st @@ -7,6 +7,11 @@ Class { #category : #Grafoscopio } +{ #category : #'code-critics' } +ManifestGrafoscopio class >> ruleRBClassNameInSelectorRuleV1FalsePositive [ + ^ #(#(#(#RGMethodDefinition #(#'Documentation class' #grafoscopioDocumentation #true)) #'2016-10-07T19:39:23.013722-05:00') ) +] + { #category : #'code-critics' } ManifestGrafoscopio class >> ruleRBSentNotImplementedRuleV1FalsePositive [ ^ #(#(#(#RGMetaclassDefinition #(#'GrafoscopioGUI class' #GrafoscopioGUI)) #'2015-12-23T10:38:16.706667-05:00') #(#(#RGClassDefinition #(#GrafoscopioGUI)) #'2016-01-06T18:53:45.844051-05:00') )