modelbuilder: build MDoc of MGroup from README files
authorJean Privat <jean@pryen.org>
Tue, 3 Jun 2014 12:45:59 +0000 (08:45 -0400)
committerJean Privat <jean@pryen.org>
Tue, 3 Jun 2014 12:45:59 +0000 (08:45 -0400)
This is a crazy idea form lunch-time; let's see if it catches.

Signed-off-by: Jean Privat <jean@pryen.org>

src/modelbuilder.nit

index 89e4675..85f9443 100644 (file)
@@ -498,6 +498,16 @@ class ModelBuilder
                        mgroup = new MGroup(pn, parent.mproject, parent)
                        toolcontext.info("found sub group `{mgroup.full_name}` at {dirpath}", 2)
                end
+               var readme = dirpath.join_path("README")
+               if readme.file_exists then
+                       var mdoc = new MDoc
+                       var s = new IFStream.open(readme)
+                       while not s.eof do
+                               mdoc.content.add(s.read_line)
+                       end
+                       mgroup.mdoc = mdoc
+                       mdoc.original_mentity = mgroup
+               end
                mgroup.filepath = dirpath
                mgroups[rdp] = mgroup
                return mgroup