X Tutup
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2908a8f
Implementation of readFileStream and writeFileStream on GRPlatform fo…
May 21, 2020
74b46ba
A bit more succinct implementation of write:toFile:inFolder:
May 23, 2020
7c87436
read/write filestream api implementation on GRPharoPlatform for Pharo7+8
May 23, 2020
05f8180
Merge branch 'mergegrease' into 104/Filestreams
Jul 3, 2020
79512a2
seems like sourcetree took mergegrease branch to merge rather than ma…
Jul 3, 2020
517e32e
Move filestream tests from Pharo-specific tests package to the common…
Jul 3, 2020
c78ddd6
Merge 79512a2068ddab8e320cb2178ce842747214a02e
Jul 3, 2020
5d15eb8
read and write stream methods for GemStone
Jul 3, 2020
831caae
Merge branch 'master' of https://github.com/SeasideSt/Grease into rem…
Jul 3, 2020
9541cd8
added a method to the gemstone core tests package (but needed to monk…
Jul 3, 2020
48a57af
Changed baseline to use separate test package name from GemStome32 on…
Jul 3, 2020
9d4fe1a
Renamed Grease-Tests-GemStone-Core.v32 to Grease-Tests-GemStone32-Cor…
Jul 3, 2020
d7adb2c
missed a rename
Jul 3, 2020
0697d0c
Filestream methods in Squeak
Jul 3, 2020
2289733
remove all the monticello metadata
Jul 3, 2020
6698993
update README to show badge for Pharo9
Jul 12, 2020
4eb931b
update README to show badge for Pharo9 (2)
Jul 12, 2020
1e7daed
Remove comment about dropping `wantsLineEndConversion:`. I don't thin…
Jul 12, 2020
21bf3c4
Merge 4eb931b4a927a55b6863ca8c47f76d0f6004125d
Jul 12, 2020
79ec953
We *can* keep the 'wantsLineEndConversion' when writing out files...
Jul 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,3 @@ matrix:
env: BUILD_NAME=GemStone-3.1.0.6
- smalltalk: GemStone-2.4.8
env: BUILD_NAME=GemStone-2.4.8

notifications:
slack: gemtalksystems:4YWbzy6sJN9cE0FhxvUPP8nS

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ The latest Grease version is supported on the following platforms and versions,

| Squeak | Pharo | GemStone |
| --------------- | ---------------- | -------------------- |
| [![Build status: Squeak-5.2](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=Squeak-trunk&label=5.2)](http://travis-ci.org/SeasideSt/Grease) | [![Build status: Pharo64-8.0](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=Pharo64-8.0&label=8.0)](http://travis-ci.org/SeasideSt/Grease) | [![Build status: Gemstone-3.5.2](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=GemStone-3.5.2&label=3.5.2)](http://travis-ci.org/SeasideSt/Grease) |
| [![Build status: Squeak-5.1](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=Squeak-5.1&label=5.1)](http://travis-ci.org/SeasideSt/Grease) | [![Build status: Pharo64-7.0](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=Pharo64-7.0&label=7.0)](http://travis-ci.org/SeasideSt/Grease) | [![Build status: Gemstone-3.4.5](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=GemStone-3.4.5&label=3.4.5)](http://travis-ci.org/SeasideSt/Grease) |
| | [![Build status: Pharo-6.1](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=Pharo-6.1&label=6.1)](http://travis-ci.org/SeasideSt/Grease) | [![Build status: Gemstone-3.3.9](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=GemStone-3.3.9&label=3.3.9)](http://travis-ci.org/SeasideSt/Grease) |
| | [![Build status: Pharo-5.0](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=Pharo-5.0&label=5.0)](http://travis-ci.org/SeasideSt/Grease) | [![Build status: Gemstone-3.2.17](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=GemStone-3.2.17&label=3.2.17)](http://travis-ci.org/SeasideSt/Grease) |
| | [![Build status: Pharo-4.0](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=Pharo-4.0&label=4.0)](http://travis-ci.org/SeasideSt/Grease) | [![Build status: Gemstone-3.1.0.6](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=GemStone-3.1.0.6&label=3.1.0.6)](http://travis-ci.org/SeasideSt/Grease) |
| | | [![Build status: Gemstone-2.4.8](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=GemStone-2.4.8&label=2.4.8)](http://travis-ci.org/SeasideSt/Grease) |
| [![Build status: Squeak-5.2](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=Squeak-trunk&label=5.2)](http://travis-ci.org/SeasideSt/Grease) | [![Build status: Pharo64-9.0](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=Pharo64-9.0&label=9.0)](http://travis-ci.org/SeasideSt/Grease) | [![Build status: Gemstone-3.5.2](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=GemStone-3.5.2&label=3.5.2)](http://travis-ci.org/SeasideSt/Grease) |
| [![Build status: Squeak-5.1](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=Squeak-5.1&label=5.1)](http://travis-ci.org/SeasideSt/Grease) | [![Build status: Pharo64-8.0](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=Pharo64-8.0&label=8.0)](http://travis-ci.org/SeasideSt/Grease) | [![Build status: Gemstone-3.4.5](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=GemStone-3.4.5&label=3.4.5)](http://travis-ci.org/SeasideSt/Grease) |
| | [![Build status: Pharo64-7.0](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=Pharo64-7.0&label=7.0)](http://travis-ci.org/SeasideSt/Grease) | [![Build status: Gemstone-3.3.9](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=GemStone-3.3.9&label=3.3.9)](http://travis-ci.org/SeasideSt/Grease) |
| | [![Build status: Pharo-6.1](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=Pharo-6.1&label=6.1)](http://travis-ci.org/SeasideSt/Grease) | [![Build status: Gemstone-3.2.17](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=GemStone-3.2.17&label=3.2.17)](http://travis-ci.org/SeasideSt/Grease) |
| | [![Build status: Pharo-5.0](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=Pharo-5.0&label=5.0)](http://travis-ci.org/SeasideSt/Grease) | [![Build status: Gemstone-3.1.0.6](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=GemStone-3.1.0.6&label=3.1.0.6)](http://travis-ci.org/SeasideSt/Grease) |
| | [![Build status: Pharo-4.0](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=Pharo-4.0&label=4.0)](http://travis-ci.org/SeasideSt/Grease) | [![Build status: Gemstone-2.4.8](http://badges.herokuapp.com/travis/SeasideSt/Grease?branch=master&env=BUILD_NAME=GemStone-2.4.8&label=2.4.8)](http://travis-ci.org/SeasideSt/Grease) |

Coveralls (experimental): [![Coverage Status](https://coveralls.io/repos/github/SeasideSt/Grease/badge.svg?branch=test-coveralls)](https://coveralls.io/github/SeasideSt/Grease?branch=test-coveralls)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@ baselineGemStone: spec
package: 'Grease-Tests-Core'
with: [
spec
requires: #('Grease-GemStone-Core');
includes: #('Grease-Tests-GemStone-Core') ];
requires: #('Grease-GemStone-Core') ];
package: 'Grease-GemStone-Core'
with: [
spec
requires:
#('Grease-Core' 'GsCore' 'System-Digital-Signatures' 'UTF8' 'SMTPMail') ];
package: 'Grease-Tests-GemStone-Core'
with: [ spec requires: #('Grease-Tests-Core') ] ].
#('Grease-Core' 'GsCore' 'System-Digital-Signatures' 'UTF8' 'SMTPMail') ] ].

spec
for: #'gs2.x'
do: [
Expand Down Expand Up @@ -89,9 +87,20 @@ baselineGemStone: spec
spec
requires: #('Grease-GemStone-Core');
postLoadDoIt: #'initializeLatin1ToUtf8Encodings' ] ].

spec for: #(#'gs2.x' #'gs3.0.x' #'gs3.1.x')
do:[
spec
package: 'Grease-Tests-GemStone-Core'
with:[ spec requires: 'Grease-Tests-Core' ];
package: 'Grease-Tests-Core'
with: [ spec includes: 'Grease-Tests-GemStone-Core' ] ].

spec
for: #(#'gs3.2.x' #'gs3.3.x' #'gs3.4.x' #'gs3.5.x' #'gs3.6.x')
do: [
spec
package: 'Grease-Tests-GemStone-Core'
with: [ spec file: 'Grease-Tests-GemStone-Core.v32' ] ]
package: 'Grease-Tests-GemStone32-Core'
with:[ spec requires: 'Grease-Tests-Core' ];
package: 'Grease-Tests-Core'
with: [ spec includes: 'Grease-Tests-GemStone32-Core' ] ]
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
file library
fileStreamOn: aString do: aBlock binary: aBoolean
self subclassResponsibility
self
greaseDeprecatedApi: 'GRPlatform>>#fileStreamOn:do:binary:'
details: 'Use readFileStreamOn:do:binary:'.
^ self readFileStreamOn: aString do: aBlock binary: aBoolean
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
file library
readFileStreamOn: aString do: aBlock binary: aBoolean
self subclassResponsibility
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ processes
thisContext
"Answer the current activation of a method execution or block activation.

For dialects with a thisContext variable and implementation can lock like this.
For dialects with a thisContext variable and implementation can look like this.

^ thisContext sender"
self subclassResponsibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
file library
writeFileStreamOn: aString do: aBlock binary: aBoolean
self subclassResponsibility
8 changes: 4 additions & 4 deletions repository/Grease-Core.package/monticello.meta/categories.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SystemOrganization addCategory: #'Grease-Core'!
SystemOrganization addCategory: #'Grease-Core-Collections'!
SystemOrganization addCategory: #'Grease-Core-Exceptions'!
SystemOrganization addCategory: #'Grease-Core-Text'!
SystemOrganization addCategory: #'Grease-Core-Utilities'!
SystemOrganization addCategory: 'Grease-Core-Collections'!
SystemOrganization addCategory: 'Grease-Core-Exceptions'!
SystemOrganization addCategory: 'Grease-Core-Text'!
SystemOrganization addCategory: 'Grease-Core-Utilities'!

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
file-library
readFileStreamOn: aString do: aBlock binary: aBoolean
| stream dir file |
[
file := GsFile openReadOnServer: aString.
[
stream := RWBinaryOrTextStream on: file contents.
aBoolean
ifTrue: [ stream binary ]
ifFalse: [ stream ascii ].
^ aBlock value: stream ]
ensure: [ stream close ] ]
ensure: [ file close ]
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
file-library
write: aStringOrByteArray toFile: aFileNameString inFolder: aFolderString
"writes aStringOrByteArray to a file named aFilenameString in the folder aFolderString"
| folder stream fullFilePath |
fullFilePath := ServerFileDirectory default fullNameFor: aFolderString.
folder := ServerFileDirectory on: fullFilePath.
stream := folder forceNewFileNamed: aFileNameString.
stream := aStringOrByteArray isString
ifTrue: [ stream ascii ]
ifFalse: [ stream binary ].
[ stream nextPutAll: aStringOrByteArray ]
ensure: [ stream close ]
"writes aStringOrByteArray to a file named aFilenameString in the folder aFolderString"

| folder fullFilePath |
fullFilePath := ServerFileDirectory default fullNameFor: aFolderString.
folder := ServerFileDirectory on: fullFilePath.
(folder fileExists: aFileNameString)
ifTrue: [ folder deleteFileNamed: aFileNameString ].
^ self
writeFileStreamOn: (folder / aFileNameString) fullName
do: [ :stream | stream nextPutAll: aStringOrByteArray ]
binary: aStringOrByteArray isString not
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
file-library
writeFileStreamOn: fileName do: aBlock binary: isBinary
| stream |
stream := BinaryOrTextFile open: fileName mode: 'w+b' onClient: false.
stream := isBinary
ifTrue: [ stream binary ]
ifFalse: [ stream ascii ].
[ aBlock value: stream ]
ensure: [ stream close ]
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
{
"name" : "Symbol"
}
"name" : "Symbol" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
file library
readFileStreamOn: aString do: aBlock binary: aBoolean
"Line end conversion is no longer done for ascii... TBD!"

^ aBoolean
ifTrue: [ aString asFileReference binaryReadStreamDo: aBlock ]
ifFalse: [ aString asFileReference readStreamEncoded: 'ascii' do: aBlock ]
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
file library
write: aStringOrByteArray toFile: aFileNameString inFolder: aFolderString
"writes aStringOrByteArray to a file named aFilenameString in the folder aFolderString"
| folder stream fullFilePath |
folder := FileSystem disk resolveString: aFolderString.
fullFilePath := (folder / aFileNameString) asFileReference.
stream := aStringOrByteArray isString
ifTrue: [
(MultiByteFileStream forceNewFileNamed: fullFilePath fullName)
ascii;
wantsLineEndConversion: true;
yourself ]
ifFalse: [ (FileStream forceNewFileNamed: fullFilePath fullName) binary ].
[ stream nextPutAll: aStringOrByteArray ]
ensure: [ stream close ]
"TODO: wantsLineEndConversion: true; ??"
^ self
writeFileStreamOn: (aFolderString asFileReference / aFileNameString) ensureDelete pathString
do: [ :stream | stream nextPutAll: aStringOrByteArray ]
binary: aStringOrByteArray isString not
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
file library
writeFileStreamOn: aString do: aBlock binary: aBoolean
^ aBoolean
ifTrue: [ aString asFileReference binaryWriteStreamDo: aBlock ]
ifFalse: [ aString asFileReference writeStreamEncoded: 'ascii' do: aBlock ]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
file library
contentsOfFile: aString binary: aBoolean
^ self fileStreamOn: aString do: [ :stream | stream contents ] binary: aBoolean
^ self readFileStreamOn: aString do: [ :stream | stream contents ] binary: aBoolean

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
file library
readFileStreamOn: aString do: aBlock binary: aBoolean

^ aBoolean
ifTrue: [ aString asFileReference binaryReadStreamDo: aBlock ]
ifFalse: [ aString asFileReference readStreamEncoded: 'ascii' do: aBlock ]
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
file library
write: aStringOrByteArray toFile: aFileNameString inFolder: aFolderString
"writes aStringOrByteArray to a file named aFilenameString in the folder aFolderString"
| folder stream fullFilePath |
folder := FileSystem disk resolveString: aFolderString.
fullFilePath := (folder / aFileNameString) asFileReference.
stream := aStringOrByteArray isString
ifTrue: [
(MultiByteFileStream forceNewFileNamed: fullFilePath fullName)
ascii;
wantsLineEndConversion: true;
yourself ]
ifFalse: [ (FileStream forceNewFileNamed: fullFilePath fullName) binary ].
[ stream nextPutAll: aStringOrByteArray ]
ensure: [ stream close ]
^ self
writeFileStreamOn: (aFolderString asFileReference / aFileNameString) ensureDelete pathString
do: [ :stream | stream nextPutAll: aStringOrByteArray ]
binary: aStringOrByteArray isString not
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
file library
writeFileStreamOn: aString do: aBlock binary: aBoolean
^ aBoolean
ifTrue: [ aString asFileReference binaryWriteStreamDo: aBlock ]
ifFalse: [ aString asFileReference writeStreamEncoded: 'ascii' do: [ :str | aBlock value: (ZnNewLineWriterStream on: str) ] ]
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class initialization
initialize
self initializeXmlTable.
self initializeUrlTable.
self select
self initializeUrlTable

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
file library
fileStreamOn: aString do: aBlock binary: aBoolean
as yet unclassified
readFileStreamOn: aString do: aBlock binary: aBoolean
^ aBoolean
ifTrue: [
FileStream fileNamed: aString do: [ :stream |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
file library
write: aStringOrByteArray toFile: aFileNameString inFolder: aFolderString
"writes aStringOrByteArray to a file named aFilenameString in the folder aFolderString"
| folder stream fullFilePath |
folder := FileDirectory default directoryNamed: aFolderString.
fullFilePath := folder fullNameFor: aFileNameString.
stream := aStringOrByteArray isString
ifTrue: [
(MultiByteFileStream forceNewFileNamed: fullFilePath)
ascii;
wantsLineEndConversion: true;
yourself ]
ifFalse: [ (FileStream forceNewFileNamed: fullFilePath) binary ].
[ stream nextPutAll: aStringOrByteArray ]
ensure: [ stream close ]
write: aStringOrByteArray toFile: aFileNameString inFolder: aFolderString
| folder fullFilePath |
fullFilePath := FileDirectory default fullNameFor: aFolderString.
folder := FileDirectory on: fullFilePath.
(folder fileExists: aFileNameString)
ifTrue: [folder deleteFileNamed: aFileNameString].
^ self
writeFileStreamOn: (folder / aFileNameString) fullName
do: [:stream | stream nextPutAll: aStringOrByteArray]
binary: aStringOrByteArray isString not
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
as yet unclassified
writeFileStreamOn: aString do: aBlock binary: aBoolean
| stream |
stream := aBoolean
ifTrue: [ (MultiByteFileStream fileNamed: aString) ascii; wantsLineEndConversion: true; yourself ]
ifFalse: [ (FileStream fileNamed: aString) binary ].
[ aBlock value: stream ]
ensure: [ stream close ]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tests
tests-filestreams
testReadWriteToFileInFolderBinary
| bytes |
bytes := #(80 104 39 110 103 108 117 105 32 109 103 108 119 39 110 97 102 104 32 67 116 104 117 108 104 117 32 82 39 108 121 101 104 32 119 103 97 104 39 110 97 103 108 32 102 104 116 97 103 110) asByteArray.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tests
tests-filestreams
testReadWriteToFileInFolderText
| text |
text := 'Ph''nglui mglw''nafh Cthulhu R''lyeh wgah''nagl fhtagn'.
Expand Down
Loading
X Tutup