readPubspec static method
Implementation
static Future<BPConfig> readPubspec() async {
final rawPubspecFile = File('pubspec.yaml');
if (!(await rawPubspecFile.exists())) {
Console.logError("pubspec.yaml file could not be found!");
exit(1);
}
final pubspec = yaml.loadYaml(await rawPubspecFile.readAsString());
if (!(pubspec as yaml.YamlMap).containsKey("build_pipe")) {
Console.logError(
"please add the build_pipe configuration to your pubspec file!",
);
exit(1);
}
final config = BPConfig.fromMap(
pubspec["build_pipe"],
pubspec["version"].split("+")[0],
pubspec["version"].split("+")[1],
);
if (config.platforms.isEmpty) {
Console.logError(
"No target platforms were detected. Please add your target platforms to pubspec",
);
exit(1);
}
return config;
}