Patrick Rein uploaded a new version of System to project The Inbox:
http://source.squeak.org/inbox/System-pre.1067.mcz ==================== Summary ==================== Name: System-pre.1067 Author: pre Time: 11 June 2019, 4:55:47.644016 pm UUID: c33f640c-7adc-5844-97dc-4d679c4c980b Ancestors: System-fn.1066 Refactors the change set fileout protocol to remove some code duplication. This change would entail further removal of code duplication in ReadWriteStream added through an Etoys method. =============== Diff against System-fn.1066 =============== Item was changed: ----- Method: ChangeSet>>buildMessageForMailOutWithUser: (in category 'fileIn/Out') ----- buildMessageForMailOutWithUser: userName | message compressBuffer compressStream data compressedStream compressTarget | "prepare the message" message := MailMessage empty. message setField: 'from' toString: userName. message setField: 'to' toString: '[hidden email]'. message setField: 'subject' toString: (self chooseSubjectPrefixForEmail, name). message body: (MIMEDocument contentType: 'text/plain' content: (String streamContents: [ :str | str nextPutAll: 'from preamble:'; cr; cr. self fileOutPreambleOn: str ])). "Prepare the gzipped data" data := WriteStream on: String new. + self fileOutFullOn: data. - data header; timeStamp. - self fileOutPreambleOn: data. - self fileOutOn: data. - self fileOutPostscriptOn: data. - data trailer. data := ReadStream on: data contents. compressBuffer := ByteArray new: 1000. compressStream := GZipWriteStream on: (compressTarget := WriteStream on: (ByteArray new: 1000)). [data atEnd] whileFalse: [compressStream nextPutAll: (data nextInto: compressBuffer)]. compressStream close. compressedStream := ReadStream on: compressTarget contents asString. message addAttachmentFrom: compressedStream withName: (name, '.cs.gz'). ^ message! Item was changed: ----- Method: ChangeSet>>fileOut (in category 'fileIn/Out') ----- fileOut "File out the receiver, to a file whose name is a function of the change-set name and either of the date & time or chosen to have a unique numeric tag, depending on the preference 'changeSetVersionNumbers'" | slips nameToUse | self checkForConversionMethods. ChangeSet promptForDefaultChangeSetDirectoryIfNecessary. nameToUse := Preferences changeSetVersionNumbers ifTrue: [self defaultChangeSetDirectory nextNameFor: self name extension: FileStream cs] ifFalse: [self name , FileDirectory dot , Utilities dateTimeSuffix, FileDirectory dot , FileStream cs]. Cursor write showWhile: [ | internalStream | internalStream := WriteStream on: (String new: 10000). + self fileOutFullOn: internalStream. - internalStream header; timeStamp. - self fileOutPreambleOn: internalStream. - self fileOutOn: internalStream. - self fileOutPostscriptOn: internalStream. - internalStream trailer. FileStream writeSourceCodeFrom: internalStream baseName: (nameToUse copyFrom: 1 to: nameToUse size - 3) isSt: false useHtml: false. ]. Preferences checkForSlips ifFalse: [^ self]. slips := self checkForSlips. (slips size > 0 and: [UIManager default confirm: 'Changeset was filed out. Still, methods in this fileOut have halts\or references to the Transcript or other ''slips'' in them.\Would you like to browse them?' withCRs title: 'Browse Slips?']) ifTrue: [self systemNavigation browseMessageList: slips name: 'Possible slips in ' , name]! Item was added: + ----- Method: ChangeSet>>fileOutFullOn: (in category 'private') ----- + fileOutFullOn: aStream + + aStream header; timeStamp. + self fileOutMainPartOn: aStream. + aStream trailer.! Item was added: + ----- Method: ChangeSet>>fileOutMainPartOn: (in category 'private') ----- + fileOutMainPartOn: aStream + + self + fileOutPreambleOn: aStream; + fileOutOn: aStream; + fileOutPostscriptOn: aStream.! Item was changed: ----- Method: WriteStream>>fileOutChangeSet:andObject: (in category '*System-Object Storage-fileIn/Out') ----- fileOutChangeSet: aChangeSetOrNil andObject: theObject "Write a file that has both the source code for the named class and an object as bits. Any instance-specific object will get its class written automatically." "An experimental version to fileout a changeSet first so that a project can contain its own classes" self setFileTypeToObject. "Type and Creator not to be text, so can attach correctly to an email msg" self header; timeStamp. aChangeSetOrNil ifNotNil: [ + aChangeSetOrNil fileOutMainPartOn: self. - aChangeSetOrNil fileOutPreambleOn: self. - aChangeSetOrNil fileOutOn: self. - aChangeSetOrNil fileOutPostscriptOn: self. ]. self trailer. "Does nothing for normal files. HTML streams will have trouble with object data" "Append the object's raw data" (SmartRefStream on: self) nextPut: theObject; "and all subobjects" close. "also closes me" ! |
Free forum by Nabble | Edit this page |