bestForMacOS method
Determines the best installation method for macOS.
The to parameter is the installation target.
Implementation
Future<String> bestForMacOS({String to = 'install'}) async {
final methods = package.methods ?? [];
final hasMethod = methods.contains('brew');
final defaults = package.defaults ?? [];
final hasDefault = defaults.contains('brew');
if (hasMethod || hasDefault) {
final brew = await Executable('brew').find();
if (brew != null) {
Global.updateCommand = '$brew update || $errorOnUpdate';
if (hasDefault) {
return '$brew $to ${package.name}';
}
return '${to}_macos "$brew"';
}
}
stopIfForcedMethodNotFound();
return await bestForAny(to: to);
}