• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moosetechnology / GitProjectHealth / 10880677211

16 Sep 2024 09:01AM UTC coverage: 20.332% (-0.2%) from 20.538%
10880677211

push

github

web-flow
Merge pull request #54 from moosetechnology/metrics-fixing

Metrics fixing

0 of 178 new or added lines in 19 files covered. (0.0%)

18 existing lines in 6 files now uncovered.

1961 of 9645 relevant lines covered (20.33%)

0.2 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

30.65
/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st
1
Class {
2
        #name : #GLHModelImporter,
3
        #superclass : #GPModelImporter,
4
        #instVars : [
5
                'glhApi',
6
                'withCommitDiffs',
7
                'withInitialCommits',
8
                'withInitialMergeRequest',
9
                'generalReader',
10
                'userCatalogue'
11
        ],
12
        #classVars : [
13
                'currentImporter'
14
        ],
15
        #category : 'GitLabHealth-Model-Importer'
16
}
17

18
{ #category : #'as yet unclassified' }
NEW
19
GLHModelImporter class >> importers [
×
NEW
20
        ^ currentImporter 
×
NEW
21
]
×
22

23
{ #category : #initialization }
NEW
24
GLHModelImporter class >> reset [
×
NEW
25
        currentImporter := nil.
×
UNCOV
26
]
×
27

28
{ #category : #'private - api' }
29
GLHModelImporter >> addCommits: commitsList toRepository: aProjectRepository [
×
30
        "I take a list of GLHCommit. But some might have been parsed but are already on the model..."
×
31

×
32
        "I return the list of added commits"
×
33

×
34
        | existingCommits newlyFoundCommit |
×
35
        existingCommits := aProjectRepository mooseModel allWithType:
×
36
                                   GLHCommit.
×
37
        newlyFoundCommit := commitsList reject: [ :commitParsed |
×
38
                                    existingCommits anySatisfy: [ :existingCommit |
×
39
                                            existingCommit id = commitParsed id ] ].
×
40
        aProjectRepository mooseModel addAll: newlyFoundCommit.
×
41
        aProjectRepository commits addAll: newlyFoundCommit.
×
42
        ^ newlyFoundCommit
×
43
]
×
44

45
{ #category : #private }
46
GLHModelImporter >> addGroupResultToModel: groupResult [
1✔
47
        |group|
1✔
48
        group := self glhModel add: groupResult unless: self blockOnIdEquality.
1✔
49
        self glhModel
1✔
50
                addAll: group projects
1✔
51
                unless: self blockOnIdEquality.
1✔
52
        ^ group 
1✔
53
]
1✔
54

55
{ #category : #'as yet unclassified' }
56
GLHModelImporter >> blockEqualityOn: aSymbol [
1✔
57
        ^ [ :existing :new |
1✔
58
          (existing perform: aSymbol) = (new perform: aSymbol) ]
1✔
59
]
1✔
60

61
{ #category : #equality }
62
GLHModelImporter >> blockForDiffEquality [
1✔
63
        ^ [ :existing :new |
1✔
64
                        existing diffString size = new diffString size and: [
1✔
65
                                existing diffString = new diffString ] ]
1✔
66
]
1✔
67

68
{ #category : #equality }
69
GLHModelImporter >> blockOnIdEquality [
1✔
70

1✔
71
        ^ [ :existing :new |
1✔
72
          existing id = new id ]
1✔
73
]
1✔
74

75
{ #category : #equality }
76
GLHModelImporter >> blockOnNameEquality [
1✔
77

1✔
78
        ^ self blockEqualityOn: #name
1✔
79
]
1✔
80

81
{ #category : #'as yet unclassified' }
82
GLHModelImporter >> chainsCommitsFrom: commitsCollection [
×
83

×
84
        | dic |
×
85
        
×
86
        ('Chains ', commitsCollection size printString , ' commits') recordInfo.
×
87
        
×
88
        dic := ((self glhModel allWithType: GLHCommit) collect: [ :commit |
×
89
                        commit id -> commit ]) asSet asDictionary.
×
90

×
91
        commitsCollection do: [ :commit |
×
92
                commit parent_ids do: [ :parentId | 
×
93
                        dic
×
94
                                at: parentId
×
95
                                ifPresent: [ :parentCommit |
×
96
                                        parentCommit childCommits
×
97
                                                add: commit
×
98
                                                unless: self blockOnIdEquality ]
×
99
                                ifAbsent: [  ] ] ].
×
100
        ^ commitsCollection
×
101
]
×
102

103
{ #category : #'private - api' }
104
GLHModelImporter >> completeImportProject: aGLHProject [
1✔
105

1✔
106
        | importedProject |
1✔
107
        ('Complete import of project: ' , aGLHProject id printString)
1✔
108
                recordInfo.
1✔
109
        aGLHProject repository ifNotNil: [ ^ aGLHProject ].
1✔
110

1✔
111
        importedProject := self glhModel
1✔
112
                                   add: aGLHProject
1✔
113
                                   unless: self blockOnIdEquality.
1✔
114

1✔
115
        self importPipelinesOfProject: importedProject.
1✔
116

1✔
117
        "aGLHProject creator: (self importUser: aGLHProject creator_id)."
1✔
118

1✔
119
        (self importUser: importedProject creator_id) addCreatedProject:
1✔
120
                importedProject.
1✔
121

1✔
122

1✔
123
        importedProject repository: GLHRepository new.
1✔
124
        self glhModel add: importedProject repository.
1✔
125
        self importRepository: importedProject repository.
1✔
126

1✔
127
        ^ importedProject
1✔
128
]
1✔
129

130
{ #category : #'as yet unclassified' }
131
GLHModelImporter >> completeImportedCommit: aCommit [
×
132

×
133
        ('completing commit: ' , aCommit short_id printString) recordInfo.
×
134
        self importCreatorOfCommit: aCommit.
×
135

×
136
        self withCommitDiffs ifTrue: [
×
137
                | diffs |
×
138
                aCommit diffs ifEmpty: [
×
139
                        diffs := self importDiffOfCommit: aCommit.
×
140
                        self glhModel addAll: diffs unless: self blockForDiffEquality ] ].
×
141

×
142
        ^ aCommit
×
143
]
×
144

145
{ #category : #'private - configure reader' }
146
GLHModelImporter >> configureReaderForCommit: reader [
1✔
147

1✔
148
          reader for: GLHCommit do: [ :mapping |
1✔
149
                mapping mapInstVars:
1✔
150
                        #( id short_id title author_name author_email committer_name
1✔
151
                           committer_email message web_url ).
1✔
152
                (mapping mapInstVar: #authored_date) valueSchema: DateAndTime.
1✔
153
                (mapping mapInstVar: #committed_date) valueSchema: DateAndTime.
1✔
154
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
1✔
155
                (mapping mapInstVar: #parent_ids) valueSchema: #ArrayOfIds.
1✔
156
                mapping
1✔
157
                        mapProperty: 'stats'
1✔
158
                        getter: [ :el | "Not used" ]
1✔
159
                        setter: [ :commit :value |
1✔
160
                                commit deletions: (value at: #deletions).
1✔
161
                                commit additions: (value at: #additions) ] ].
1✔
162

1✔
163
        reader for: DateAndTime customDo: [ :mapping |
1✔
164
                mapping decoder: [ :string | DateAndTime fromString: string ] ].
1✔
165

1✔
166
        reader
1✔
167
                for: #ArrayOfIds
1✔
168
                customDo: [ :mapping | mapping decoder: [ :string | string ] ].
1✔
169
  
1✔
170
        reader
1✔
171
                for: #ArrayOfCommit
1✔
172
                customDo: [ :customMappting |
1✔
173
                customMappting listOfElementSchema: GLHCommit ].
1✔
174

1✔
175
]
1✔
176

177
{ #category : #'private - configure reader' }
178
GLHModelImporter >> configureReaderForDiffs: reader [
1✔
179

1✔
180
        reader for: GLHDiff do: [ :mapping |
1✔
181
                mapping mapInstVars:
1✔
182
                        #( deleted_file new_file new_path old_path renamed_file ).
1✔
183
                mapping mapInstVar: #diffString to: #diff ].
1✔
184

1✔
185
        reader
1✔
186
                for: #ArrayOfDiffs
1✔
187
                customDo: [ :customMappting |
1✔
188
                customMappting listOfElementSchema: GLHDiff ].
1✔
189
        ^ reader
1✔
190
]
1✔
191

192
{ #category : #'private - configure reader' }
193
GLHModelImporter >> configureReaderForGroup: reader [
1✔
194

1✔
195
        reader for: GLHGroup do: [ :mapping |
1✔
196
                mapping mapInstVars.
1✔
197
                (mapping mapInstVar: #projects) valueSchema: #ArrayOfProjects ].
1✔
198
        reader mapInstVarsFor: GLHProject.
1✔
199
        reader
1✔
200
                for: #ArrayOfProjects
1✔
201
                customDo: [ :customMappting |
1✔
202
                customMappting listOfElementSchema: GLHProject ].
1✔
203
        reader
1✔
204
                for: #ArrayOfGroups
1✔
205
                customDo: [ :customMappting |
1✔
206
                customMappting listOfElementSchema: GLHGroup ]
1✔
207
]
1✔
208

209
{ #category : #private }
210
GLHModelImporter >> convertApiFileAsFile: aAPIFile [
×
211

×
212
        aAPIFile type = 'tree' ifTrue: [ 
×
213
                ^ GLHFileDirectory new
×
214
                          name: aAPIFile name;
×
215
                          yourself ].
×
216
        ^ GLHFileBlob new
×
217
                  name: aAPIFile name;
×
218
                  yourself
×
219
]
×
220

221
{ #category : #'as yet unclassified' }
222
GLHModelImporter >> detectEntityType: aType overAttribut: aSelector equalTo: value [
×
223

×
224
        ^ (self glhModel allWithType: aType) detect: [ :entity |
×
225
                  (entity perform: aSelector) = value ] ifNone: [ nil ]. 
×
226
]
×
227

228
{ #category : #'as yet unclassified' }
229
GLHModelImporter >> filterCommitChanges: aCollection [
1✔
230

1✔
231
        ^ aCollection reject: [ :line |
1✔
232
                  | trimmedLine |
1✔
233
                  trimmedLine := line trimLeft.
1✔
234
                  (trimmedLine beginsWith: '---') or: [
1✔
235
                          (trimmedLine beginsWith: '+++') or: [
1✔
236
                                  trimmedLine beginsWith: '\ No newline at end of file' ] ] ]
1✔
237
]
1✔
238

239
{ #category : #accessing }
240
GLHModelImporter >> glhApi [
1✔
241

1✔
242
        ^ glhApi
1✔
243
]
1✔
244

245
{ #category : #accessing }
246
GLHModelImporter >> glhApi: anObject [
1✔
247

1✔
248
        glhApi := anObject
1✔
249
]
1✔
250

251
{ #category : #accessing }
252
GLHModelImporter >> glhModel [
1✔
253

1✔
254
        ^ glhModel
1✔
255
]
1✔
256

257
{ #category : #accessing }
258
GLHModelImporter >> glhModel: anObject [
1✔
259

1✔
260
        glhModel := anObject
1✔
261
]
1✔
262

263
{ #category : #'as yet unclassified' }
264
GLHModelImporter >> importActiveHumanUsers [
×
265

×
266
        | newlyFoundUser page foundUsers |
×
267
        page := 0.
×
268
        foundUsers := OrderedCollection new.
×
269
        newlyFoundUser := { true }.
×
270
        [ newlyFoundUser isNotEmpty ] whileTrue: [
×
271
                | results |
×
272
                page := page + 1.
×
273
                ('import users page ' , page printString) recordInfo.
×
274
                results := self glhApi
×
275
                                   usersHuman: true
×
276
                                   active: true
×
277
                                   withoutProjectBots: true
×
278
                                   perPage: 100
×
279
                                   page: page.
×
280

×
281
                newlyFoundUser := self parseUsersResult: results.
×
282
                "newlyFoundCommit do: [ :c | c repository: aProject repository ]."
×
283

×
284
                foundUsers addAll:
×
285
                        (self glhModel
×
286
                                 addAll: newlyFoundUser
×
287
                                 unless: self blockOnIdEquality) ].
×
288

×
289

×
290
        ^ foundUsers
×
291
]
×
292

293
{ #category : #api }
UNCOV
294
GLHModelImporter >> importAllGroups [
×
295

×
296
        | page foundGroups newlyFoundGroups |
×
297
        page := 0.
×
298
        foundGroups := OrderedCollection new.
×
299
        newlyFoundGroups := { true }.
×
300
        [ newlyFoundGroups isNotEmpty ] whileTrue: [
×
301
                | results |
×
302
                page := page + 1.
×
303
                results := self glhApi listGroupsWithTopLevelOnly: true page: page.
×
304

×
305
                newlyFoundGroups := generalReader
×
306
                                            on: results readStream;
×
307
                                            nextAs: #ArrayOfGroups.
×
308
                foundGroups addAll: newlyFoundGroups ].
×
309
        ^ foundGroups
×
310
]
×
311

312
{ #category : #'as yet unclassified' }
UNCOV
313
GLHModelImporter >> importAndLoadLatestsCommitsOfProject: aGLHProject [
×
314

×
315
        | commits |
×
316
        self completeImportProject: aGLHProject.
×
317
        commits := self importLastestCommitsOfProject: aGLHProject.
×
318
        commits do: [ :commit | self completeImportedCommit: commit ].
×
319
        self chainsCommitsFrom: commits.
×
320
        ^ commits
×
321
]
×
322

323
{ #category : #'private - api' }
324
GLHModelImporter >> importCommit: aCommitID ofProject: aGLHProject [
×
325

×
326
        | result parsedResult |
×
327
        (self glhModel allWithType: GLHCommit) asOrderedCollection
×
328
                detect: [ :commit | commit id = aCommitID ]
×
329
                ifFound: [ :commit | ^ commit ].
×
330
        result := self glhApi
×
331
                          commit: aCommitID
×
332
                          ofProject: aGLHProject id
×
333
                          withStat: false.
×
334
        parsedResult := self parseCommitResult: result.
×
335
        self
×
336
                addCommits: { parsedResult }
×
337
                toRepository: aGLHProject repository.
×
338
        ^ parsedResult
×
339
]
×
340

341
{ #category : #'as yet unclassified' }
342
GLHModelImporter >> importCommitOfProject: anProject withId: anID [
×
343

×
344
        | commit result |
×
345
        anID ifNil: [ ^ nil ].
×
346

×
347
        ('looking for commit ' , anID printString , ' in project : '
×
348
         , anProject id printString) recordInfo.
×
349

×
350
        commit := (self
×
351
                           detectEntityType: GLHCommit
×
352
                           overAttribut: #id
×
353
                           equalTo: anID) ifNil: [
×
354
                          result := self glhApi commit: anID ofProject: anProject id.
×
355
                          commit := (self parseCommitsResult: '[' , result , ']')
×
356
                                            first.
×
357

×
358
                          self glhModel add: commit unless: self blockOnIdEquality.
×
359
                          commit repository: anProject repository.
×
360

×
361
                          commit ].
×
362

×
363
        self withCommitDiffs ifTrue: [ self importDiffOfCommit: commit ].
×
364

×
365
        ^ commit
×
366
]
×
367

368
{ #category : #'private - api' }
UNCOV
369
GLHModelImporter >> importCommits: aGLHProject [
×
370
        "limited to the last 20 commits"
×
371

×
372
        | results parsedResults |
×
373
        results := self glhApi
×
374
                           commitsOfProject: aGLHProject id
×
375
                           forRefName: nil
×
376
                           since: nil
×
377
                           until: nil
×
378
                           path: nil
×
379
                           author: nil
×
380
                           all: nil
×
381
                           with_stats: true
×
382
                           firstParent: nil
×
383
                           order: nil
×
384
                           trailers: nil
×
385
                           perPage: nil
×
386
                           page: nil.
×
387
        parsedResults := self parseCommitsResult: results.
×
388
        self glhModel addAll: parsedResults unless: self blockOnIdEquality.
×
389

×
390
        parsedResults do: [ :commit |
×
391
                commit repository: aGLHProject repository ].
×
392

×
393
        self withCommitDiffs ifTrue: [
×
394
                parsedResults do: [ :commit | self importDiffOfCommit: commit ] ].
×
395
        
×
396
        ^ parsedResults. 
×
397
]
×
398

399
{ #category : #'as yet unclassified' }
400
GLHModelImporter >> importCommitsFollowing: aCommit upToDays: aNumberOfDay [
×
401
        "import the 'n' commits of a project starting from an initial 'aCommit' commit. 
×
402
        Lazy import does not import the entities inside the model"
×
403

×
404
        | date |
×
405
        date := aCommit created_at asDateAndTime.
×
406

×
407
        ^ self
×
408
                  importCommitsOfBranch: aCommit branch
×
409
                  forRefName: aCommit branch name
×
410
                  since: date
×
411
                  until: (date + aNumberOfDay day)
×
412
]
×
413

414
{ #category : #commit }
415
GLHModelImporter >> importCommitsOProject: aProject since: fromDate until: toDate [
×
416

×
417
        | newlyFoundCommit page foundCommit |
×
418
        page := 0.
×
419
        foundCommit := OrderedCollection new.
×
420
        newlyFoundCommit := { true }.
×
421
        [ newlyFoundCommit isNotEmpty ] whileTrue: [
×
422
                | results |
×
423
                page := page + 1.
×
424
                ('import commit page ' , page printString) recordInfo.
×
425
                results := self glhApi
×
426
                                   commitsOfProject: aProject id
×
427
                                   forRefName: nil
×
428
                                   since:
×
429
                                   (fromDate ifNotNil: [ fromDate asDateAndTime asString ])
×
430
                                   until:
×
431
                                   (toDate ifNotNil: [ toDate asDateAndTime asString ])
×
432
                                   path: nil
×
433
                                   author: nil
×
434
                                   all: true
×
435
                                   with_stats: true
×
436
                                   firstParent: nil
×
437
                                   order: nil
×
438
                                   trailers: nil
×
439
                                   perPage: 100
×
440
                                   page: page.
×
441

×
442
                newlyFoundCommit := self parseCommitsResult: results.
×
443
                "newlyFoundCommit do: [ :c | c repository: aProject repository ]."
×
444

×
445
                foundCommit addAll: (aProject repository commits
×
446
                        addAll: newlyFoundCommit
×
447
                        unless: self blockOnIdEquality). ].
×
448

×
449

×
450
        ^ self glhModel addAll: foundCommit unless: self blockOnIdEquality
×
451
]
×
452

453
{ #category : #commit }
UNCOV
454
GLHModelImporter >> importCommitsOf: aGLHProject withStats: aBoolean until: toDate [
×
455

×
456
        | newlyFoundCommit page |
×
457
        
×
458
        self deprecated: [  ] .
×
459
        
×
460
        page := 0.
×
461
        newlyFoundCommit := { true }.
×
462
        [ newlyFoundCommit isNotEmpty ] whileTrue: [
×
463
                | results parsedResults existingCommits |
×
464
                page := page + 1.
×
465
                ('import commit page ' , page printString) recordInfo.
×
466
                results := self glhApi
×
467
                                   commitsOfProject: aGLHProject id
×
468
                                   forRefName: nil
×
469
                                   since: nil
×
470
                                   until: nil
×
471
                                   path: nil
×
472
                                   author: nil
×
473
                                   all: nil
×
474
                                   with_stats: aBoolean
×
475
                                   firstParent: nil
×
476
                                   order: nil
×
477
                                   trailers: nil
×
478
                                   perPage: 100
×
479
                                   page: page.
×
480
                parsedResults := self parseCommitsResult: results.
×
481
                existingCommits := aGLHProject mooseModel allWithType: GLHCommit.
×
482

×
483
                newlyFoundCommit := parsedResults reject: [ :commitParsed |
×
484
                                            (toDate isNil or: [
×
485
                                                     commitParsed committed_date
×
486
                                                     < toDate asDateAndTime ]) or: [
×
487
                                                    existingCommits anySatisfy: [ :existingCommit |
×
488
                                                            existingCommit id = commitParsed id ] ] ].
×
489
                aGLHProject mooseModel addAll: newlyFoundCommit.
×
490
                aGLHProject repository commits addAll: newlyFoundCommit ].
×
491

×
492

×
493
        self withCommitDiffs ifTrue: [
×
494
                aGLHProject repository commits do: [ :commit |
×
495
                        self importDiffOfCommit: commit ] ]
×
496
]
×
497

498
{ #category : #commit }
499
GLHModelImporter >> importCommitsOfBranch: aGLHBranch forRefName: refName since: fromDate [
×
500

×
501
        ^ self
×
502
                  importCommitsOfBranch: aGLHBranch
×
503
                  forRefName: aGLHBranch name
×
504
                  since: fromDate
×
505
                  until: nil
×
506
]
×
507

508
{ #category : #commit }
509
GLHModelImporter >> importCommitsOfBranch: aGLHBranch forRefName: refName since: fromDate until: toDate [
×
510

×
511
        | newlyFoundCommit page foundCommit|
×
512
        page := 0.
×
513
        foundCommit := OrderedCollection new. 
×
514
        newlyFoundCommit := { true }.
×
515
        [ newlyFoundCommit isNotEmpty ] whileTrue: [
×
516
                | results |
×
517
                page := page + 1.
×
518
                ('import commit page ' , page printString) recordInfo.
×
519
                results := self glhApi
×
520
                                   commitsOfProject: aGLHBranch repository project id
×
521
                                   forRefName: aGLHBranch name
×
522
                                   since:
×
523
                                   (fromDate ifNotNil: [ fromDate asDateAndTime asString ])
×
524
                                   until:
×
525
                                   (toDate ifNotNil: [ toDate asDateAndTime asString ])
×
526
                                   path: nil
×
527
                                   author: nil
×
528
                                   all: nil
×
529
                                   with_stats: nil
×
530
                                   firstParent: nil
×
531
                                   order: nil
×
532
                                   trailers: nil
×
533
                                   perPage: 100
×
534
                                   page: page.
×
535

×
536
                newlyFoundCommit := self parseCommitsResult: results.
×
537
        aGLHBranch commits
×
538
                        addAll: newlyFoundCommit
×
539
                        unless: self blockOnIdEquality.
×
540
        foundCommit addAll: newlyFoundCommit.  
×
541
                        ].
×
542

×
543
        self glhModel
×
544
                addAll: aGLHBranch commits
×
545
                unless: self blockOnIdEquality.
×
546

×
547
        "self withCommitDiffs ifTrue: [
×
548
                aGLHBranch commits: [ :commit | self importDiffOfCommit: commit ] ]."
×
549

×
550
        ^ foundCommit
×
551
]
×
552

553
{ #category : #commit }
554
GLHModelImporter >> importCommitsOfBranch: aGLHBranch forRefName: refName until: toDate [
×
555

×
556
        ^ self
×
557
                  importCommitsOfBranch: aGLHBranch
×
558
                  forRefName: aGLHBranch name
×
559
                  since: nil
×
560
                  until: toDate
×
561
]
×
562

563
{ #category : #'as yet unclassified' }
564
GLHModelImporter >> importContributedProjectsOfUser: aGLHUser [
×
565

×
566
        | newlyFoundElmts page foundElmts remaningProjects|
×
567
        page := 0.
×
568
        foundElmts := OrderedCollection new.
×
569
        newlyFoundElmts := { true }.
×
570
        [ newlyFoundElmts isNotEmpty ] whileTrue: [
×
571
                | results |
×
572
                page := page + 1.
×
573
                ('import contributed project of user ' , aGLHUser name , ' page '
×
574
                 , page printString) recordInfo.
×
575
                results := self glhApi 
×
576
                                   contributedProjectsOfUserId: aGLHUser id
×
577
                                   orderBy: 'last_activity_at'
×
578
                                   simple: true
×
579
                                   sort: 'desc'
×
580
                                   perPage: 100
×
581
                                   page: page.
×
582

×
583
                newlyFoundElmts := self parseArrayOfProject: results.
×
584

×
585
                foundElmts addAll:
×
586
                        (self glhModel
×
587
                                 addAll: newlyFoundElmts
×
588
                                 unless: self blockOnIdEquality) ].
×
589
]
×
590

591
{ #category : #'as yet unclassified' }
NEW
592
GLHModelImporter >> importCreatorOfCommit2: aCommit [
×
NEW
593

×
NEW
594
        aCommit commitCreator ifNil: [                
×
NEW
595
                aCommit commitCreator:
×
NEW
596
                        (self importUserByUsername: aCommit author_name) ].
×
NEW
597
        self userCatalogue addUser: aCommit commitCreator withProject: aCommit repository project id.
×
NEW
598
        ^ aCommit commitCreator
×
NEW
599
]
×
600

601
{ #category : #'as yet unclassified' }
602
GLHModelImporter >> importCreatorOfCommit: aCommit [
×
603
        
×
604
        remaningProjects := self importProjects: ((foundElmts collect: #id) difference: ((self userCatalogue atId: aGLHUser id) at: #contributedProjects)).
×
605

×
606
        aGLHUser contributedProjects
×
607
                addAll: (foundElmts, remaningProjects)
×
608
                unless: self blockOnIdEquality.
×
609
                
×
610
        self userCatalogue addUser: aGLHUser withProjects: (aGLHUser contributedProjects collect: #id).
×
611

×
612
        ^ foundElmts
×
613
]
×
614

615
{ #category : #api }
616
GLHModelImporter >> importDiffOfCommit: aCommit [
1✔
617

1✔
618
        | result diffsResult |
1✔
619
        aCommit diffs ifNotEmpty: [
1✔
620
                'Diff already importer: ' , aCommit short_id printString recordInfo.
1✔
621
                ^ aCommit diffs ].
1✔
622
        ('Import diff of commit: ' , aCommit short_id printString) recordInfo.
1✔
623
        result := self glhApi
1✔
624
                          commitDiff: aCommit id
1✔
625
                          ofProject: aCommit repository project id
1✔
626
                          unidiff: true.
1✔
627
        diffsResult := self newParseDiffResult: result.
1✔
628

1✔
629
        ^ aCommit diffs addAll: diffsResult unless: self blockForDiffEquality.
1✔
630

1✔
631
]
1✔
632

633
{ #category : #'private - api' }
634
GLHModelImporter >> importDirectoryFiles: aDirectoryFile OfBranch: aBranch [
×
635

×
636
        | result files apiFiles |
×
637
        result := self glhApi
×
638
                          treeOfRepository: aBranch repository project id
×
639
                          ofBranch: aBranch name
×
640
                          andPath: aDirectoryFile path , '/'.
×
641
        apiFiles := self parseFileTreeResult: result.
×
642
        files := apiFiles collect: [ :apiFile |
×
643
                         self convertApiFileAsFile: apiFile ].
×
644
        files do: [ :file |
×
645
                
×
646
                self glhModel add: file.
×
647
                aDirectoryFile addFile: file ].
×
648
        files
×
649
                select: [ :file | file isKindOf: GLHFileDirectory ]
×
650
                thenCollect: [ :file |
×
651
                self importDirectoryFiles: file OfBranch: aBranch ]
×
652
]
×
653

654
{ #category : #'private - api' }
655
GLHModelImporter >> importFilesOfBranch: aBranch [
×
656

×
657
        | result files apiFiles |
×
658
        result := self glhApi
×
659
                          treeOfRepository: aBranch repository project id
×
660
                          ofBranch: aBranch name
×
661
                          andPath: nil.
×
662
        apiFiles := self parseFileTreeResult: result.
×
663
        files := apiFiles collect: [ :apiFile | 
×
664
                         self convertApiFileAsFile: apiFile ].
×
665
        files do: [ :file | 
×
666
                self glhModel add: file.
×
667
                aBranch addFile: file ].
×
668
        files
×
669
                select: [ :file | file isKindOf: GLHFileDirectory ]
×
670
                thenCollect: [ :file | 
×
671
                self importDirectoryFiles: file OfBranch: aBranch ]
×
672
]
×
673

674
{ #category : #api }
675
GLHModelImporter >> importGroup: aGroupID [
1✔
676

1✔
677
        | result groupResult |
1✔
678
        ('Import group: ' , aGroupID printString) recordInfo.
1✔
679

1✔
680
        result := self glhApi group: aGroupID.
1✔
681
        groupResult := self parseGroupResult: result.
1✔
682
        groupResult := self addGroupResultToModel: groupResult.
1✔
683

1✔
684
        groupResult projects do: [ :project |
1✔
685
                self completeImportProject: project ].
1✔
686

1✔
687
        (self subGroupsOf: aGroupID) do: [ :subGroup |
1✔
688
                
1✔
689
                groupResult subGroups
1✔
690
                        add: (self importGroup: subGroup id)
1✔
691
                        unless: self blockOnIdEquality ].
1✔
692
        ^ groupResult
1✔
693
]
1✔
694

695
{ #category : #api }
696
GLHModelImporter >> importJobsOf: aPipeline [
×
697

×
698
        | result jobs |
×
699
        result := self glhApi
×
700
                          jobsOfProject: aPipeline project id
×
701
                          ofPipelines: aPipeline id.
×
702
        jobs := self parseJobsResult: result ofProject: aPipeline project.
×
703
        jobs do: [ :job | aPipeline addJob: job ].
×
704
        self glhModel addAll: jobs
×
705

×
706
]
×
707

708
{ #category : #'private - api' }
709
GLHModelImporter >> importLastestCommitsOfProject: aGLHProject [
1✔
710
        "limited to the last 50 commits"
1✔
711

1✔
712
        | results parsedResults |
1✔
713
        results := self glhApi
1✔
714
                           commitsOfProject: aGLHProject id
1✔
715
                           forRefName: nil
1✔
716
                           since: nil
1✔
717
                           until: nil
1✔
718
                           path: nil
1✔
719
                           author: nil
1✔
720
                           all: nil
1✔
721
                           with_stats: true
1✔
722
                           firstParent: nil
1✔
723
                           order: nil
1✔
724
                           trailers: nil
1✔
725
                           perPage: 50
1✔
726
                           page: nil.
1✔
727
        parsedResults := self parseCommitsResult: results.
1✔
728
        parsedResults := self glhModel addAll: parsedResults unless: self blockOnIdEquality.
1✔
729

1✔
730
        aGLHProject repository commits addAll: parsedResults unless: self blockOnIdEquality.
1✔
731
        "parsedResults do: [ :commit |
1✔
732
                commit repository: aGLHProject repository ]."
1✔
733

1✔
734
        self withCommitDiffs ifTrue: [
1✔
735
                parsedResults do: [ :commit | self importDiffOfCommit: commit ] ].
1✔
736

1✔
737
        ^ parsedResults
1✔
738
]
1✔
739

740
{ #category : #commit }
741
GLHModelImporter >> importParentCommitsOfCommit: aGLHCommit since: aDate [
×
742

×
743
        | parentsIds commits |
×
744
        commits := OrderedCollection new.
×
745
        aGLHCommit created_at asDateAndTime < aDate asDateAndTime ifTrue: [
×
746
                 
×
747
                ^ commits
×
748
                          add: aGLHCommit;
×
749
                          yourself ].
×
750

×
751
        parentsIds := aGLHCommit parent_ids.
×
752

×
753
        commits addAll: (parentsIds collect: [ :id |
×
754
                         self
×
755
                                 importCommitOfProject: aGLHCommit repository project
×
756
                                 withId: id ]).
×
757

×
758

×
759
        ^ (commits collect: [ :parentCommit |
×
760
                   self importParentCommitsOfCommit: parentCommit since: aDate ])
×
761
                  flatten
×
762
]
×
763

764
{ #category : #'private - api' }
765
GLHModelImporter >> importPipelinesOfProject: aGLHProject [
1✔
766

1✔
767
        (self pipelinesOf: aGLHProject id) do: [ :pipeline |
1✔
768
                self glhModel add: pipeline unless: self blockOnIdEquality .
1✔
769
                aGLHProject pipelines add: pipeline unless: self blockOnIdEquality]
1✔
770
]
1✔
771

772
{ #category : #projects }
773
GLHModelImporter >> importProject: aProjectID [
×
774

×
775
        | result projectResult |
×
776
        ('Import project with id: ' , aProjectID printString) recordInfo.
×
777

×
778
        result := self glhApi project: aProjectID.
×
779
        projectResult := self parseProjectResult: result.
×
780

×
781
        ^ self completeImportProject: projectResult
×
782
]
×
783

784
{ #category : #imports }
785
GLHModelImporter >> importProjects [
×
786

×
787
        ^ self importProjectsSince: nil
×
788
]
×
789

790
{ #category : #projects }
791
GLHModelImporter >> importProjects: aCollectionOfProjectID [
×
792

×
793
        ^ aCollectionOfProjectID collect: [ :id | self importProject: id ]
×
794
]
×
795

796
{ #category : #imports }
797
GLHModelImporter >> importProjectsSince: since [
×
798
        "heavy import of all projects"
×
799

×
800
        "copy import from commits"
×
801

×
802
        | newlyFoundProjects page foundProject amount |
×
803
        ('import all Projects since: ' , since printString) recordInfo.
×
804

×
805
        "number of projects per page"
×
806
        amount := 100.
×
807
        page := 0.
×
808
        foundProject := OrderedCollection new.
×
809
        newlyFoundProjects := { true }.
×
810
        [ newlyFoundProjects isNotEmpty ] whileTrue: [
×
811
                | results |
×
812
                page := page + 1.
×
813
                ('import projects page #' , page printString) recordInfo.
×
814

×
815
                results := self glhApi projects: amount since: since page: page.
×
816

×
817
                newlyFoundProjects := self glhModel
×
818
                                              addAll: (self parseArrayOfProject: results)
×
819
                                              unless: self blockOnIdEquality.
×
820
                foundProject addAll: newlyFoundProjects ].
×
821

×
822
        ^ foundProject
×
823
]
×
824

825
{ #category : #'private - api' }
826
GLHModelImporter >> importRepository: aGLHRepository [
1✔
827

1✔
828
        | resultBranches branches |
1✔
829
        [
1✔
830
        ('import the repository of project ' , aGLHRepository project name)
1✔
831
                recordInfo.
1✔
832

1✔
833
        resultBranches := self glhApi branchesOfRepository:
1✔
834
                                  aGLHRepository project id.
1✔
835
        branches := self parseBranchesResult: resultBranches.
1✔
836

1✔
837
        'import the branches of project ' recordInfo.
1✔
838

1✔
839
        branches := aGLHRepository branches
1✔
840
                            addAll: branches
1✔
841
                            unless: self blockOnNameEquality.
1✔
842
        branches := self glhModel
1✔
843
                            addAll: branches
1✔
844
                            unless: self blockOnNameEquality.
1✔
845

1✔
846

1✔
847
        self withFiles ifTrue: [
1✔
848
                branches do: [ :branch | self importFilesOfBranch: branch ] ] ]
1✔
849
                on: NeoJSONParseError
1✔
850
                do: [
1✔
851
                self inform: aGLHRepository project name , ' has no repository' ]
1✔
852
]
1✔
853

854
{ #category : #'private - api' }
855
GLHModelImporter >> importUser: aUserID [
1✔
856

1✔
857
        | result userResult |
1✔
858
        (self glhModel allWithType: GLHUser)
1✔
859
                detect: [ :user | user id = aUserID ]
1✔
860
                ifFound: [ :user | ^ user ].
1✔
861
        ('Import user: ' , aUserID printString) recordInfo.
1✔
862
        result := self glhApi user: aUserID.
1✔
863
        userResult := self parseUserResult: result.
1✔
864
        ^ self glhModel add: userResult unless: self blockOnIdEquality
1✔
865
]
1✔
866

867
{ #category : #user }
868
GLHModelImporter >> importUserByUsername: anUsername [
×
869

×
870
        | dicUsername resultUser |
×
871
        dicUsername := ((self glhModel allWithType: GLHUser) collect: [ :user |
×
872
                                user username -> user ]) asSet asDictionary.
×
873

×
874
        dicUsername addAll: self userCatalogue collectUsernames.
×
875

×
876

×
877
        resultUser := dicUsername
×
878
                              at: anUsername
×
879
                              ifAbsent: [ "thus we have to import this new user"
×
880
                                      | result userId searchResult |
×
881
                                      ('Import user with username: '
×
882
                                       , anUsername printString) recordInfo.
×
883
                                      result := self glhApi usersSearchByUsername:
×
884
                                                        anUsername.
×
885
                                      searchResult := NeoJSONReader fromString: result.
×
886

×
887
                                      (searchResult class = Dictionary and: [
×
888
                                               (searchResult at: #message) includesSubstring:
×
889
                                                       '403 Forbidden' ])
×
890
                                              ifTrue: [ "if the result is an 403 error we fake a new user"
×
891
                                                      self glhModel
×
892
                                                              add: (GLHUser new
×
893
                                                                               username: anUsername;
×
894
                                                                               name: anUsername;
×
895
                                                                               yourself)
×
896
                                                              unless: [ :nu :ou | nu username = ou username ] ]
×
897
                                              ifFalse: [
×
898
                                                      searchResult
×
899
                                                              ifEmpty: [ "results can be empty thus we force a new user with the info we have "
×
900
                                                                      self glhModel
×
901
                                                                              add: (GLHUser new
×
902
                                                                                               username: anUsername;
×
903
                                                                                               name: anUsername;
×
904
                                                                                               yourself)
×
905
                                                                              unless: [ :nu :ou | nu username = ou username ] ]
×
906
                                                              ifNotEmpty: [ "because we may already have the researched user, we look by ID in the model"
×
907
                                                                      userId := searchResult first at: #id.
×
908
                                                                      (self glhModel allWithType: GLHUser)
×
909
                                                                              detect: [ :user | user id = userId ]
×
910
                                                                              ifNone: [ self importUser: userId ] ] ] ].
×
911

×
912
        self userCatalogue addUser: resultUser withName: anUsername.
×
913

×
914
        ^ resultUser
×
915
]
×
916

917
{ #category : #initialization }
918
GLHModelImporter >> initReader [
1✔
919

1✔
920
        generalReader := NeoJSONReader new.
1✔
921
        self configureReaderForCommit: generalReader.
1✔
922
        self configureReaderForGroup: generalReader.
1✔
923
        self configureReaderForDiffs: generalReader. 
1✔
924
]
1✔
925

926
{ #category : #initialization }
927
GLHModelImporter >> initialize [
1✔
928

1✔
929
        super initialize.
1✔
930
        withCommitDiffs := false.
1✔
931
        withInitialCommits := false.
1✔
932
        withInitialMergeRequest := false.
1✔
933

1✔
934
        withCommitsSince := (Date today - 1 week) asDateAndTime.
1✔
935
        userCatalogue := GLHUserCatalogueV2 new
1✔
936
                                 anImporter: self;
1✔
937
                                 yourself.
1✔
938
        self initReader.
1✔
939

1✔
940
        currentImporter := self
1✔
941
]
1✔
942

943
{ #category : #importer }
944
GLHModelImporter >> loadAllProjectsFromRepositorySoftware [
×
945
        "heavy import that load all the active project inside the model. Only import the project entities"
×
946
        |projects|
×
947
        
×
948
        projects := self glhApi projects. 
×
949
]
×
950

951
{ #category : #'as yet unclassified' }
952
GLHModelImporter >> makeGlobal [
×
NEW
953
        ^ self makeGlobal: DateAndTime now printString.
×
954
]
×
955

956
{ #category : #'as yet unclassified' }
NEW
957
GLHModelImporter >> makeGlobal: aLabel [ 
×
UNCOV
958

×
NEW
959
        currentImporter := currentImporter ifNil: [ OrderedDictionary new ].
×
NEW
960
        currentImporter at: aLabel put: self. 
×
NEW
961
        ^ self
×
NEW
962
]
×
963

964
{ #category : #private }
965
GLHModelImporter >> newParseCommitResult: result [
×
966

×
967
        generalReader  on: result readStream.
×
968

×
969
        ^ generalReader nextAs: GLHCommit
×
970
]
×
971

972
{ #category : #private }
973
GLHModelImporter >> newParseDiffResult: result [
1✔
974

1✔
975
        generalReader on: result readStream.
1✔
976
        ^ generalReader nextAs: #ArrayOfDiffs
1✔
977
]
1✔
978

979
{ #category : #parsing }
980
GLHModelImporter >> parseArrayOfProject: arrayOfProjects [
×
981

×
982
        | reader |
×
983
        reader := NeoJSONReader on: arrayOfProjects readStream.
×
984
        reader
×
985
                for: #ArrayOfProjects
×
986
                customDo: [ :customMappting |
×
987
                customMappting listOfElementSchema: GLHProject ].
×
988
        reader for: GLHProject do: [ :mapping |
×
989
                mapping mapInstVar: #name to: #name.
×
990
                mapping mapInstVar: #description to: #description.
×
991
                mapping mapInstVar: #id to: #id.
×
992
                mapping mapInstVar: #archived to: #archived.
×
993
                mapping mapInstVar: #web_url to: #html_url.
×
994
                mapping mapInstVar: #topics to: #topics ].
×
995
        ^ reader nextAs: #ArrayOfProjects
×
996
]
×
997

998
{ #category : #private }
999
GLHModelImporter >> parseBranchesResult: result [
1✔
1000

1✔
1001
        | reader |
1✔
1002
        reader := NeoJSONReader on: result readStream.
1✔
1003
        reader mapInstVarsFor: GLHBranch.
1✔
1004
        reader
1✔
1005
                for: #ArrayOfBranch
1✔
1006
                customDo: [ :customMappting | 
1✔
1007
                customMappting listOfElementSchema: GLHBranch ].
1✔
1008
        ^ reader nextAs: #ArrayOfBranch
1✔
1009
]
1✔
1010

1011
{ #category : #private }
1012
GLHModelImporter >> parseCommitResult: result [
×
1013

×
1014
        | reader |
×
1015
        reader := NeoJSONReader on: result readStream.
×
1016

×
1017
        reader for: GLHCommit do: [ :mapping |
×
1018
                mapping mapInstVars:
×
1019
                        #( id short_id title author_name author_email committer_name
×
1020
                           committer_email message web_url ).
×
1021
                (mapping mapInstVar: #authored_date) valueSchema: DateAndTime.
×
1022
                (mapping mapInstVar: #committed_date) valueSchema: DateAndTime.
×
1023
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
×
1024
                (mapping mapInstVar: #parent_ids) valueSchema: #ArrayOfIds.
×
1025
                mapping
×
1026
                        mapProperty: 'stats'
×
1027
                        getter: [ :el | "Not used" ]
×
1028
                        setter: [ :commit :value |
×
1029
                                commit deletions: (value at: #deletions).
×
1030
                                commit additions: (value at: #additions) ] ].
×
1031

×
1032
        reader for: DateAndTime customDo: [ :mapping |
×
1033
                mapping decoder: [ :string | DateAndTime fromString: string ] ].
×
1034

×
1035
        reader
×
1036
                for: #ArrayOfIds
×
1037
                customDo: [ :mapping | mapping decoder: [ :string | string ] ].
×
1038

×
1039

×
1040
        ^ reader nextAs: GLHCommit
×
1041
]
×
1042

1043
{ #category : #private }
1044
GLHModelImporter >> parseCommitsResult: result [
1✔
1045

1✔
1046
        | reader |
1✔
1047
        reader := NeoJSONReader on: result readStream.
1✔
1048

1✔
1049
          reader for: GLHCommit do: [ :mapping |
1✔
1050
                mapping mapInstVars:
1✔
1051
                        #( id short_id title author_name author_email committer_name
1✔
1052
                           committer_email message web_url ).
1✔
1053
                (mapping mapInstVar: #authored_date) valueSchema: DateAndTime.
1✔
1054
                (mapping mapInstVar: #committed_date) valueSchema: DateAndTime.
1✔
1055
                (mapping mapInstVar: #created_at) valueSchema: DateAndTime.
1✔
1056
                (mapping mapInstVar: #parent_ids) valueSchema: #ArrayOfIds.
1✔
1057
                mapping
1✔
1058
                        mapProperty: 'stats'
1✔
1059
                        getter: [ :el | "Not used" ]
1✔
1060
                        setter: [ :commit :value |
1✔
1061
                                commit deletions: (value at: #deletions).
1✔
1062
                                commit additions: (value at: #additions) ] ].
1✔
1063

1✔
1064
        reader for: DateAndTime customDo: [ :mapping |
1✔
1065
                mapping decoder: [ :string | DateAndTime fromString: string ] ].
1✔
1066

1✔
1067
        reader
1✔
1068
                for: #ArrayOfIds
1✔
1069
                customDo: [ :mapping | mapping decoder: [ :string | string ] ].
1✔
1070
  
1✔
1071
        reader
1✔
1072
                for: #ArrayOfCommit
1✔
1073
                customDo: [ :customMappting |
1✔
1074
                customMappting listOfElementSchema: GLHCommit ].
1✔
1075

1✔
1076
        ^ reader nextAs: #ArrayOfCommit
1✔
1077
]
1✔
1078

1079
{ #category : #private }
1080
GLHModelImporter >> parseDiffResult: result [
×
1081

×
1082
        | reader |
×
1083
        self
×
1084
                deprecated: 'Use #newParseDiffResult: instead'
×
1085
                on: '28 June 2024'
×
1086
                in:
×
1087
                'Pharo-11.0.0+build.726.sha.aece1b5473acf3830a0e082c1bc3a15d4ff3522b (64 Bit)'.
×
1088
        reader := NeoJSONReader on: result readStream.
×
1089
        reader for: GLHDiff do: [ :mapping |
×
1090
                mapping mapInstVars:
×
1091
                        #( deleted_file new_file new_path old_path renamed_file ).
×
1092
                mapping mapInstVar: #diffString to: #diff ].
×
1093

×
1094
        reader
×
1095
                for: #ArrayOfDiffs
×
1096
                customDo: [ :customMappting |
×
1097
                customMappting listOfElementSchema: GLHDiff ].
×
1098
        ^ reader nextAs: #ArrayOfDiffs
×
1099
]
×
1100

1101
{ #category : #private }
1102
GLHModelImporter >> parseFileTreeResult: aResult [
×
1103

×
1104
        | reader |
×
1105
        reader := NeoJSONReader on: aResult readStream.
×
1106
        reader mapInstVarsFor: GLHApiFile.
×
1107
        reader
×
1108
                for: #ArrayOfFile
×
1109
                customDo: [ :customMappting | 
×
1110
                customMappting listOfElementSchema: GLHApiFile ].
×
1111
        ^ reader nextAs: #ArrayOfFile
×
1112
]
×
1113

1114
{ #category : #private }
1115
GLHModelImporter >> parseGroupResult: aResult [
1✔
1116

1✔
1117
        | reader |
1✔
1118

1✔
1119
        reader := NeoJSONReader on: aResult readStream.
1✔
1120
        reader for: GLHGroup do: [ :mapping |
1✔
1121
                mapping mapInstVars.
1✔
1122
                (mapping mapInstVar: #projects) valueSchema: #ArrayOfProjects ].
1✔
1123
        reader mapInstVarsFor: GLHProject.
1✔
1124
        reader
1✔
1125
                for: #ArrayOfProjects
1✔
1126
                customDo: [ :customMappting |
1✔
1127
                customMappting listOfElementSchema: GLHProject ].
1✔
1128
        ^ reader nextAs: GLHGroup
1✔
1129
]
1✔
1130

1131
{ #category : #private }
1132
GLHModelImporter >> parseJobsResult: result ofProject: aProject [
×
1133

×
1134
        | reader |
×
1135
        reader := NeoJSONReader on: result readStream.
×
1136
        reader for: GLHJob do: [ :mapping |
×
1137
                mapping mapInstVars: #( id allow_failure web_url name ).
×
1138

×
1139
                mapping
×
1140
                        mapProperty: #user
×
1141
                        getter: [ :object | #ignore ]
×
1142
                        setter: [ :object :value |
×
1143
                        object user: (self importUser: (value at: #id)) ].
×
1144

×
1145
                mapping
×
1146
                        mapProperty: #commit
×
1147
                        getter: [ :object | #ignore ]
×
1148
                        setter: [ :object :value |
×
1149
                                value ifNotNil: [
×
1150
                                        object commit:
×
1151
                                                (self importCommit: (value at: #id) ofProject: aProject) ] ].
×
1152

×
1153
                mapping
×
1154
                        mapProperty: #duration
×
1155
                        getter: [ :object | #ignore ]
×
1156
                        setter: [ :object :value |
×
1157
                        value ifNotNil: [ object duration: value seconds ] ] ].
×
1158

×
1159
        reader
×
1160
                for: #ArrayOfGLHJob
×
1161
                customDo: [ :customMappting |
×
1162
                customMappting listOfElementSchema: GLHJob ].
×
1163
        ^ reader nextAs: #ArrayOfGLHJob
×
1164
]
×
1165

1166
{ #category : #private }
1167
GLHModelImporter >> parsePipelinesResult: result [
1✔
1168

1✔
1169
        | reader |
1✔
1170
        
1✔
1171
        (result includesSubstring: '{"message":"40' )ifTrue: [ ^ {  } ].
1✔
1172
        
1✔
1173
        reader := NeoJSONReader on: result readStream.
1✔
1174
        reader mapInstVarsFor: GLHPipeline.
1✔
1175
        reader for: GLHPipeline do: [ :mapping |
1✔
1176
                mapping
1✔
1177
                        mapProperty: #created_at
1✔
1178
                        getter: [ :object | #ignore ]
1✔
1179
                        setter: [ :object :value |
1✔
1180
                        object runDate: (DateAndTime fromString: value) ] ].
1✔
1181
        reader
1✔
1182
                for: #ArrayOfPipelines
1✔
1183
                customDo: [ :customMappting |
1✔
1184
                customMappting listOfElementSchema: GLHPipeline ].
1✔
1185
        ^ reader nextAs: #ArrayOfPipelines
1✔
1186
]
1✔
1187

1188
{ #category : #parsing }
UNCOV
1189
GLHModelImporter >> parseProjectResult: aResult [ 
×
1190
                | reader |
×
1191
        reader := NeoJSONReader on: aResult readStream.
×
1192
        reader for: GLHProject do: [ :mapping |
×
1193
                mapping mapInstVars. ].
×
1194
"        reader mapInstVarsFor: GLHProject."
×
1195

×
1196
        ^ reader nextAs: GLHProject
×
1197
]
×
1198

×
NEW
1199
{ #category : #private }
×
1200
GLHModelImporter >> parseSubGroupResult: aResult [
×
1201

×
1202
        | reader |
×
1203
        reader := NeoJSONReader on: aResult readStream.
×
1204
        self configureReaderForGroup: reader.
×
1205
        ^ reader nextAs: #ArrayOfGroups
×
1206
]
×
1207

×
NEW
1208
{ #category : #private }
×
1209
GLHModelImporter >> parseUserResult: result [
×
1210

×
1211
        | reader |
×
1212
        reader := NeoJSONReader on: result readStream.
×
1213
        reader mapInstVarsFor: GLHUser.
×
1214
        ^ reader nextAs: GLHUser
×
1215
]
×
1216

×
1217
{ #category : #private }
×
1218
GLHModelImporter >> parseUsersResult: result [
×
1219

×
1220
        | reader |
×
1221
        reader := NeoJSONReader on: result readStream.
×
1222

×
1223
        reader mapInstVarsFor: GLHUser.
×
1224

×
1225
        reader
×
1226
                for: #ArrayOfUser
×
1227
                customDo: [ :customMappting |
×
1228
                customMappting listOfElementSchema: GLHUser ].
×
1229

×
1230
        ^ reader nextAs: #ArrayOfUser
×
1231
]
×
1232

×
NEW
1233
{ #category : #'private - api' }
×
1234
GLHModelImporter >> pipelinesOf: aProjectID [
×
1235

×
1236
        | result |
×
1237
        ('Search pipelines of: ' , aProjectID printString) recordInfo.
×
1238
        result := self glhApi pipelinesOfProject: aProjectID.
×
1239
        ^ self parsePipelinesResult: result .
×
1240
]
×
1241

×
NEW
1242
{ #category : #'as yet unclassified' }
×
1243
GLHModelImporter >> selectEntityType: aType overAttribut: aSelector equalTo: value [
×
1244

×
1245
        ^ (self glhModel allWithType: aType)
×
1246
                select: [ :entity | (entity perform: aSelector) = value ]
×
1247
]
×
1248

×
NEW
1249
{ #category : #'private - api' }
×
1250
GLHModelImporter >> subGroupsOf: aGroupID [
×
1251

×
1252
        | results parsedResult result page |
×
1253
        ('Search subgroup of: ' , aGroupID printString) recordInfo.
×
1254
        results := OrderedCollection new.
×
1255
        page := 0.
×
1256
        
×
1257
        parsedResult := { true }.
×
1258
        [ parsedResult size > 0 ] whileTrue: [ 
×
1259
                result := self glhApi subgroupsOfGroup: aGroupID page: page.
×
1260
                parsedResult := self parseSubGroupResult: result.
×
1261
                results addAll: parsedResult.
×
1262
                                page := page + 1. ].
×
1263
        
×
1264
        ^ results
×
1265
]
×
1266

×
1267
{ #category : #accessing }
×
1268
GLHModelImporter >> userCatalogue [
×
1269
        ^ userCatalogue 
×
1270
]
×
1271

×
1272
{ #category : #accessing }
×
1273
GLHModelImporter >> userCatalogue: aGLHUserCatalogue [
×
1274

×
1275
        userCatalogue := aGLHUserCatalogue.
×
1276
        aGLHUserCatalogue anImporter: self. 
×
1277
]
×
1278

×
NEW
1279
{ #category : #accessing }
×
1280
GLHModelImporter >> withCommitDiffs [
×
1281

×
1282
        ^ withCommitDiffs
×
1283
]
×
1284

×
NEW
1285
{ #category : #accessing }
×
1286
GLHModelImporter >> withCommitDiffs: anObject [
×
1287

×
1288
        withCommitDiffs := anObject
×
1289
]
×
1290

×
NEW
1291
{ #category : #accessing }
×
1292
GLHModelImporter >> withInitialCommits: boolean [
×
1293
        withInitialCommits := boolean 
×
1294
]
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc