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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 dir('info'), | 90 dir('info'), |
91 dir('objects'), | 91 dir('objects'), |
92 dir('refs') | 92 dir('refs') |
93 ])); | 93 ])); |
94 } | 94 } |
95 | 95 |
96 /// Describes the `packages/` directory containing all the given [packages], | 96 /// Describes the `packages/` directory containing all the given [packages], |
97 /// which should be name/version pairs. The packages will be validated against | 97 /// which should be name/version pairs. The packages will be validated against |
98 /// the format produced by the mock package server. | 98 /// the format produced by the mock package server. |
99 /// | 99 /// |
100 /// A package with a null version should not be installed. | 100 /// A package with a null version should not be downloaded. |
101 Descriptor packagesDir(Map<String, String> packages) { | 101 Descriptor packagesDir(Map<String, String> packages) { |
102 var contents = <Descriptor>[]; | 102 var contents = <Descriptor>[]; |
103 packages.forEach((name, version) { | 103 packages.forEach((name, version) { |
104 if (version == null) { | 104 if (version == null) { |
105 contents.add(nothing(name)); | 105 contents.add(nothing(name)); |
106 } else { | 106 } else { |
107 contents.add(dir(name, [ | 107 contents.add(dir(name, [ |
108 file("$name.dart", 'main() => "$name $version";') | 108 file("$name.dart", 'main() => "$name $version";') |
109 ])); | 109 ])); |
110 } | 110 } |
111 }); | 111 }); |
112 return dir(packagesPath, contents); | 112 return dir(packagesPath, contents); |
113 } | 113 } |
114 | 114 |
115 /// Describes the global package cache directory containing all the given | 115 /// Describes the global package cache directory containing all the given |
116 /// [packages], which should be name/version pairs. The packages will be | 116 /// [packages], which should be name/version pairs. The packages will be |
117 /// validated against the format produced by the mock package server. | 117 /// validated against the format produced by the mock package server. |
118 /// | 118 /// |
119 /// A package's value may also be a list of versions, in which case all | 119 /// A package's value may also be a list of versions, in which case all |
120 /// versions are expected to be installed. | 120 /// versions are expected to be downloaded. |
121 /// | 121 /// |
122 /// If [includePubspecs] is `true`, then pubspecs will be created for each | 122 /// If [includePubspecs] is `true`, then pubspecs will be created for each |
123 /// package. Defaults to `false` so that the contents of pubspecs are not | 123 /// package. Defaults to `false` so that the contents of pubspecs are not |
124 /// validated since they will often lack the dependencies section that the | 124 /// validated since they will often lack the dependencies section that the |
125 /// real pubspec being compared against has. You usually only need to pass | 125 /// real pubspec being compared against has. You usually only need to pass |
126 /// `true` for this if you plan to call [create] on the resulting descriptor. | 126 /// `true` for this if you plan to call [create] on the resulting descriptor. |
127 Descriptor cacheDir(Map packages, {bool includePubspecs: false}) { | 127 Descriptor cacheDir(Map packages, {bool includePubspecs: false}) { |
128 var contents = <Descriptor>[]; | 128 var contents = <Descriptor>[]; |
129 packages.forEach((name, versions) { | 129 packages.forEach((name, versions) { |
130 if (versions is! List) versions = [versions]; | 130 if (versions is! List) versions = [versions]; |
(...skipping 30 matching lines...) Expand all Loading... |
161 ['https://www.googleapis.com/auth/userinfo.email'], | 161 ['https://www.googleapis.com/auth/userinfo.email'], |
162 expiration).toJson()) | 162 expiration).toJson()) |
163 ]); | 163 ]); |
164 })); | 164 })); |
165 } | 165 } |
166 | 166 |
167 /// Describes the application directory, containing only a pubspec specifying | 167 /// Describes the application directory, containing only a pubspec specifying |
168 /// the given [dependencies]. | 168 /// the given [dependencies]. |
169 DirectoryDescriptor appDir([Map dependencies]) => | 169 DirectoryDescriptor appDir([Map dependencies]) => |
170 dir(appPath, [appPubspec(dependencies)]); | 170 dir(appPath, [appPubspec(dependencies)]); |
OLD | NEW |