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:pub/src/io.dart'; | 9 import 'package:pub/src/io.dart'; |
10 import 'package:pub/src/utils.dart'; | 10 import 'package:pub/src/utils.dart'; |
11 import 'package:scheduled_test/descriptor.dart'; | 11 import 'package:scheduled_test/descriptor.dart'; |
12 import 'package:scheduled_test/scheduled_server.dart'; | 12 import 'package:scheduled_test/scheduled_server.dart'; |
13 import 'package:package_config/packages_file.dart' as pkgfile; | |
13 | 14 |
14 import 'descriptor/git.dart'; | 15 import 'descriptor/git.dart'; |
15 import 'descriptor/tar.dart'; | 16 import 'descriptor/tar.dart'; |
16 import 'test_pub.dart'; | 17 import 'test_pub.dart'; |
17 | 18 |
18 export 'package:scheduled_test/descriptor.dart'; | 19 export 'package:scheduled_test/descriptor.dart'; |
19 export 'descriptor/git.dart'; | 20 export 'descriptor/git.dart'; |
20 export 'descriptor/tar.dart'; | 21 export 'descriptor/tar.dart'; |
21 | 22 |
22 /// Creates a new [GitRepoDescriptor] with [name] and [contents]. | 23 /// Creates a new [GitRepoDescriptor] with [name] and [contents]. |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 ['https://www.googleapis.com/auth/userinfo.email'], | 176 ['https://www.googleapis.com/auth/userinfo.email'], |
176 expiration).toJson()) | 177 expiration).toJson()) |
177 ]); | 178 ]); |
178 })); | 179 })); |
179 } | 180 } |
180 | 181 |
181 /// Describes the application directory, containing only a pubspec specifying | 182 /// Describes the application directory, containing only a pubspec specifying |
182 /// the given [dependencies]. | 183 /// the given [dependencies]. |
183 DirectoryDescriptor appDir([Map dependencies]) => | 184 DirectoryDescriptor appDir([Map dependencies]) => |
184 dir(appPath, [appPubspec(dependencies)]); | 185 dir(appPath, [appPubspec(dependencies)]); |
186 | |
187 /// Desribe a .packages file. | |
188 /// | |
189 /// The file path is relative to [appPath]. | |
190 Descriptor dotPackagesFile(String filePath, | |
nweiz
2015/06/10 22:33:59
I'd just call this "packagesFile".
Having the use
Lasse Reichstein Nielsen
2015/06/11 11:21:02
Since we changed the file to have only absolute UR
| |
191 [Map<String, String> dependencies]) { | |
192 // Check only for existence. | |
193 if (dependencies == null) return matcherFile('.packages', (_) => true); | |
194 // Check contents as well. | |
195 matchFile(content) { | |
196 // TODO(lrn): Create a Matcher that gives better error messages. | |
197 Uri fileLocation = new Uri.directory(appPath).resolve(filePath); | |
Lasse Reichstein Nielsen
2015/06/11 11:21:02
and p.toUri I guess.
| |
198 var map = pkgfile.parse(content, fileLocation); | |
199 | |
200 for (var packageName in dependencies.keys) { | |
201 if (!map.containsKey(packageName)) { | |
202 return false; | |
203 } | |
204 var version = dependencies[packageName]; | |
205 if (!map[packageName].contains(version)) return false; | |
206 } | |
207 if (map.length != dependencies.length) return false; | |
208 } | |
209 return matcherFile('.packages', matchFile); | |
210 } | |
OLD | NEW |