| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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('git_source'); | 5 #library('git_source'); |
| 6 | 6 |
| 7 #import('io.dart'); | 7 #import('io.dart'); |
| 8 #import('package.dart'); | 8 #import('package.dart'); |
| 9 #import('source.dart'); | 9 #import('source.dart'); |
| 10 #import('utils.dart'); | 10 #import('utils.dart'); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 "Cannot install '${id.name}' from Git (${id.description}).\n" | 40 "Cannot install '${id.name}' from Git (${id.description}).\n" |
| 41 "Please ensure Git is correctly installed."); | 41 "Please ensure Git is correctly installed."); |
| 42 } | 42 } |
| 43 }); | 43 }); |
| 44 } | 44 } |
| 45 | 45 |
| 46 /** | 46 /** |
| 47 * The package name of a Git repo is the name of the directory into which | 47 * The package name of a Git repo is the name of the directory into which |
| 48 * it'll be cloned. | 48 * it'll be cloned. |
| 49 */ | 49 */ |
| 50 String packageName(PackageId id) => | 50 String packageName(description) => |
| 51 basename(id.description).replaceFirst(const RegExp("\.git\$"), ""); | 51 basename(description).replaceFirst(const RegExp("\.git\$"), ""); |
| 52 | 52 |
| 53 /** | 53 /** |
| 54 * Ensures [description] is a Git URL. | 54 * Ensures [description] is a Git URL. |
| 55 */ | 55 */ |
| 56 void validateDescription(description) { | 56 void validateDescription(description) { |
| 57 if (description is! String) { | 57 if (description is! String) { |
| 58 throw new FormatException("The description must be a git URL."); | 58 throw new FormatException("The description must be a git URL."); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 } | 61 } |
| OLD | NEW |