コード例 #1
0
        public Result <IEnumerable <string> > Handle(ListAllProjectsCommand message)
        {
            var projects = ProjectsScanner.GetAllProjectsInSln(message.SlnPath)
                           .Choose(x => x)
                           .Map(ProjectConverter.ToViewString)
                           .ToList();

            return(projects.Any()
                ? new Result <IEnumerable <string> >(projects)
                : new Result <IEnumerable <string> >(new NothingFoundException("no projects were found")));
        }
コード例 #2
0
        public static string PushToSource(Project project, string source, string buildProfile)
        {
            var pathToPackage = Path.Combine(Path.GetDirectoryName(project.Path), "bin", buildProfile,
                                             $"{ProjectsScanner.GetProjectNameFromPath(project.Path)}.{VersionConverter.ToString(project.Version)}.nupkg");

            using var cmd = GetCommandProcess("dotnet", $"nuget push --source {source} {pathToPackage}");

            cmd.Start();
            cmd.WaitForExit();

            return(cmd.StandardOutput.ReadToEnd());
        }
コード例 #3
0
        public Result <IEnumerable <string> > Handle(DecrementProjectsCommand message)
        {
            var projects = ProjectsScanner.GetAllProjectsInSln(message.SlnPath)
                           .Choose(x => x).ToList();

            return(Prelude.Optional(DependencyTree.FindReferences(projects, message.ProjectNames)
                                    .Select(x => VersionModifier.DecrementVersion(x, message.Version))
                                    .Select(ProjectSaver.Save)
                                    .Select(ProjectConverter.ToViewString)
                                    .DefaultIfEmpty())
                   .Match(x => new Result <IEnumerable <string> >(x),
                          new Result <IEnumerable <string> >(new NothingFoundException("no projects were found"))));
        }
コード例 #4
0
        public Result <IEnumerable <string> > Handle(ListDependentProjectsCommand message)
        {
            var projects = ProjectsScanner.GetAllProjectsInSln(message.SlnPath)
                           .Choose(x => x)
                           .ToList();

            var dependentProjects = DependencyTree.FindReferences(projects, message.ProjectNames)
                                    .Select(ProjectConverter.ToViewString).ToList();

            return(dependentProjects.Any()
                ? new Result <IEnumerable <string> >(dependentProjects)
                : new Result <IEnumerable <string> >(new NothingFoundException("no projects were found")));
        }
コード例 #5
0
        public Result <IEnumerable <string> > Handle(PushProjectsCommand message)
        {
            var projects = ProjectsScanner.GetAllProjectsInSln(message.SlnPath)
                           .Choose(x => x).ToList();

            return(Prelude.Optional(DependencyTree.FindReferences(projects, message.ProjectNames)
                                    .SelectMany(x =>
            {
                var buildLog = Pusher.Build(x, message.BuildProfile);
                var pushLog = Pusher.PushToSource(x, message.Source, message.BuildProfile);

                return new[] { buildLog, pushLog };
            }).DefaultIfEmpty())
                   .Match(x => new Result <IEnumerable <string> >(x),
                          new Result <IEnumerable <string> >(new NothingFoundException("no projects were found"))));
        }