OLD | NEW |
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 /// Pub-specific scheduled_test descriptors. | 5 /// Pub-specific scheduled_test descriptors. |
6 library descriptor; | 6 library descriptor; |
7 | 7 |
8 import 'package:oauth2/oauth2.dart' as oauth2; | 8 import 'package:oauth2/oauth2.dart' as oauth2; |
9 import 'package:scheduled_test/scheduled_server.dart'; | 9 import 'package:scheduled_test/scheduled_server.dart'; |
10 import 'package:scheduled_test/descriptor.dart'; | 10 import 'package:scheduled_test/descriptor.dart'; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 if (versions is! List) versions = [versions]; | 130 if (versions is! List) versions = [versions]; |
131 for (var version in versions) { | 131 for (var version in versions) { |
132 var packageContents = [libDir(name, '$name $version')]; | 132 var packageContents = [libDir(name, '$name $version')]; |
133 if (includePubspecs) { | 133 if (includePubspecs) { |
134 packageContents.add(libPubspec(name, version)); | 134 packageContents.add(libPubspec(name, version)); |
135 } | 135 } |
136 contents.add(dir("$name-$version", packageContents)); | 136 contents.add(dir("$name-$version", packageContents)); |
137 } | 137 } |
138 }); | 138 }); |
139 | 139 |
| 140 return hostedCache(contents); |
| 141 } |
| 142 |
| 143 /// Describes the main cache directory containing cached hosted packages |
| 144 /// downloaded from the mock package server. |
| 145 Descriptor hostedCache(Iterable<Descriptor> contents) { |
140 return dir(cachePath, [ | 146 return dir(cachePath, [ |
141 dir('hosted', [ | 147 dir('hosted', [ |
142 async(port.then((p) => dir('127.0.0.1%58$p', contents))) | 148 async(port.then((p) => dir('127.0.0.1%58$p', contents))) |
143 ]) | 149 ]) |
144 ]); | 150 ]); |
145 } | 151 } |
146 | 152 |
147 /// Describes the file in the system cache that contains the client's OAuth2 | 153 /// Describes the file in the system cache that contains the client's OAuth2 |
148 /// credentials. The URL "/token" on [server] will be used as the token | 154 /// credentials. The URL "/token" on [server] will be used as the token |
149 /// endpoint for refreshing the access token. | 155 /// endpoint for refreshing the access token. |
(...skipping 11 matching lines...) Expand all Loading... |
161 ['https://www.googleapis.com/auth/userinfo.email'], | 167 ['https://www.googleapis.com/auth/userinfo.email'], |
162 expiration).toJson()) | 168 expiration).toJson()) |
163 ]); | 169 ]); |
164 })); | 170 })); |
165 } | 171 } |
166 | 172 |
167 /// Describes the application directory, containing only a pubspec specifying | 173 /// Describes the application directory, containing only a pubspec specifying |
168 /// the given [dependencies]. | 174 /// the given [dependencies]. |
169 DirectoryDescriptor appDir([Map dependencies]) => | 175 DirectoryDescriptor appDir([Map dependencies]) => |
170 dir(appPath, [appPubspec(dependencies)]); | 176 dir(appPath, [appPubspec(dependencies)]); |
OLD | NEW |