File tree Expand file tree Collapse file tree 2 files changed +49
-8
lines changed
plugins/eu.coresense.CognitiveModule.xtext/src/eu/coresense/cognitivemodule/generator Expand file tree Collapse file tree 2 files changed +49
-8
lines changed Original file line number Diff line number Diff line change @@ -7,19 +7,24 @@ import org.eclipse.emf.ecore.resource.Resource
7
7
import org.eclipse.xtext.generator.AbstractGenerator
8
8
import org.eclipse.xtext.generator.IFileSystemAccess2
9
9
import org.eclipse.xtext.generator.IGeneratorContext
10
+ import eu.coresense.CognitiveModule.CognitiveModule
11
+ import com.google.inject.Inject
10
12
11
13
/**
12
14
* Generates code from your model files on save.
13
15
*
14
16
* See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#code-generation
15
17
*/
16
18
class CogModGenerator extends AbstractGenerator {
19
+
20
+ @Inject extension ReadmeCompiler
17
21
18
- override void doGenerate (Resource resource , IFileSystemAccess2 fsa , IGeneratorContext context ) {
19
- // fsa.generateFile('greetings.txt', 'People to greet: ' +
20
- // resource.allContents
21
- // .filter(Greeting)
22
- // .map[name]
23
- // .join(', '))
24
- }
25
- }
22
+ override void doGenerate (Resource resource , IFileSystemAccess2 fsa , IGeneratorContext context ){
23
+ for (cognitive_module : resource. allContents. toIterable. filter(CognitiveModule )){
24
+ fsa. generateFile(
25
+ cognitive_module. getName(). toLowerCase+ " /README.md" ,
26
+ compile_toREADME(cognitive_module). toString(). replace(" \t " ," " )
27
+ )
28
+ }}
29
+
30
+ }
Original file line number Diff line number Diff line change
1
+ package eu.coresense.cognitivemodule.generator
2
+
3
+ import eu.coresense.CognitiveModule.CognitiveModule
4
+
5
+ class ReadmeCompiler {
6
+
7
+ def compile_toREADME (CognitiveModule cogmod ) '''
8
+ # «cogmod.name»
9
+
10
+ This package has be created automatically using the [RosTooling](https://github.com/ipa320/RosTooling).
11
+
12
+
13
+ This Cognitive Module has the following structure:
14
+
15
+ ### Core
16
+ «cogmod.core.name»
17
+
18
+ ### Meta
19
+ «cogmod.meta.name»
20
+
21
+ ### Coupling
22
+ «cogmod.coupling.name»
23
+
24
+ ### Afferents
25
+ «FOR af:cogmod.afferent»
26
+ - «af.topic» [«af.type»]
27
+ «ENDFOR»
28
+
29
+ ### Efferents
30
+ «FOR ef:cogmod.efferent»
31
+ - «ef.topic» [«ef.type»]
32
+ «ENDFOR»
33
+
34
+ '''}
35
+
36
+
You can’t perform that action at this time.
0 commit comments