From c803bfb592144d48847b4a75ecb4074e57fb436b Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Fri, 31 May 2024 09:33:49 -0400 Subject: [PATCH 1/3] Improved check if git and error handling --- lib/src/services/flutter_service.dart | 2 +- lib/src/workflows/use_version.workflow.dart | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/src/services/flutter_service.dart b/lib/src/services/flutter_service.dart index 9fbaebdd..af5521fb 100644 --- a/lib/src/services/flutter_service.dart +++ b/lib/src/services/flutter_service.dart @@ -198,8 +198,8 @@ class FlutterService extends ContextService { throw Exception('Git cache directory does not exist'); } - final gitDir = await GitDir.fromExisting(context.gitCachePath); try { + final gitDir = await GitDir.fromExisting(context.gitCachePath); final result = await gitDir.runCommand( ['rev-parse', '--short', '--verify', ref], ); diff --git a/lib/src/workflows/use_version.workflow.dart b/lib/src/workflows/use_version.workflow.dart index 71ecda2e..7a871466 100644 --- a/lib/src/workflows/use_version.workflow.dart +++ b/lib/src/workflows/use_version.workflow.dart @@ -111,12 +111,6 @@ Future _checkGitignore(Project project, {required bool force}) async { final updateGitIgnore = project.config?.updateGitIgnore ?? true; logger.detail('Update gitignore: $updateGitIgnore'); - if (!await GitDir.isGitDir(project.path)) { - logger.warn( - 'Project is not a git repository. \n But will set .gitignore as IDEs may use it,' - 'to determine what to index and display on searches,', - ); - } if (!updateGitIgnore) { logger.detail( @@ -131,6 +125,12 @@ Future _checkGitignore(Project project, {required bool force}) async { final ignoreFile = project.gitIgnoreFile; if (!ignoreFile.existsSync()) { + if (!await GitDir.isGitDir(project.path)) { + logger.warn( + 'Project is not a git repository. \n But will set .gitignore as IDEs may use it,' + 'to determine what to index and display on searches,', + ); + } ignoreFile.createSync(recursive: true); } From 8dcfc7cf9075cb10e0fbbdd335f6d76ccbab0885 Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Fri, 31 May 2024 09:34:21 -0400 Subject: [PATCH 2/3] Better message for behavior on pubspec --- .../resolve_dependencies.workflow.dart | 8 +++++++ lib/src/workflows/use_version.workflow.dart | 23 +++++++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/lib/src/workflows/resolve_dependencies.workflow.dart b/lib/src/workflows/resolve_dependencies.workflow.dart index 018d40f3..1fba8932 100644 --- a/lib/src/workflows/resolve_dependencies.workflow.dart +++ b/lib/src/workflows/resolve_dependencies.workflow.dart @@ -27,6 +27,14 @@ Future resolveDependenciesWorkflow( return; } + if (!project.hasPubspec) { + logger + ..info('Skipping "pub get" because no pubspec.yaml found.') + ..spacer; + + return; + } + final progress = logger.progress('Resolving dependencies...'); // Try to resolve offline diff --git a/lib/src/workflows/use_version.workflow.dart b/lib/src/workflows/use_version.workflow.dart index 7a871466..504ffc69 100644 --- a/lib/src/workflows/use_version.workflow.dart +++ b/lib/src/workflows/use_version.workflow.dart @@ -33,12 +33,25 @@ Future useVersionWorkflow({ }) async { // If project use check that is Flutter project if (!project.hasPubspec && !force) { - logger - ..spacer - ..info('No pubspec.yaml detected in this directory'); - final proceed = logger.confirm('Would you like to continue?'); + if (project.hasConfig) { + if (project.path != ctx.workingDirectory) { + logger + ..spacer + ..info('Using $kFvmConfigFileName in ${project.path}') + ..spacer + ..info( + 'If this is incorrect either use the --force flag or remove the $kFvmConfigFileName and the $kFvmDirName directory.', + ) + ..spacer; + } + } else { + logger + ..spacer + ..info('No pubspec.yaml detected in this directory'); + final proceed = logger.confirm('Would you like to continue?'); - if (!proceed) exit(ExitCode.success.code); + if (!proceed) exit(ExitCode.success.code); + } } logger From 612db15f63cf0cabb300b3a70aedee9edd66e966 Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Fri, 31 May 2024 09:46:46 -0400 Subject: [PATCH 3/3] Update workflow for concurrency --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index de12a59a..14468d0b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -61,7 +61,6 @@ jobs: test-os: name: Test on ${{ matrix.os }} - needs: test timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: