Skip to content

Commit 0ee3b2d

Browse files
committed
Added dart mappable
1 parent b12deb2 commit 0ee3b2d

17 files changed

+1296
-381
lines changed

.github/actions/prepare/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ runs:
2121
shell: bash
2222

2323
- name: Build Version
24-
run: dart run grinder build-version
24+
run: dart run build_runner build --delete-conflicting-outputs
2525
shell: bash

lib/src/commands/config_command.dart

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,48 +29,56 @@ class ConfigCommand extends BaseCommand {
2929
@override
3030
Future<int> run() async {
3131
// Flag if settings should be saved
32-
var shouldSave = false;
3332

34-
var current = ConfigRepository.loadFile();
33+
final currentConfig = ConfigRepository.loadAppConfig();
34+
var updatedConfig = currentConfig;
35+
36+
// TODO: Consolidate redundant code
3537

3638
if (wasParsed(ConfigKeys.flutterUrl.paramKey)) {
3739
final flutterRepo = stringArg(ConfigKeys.flutterUrl.paramKey);
3840
logger.info('Setting flutter repo to: ${yellow.wrap(flutterRepo)}');
39-
current.flutterUrl = flutterRepo;
40-
41-
shouldSave = true;
41+
// current.flutterUrl = flutterRepo;
42+
updatedConfig = currentConfig.copyWith(flutterUrl: flutterRepo);
4243
}
4344

4445
if (wasParsed(ConfigKeys.gitCachePath.paramKey)) {
4546
final gitCachePath = stringArg(ConfigKeys.gitCachePath.paramKey);
4647
logger.info('Setting git cache path to: ${yellow.wrap(gitCachePath)}');
47-
current.gitCachePath = gitCachePath;
48-
shouldSave = true;
48+
// currentConfig.gitCachePath = gitCachePath;
49+
updatedConfig = currentConfig.copyWith(gitCachePath: gitCachePath);
4950
}
5051

5152
if (wasParsed(ConfigKeys.useGitCache.paramKey)) {
5253
final gitCache = boolArg(ConfigKeys.useGitCache.paramKey);
5354
logger.info(
5455
'Setting use git cache to: ${yellow.wrap(gitCache.toString())}',
5556
);
56-
current.useGitCache = gitCache;
57-
shouldSave = true;
57+
updatedConfig = currentConfig.copyWith(useGitCache: gitCache);
5858
}
5959

6060
if (wasParsed(ConfigKeys.cachePath.paramKey)) {
6161
final cachePath = stringArg(ConfigKeys.cachePath.paramKey);
6262
logger.info('Setting fvm path to: ${yellow.wrap(cachePath)}');
63-
current.cachePath = cachePath;
64-
shouldSave = true;
63+
updatedConfig = currentConfig.copyWith(cachePath: cachePath);
64+
}
65+
66+
if (wasParsed(ConfigKeys.priviledgedAccess.paramKey)) {
67+
final priviledgedAccess = boolArg(ConfigKeys.priviledgedAccess.paramKey);
68+
logger.info(
69+
'Setting priviledged access to: ${yellow.wrap(priviledgedAccess.toString())}',
70+
);
71+
updatedConfig =
72+
currentConfig.copyWith(priviledgedAccess: priviledgedAccess);
6573
}
6674

6775
// Save
68-
if (shouldSave) {
76+
if (updatedConfig != currentConfig) {
6977
logger.info('');
7078
final updateProgress = logger.progress('Saving settings');
7179
// Update settings
7280
try {
73-
ConfigRepository.save(current);
81+
ConfigRepository.save(currentConfig);
7482
} catch (error) {
7583
updateProgress.fail('Failed to save settings');
7684
rethrow;
@@ -84,7 +92,7 @@ class ConfigCommand extends BaseCommand {
8492
..info('Located at ${ctx.configPath}')
8593
..info('');
8694

87-
final options = current.toMap();
95+
final options = currentConfig.toMap();
8896

8997
if (options.keys.isEmpty) {
9098
logger.info('No settings have been configured.');

lib/src/commands/update_command.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import 'package:pub_updater/pub_updater.dart';
66

77
import '../services/logger_service.dart';
88
import '../utils/constants.dart';
9-
import '../version.g.dart';
9+
import '../version.dart';
1010

1111
class UpdateCommand extends Command<int> {
1212
static const String commandName = 'update';

0 commit comments

Comments
 (0)