Example #1
0
 public PartVM()
 {
     Model = new PinnedPart()
     {
         Alias      = "Alias",
         Name       = "Name",
         PartFile   = "PartFile",
         Repository = "Repo",
         PartType   = PartType.CSharp
     };
 }
Example #2
0
        private void Pin(object parameter)
        {
            var c = _configuration;

            if (c == null)
            {
                return;
            }

            PinnedPart pinnedPart = GenerateModel();

            c.AddPartCommand.Execute(pinnedPart);
        }
Example #3
0
        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));
        }
Example #4
0
        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));
        }
Example #5
0
 internal PartVM(ConfigurationVM parent, PinnedPart model)
 {
     Parent = parent;
     Model  = model;
     WireupCommands();
 }