From 1c94f5f2ca489b3cbed6e90caf505132705d3c08 Mon Sep 17 00:00:00 2001 From: Hugo Pointcheval Date: Fri, 5 Apr 2024 14:40:00 +0200 Subject: [PATCH] fix(wyatt_cd): export all the needed layers from wyatt_cd --- .../wyatt_continuous_deployment_example.dart | 33 ++++++++----------- .../example/lib/main.dart | 27 --------------- .../example/pubspec.yaml | 15 ++------- .../example/test/widget_test.dart | 1 - .../lib/src/wyatt_continuous_deployment.dart | 18 ---------- .../lib/wyatt_continuous_deployment.dart | 3 ++ 6 files changed, 20 insertions(+), 77 deletions(-) delete mode 100644 packages/wyatt_continuous_deployment/example/lib/main.dart delete mode 100644 packages/wyatt_continuous_deployment/example/test/widget_test.dart delete mode 100644 packages/wyatt_continuous_deployment/lib/src/wyatt_continuous_deployment.dart diff --git a/packages/wyatt_continuous_deployment/example/bin/wyatt_continuous_deployment_example.dart b/packages/wyatt_continuous_deployment/example/bin/wyatt_continuous_deployment_example.dart index 6b90a629..b0bc5741 100644 --- a/packages/wyatt_continuous_deployment/example/bin/wyatt_continuous_deployment_example.dart +++ b/packages/wyatt_continuous_deployment/example/bin/wyatt_continuous_deployment_example.dart @@ -1,23 +1,18 @@ -// Copyright (C) 2024 WYATT GROUP -// Please see the AUTHORS file for details. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - import 'dart:io'; -import 'package:wyatt_continuous_deployment_example/main.dart'; +import 'package:wyatt_continuous_deployment/wyatt_continuous_deployment.dart'; -void main(List args) { - WyattContinuousDeploymentExample.run(args).then((_) => exit(0)); +Future main(List args) async { + await bootstrap(); + await flushThenExit(await WyattContinuousDeploymentCommandRunner().run(args)); } + +/// Flushes the stdout and stderr streams, then exits the program with the given +/// status code. +/// +/// This returns a Future that will never complete, since the program will have +/// exited already. This is useful to prevent Future chains from proceeding +/// after you've decided to exit. +Future flushThenExit(int status) => + Future.wait([stdout.close(), stderr.close()]) + .then((_) => exit(status)); diff --git a/packages/wyatt_continuous_deployment/example/lib/main.dart b/packages/wyatt_continuous_deployment/example/lib/main.dart deleted file mode 100644 index d3342cf8..00000000 --- a/packages/wyatt_continuous_deployment/example/lib/main.dart +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2024 WYATT GROUP -// Please see the AUTHORS file for details. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -import 'package:wyatt_continuous_deployment/wyatt_continuous_deployment.dart'; - -class WyattContinuousDeploymentExample { - static Future run(List args) async { - const useCase = CheckToolsUsecase(); - - final result = await useCase(); - - result.fold((value) => print('Success'), (error) => print('Error: $error')); - } -} diff --git a/packages/wyatt_continuous_deployment/example/pubspec.yaml b/packages/wyatt_continuous_deployment/example/pubspec.yaml index 2f1b5564..058fdb33 100644 --- a/packages/wyatt_continuous_deployment/example/pubspec.yaml +++ b/packages/wyatt_continuous_deployment/example/pubspec.yaml @@ -2,30 +2,21 @@ name: wyatt_continuous_deployment_example description: A new Flutter project. version: 1.0.0 -publish_to: 'none' +publish_to: "none" environment: sdk: ">=3.0.0 <4.0.0" dependencies: - - - wyatt_continuous_deployment: path: "../" dev_dependencies: - - - test: ^1.21.0 - - - wyatt_analysis: hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub version: ^2.6.1 - - +executables: + wyatt_continuous_deployment_example: bin/wyatt_continuous_deployment_example.dart diff --git a/packages/wyatt_continuous_deployment/example/test/widget_test.dart b/packages/wyatt_continuous_deployment/example/test/widget_test.dart deleted file mode 100644 index 8b137891..00000000 --- a/packages/wyatt_continuous_deployment/example/test/widget_test.dart +++ /dev/null @@ -1 +0,0 @@ - diff --git a/packages/wyatt_continuous_deployment/lib/src/wyatt_continuous_deployment.dart b/packages/wyatt_continuous_deployment/lib/src/wyatt_continuous_deployment.dart deleted file mode 100644 index 8ac51f30..00000000 --- a/packages/wyatt_continuous_deployment/lib/src/wyatt_continuous_deployment.dart +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2024 WYATT GROUP -// Please see the AUTHORS file for details. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -// TODO(mleon): export all layers -export ''; diff --git a/packages/wyatt_continuous_deployment/lib/wyatt_continuous_deployment.dart b/packages/wyatt_continuous_deployment/lib/wyatt_continuous_deployment.dart index 40bef808..e8fd8e56 100644 --- a/packages/wyatt_continuous_deployment/lib/wyatt_continuous_deployment.dart +++ b/packages/wyatt_continuous_deployment/lib/wyatt_continuous_deployment.dart @@ -17,5 +17,8 @@ /// Wyatt CD library wyatt_continuous_deployment; +export './src/bootstrap.dart'; export './src/core/core.dart'; export './src/domain/domain.dart'; +export './src/version.dart'; +export './src/wyatt_continuous_deployment_command_runner.dart';