From 997344488c870c90b6b7fa60ba3e249e8eb5a65e Mon Sep 17 00:00:00 2001 From: Tobe O Date: Sat, 14 Jul 2018 18:36:10 -0400 Subject: [PATCH] Remove update+version commands --- bin/angel.dart | 4 +-- lib/src/commands/update.dart | 68 ----------------------------------- lib/src/commands/version.dart | 13 ------- 3 files changed, 1 insertion(+), 84 deletions(-) delete mode 100644 lib/src/commands/update.dart delete mode 100644 lib/src/commands/version.dart diff --git a/bin/angel.dart b/bin/angel.dart index 8f066e1..cc11c96 100644 --- a/bin/angel.dart +++ b/bin/angel.dart @@ -17,9 +17,7 @@ main(List args) async { ..addCommand(new InitCommand()) ..addCommand(new InstallCommand()) ..addCommand(new RenameCommand()) - ..addCommand(new UpdateCommand()) - ..addCommand(new MakeCommand()) - ..addCommand(new VersionCommand()); + ..addCommand(new MakeCommand()); return await runner.run(args).then((_) {}).catchError((exc) { stderr.writeln("Oops, something went wrong: $exc"); diff --git a/lib/src/commands/update.dart b/lib/src/commands/update.dart deleted file mode 100644 index d0e5c21..0000000 --- a/lib/src/commands/update.dart +++ /dev/null @@ -1,68 +0,0 @@ -import 'dart:io'; -import 'package:args/command_runner.dart'; -import 'package:console/console.dart'; -import 'package:http/http.dart' as http; -import 'pubspec.update.g.dart'; -import 'pub.dart'; - -class UpdateCommand extends Command { - @override - String get name => 'update'; - - @override - String get description => 'Updates the Angel CLI, if an update is available.'; - - @override - run() async { - stdout.write('Checking for update... '); - - try { - var client = new http.Client(); - var update = await checkForUpdate(client); - client.close(); - - if (update != null) { - stdout.writeln(); - var pen = new TextPen(); - pen.cyan(); - pen.text( - 'ATTENTION: There is a new version of the Angel CLI available (version $update).'); - pen.call(); - var prompt = new Chooser(['Yes', 'No']); - print('Update now?'); - var choice = await prompt.choose(); - - if (choice != 'Yes') { - pen.reset(); - pen.cyan(); - pen.text( - 'When you are ready to update, run `pub global activate angel_cli`.'); - pen(); - stdout.writeln(); - } else { - var pubPath = resolvePub(); - print('Running `pub global activate` using $pubPath...'); - var p = - await Process.start(pubPath, ['global', 'activate', 'angel_cli']); - p.stderr.listen(stderr.add); - p.stdout.listen(stdout.add); - var exitCode = await p.exitCode; - - if (exitCode != 0) - throw 'Pub terminated with a non-zero exit code.'; - else { - pen.reset(); - pen.green(); - pen("${Icon.CHECKMARK} Successfully updated the Angel CLI to version $update.\n"); - pen(); - } - } - } else - stdout.writeln('No update available.'); - } catch (e, st) { - stdout.writeln('Failed to check for update.'); - stderr.writeln(e); - stderr.writeln(st); - } - } -} diff --git a/lib/src/commands/version.dart b/lib/src/commands/version.dart deleted file mode 100644 index 4d26599..0000000 --- a/lib/src/commands/version.dart +++ /dev/null @@ -1,13 +0,0 @@ -import 'package:args/command_runner.dart'; -import 'pubspec.update.g.dart'; - -class VersionCommand extends Command { - @override - String get name => 'version'; - - @override - String get description => 'Prints the currently-installed version of the Angel CLI.'; - - @override - run() => print('Angel CLI version $PACKAGE_VERSION'); -} \ No newline at end of file