Refactoring of FossilRepo and new documentation object.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2016-10-07 20:29:34 +00:00
parent 5272b45710
commit 8ed0f0a4eb
3 changed files with 81 additions and 7 deletions

View File

@ -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
]

View File

@ -12,12 +12,32 @@ Class {
#category : #'Grafoscopio-Model' #category : #'Grafoscopio-Model'
} }
{ #category : #'as yet unclassified' } { #category : #querying }
FossilRepo >> jsonDataFor: aFileName [ FossilRepo >> checkinsFor: aFullFileName [
^ NeoJSONReader fromString: (self jsonStringFor: aFileName) "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 [ FossilRepo >> jsonStringFor: aFileName [
| queryForJSONData | | queryForJSONData |
queryForJSONData := self url addPathSegments: #('json' 'finfo'). queryForJSONData := self url addPathSegments: #('json' 'finfo').
@ -25,10 +45,11 @@ FossilRepo >> jsonStringFor: aFileName [
^ (ZnEasy get: queryForJSONData) contents. ^ (ZnEasy get: queryForJSONData) contents.
] ]
{ #category : #'as yet unclassified' } { #category : #querying }
FossilRepo >> lastHashNumberFor: aFileName [ 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 ]. "I'm useful to see if local versions of files are updated to the last versions of the
^ (((self jsonDataFor: aFileName) at: 'payload') at: 'checkins') first at: 'uuid' online repository"
^ (self checkinsFor: aFileName) first at: 'uuid'
] ]
{ #category : #accessing } { #category : #accessing }

View File

@ -7,6 +7,11 @@ Class {
#category : #Grafoscopio #category : #Grafoscopio
} }
{ #category : #'code-critics' }
ManifestGrafoscopio class >> ruleRBClassNameInSelectorRuleV1FalsePositive [
^ #(#(#(#RGMethodDefinition #(#'Documentation class' #grafoscopioDocumentation #true)) #'2016-10-07T19:39:23.013722-05:00') )
]
{ #category : #'code-critics' } { #category : #'code-critics' }
ManifestGrafoscopio class >> ruleRBSentNotImplementedRuleV1FalsePositive [ 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') ) ^ #(#(#(#RGMetaclassDefinition #(#'GrafoscopioGUI class' #GrafoscopioGUI)) #'2015-12-23T10:38:16.706667-05:00') #(#(#RGClassDefinition #(#GrafoscopioGUI)) #'2016-01-06T18:53:45.844051-05:00') )