public IEnumerable <NuspecDependencyToken> DetermineDependencies(NuspecTemplateContext context)
        {
            var local = context.Solution.LocalDependencies();

            return(context
                   .Current
                   .DetermineDependencies()
                   .Select(dependency =>
            {
                var constraint = context.Solution.ConstraintFor(dependency);
                SemanticVersion version;
                if (local.Has(dependency))
                {
                    version = local.Get(dependency).Version;
                }
                else if (dependency.Version.IsEmpty())
                {
                    throw new InvalidOperationException(dependency.Name + " is not configured with a version and no local copy exists");
                }
                else
                {
                    version = dependency.SemanticVersion();
                }


                return new NuspecDependencyToken(dependency, version, constraint);
            }));
        }
        public IEnumerable<NuspecDependencyToken> DetermineDependencies(NuspecTemplateContext context)
        {
            var local = context.Solution.LocalDependencies();
            return context
                .Current
                .DetermineDependencies()
                .Select(dependency =>
                {
                    var constraint = context.Solution.ConstraintFor(dependency);
                    SemanticVersion version;
                    if (local.Has(dependency))
                    {
                        version = local.Get(dependency).Version;
                    }
                    else if(dependency.Version.IsEmpty())
                    {
                        throw new InvalidOperationException(dependency.Name + " is not configured with a version and no local copy exists");
                    }
                    else
                    {
                        version = dependency.SemanticVersion();
                    }

                    return new NuspecDependencyToken(dependency, version, constraint);
                });
        }
        public void SetUp()
        {
            theScenario = SolutionScenario.Create(scenario =>
            {
                scenario.Solution("Test", test =>
                {
                    test.Publishes("MyProject");
                    test.Publishes("AnotherProject");

                    test.SolutionDependency("Bottles", "1.1.0.0", UpdateMode.Fixed);
                    test.SolutionDependency("FubuCore", "1.0.0.0", UpdateMode.Float);
                    test.SolutionDependency("FubuLocalization", "1.8.0.0", UpdateMode.Fixed);

                    test.LocalDependency("Bottles", "1.1.0.255");
                    test.LocalDependency("FubuCore", "1.0.1.244");
                    test.LocalDependency("FubuLocalization", "1.8.0.0");

                    test.ProjectDependency("MyProject", "Bottles");
                    test.ProjectDependency("MyProject", "FubuCore");
                    test.ProjectDependency("MyProject", "FubuLocalization");

                    test.ProjectDependency("AnotherProject", "FubuCore");
                });
            });

            theSolution = theScenario.Find("Test");
            theSolution.FindProject("AnotherProject").AddProjectReference(theSolution.FindProject("MyProject"));

            var templates = new NuspecTemplateFinder().Templates(theSolution);
            var current = templates.FindByProject("AnotherProject");

            theContext = new NuspecTemplateContext(current, templates, theSolution, new SemanticVersion("1.1.0.0"));
            theTokens = new ProjectDependenciesSource().DetermineDependencies(theContext);
        }
        public IEnumerable <NuspecDependencyToken> DetermineDependencies(NuspecTemplateContext context)
        {
            var projects = context
                           .Current
                           .Projects
                           .Where(x => x.References.Any())
                           .SelectMany(x => x.References);

            var tokens = new List <NuspecDependencyToken>();

            projects.Each(projectRef =>
            {
                var target = context
                             .Templates
                             .Except(context.Current)
                             .FindByProject(projectRef);

                if (target == null)
                {
                    return;
                }

                var constraint = context.Solution.NuspecSettings.Float;
                tokens.Add(new NuspecDependencyToken(new Dependency(projectRef.Name), context.Version, constraint));
            });

            return(tokens);
        }
 public IEnumerable <NuspecDependencyToken> DetermineDependencies(NuspecTemplateContext context)
 {
     return(context
            .Current
            .NugetSpecDependencies()
            .Select(spec =>
     {
         var constraint = context.Solution.NuspecSettings.Float;
         return new NuspecDependencyToken(spec.Name, context.Version, constraint);
     }));
 }
 public IEnumerable<NuspecDependencyToken> DetermineDependencies(NuspecTemplateContext context)
 {
     return context
         .Current
         .NugetSpecDependencies()
         .Select(spec =>
         {
             var constraint = context.Solution.NuspecSettings.Float;
             return new NuspecDependencyToken(spec.Name, context.Version, constraint);
         });
 }
Пример #7
0
        public NuspecGenerationPlan PlanFor(Solution solution, SemanticVersion version)
        {
            var plan      = new NuspecGenerationPlan(solution, version);
            var templates = _finder.Templates(solution);

            templates.Each(template =>
            {
                var child   = new NuspecPlan(template, version);
                var context = new NuspecTemplateContext(template, templates, solution, version);

                child.AddDependencies(_sources.SelectMany(x => x.DetermineDependencies(context)));

                plan.Add(child);
            });

            return(plan);
        }
Пример #8
0
        public NuspecGenerationPlan PlanFor(Solution solution, SemanticVersion version)
        {
            var plan = new NuspecGenerationPlan(solution, version);
            var templates = _finder.Templates(solution);

            templates.Each(template =>
            {
                var child = new NuspecPlan(template, version);
                var context = new NuspecTemplateContext(template, templates, solution, version);

                child.AddDependencies(_sources.SelectMany(x => x.DetermineDependencies(context)));

                plan.Add(child);
            });

            return plan;
        }
        public IEnumerable<NuspecDependencyToken> DetermineDependencies(NuspecTemplateContext context)
        {
            var projects = context
                .Current
                .Projects
                .Where(x => x.References.Any())
                .SelectMany(x => x.References);

            var tokens = new List<NuspecDependencyToken>();
            projects.Each(projectRef =>
            {
                var target = context
                    .Templates
                    .Except(context.Current)
                    .FindByProject(projectRef);

                if (target == null) return;

                var constraint = context.Solution.NuspecSettings.Float;
                tokens.Add(new NuspecDependencyToken(new Dependency(projectRef.Name), context.Version, constraint));
            });

            return tokens;
        }
Пример #10
0
 protected bool Equals(NuspecTemplateContext other)
 {
     return(Current.Equals(other.Current));
 }
Пример #11
0
 protected bool Equals(NuspecTemplateContext other)
 {
     return Current.Equals(other.Current);
 }