Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: sdk/lib/_internal/pub/test/descriptor/tar.dart

Issue 16351003: Move pub over to using the pub.dartlang.org API v2. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library descriptor.tar; 5 library descriptor.tar;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:async'; 8 import 'dart:async';
9 9
10 import 'package:pathos/path.dart' as path; 10 import 'package:pathos/path.dart' as path;
11 import 'package:scheduled_test/scheduled_test.dart'; 11 import 'package:scheduled_test/scheduled_test.dart';
12 import 'package:scheduled_test/descriptor.dart'; 12 import 'package:scheduled_test/descriptor.dart';
13 13
14 import '../../lib/src/io.dart'; 14 import '../../lib/src/io.dart';
15 import '../../lib/src/utils.dart'; 15 import '../../lib/src/utils.dart';
16 16
17 /// Describes a tar file and its contents. 17 /// Describes a tar file and its contents.
18 class TarFileDescriptor extends DirectoryDescriptor { 18 class TarFileDescriptor extends DirectoryDescriptor
19 implements ReadableDescriptor {
19 TarFileDescriptor(String name, List<Descriptor> contents) 20 TarFileDescriptor(String name, List<Descriptor> contents)
20 : super(name, contents); 21 : super(name, contents);
21 22
22 /// Creates the files and directories within this tar file, then archives 23 /// Creates the files and directories within this tar file, then archives
23 /// them, compresses them, and saves the result to [parentDir]. 24 /// them, compresses them, and saves the result to [parentDir].
24 Future<String> create([String parent]) => schedule(() { 25 Future<String> create([String parent]) => schedule(() {
25 if (parent == null) parent = defaultRoot; 26 if (parent == null) parent = defaultRoot;
26 return withTempDir((tempDir) { 27 return withTempDir((tempDir) {
27 return Future.wait(contents.map((entry) { 28 return Future.wait(contents.map((entry) {
28 return entry.create(tempDir); 29 return entry.create(tempDir);
(...skipping 16 matching lines...) Expand all
45 throw new UnimplementedError("TODO(nweiz): implement this"); 46 throw new UnimplementedError("TODO(nweiz): implement this");
46 } 47 }
47 48
48 Stream<List<int>> read() { 49 Stream<List<int>> read() {
49 return new Stream<List<int>>.fromFuture(withTempDir((tempDir) { 50 return new Stream<List<int>>.fromFuture(withTempDir((tempDir) {
50 return create(tempDir).then((_) => 51 return create(tempDir).then((_) =>
51 readBinaryFile(path.join(tempDir, name))); 52 readBinaryFile(path.join(tempDir, name)));
52 })); 53 }));
53 } 54 }
54 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698