public PartVM() { Model = new PinnedPart() { Alias = "Alias", Name = "Name", PartFile = "PartFile", Repository = "Repo", PartType = PartType.CSharp }; }
private void Pin(object parameter) { var c = _configuration; if (c == null) { return; } PinnedPart pinnedPart = GenerateModel(); c.AddPartCommand.Execute(pinnedPart); }
private static string BuildPrefix(PinnedPart part) { if (string.IsNullOrEmpty(part?.Name)) { throw new UserfriendlyException("Provided Part needs a valid name."); } var args = new List <string>(); if (!string.IsNullOrEmpty(part.Repository)) { args.Add($"-r{part.Repository}"); } if (!string.IsNullOrEmpty(part.PartFile)) { args.Add($"-f{part.PartFile}"); } args.Add($"-p{part.Name}"); return(string.Join(" ", args)); }
internal static OperationResult Build(CancellationToken cancellationToken, ProgressViewModel progress, ConfigurationVM configurationVM, PinnedPart part = null) { var shell = configurationVM.SetupEnv(); var mainVM = configurationVM?.Parent?.Parent; var vm = mainVM?.HistoryVM?.CreateHistoryEvent(); if (vm == null) { throw new InvalidOperationException("Could not create new history event"); } vm.InitializeWith(configurationVM); if (part == null) { vm.Command = "bb b"; } else { vm.Part = part?.Name; var prefix = BuildPrefix(part); vm.Command = $"bb {prefix} b"; } vm.JobName = "Build"; var context = new JobContext <BuildInfo>(shell, cancellationToken, progress, vm, mainVM.OutputVM); return(Execute(context, ProcessBuildOutput)); }
internal PartVM(ConfigurationVM parent, PinnedPart model) { Parent = parent; Model = model; WireupCommands(); }