Skip to content

Commit 73c8aab

Browse files
authored
Update v1 branch for new IO. (#61)
1 parent a01cd54 commit 73c8aab

File tree

5 files changed

+20
-23
lines changed

5 files changed

+20
-23
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
os: [ ubuntu-latest, windows-latest, macos-latest ]
1313
# The versions should contain (at least) the lowest requirement
1414
# and a version that is more up to date.
15-
toit-version: [ v2.0.0-alpha.128, latest ]
15+
toit-version: [ v2.0.0-alpha.144, latest ]
1616
include:
17-
- toit-version: v2.0.0-alpha.128
17+
- toit-version: v2.0.0-alpha.144
1818
version-name: old
1919
- toit-version: latest
2020
version-name: new

package.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
sdk: ^2.0.0-alpha.120
1+
sdk: ^2.0.0-alpha.144
22
prefixes:
33
fs: pkg-fs
44
host: pkg-host
55
packages:
66
pkg-fs:
77
url: github.com/toitlang/pkg-fs
88
name: fs
9-
version: 2.1.0
10-
hash: ac3933367912563055ceea4188adcead3428103c
9+
version: 2.2.0
10+
hash: 863280c5c62ac259d16d0d3b24df21209b461b14
1111
prefixes:
1212
host: pkg-host
1313
pkg-host:
1414
url: github.com/toitlang/pkg-host
1515
name: host
16-
version: 1.12.0
17-
hash: fe5e10c56abc3fca1ef9bcba415e77fd59183cab
16+
version: 1.15.0
17+
hash: 2588faa0c7553eca9a85cb6f829f3df41d9466f2

package.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: cli
22
description: Tools, like an argument parser, to create command-line applications.
33
environment:
4-
sdk: ^2.0.0-alpha.128
4+
sdk: ^2.0.0-alpha.144
55
dependencies:
66
fs:
77
url: github.com/toitlang/pkg-fs
8-
version: ^2.1.0
8+
version: ^2.2.0
99
host:
1010
url: github.com/toitlang/pkg-host
11-
version: ^1.12.0
11+
version: ^1.15.0

src/cache.toit

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import fs.xdg
1010
import host.os
1111
import host.file
1212
import host.directory
13+
import io
1314
import system
1415
import uuid
15-
import writer
1616

1717
import .utils_
1818

@@ -232,7 +232,7 @@ interface FileStore:
232232
save bytes/ByteArray
233233

234234
/**
235-
Calls the given $block with a $writer.Writer.
235+
Calls the given $block with an $io.Writer.
236236
237237
The $block must write its chunks to the writer.
238238
The writer is closed after the block returns.
@@ -329,15 +329,15 @@ class FileStore_ implements FileStore:
329329
file.write-content bytes --path=file-path
330330

331331
/**
332-
Calls the given $block with a $writer.Writer.
332+
Calls the given $block with a $io.Writer.
333333
334334
The $block must write its chunks to the writer.
335335
The writer is closed after the block returns.
336336
*/
337337
save-via-writer [block]:
338338
store_: | file-path/string |
339339
stream := file.Stream.for-write file-path
340-
w := writer.Writer stream
340+
w := stream.out
341341
try:
342342
block.call w
343343
finally:
@@ -463,9 +463,8 @@ atomic-move-directory_ source-path/string target-path/string -> none:
463463
copy-file_ --source/string --target/string -> none:
464464
// TODO(florian): we want to keep the permissions of the original file,
465465
// except that we want to make the file read-only.
466-
in := file.Stream.for-read source
467-
out := file.Stream.for-write target
468-
w := writer.Writer out
469-
w.write-from in
470-
in.close
471-
out.close
466+
in-stream := file.Stream.for-read source
467+
out-stream := file.Stream.for-write target
468+
out-stream.out.write-from in-stream.in
469+
in-stream.close
470+
out-stream.close

src/config.toit

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import host.os
66
import host.file
77
import host.directory
88
import encoding.json
9-
import writer
109
import fs.xdg
1110
import fs
1211
import .utils_
@@ -188,7 +187,6 @@ class Config:
188187
content := json.encode data
189188
stream := file.Stream.for-write path
190189
try:
191-
writer := writer.Writer stream
192-
writer.write content
190+
stream.out.write content
193191
finally:
194192
stream.close

0 commit comments

Comments
 (0)