Skip to content

Commit

Permalink
Merge branch 'main' into fix_#699
Browse files Browse the repository at this point in the history
  • Loading branch information
Nidal-Bakir authored May 31, 2024
2 parents 7733aa1 + 67672d9 commit 53a951d
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 15 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ jobs:

test-os:
name: Test on ${{ matrix.os }}
needs: test
timeout-minutes: 30
runs-on: ${{ matrix.os }}
strategy:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 3.1.6

- Improved messages when nested .fvmrc file is found.
- Better error handling for .git directory check.

## 3.1.5

* Improved mirror creation logging
Expand Down
2 changes: 1 addition & 1 deletion lib/src/services/flutter_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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],
);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/version.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions lib/src/workflows/resolve_dependencies.workflow.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ Future<void> 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
Expand Down
35 changes: 24 additions & 11 deletions lib/src/workflows/use_version.workflow.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,25 @@ Future<void> 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
Expand Down Expand Up @@ -111,12 +124,6 @@ Future<void> _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(
Expand All @@ -131,6 +138,12 @@ Future<void> _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);
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: fvm
description: A simple cli to manage Flutter SDK versions per project. Support
channels, releases, and local cache for fast switching between versions.
version: 3.1.5
version: 3.1.6
homepage: https://github.com/leoafarias/fvm

environment:
Expand Down

0 comments on commit 53a951d

Please sign in to comment.