Refactored and improved support for writing Bee packages. jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 03 Nov 2015 07:19:15 +0000
branchjv
changeset 3922 ae8879b8ba67
parent 3921 243f926d6101
child 3924 92daeb5a8bfa
Refactored and improved support for writing Bee packages. Added support to write both, .stp and .prj files.
BeeProjectDefinitionWriter.st
BeeProjectWriter.st
ChangeDeltaInformation.st
--- a/BeeProjectDefinitionWriter.st	Mon Nov 02 20:30:10 2015 +0000
+++ b/BeeProjectDefinitionWriter.st	Tue Nov 03 07:19:15 2015 +0000
@@ -60,14 +60,34 @@
 
     classes do:[:class |  
         stream nextPutAll: 'project addClass: '; nextPutAll: class name storeString; nextPutAll: '.'; cr.
-    ]
+    ].
+    stream cr.
 
-    "Modified: / 02-11-2015 / 19:14:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-11-2015 / 07:05:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 fileOutExtensions:methods on: stream
 
-    "Modified: / 02-11-2015 / 19:15:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    stream nextPutAll: '#('; cr.
+    methods do:[:method | 
+        stream nextPut:'''';
+               nextPutAll: method mclass name;
+               nextPutAll: '>>';
+               nextPutAll: method seelctore;
+               nextPut:'''';
+               cr.
+    ].
+    stream nextPutAll: ') do: [:string | project addMethod: string].'
+
+    "Modified: / 03-11-2015 / 07:07:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+fileOutFooterOn:aStream
+    aStream cr.
+    aStream cr.
+    aStream nextPutAll: '^ project'.
+
+    "Created: / 03-11-2015 / 23:05:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 fileOutHeaderOn:aStream
@@ -92,3 +112,10 @@
     "Modified: / 02-11-2015 / 19:16:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!BeeProjectDefinitionWriter class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+
--- a/BeeProjectWriter.st	Mon Nov 02 20:30:10 2015 +0000
+++ b/BeeProjectWriter.st	Tue Nov 03 07:19:15 2015 +0000
@@ -36,6 +36,17 @@
 "
 ! !
 
+!BeeProjectWriter class methodsFor:'private'!
+
+basenameForPackage:pkg
+    |  pkgdef |
+
+    pkgdef := ProjectDefinition definitionClassForPackage: pkg.
+    ^ pkgdef name.
+
+    "Created: / 03-11-2015 / 07:15:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !BeeProjectWriter class methodsFor:'queries'!
 
 isAbstract
@@ -48,6 +59,22 @@
 
 !BeeProjectWriter class methodsFor:'simple API'!
 
+fileOut: pkg in: directory
+    "File out Bee package (definition - .prj and source - .stp) in
+     given directory."
+
+    | basename prjFilename stpFilename |
+
+    basename := self basenameForPackage: pkg.
+    prjFilename := directory asFilename / (basename , '.prj').
+    stpFilename := directory asFilename  / (basename , '.stp').
+
+    BeeProjectDefinitionWriter fileOut: pkg to: prjFilename.
+    BeeProjectSourceWriter fileOut: pkg to: stpFilename.
+
+    "Created: / 03-11-2015 / 07:14:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 fileOut:packageId on:stream
     self new fileOut:packageId on:stream
 
@@ -116,9 +143,10 @@
     self fileOutHeaderOn:aStream.
     self fileOutClasses: classesToFileout on: aStream.
     self fileOutExtensions: methodsToFileOut on: aStream.
+    self fileOutFooterOn: aStream.
 
     "Created: / 14-04-2015 / 13:42:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 02-11-2015 / 19:06:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-11-2015 / 23:05:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 fileOutClasses:arg1 on:arg2
@@ -133,6 +161,11 @@
     ^ self subclassResponsibility
 !
 
+fileOutFooterOn:aStresm
+
+    "Created: / 03-11-2015 / 23:05:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 fileOutHeaderOn:arg
     "raise an error: must be redefined in concrete subclass(es)"
 
--- a/ChangeDeltaInformation.st	Mon Nov 02 20:30:10 2015 +0000
+++ b/ChangeDeltaInformation.st	Tue Nov 03 07:19:15 2015 +0000
@@ -228,6 +228,11 @@
 
 version_CVS
     ^ '$Header: /cvs/stx/stx/libbasic3/ChangeDeltaInformation.st,v 1.4 2014-12-11 20:47:41 cg Exp $'
+!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
 ! !