add git command
This commit is contained in:
parent
a9c051bd04
commit
0b983e9b30
4 changed files with 23 additions and 19 deletions
|
|
@ -19,12 +19,11 @@ class BuildDart extends Command {
|
|||
var data = DataBuildDart.fromJson(command.param);
|
||||
var workspace = getWorkspace(data.workspace);
|
||||
|
||||
var shell = StringBuffer();
|
||||
shell.write('cd $workspace');
|
||||
shell.write(' && flutter clean');
|
||||
shell.write(' && flutter pub upgrade --major-versions');
|
||||
shell.write(' && flutter packages upgrade');
|
||||
shell.write(' && flutter pub get');
|
||||
var shell = StringBuffer('cd $workspace');
|
||||
shell.write('&& flutter clean');
|
||||
shell.write('&& flutter pub upgrade --major-versions');
|
||||
shell.write('&& flutter packages upgrade');
|
||||
shell.write('&& flutter pub get');
|
||||
if (data.executeBuildRunner == null ? true : data.executeBuildRunner!) {
|
||||
shell.write(
|
||||
' && flutter pub run build_runner build --delete-conflicting-outputs');
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import 'package:oto_cli/oto/commands/build/build_dart_compile.dart';
|
|||
import 'package:oto_cli/oto/commands/build/build_dot_net.dart';
|
||||
import 'package:oto_cli/oto/commands/build/build_flutter.dart';
|
||||
import 'package:oto_cli/oto/commands/build/build_ios.dart';
|
||||
import 'package:oto_cli/oto/commands/git/git.dart';
|
||||
import 'package:oto_cli/oto/data/command_data.dart';
|
||||
import 'package:oto_cli/oto/data/jenkins_data.dart';
|
||||
import 'package:oto_cli/oto/commands/file/delete.dart';
|
||||
|
|
@ -41,7 +42,8 @@ enum CommandType {
|
|||
Slack,
|
||||
SlackBuild,
|
||||
Zip,
|
||||
Shell
|
||||
Shell,
|
||||
Git
|
||||
}
|
||||
|
||||
abstract class Command {
|
||||
|
|
@ -64,7 +66,8 @@ abstract class Command {
|
|||
CommandType.Slack: Slack(),
|
||||
CommandType.SlackBuild: SlackBuild(),
|
||||
CommandType.Zip: Zip(),
|
||||
CommandType.Shell: Shell()
|
||||
CommandType.Shell: Shell(),
|
||||
CommandType.Git: Git()
|
||||
};
|
||||
|
||||
factory Command.byType(CommandType type) {
|
||||
|
|
@ -165,8 +168,6 @@ abstract class Command {
|
|||
class SimpleCommand extends Command {
|
||||
@override
|
||||
Future execute(DataCommand command) async {
|
||||
var property = Application.instance.property;
|
||||
var jenkins = Application.instance.jenkinsData;
|
||||
print(command.param);
|
||||
return simpleFuture;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:oto_cli/oto/application.dart';
|
||||
import 'package:oto_cli/oto/commands/command.dart';
|
||||
import 'package:oto_cli/oto/data/command_data.dart';
|
||||
import 'package:dart_framework/platform/process.dart';
|
||||
|
|
@ -8,15 +7,19 @@ import 'package:dart_framework/platform/process.dart';
|
|||
class Git extends Command {
|
||||
@override
|
||||
Future execute(DataCommand command) async {
|
||||
var data = DataExecuteApp.fromJson(command.param);
|
||||
var data = DataGit.fromJson(command.param);
|
||||
var workspace = getWorkspace(data.workspace);
|
||||
|
||||
var exe = replaceTag(data.executable);
|
||||
var desktop = replaceTag(data.desktopServicePath);
|
||||
print('Process Start: $exe');
|
||||
var content = 'start "" "$exe" & exit';
|
||||
var shell = StringBuffer('cd $workspace');
|
||||
var commands = data.commands;
|
||||
for (var item in commands) {
|
||||
shell.write('&& git ${getPathNormal(item)}');
|
||||
}
|
||||
|
||||
var buffer = StringBuffer(content);
|
||||
var processData = await ProcessExecutor.run(buffer, workspace: desktop);
|
||||
return complete(processData.exitCode, command);
|
||||
var process = await ProcessExecutor.start(shell,
|
||||
workspace: workspace, printStderr: false);
|
||||
|
||||
return complete(await process.process.exitCode, command,
|
||||
errorMessage: process.stderr.toString());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ const _$CommandTypeEnumMap = {
|
|||
CommandType.SlackBuild: 'SlackBuild',
|
||||
CommandType.Zip: 'Zip',
|
||||
CommandType.Shell: 'Shell',
|
||||
CommandType.Git: 'Git',
|
||||
};
|
||||
|
||||
DataParam _$DataParamFromJson(Map<String, dynamic> json) =>
|
||||
|
|
|
|||
Loading…
Reference in a new issue