Beispiel #1
0
        public EnumGroupInfo GroupMapping(SpecGroup prototype)
        {
            EnumGroupInfo group = new EnumGroupInfo();

            group.Group = prototype;
            group.Name  = prototype.Name;
            foreach (var map in groupMaps)
            {
                var match = map.Match(prototype.Name);
                if (!match.Success)
                {
                    continue;
                }
                group.Name      = match.Result(group.Name);
                group.Namespace = match.Result(map.Namespace);
                var classChain = match.Result(map.Class);
                if (classChain.Contains("::"))
                {
                    group.Class = classChain.Split(new[] { "::" }, StringSplitOptions.RemoveEmptyEntries);
                }
                else
                {
                    group.Class = new[] { classChain };
                }
                group.FileOutput = match.Result(map.FileOutput);
                if (map.CamelCase)
                {
                    group.Namespace = group.Namespace.ToCamelCase();
                    for (int i = 0; i < group.Class.Length; i++)
                    {
                        var value = group.Class[i].ToCamelCase();
                        if (value.Length > 0 && char.IsDigit(value[0]))
                        {
                            value = "_" + value;
                        }
                        group.Class[i] = value;
                    }
                    group.FileOutput =
                        Path.GetFileNameWithoutExtension(group.FileOutput).ToCamelCase()
                        + Path.GetExtension(group.FileOutput);
                }
                else
                {
                    for (int i = 0; i < group.Class.Length; i++)
                    {
                        var value = group.Class[i];
                        if (value.Length > 0 && char.IsDigit(value[0]))
                        {
                            value = "_" + value;
                        }
                        group.Class[i] = value;
                    }
                }
            }
            return(group);
        }
Beispiel #2
0
        private void updateSpecification(CreatePackagesInput input, SpecGroup group, IEnumerable <SpecGroup> groups)
        {
            var spec   = group.Spec;
            var local  = Solution.LocalDependencies();
            var nuspec = new NuspecDocument(spec.Filename);

            group
            .DetermineDependencies()
            .Each(dependency =>
            {
                var localDependency = local.Get(dependency);
                var constraint      = Solution.ConstraintFor(dependency);
                var version         = constraint.SpecFor(localDependency.Version);

                var nuspecDep = new NuspecDependency(dependency.Name, version);

                RippleLog.Info("Adding dependency: " + nuspecDep);

                nuspec.AddDependency(nuspecDep);
            });

            group
            .Projects
            .SelectMany(project => project.References)
            .Each(projectRef =>
            {
                var target = groups.FirstOrDefault(x => x.Projects.Contains(projectRef));
                if (target == null)
                {
                    return;
                }

                // TODO -- Do we need another setting for project references?
                var constraint = Solution.NuspecSettings.Float;
                var version    = constraint.SpecFor(new SemanticVersion(input.VersionFlag));

                var nuspecDep = new NuspecDependency(target.Spec.Name, version);

                RippleLog.Info("Adding dependency: " + nuspecDep);

                nuspec.AddDependency(nuspecDep);
            });



            nuspec.SaveChanges();
        }
Beispiel #3
0
        public void SetUp()
        {
            theSolution = new Solution();
            p1          = theSolution.AddProject("MyProject");

            p1.AddDependency("Bottles");
            p1.AddDependency("FubuCore");
            p1.AddDependency("FubuLocalization");

            p2 = theSolution.AddProject("MyOtherProject");
            p2.AddDependency("FubuMVC.Core");

            theSolution.AddDependency(new Dependency("Bottles", "1.0.0.0", UpdateMode.Fixed));
            theSolution.AddDependency(new Dependency("FubuCore", "1.1.0.0", UpdateMode.Float));
            theSolution.AddDependency(new Dependency("FubuLocalization", "1.2.0.0", UpdateMode.Fixed));
            theSolution.AddDependency(new Dependency("FubuMVC.Core", "1.4.0.0", UpdateMode.Fixed));

            theNugetSpec = new NugetSpec("MyProject", "myproject.nuspec");
            // explicit dependencies are not overridden
            theNugetSpec.Dependencies.Add(new NuspecDependency("Bottles", "1.0.0.0"));

            theGroup = new SpecGroup(theNugetSpec, new[] { p1, p2 });
        }