Esempio n. 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")));
        }
Esempio n. 2
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")));
        }
        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"))));
        }
Esempio n. 4
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"))));
        }