run method
Executes the init command to set up the distribution environment.
Implementation
@override
/// Executes the `init` command to set up the distribution environment.
Future? run() async {
final environment = Environment.fromArgResults(globalResults);
final initialized = <String, bool>{};
logger = ColorizeLogger(environment);
_logOSInfo();
_checkPubspecFile();
await _createDirectory(
"distribution/android", initialized, "android_directory");
if (Platform.isMacOS) {
await _createDirectory("distribution/ios", initialized, "ios_directory");
}
await _checkTool("git", "Git", initialized, args: ["help"]);
await _checkTool("firebase", "Firebase", initialized);
await _checkTool("fastlane", "Fastlane", initialized, args: ['actions']);
await _validateFastlaneJson(initialized);
await _downloadAndroidMetaData(environment);
if (Platform.isMacOS) {
await _checkTool("xcrun", "XCRun", initialized, args: ["altool", "-h"]);
}
await File("dist").writeAsString(jsonEncode(initialized),
flush: true, mode: FileMode.write, encoding: utf8);
logger.logInfo(
"Make sure you follow the instructions to setup configurations");
logger.logInfo(
"Please fill in the configuration file: ${environment.configPath}");
exit(0);
}