From 82f23a561bb6523fe3e6a2bb8bb8de6e3fc72aec Mon Sep 17 00:00:00 2001 From: leoafarias Date: Fri, 9 Apr 2021 22:44:18 -0400 Subject: [PATCH] Added private constructors, and small arg tweaks --- lib/src/commands/install_command.dart | 2 +- lib/src/runner.dart | 1 - lib/src/services/cache_service.dart | 3 ++- lib/src/services/config_service.dart | 2 ++ lib/src/services/flutter_tools.dart | 2 ++ lib/src/services/git_tools.dart | 3 ++- lib/src/services/project_service.dart | 2 ++ lib/src/services/settings_service.dart | 2 +- pubspec.yaml | 28 ++++++++++++-------------- 9 files changed, 25 insertions(+), 20 deletions(-) diff --git a/lib/src/commands/install_command.dart b/lib/src/commands/install_command.dart index ffabaab0..db5fd338 100644 --- a/lib/src/commands/install_command.dart +++ b/lib/src/commands/install_command.dart @@ -34,7 +34,7 @@ class InstallCommand extends BaseCommand { @override Future run() async { CacheVersion cacheVersion; - final skipSetup = argResults['skip-setup'] == true; + final skipSetup = boolArg('skip-setup'); String version; // If no version was passed as argument check project config. diff --git a/lib/src/runner.dart b/lib/src/runner.dart index 3dfaf5fa..01bc768c 100644 --- a/lib/src/runner.dart +++ b/lib/src/runner.dart @@ -17,7 +17,6 @@ import 'commands/spawn_command.dart'; import 'commands/use_command.dart'; import 'commands/which_command.dart'; import 'utils/logger.dart'; -import 'utils/logger.dart' show logger; import 'utils/pubdev.dart'; import 'version.dart'; diff --git a/lib/src/services/cache_service.dart b/lib/src/services/cache_service.dart index 313123f2..465d22dd 100644 --- a/lib/src/services/cache_service.dart +++ b/lib/src/services/cache_service.dart @@ -10,9 +10,10 @@ import 'context.dart'; import 'flutter_tools.dart'; import 'git_tools.dart'; -// ignore: avoid_classes_with_only_static_members /// Service to interact with FVM Cache class CacheService { + CacheService._(); + /// Directory where local versions are cached /// Returns a [CacheVersion] from a [versionName] diff --git a/lib/src/services/config_service.dart b/lib/src/services/config_service.dart index 401eff46..f96918fc 100644 --- a/lib/src/services/config_service.dart +++ b/lib/src/services/config_service.dart @@ -8,6 +8,8 @@ import '../utils/helpers.dart'; /// Helpers and tools for the FVM config within a project class ConfigService { + ConfigService._(); + /// Returns a [FvmConfig] from within a [directory] static Future read(Directory directory) async { final configDir = Directory(join(directory.path, kFvmDirName)); diff --git a/lib/src/services/flutter_tools.dart b/lib/src/services/flutter_tools.dart index 3d9bb7aa..df5eccf4 100644 --- a/lib/src/services/flutter_tools.dart +++ b/lib/src/services/flutter_tools.dart @@ -11,6 +11,8 @@ import 'releases_service/releases_client.dart'; /// Helpers and tools to interact with Flutter sdk class FlutterTools { + FlutterTools._(); + /// Upgrades a cached channel static Future upgradeChannel(CacheVersion version) async { if (version.isChannel) { diff --git a/lib/src/services/git_tools.dart b/lib/src/services/git_tools.dart index 4494a16c..5033eed2 100644 --- a/lib/src/services/git_tools.dart +++ b/lib/src/services/git_tools.dart @@ -10,9 +10,10 @@ import '../utils/logger.dart'; import 'context.dart'; import 'settings_service.dart'; -// ignore: avoid_classes_with_only_static_members /// Tools and helpers used for interacting with git class GitTools { + GitTools._(); + /// Check if Git is installed static Future canRun() async { try { diff --git a/lib/src/services/project_service.dart b/lib/src/services/project_service.dart index 49e80970..89c49631 100644 --- a/lib/src/services/project_service.dart +++ b/lib/src/services/project_service.dart @@ -11,6 +11,8 @@ import 'config_service.dart'; /// Flutter Project Services /// APIs for interacting with local Flutter projects class ProjectService { + ProjectService._(); + /// Returns projects by providing a [directory] static Future getByDirectory(Directory directory) async { final pubspec = await _getPubspec(directory); diff --git a/lib/src/services/settings_service.dart b/lib/src/services/settings_service.dart index 10cdb563..0a3d66fe 100644 --- a/lib/src/services/settings_service.dart +++ b/lib/src/services/settings_service.dart @@ -1,9 +1,9 @@ import '../../fvm.dart'; import 'context.dart'; -// ignore: avoid_classes_with_only_static_members /// Service for FVM settings class SettingsService { + SettingsService._(); static FvmSettings _settings; /// Returns [FvmSettings] diff --git a/pubspec.yaml b/pubspec.yaml index 6cd191b8..3e0d4292 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,6 @@ name: fvm -description: A simple cli to manage Flutter SDK versions per project. Support channels, releases, and local cache for fast switching between versions. +description: A simple cli to manage Flutter SDK versions per project. Support + channels, releases, and local cache for fast switching between versions. version: 2.0.0-dev.4 homepage: https://github.com/leoafarias/fvm @@ -10,28 +11,25 @@ executables: fvm: main dependencies: - meta: ^1.3.0 - pubspec_yaml: ^2.0.1+1 args: ^1.6.0 cli_util: ^0.3.0 console: ^3.1.0 + date_format: ^2.0.2 + http: ^0.12.2 io: ^0.3.4 + meta: ^1.3.0 path: ^1.7.0 process_run: ^0.11.2+8 - http: ^0.12.2 - date_format: ^2.0.2 - version: ^2.0.0 pub_api_client: ^1.0.9 - + pubspec_yaml: ^2.0.1+1 + version: ^2.0.0 + dev_dependencies: - effective_dart: ^1.3.1 - test: ^1.15.7 - test_coverage: ^0.5.0 build_runner: ^1.10.0 - build_version: ^2.0.2 build_test: ^1.2.2 - grinder: ^0.8.6 + build_version: ^2.0.2 cli_pkg: ^1.2.0 - - - + effective_dart: ^1.3.1 + grinder: ^0.8.6 + test: ^1.15.7 + test_coverage: ^0.5.0