public override async Task <IGenesisExecutionResult> Execute(GenesisContext genesis, string[] args) { var result = new OutputGenesisExecutionResult(); if (!Directory.Exists(Config.OutputPath)) //TODO: Worry about the output path in the OutputGenerator base { Directory.CreateDirectory(Config.OutputPath); } foreach (var obj in genesis.Objects) { await ExecuteGraph(obj); } var outPath = Path.Combine(Config.OutputPath, "Mapper.cs"); var output = Template.Raw .Replace("~MAPPING_CODE~", string.Join(Environment.NewLine, _lines)) .Replace(Tokens.DepsModelNamespace, Config.ModelNamespace) .Replace(Tokens.DepsDtoNamespace, Config.DtoNamespace) .Replace(Tokens.DepsNamespace, Config.DepsNamespace) .Replace(Tokens.Namespace, Config.Namespace); File.WriteAllText(outPath, output); result.Success = true; return(result); }
public override async Task <IGenesisExecutionResult> Execute(GenesisContext genesis, string[] args) { var result = new OutputGenesisExecutionResult(); foreach (var obj in genesis.Objects) { await ExecuteGraph(obj); } return(result); }
public override async Task <IGenesisExecutionResult> Execute(GenesisContext genesis, string[] args) { Text.DarkGrayLine($@"Generating MVC Controllers in: {Config.OutputPath}"); var result = new OutputGenesisExecutionResult(); //overridden just to loop over all the graphs foreach (var obj in genesis.Objects) { await ExecuteGraph(obj); } return(result); }
public override async Task <IGenesisExecutionResult> Execute(GenesisContext genesis, string[] args) { var result = new OutputGenesisExecutionResult(); try { foreach (var obj in genesis.Objects) { await ExecuteGraph(obj); } result.Success = true; } catch (Exception e) { Debug.WriteLine(e.Message); result.Message = e.Message; } return(result); }
public override async Task <IGenesisExecutionResult> Execute(GenesisContext genesis, string[] args) { var result = new OutputGenesisExecutionResult(); if (!Directory.Exists(Config.OutputPath)) //TODO: Worry about the output path in the OutputGenerator base { Directory.CreateDirectory(Config.OutputPath); } await DepositDependencies(); foreach (var obj in genesis.Objects) { await ExecuteGraph(obj); } result.Success = true; return(result); }
public override async Task <IGenesisExecutionResult> Execute(GenesisContext genesis, string[] args) { var result = new OutputGenesisExecutionResult(); if (!Directory.Exists(Config.OutputPath)) { Directory.CreateDirectory(Config.OutputPath); } var path = !string.IsNullOrEmpty(Config.DepsPath) && Directory.Exists(Config.DepsPath) ? Config.DepsPath : Config.OutputPath; await DepositDependencies(path); foreach (var obj in genesis.Objects) { await ExecuteGraph(obj); } return(result); }
public override async Task <IGenesisExecutionResult> Execute(GenesisContext genesis, string[] args) { var result = new OutputGenesisExecutionResult(); if (!Directory.Exists(Config.OutputPath)) //TODO: Worry about the output path in the OutputGenerator base { Directory.CreateDirectory(Config.OutputPath); } var path = !string.IsNullOrEmpty(Config.DepsPath) && Directory.Exists(Config.DepsPath) ? Config.DepsPath : Config.OutputPath; //TODO: This is still kinda ghetto; feels unprepared await DepositDependencies(path); foreach (var obj in genesis.Objects) { await ExecuteGraph(obj); } result.Success = true; return(result); }
public override async Task <IGenesisExecutionResult> Execute(GenesisContext genesis, string[] args) { var result = new OutputGenesisExecutionResult { Success = true }; if (args.Length == 1) //config { await OnHelpRequested(args); return(result); } else if (args.Length == 2) //config executorname { WriteExecutorDetails(args[1]); return(result); } else { try { var generator = OutputManager.Outputs.Find(g => g.CommandText.Trim().ToLower().Equals(args[1].Trim().ToLower(), StringComparison.Ordinal)); var populator = InputManager.Inputs.Find(p => p.CommandText.Trim().ToLower() == args[1].Trim().ToLower()); var chunks = args[2].Split('='); //TODO: terse var propertyName = chunks[0]; var val = args[2].Substring(propertyName.Length + 1); object?propertyValue = null; if (int.TryParse(val, out var number)) { propertyValue = number; } else if (bool.TryParse(val, out var bit)) { propertyValue = bit; } else { propertyValue = val; } if (generator != null) { if (!await generator.EditConfig(propertyName, propertyValue)) { Text.RedLine("Couldn't update value"); } else { result.Success = true; } } else if (populator != null) { if (!await populator.EditConfig(propertyName, propertyValue)) { Text.RedLine("Couldn't update value"); } else { result.Success = true; } } else { Text.CliCommand(args[1]); Text.Red(" is not a known Executor. ("); Text.FriendlyText("Input", false); Text.Red(" or "); Text.FriendlyText("Output"); Text.RedLine(")."); result.Message = "Invalid Executor"; } } catch (IndexOutOfRangeException ioor) { result.Message = ioor.Message; Text.RedLine("Invalid arguments"); } return(await Task.FromResult(result)); } }