test
This commit is contained in:
parent
bca1209045
commit
cea929f38e
2 changed files with 24 additions and 28 deletions
|
|
@ -121,13 +121,17 @@ class CLI {
|
|||
}
|
||||
|
||||
static Future printBuffer(StringBuffer buffer) async {
|
||||
return await print(buffer.toString().split('\n'));
|
||||
return await printString(buffer.toString());
|
||||
}
|
||||
|
||||
static Future printString(String str) async {
|
||||
return await print(str.split('\n'));
|
||||
}
|
||||
|
||||
static Future println(String str, Color color) async {
|
||||
return await printString(CLI.style(str, color: color));
|
||||
}
|
||||
|
||||
late CLIConfig config;
|
||||
late CommandManager _commandManager;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ class Application {
|
|||
|
||||
Map<String, dynamic>? buildMap;
|
||||
Map<String, dynamic>? jenkinsMap;
|
||||
String buildContent = '';
|
||||
// var envArgs = envArguments(arguments);
|
||||
// bool isTest = envArgs.containsKey('isTest'); //for Unit Test
|
||||
switch (buildType) {
|
||||
|
|
@ -66,36 +67,24 @@ class Application {
|
|||
'is not Mac/Windows/Linux. build must be execute in Mac/Windows os system');
|
||||
}
|
||||
if (enable) {
|
||||
printBuildStep('Jenkins Variables');
|
||||
await printBuildStep('Jenkins Variables');
|
||||
print(jsonStr);
|
||||
}
|
||||
_jenkinsData = DataJenkins.fromJson(jenkinsMap!);
|
||||
|
||||
var content = await getBuildData();
|
||||
await composeANSIPrint(content, Color.green);
|
||||
buildMap = getMapFromYaml(content);
|
||||
buildContent = await getBuildData();
|
||||
buildMap = getMapFromYaml(buildContent);
|
||||
break;
|
||||
|
||||
case BuildType.file:
|
||||
_jenkinsData = DataJenkins.fromJson(FileData.jenkinsMap!);
|
||||
|
||||
var content = yamlContent!;
|
||||
await CLI.printString(CLI.style(content, color: Color.green));
|
||||
// await composeANSIPrint(content, Color.green);
|
||||
buildMap = getMapFromYaml(content);
|
||||
buildContent = yamlContent!;
|
||||
buildMap = getMapFromYaml(buildContent);
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
await execute(buildMap!);
|
||||
}
|
||||
print(buildContent);
|
||||
|
||||
Future composeANSIPrint(String value, Color color) async {
|
||||
var list = value.split('\n');
|
||||
for (var item in list) {
|
||||
await CLI.print([CLI.style(item, color: color)]);
|
||||
}
|
||||
return simpleFuture;
|
||||
await execute(buildMap!);
|
||||
}
|
||||
|
||||
Future setKorean() async {
|
||||
|
|
@ -117,23 +106,26 @@ class Application {
|
|||
for (var command in build.commands) {
|
||||
String commandStr =
|
||||
command.command.toString().replaceAll('CommandType.', '');
|
||||
printBuildStep('Phase Start: $commandStr');
|
||||
await printBuildStep('Phase Start: $commandStr');
|
||||
if (!await Command(command.command).execute(command)) {
|
||||
exit(10);
|
||||
}
|
||||
}
|
||||
|
||||
c.complete();
|
||||
printBuildStep('Build Successfully Complete');
|
||||
await printBuildStep('Build Successfully Complete');
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void printBuildStep(String name) {
|
||||
print(
|
||||
'************************************************************************************');
|
||||
print('* $name');
|
||||
print(
|
||||
'************************************************************************************');
|
||||
Future printBuildStep(String name) async {
|
||||
await CLI.println(
|
||||
'************************************************************************************',
|
||||
Color.green);
|
||||
await CLI.println('* $name', Color.green);
|
||||
await CLI.println(
|
||||
'************************************************************************************',
|
||||
Color.green);
|
||||
return simpleFuture;
|
||||
}
|
||||
|
||||
Future<String> getBuildData() async {
|
||||
|
|
|
|||
Loading…
Reference in a new issue