Skip to content

Commit

Permalink
Improve importers API
Browse files Browse the repository at this point in the history
Allow to either import or import and install models
  • Loading branch information
jecisc committed Jun 18, 2024
1 parent 0f15a75 commit a6ee96c
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Moose-Importers/FamixAbstractFileImporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Class {
'model',
'inputStream'
],
#category : #'Moose-Importers'
#category : #'Moose-Importers-FromPersistedFiles'
}

{ #category : #testing }
Expand Down
2 changes: 1 addition & 1 deletion src/Moose-Importers/FamixJSONFileImporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Importer for JSON file
Class {
#name : #FamixJSONFileImporter,
#superclass : #FamixAbstractFileImporter,
#category : #'Moose-Importers'
#category : #'Moose-Importers-FromPersistedFiles'
}

{ #category : #executing }
Expand Down
51 changes: 43 additions & 8 deletions src/Moose-Importers/FamixJavaFoldersImporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ Class {
#name : #FamixJavaFoldersImporter,
#superclass : #Object,
#instVars : [
'folders'
'folders',
'models'
],
#classVars : [
'VerveineJPath'
],
#category : #'Moose-Importers'
#category : #'Moose-Importers-ParseFolders'
}

{ #category : #accessing }
Expand All @@ -39,13 +40,23 @@ FamixJavaFoldersImporter class >> defaultVerveineJDirectory [
]

{ #category : #actions }
FamixJavaFoldersImporter class >> importFolder: aFileReference [
FamixJavaFoldersImporter class >> importAndInstallFolder: aFileReference [

^ self importFolders: { aFileReference }
^ self importAndInstallFolders: { aFileReference }
]

{ #category : #actions }
FamixJavaFoldersImporter class >> importAndInstallFolders: aCollection [
"I'll parse, import in a moose model and install the models for each folder in the collection."

^ self new
folders: aCollection;
importAndInstall
]

{ #category : #actions }
FamixJavaFoldersImporter class >> importFolders: aCollection [
"I'll parse and import in a moose model for each folder in the collection."

^ self new
folders: aCollection;
Expand Down Expand Up @@ -124,7 +135,19 @@ FamixJavaFoldersImporter >> import [

self generateJsonOfProjects.

self importModels
self importModels.

^ models
]

{ #category : #actions }
FamixJavaFoldersImporter >> importAndInstall [

self import.

self installModels.

^ models
]

{ #category : #actions }
Expand All @@ -143,12 +166,24 @@ FamixJavaFoldersImporter >> importModels [
inputFile: json;
run.

model
name: folder basename;
install ]
model name: folder basename.
models add: model ]
displayingProgress: [ :folder | folder basename ]
]

{ #category : #initialization }
FamixJavaFoldersImporter >> initialize [

super initialize.
models := OrderedCollection new
]

{ #category : #actions }
FamixJavaFoldersImporter >> installModels [

models do: [ :model | model install ]
]

{ #category : #actions }
FamixJavaFoldersImporter >> jsonForFolder: folder [

Expand Down
2 changes: 1 addition & 1 deletion src/Moose-Importers/FamixMSEFileImporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Importer for MSE files
Class {
#name : #FamixMSEFileImporter,
#superclass : #FamixAbstractFileImporter,
#category : #'Moose-Importers'
#category : #'Moose-Importers-FromPersistedFiles'
}

{ #category : #executing }
Expand Down
2 changes: 1 addition & 1 deletion src/Moose-Importers/MooseFileStructureImporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Class {
'mooseModel',
'factory'
],
#category : #'Moose-Importers-Importers'
#category : #'Moose-Importers-FileSystem'
}

{ #category : #accessing }
Expand Down

0 comments on commit a6ee96c

Please sign in to comment.