From d82f4d5fb16a573e9cdc105db18870ac181a0af6 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Mon, 31 Dec 2018 12:29:53 -0500 Subject: [PATCH] 2.1.1 --- CHANGELOG.md | 3 +++ lib/src/commands/rename.dart | 13 ++++--------- pubspec.yaml | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a02163..c660679 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 2.1.1 +* Edit the way `rename` runs, leaving no corner unturned. + # 2.1.0 * Deprecate `angel install`. * Rename projects using `snake_case`. diff --git a/lib/src/commands/rename.dart b/lib/src/commands/rename.dart index 98a3752..d0213b8 100644 --- a/lib/src/commands/rename.dart +++ b/lib/src/commands/rename.dart @@ -113,7 +113,7 @@ renameDartFiles(Directory dir, String oldName, String newName) async { contents = contents.replaceRange( range.first as int, range.last as int, replacement); } 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 Map replace = {}; - RenamingVisitor(this.oldName, this.newName); + RenamingVisitor(this.oldName, this.newName) { + replace[['{{$oldName}}']] = newName; + } String updateUri(String uri) { if (uri == 'package:$oldName/$oldName.dart') { @@ -139,13 +141,6 @@ class RenamingVisitor extends RecursiveAstVisitor { return uri; } - @override - visitSimpleStringLiteral(SimpleStringLiteral node) { - if (node.value == '{{$oldName}}') { - replace[[node.value]] = newName; - } - } - @override visitExportDirective(ExportDirective ctx) { var uri = ctx.uri.stringValue, updated = updateUri(uri); diff --git a/pubspec.yaml b/pubspec.yaml index 6c7377c..f1888dd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ author: Tobe O description: Command-line tools for the Angel framework. homepage: https://github.com/angel-dart/angel_cli name: angel_cli -version: 2.1.0 +version: 2.1.1 dependencies: analyzer: ">=0.32.0" args: ^1.0.0