| 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 name_validator; | 5 library name_validator; | 
| 6 | 6 | 
| 7 import 'dart:async'; | 7 import 'dart:async'; | 
| 8 import 'dart:io'; | 8 import 'dart:io'; | 
| 9 | 9 | 
| 10 import '../../../pkg/path/lib/path.dart' as path; | 10 import '../../../pkg/path/lib/path.dart' as path; | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
| 41         warnings.add('The name of "${libraries[0]}", "$libName", should match ' | 41         warnings.add('The name of "${libraries[0]}", "$libName", should match ' | 
| 42             'the name of the package, "${entrypoint.root.name}".\n' | 42             'the name of the package, "${entrypoint.root.name}".\n' | 
| 43             'This helps users know what library to import.'); | 43             'This helps users know what library to import.'); | 
| 44       } | 44       } | 
| 45     }); | 45     }); | 
| 46   } | 46   } | 
| 47 | 47 | 
| 48   /// Returns a list of all libraries in the current package as paths relative | 48   /// Returns a list of all libraries in the current package as paths relative | 
| 49   /// to the package's root directory. | 49   /// to the package's root directory. | 
| 50   Future<List<String>> get _libraries { | 50   Future<List<String>> get _libraries { | 
| 51     var libDir = join(entrypoint.root.dir, "lib"); | 51     var libDir = path.join(entrypoint.root.dir, "lib"); | 
| 52     return defer(() { | 52     return defer(() { | 
| 53       if (!dirExists(libDir)) return []; | 53       if (!dirExists(libDir)) return []; | 
| 54       return listDir(libDir, recursive: true); | 54       return listDir(libDir, recursive: true); | 
| 55     }).then((files) { | 55     }).then((files) { | 
| 56       return files | 56       return files | 
| 57           .map((file) => path.relative(file, from: path.dirname(libDir))) | 57           .map((file) => path.relative(file, from: path.dirname(libDir))) | 
| 58           .where((file) => !path.split(file).contains("src") && | 58           .where((file) => !path.split(file).contains("src") && | 
| 59                            path.extension(file) == '.dart') | 59                            path.extension(file) == '.dart') | 
| 60           .toList(); | 60           .toList(); | 
| 61     }); | 61     }); | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
| 87       builder | 87       builder | 
| 88         ..add(source.substring(lastMatchEnd, match.start + 1)) | 88         ..add(source.substring(lastMatchEnd, match.start + 1)) | 
| 89         ..add("_") | 89         ..add("_") | 
| 90         ..add(match.group(1).toLowerCase()); | 90         ..add(match.group(1).toLowerCase()); | 
| 91       lastMatchEnd = match.end; | 91       lastMatchEnd = match.end; | 
| 92     } | 92     } | 
| 93     builder.add(source.substring(lastMatchEnd)); | 93     builder.add(source.substring(lastMatchEnd)); | 
| 94     return builder.toString().toLowerCase(); | 94     return builder.toString().toLowerCase(); | 
| 95   } | 95   } | 
| 96 } | 96 } | 
| OLD | NEW | 
|---|