Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/not git cache #730

Merged
merged 3 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
Loading