This commit is contained in:
Tobe O 2018-12-31 12:29:53 -05:00
parent bd5a48098c
commit d82f4d5fb1
3 changed files with 8 additions and 10 deletions

View file

@ -1,3 +1,6 @@
# 2.1.1
* Edit the way `rename` runs, leaving no corner unturned.
# 2.1.0 # 2.1.0
* Deprecate `angel install`. * Deprecate `angel install`.
* Rename projects using `snake_case`. * Rename projects using `snake_case`.

View file

@ -113,7 +113,7 @@ renameDartFiles(Directory dir, String oldName, String newName) async {
contents = contents.replaceRange( contents = contents.replaceRange(
range.first as int, range.last as int, replacement); range.first as int, range.last as int, replacement);
} else if (range.first is String) { } else if (range.first is String) {
contents = contents.replaceAll(range.first as Pattern, replacement); contents = contents.replaceAll(range.first as String, replacement);
} }
}); });
@ -128,7 +128,9 @@ class RenamingVisitor extends RecursiveAstVisitor {
final String oldName, newName; final String oldName, newName;
final Map<List, String> replace = {}; final Map<List, String> replace = {};
RenamingVisitor(this.oldName, this.newName); RenamingVisitor(this.oldName, this.newName) {
replace[['{{$oldName}}']] = newName;
}
String updateUri(String uri) { String updateUri(String uri) {
if (uri == 'package:$oldName/$oldName.dart') { if (uri == 'package:$oldName/$oldName.dart') {
@ -139,13 +141,6 @@ class RenamingVisitor extends RecursiveAstVisitor {
return uri; return uri;
} }
@override
visitSimpleStringLiteral(SimpleStringLiteral node) {
if (node.value == '{{$oldName}}') {
replace[[node.value]] = newName;
}
}
@override @override
visitExportDirective(ExportDirective ctx) { visitExportDirective(ExportDirective ctx) {
var uri = ctx.uri.stringValue, updated = updateUri(uri); var uri = ctx.uri.stringValue, updated = updateUri(uri);

View file

@ -2,7 +2,7 @@ author: Tobe O <thosakwe@gmail.com>
description: Command-line tools for the Angel framework. description: Command-line tools for the Angel framework.
homepage: https://github.com/angel-dart/angel_cli homepage: https://github.com/angel-dart/angel_cli
name: angel_cli name: angel_cli
version: 2.1.0 version: 2.1.1
dependencies: dependencies:
analyzer: ">=0.32.0" analyzer: ">=0.32.0"
args: ^1.0.0 args: ^1.0.0