Skip to content

Commit

Permalink
Merge pull request #82 from hpi-swa-teaching/feat/createSar
Browse files Browse the repository at this point in the history
Add Function for SAR file creation
  • Loading branch information
kolioOtSofia authored Jun 8, 2021
2 parents 5275763 + de34ce3 commit e0f5ace
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
exporting
createSar

| preamble zip |

zip := ZipArchive new.
preamble := String streamContents: [:preambleStream |
preambleStream
nextPutAll: '| loader |
loader := MCVersionLoader new.';
cr.
(((self project version: 'baseline') allPackagesForSpecNamed: #default) collect: #name) do: [:name | | stream version |
stream := RWBinaryOrTextStream on: (String new: 10000).
version := MCVersion
package: (MCPackage named: name)
info: ((MCPackage named: 'AutoTDD-Core') workingCopy ancestry ancestors
ifNotEmpty: #first
ifEmpty: [MCVersionInfo name: name, '-generated.1' id: UUID new message: '' date: Date today time: Time now author: 'generated' ancestors: #()]).
version fileOutOn: stream.
(zip addString: stream contents as: name, '.mcz') desiredCompressionLevel: 0.
preambleStream
nextPutAll: 'loader addVersion: (MCMczReader versionFromStream: (self memberNamed: ''';
nextPutAll: name;
nextPutAll: '.mcz'') contentStream).';
cr].
preambleStream nextPutAll: 'loader load.'].
zip addString: preamble as: 'install/preamble'.
zip writeToFileNamed: 'AutoTDD.sar'
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"class" : {
},
"createSar" : "ng 6/8/2021 11:50" },
"instance" : {
"baseline:" : "ct 10/7/2020 01:03",
"postLoad" : "be 5/29/2019 23:24" } }

0 comments on commit e0f5ace

Please sign in to comment.