Esempio n. 1
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");

            theGroup = new NuspecTemplate(theNugetSpec, new[]
            {
                new ProjectNuspec(p1, new NugetSpec("MyProject", "MyProject.nuspec")),
                new ProjectNuspec(p2, new NugetSpec("MyOtherProject", "MyOtherProject.nuspec"))
            });
        }
Esempio n. 2
0
 public PackageParams(NugetSpec spec, SemanticVersion version, string outputPath, bool createSymbols)
 {
     Spec          = spec;
     Version       = version;
     OutputPath    = outputPath;
     CreateSymbols = createSymbols;
 }
Esempio n. 3
0
        public NuspecTemplate(NugetSpec spec, IEnumerable <ProjectNuspec> projects)
        {
            Spec = spec;
            _projectNuspecs.AddRange(projects);

            Id = Guid.NewGuid();
        }
        public void verify_the_dependencies()
        {
            var specFile = theSolution.Specifications.Single(x => x.Name == "SomeProject");
            var spec     = NugetSpec.ReadFrom(specFile.Filename);

            verifyVersion(spec, "Bottles", "[1.1.0.255, 2.0.0.0)");
            verifyVersion(spec, "FubuCore", "1.0.1.244");
            verifyVersion(spec, "FubuLocalization", "[1.8.0.0, 1.9.0.0)");
            verifyVersion(spec, "Something", "1.0.1.244");
        }
Esempio n. 5
0
        public void SetUp()
        {
            var theFilename = "fubumvc.core.nuspec";
            var stream      = GetType()
                              .Assembly
                              .GetManifestResourceStream(typeof(DataMother), "FubuMVCNuspecTemplate.txt");

            new FileSystem().WriteStreamToFile(theFilename, stream);
            theSpec = NugetSpec.ReadFrom(theFilename.ToFullPath());
        }
 protected override void beforeEach()
 {
     theSpec  = new NugetSpec("Nug", "Nug.nuspec");
     theInput = new PublishInput
     {
         Version       = "1.0.0",
         ArtifactsFlag = "arts",
         ApiKey        = "pw"
     };
 }
Esempio n. 7
0
        private static void RunGeneration(IAnnotator annotator, NugetSpec nuspec, Args parsedArgs)
        {
            var version   = parsedArgs.Version ?? new Version("1.0.0.0");
            var dir       = parsedArgs.Directory ?? new DirectoryInfo(Environment.CurrentDirectory);
            var fixedSpec = SpecWithVersion(nuspec, version);

            annotator.CreateNugetPackage(fixedSpec, dir);

            Console.WriteLine($"Generated version {version}  in {dir.FullName}");
        }
        private static void WriteSpecFile(NugetSpec spec, DirectoryInfo packageDir)
        {
            var specFilename = spec.Id + "." + spec.Version + ".nuspec";
            var specFilePath = Path.Combine(packageDir.FullName, specFilename);

            using (var writer = new XmlTextWriter(specFilePath, Encoding.UTF8) {Formatting = Formatting.Indented})
            {
                spec.GetXml().WriteTo(writer);
            }
        }
        public AnnotationProgram([NotNull] string exeName, [NotNull] Action<IAnnotator> annotate,
            [NotNull] NugetSpec nugetSpec)
        {
            if (exeName == null) throw new ArgumentNullException(nameof(exeName));
            if (annotate == null) throw new ArgumentNullException(nameof(annotate));
            if (nugetSpec == null) throw new ArgumentNullException(nameof(nugetSpec));

            this.exeName = exeName;
            this.annotate = annotate;
            this.nugetSpec = nugetSpec;
        }
Esempio n. 10
0
 private static NugetSpec SpecWithVersion(NugetSpec spec, Version version)
 {
     return(new NugetSpec(
                spec.Id,
                version.ToString(),
                spec.Title,
                spec.Authors,
                spec.Owners,
                spec.ProjectUrl,
                spec.IconUrl,
                spec.Description,
                spec.Tags));
 }
        public static void CreateNugetPackage(NugetSpec spec, IEnumerable<AnnotationFile> annotationFiles, DirectoryInfo directory)
        {
            var packageDir = new DirectoryInfo(Path.Combine(directory.FullName, spec.Id));
            var annotationsDir = new DirectoryInfo(Path.Combine(packageDir.FullName, "ReSharper", "vAny", "annotations"));

            if (!annotationsDir.Exists)
            {
                annotationsDir.Create();
            }

            WriteSpecFile(spec, packageDir);
            WriteAnnotationFiles(annotationFiles, annotationsDir);
        }
Esempio n. 12
0
        public IEnumerable <NugetSpec> SpecificationsFor(Solution solution)
        {
            var specs = new List <NugetSpec>();

            _files.ForNuspecs(solution, file =>
            {
                var spec       = NugetSpec.ReadFrom(file.ToFullPath());
                spec.Publisher = solution;

                specs.Add(spec);
            });

            return(specs);
        }
Esempio n. 13
0
 private PackageBuilder packageBuilderFor(NugetSpec spec, SemanticVersion version)
 {
     try
     {
         return(new PackageBuilder(spec.Filename, NullPropertyProvider.Instance, true)
         {
             Version = version
         });
     }
     catch (Exception exc)
     {
         RippleAssert.Fail("Error creating package: " + exc.Message);
         return(null);
     }
 }
Esempio n. 14
0
        public void retrieve_the_nuget_specs()
        {
            var s1 = new NugetSpec("Test1", "Test1.nuspec");
            var s2 = new NugetSpec("Test2", "Test2.nuspec");

            var solution = new Solution();

            var service = MockRepository.GenerateStub <IPublishingService>();

            service.Stub(x => x.SpecificationsFor(solution)).Return(new[] { s1, s2 });

            solution.UsePublisher(service);

            solution.Specifications.ShouldHaveTheSameElementsAs(s1, s2);
        }
        public void smoke_test_the_package_validation()
        {
            var theFilename = "fubumvc.core.nuspec";
            var stream      = GetType()
                              .Assembly
                              .GetManifestResourceStream(typeof(DataMother), "FubuMVCNuspecTemplate.txt");

            new FileSystem().WriteStreamToFile(theFilename, stream);

            var spec    = NugetSpec.ReadFrom(theFilename);
            var service = new PublishingService(new StubSolutionFiles {
                RootDir = ".".ToFullPath()
            });

            Exception <RippleFatalError> .ShouldBeThrownBy(() => service.CreatePackage(new PackageParams(spec, new SemanticVersion("1.0.0.0"), ".".ToFullPath(), false)));
        }
Esempio n. 16
0
        public void publishes_the_specification()
        {
            var s1 = new NugetSpec("Test1", "Test1.nuspec");

            var solution = new Solution();

            var service = MockRepository.GenerateStub <IPublishingService>();

            service.Stub(x => x.SpecificationsFor(solution)).Return(new[] { s1 });

            solution.UsePublisher(service);

            var version = SemanticVersion.Parse("1.1.2.3");

            solution.Package(s1, version, "artifacts");

            service.AssertWasCalled(x => x.CreatePackage(s1, version, "artifacts"));
        }
Esempio n. 17
0
        static int Main(string[] args)
        {
            var annotator = Annotator.Create();

            AnnotateLogger(annotator);
            AnnotateFactories(annotator);

            var nuspec = new NugetSpec(
                id: "NLog.Annotations",
                title: "NLog Annotations",
                authors: "Julien Roncaglia",
                owners: "Julien Roncaglia",
                projectUrl: "https://github.com/vbfox/NLogResharperAnnotations",
                iconUrl: "https://raw.github.com/vbfox/NLogResharperAnnotations/master/nlog.png",
                description: "Annotations for the NLog.dll file",
                tags: "NLog Annotations");

            return(RunApp("NLogResharperAnnotations", args, annotator, nuspec));
        }
Esempio n. 18
0
        public string CreatePackage(NugetSpec spec, SemanticVersion version, string outputPath)
        {
            var builder       = packageBuilderFor(spec, version);
            var nupkgFileName = Path.Combine(outputPath, "{0}.{1}.nupkg".ToFormat(spec.Name, version));

            var package = createPackage(builder, nupkgFileName);
            var issues  = package.Validate(Rules);

            if (issues.Any(x => x.Level == PackageIssueLevel.Error))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                issues.Each(issue => Console.WriteLine("[{0}] {1} - {2}", issue.Level, issue.Title, issue.Description));
                Console.ResetColor();

                RippleAssert.Fail("Package failed validation");
            }

            return(nupkgFileName);
        }
Esempio n. 19
0
        protected override void execute(CreatePackagesInput input, IRippleStepRunner runner)
        {
            runner.CreateDirectory(input.DestinationFlag);

            var report = runner.Get <NuspecGenerationReport>();

            if (report == null)
            {
                throw new InvalidOperationException("Could not find generation report");
            }

            report.NuspecFiles.Each(file =>
            {
                var version = input.Version();
                RippleLog.Info("Building the nuget spec file at " + file + " as version " + version);

                Solution.Package(new PackageParams(NugetSpec.ReadFrom(file), version, input.DestinationFlag, input.CreateSymbolsFlag));
                RippleLog.Info(ConsoleWriter.HL);
            });
        }
Esempio n. 20
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 });
        }
Esempio n. 21
0
        public void get_nuget_directory()
        {
            var solution = new Solution
            {
                SourceFolder = "source",
                Directory    = ".".ToFullPath()
            };

            var storage = new StubNugetStorage();

            storage.Add("FubuCore", "0.9.1.37");
            solution.UseStorage(storage);

            var project    = new Project("something.csproj");
            var dependency = new Dependency("FubuCore", "0.9.1.37");

            project.AddDependency(dependency);
            solution.AddProject(project);

            var spec = new NugetSpec("FubuCore", "somefile.nuspec");

            solution.NugetFolderFor(spec)
            .ShouldEqual(".".ToFullPath().AppendPath(solution.PackagesDirectory(), "FubuCore"));
        }
Esempio n. 22
0
        private static int RunApp(string exeName, string[] args, IAnnotator annotator, NugetSpec nuspec)
        {
            try
            {
                var parsedArgs = ParseArgs(args);
                if (parsedArgs.ShowHelp)
                {
                    ShowHelp(exeName, parsedArgs);
                    return(parsedArgs.ParseError == null ? SuccessExitCode : InvalidArgumentsExitCode);
                }

                RunGeneration(annotator, nuspec, parsedArgs);
                return(SuccessExitCode);
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: " + e.Message);
                return(ExceptionExitCode);
            }
        }
Esempio n. 23
0
        public void publishes_the_specification()
        {
            var s1 = new NugetSpec("Test1", "Test1.nuspec");

            var solution = new Solution();

            var service = MockRepository.GenerateStub<IPublishingService>();
            service.Stub(x => x.SpecificationsFor(solution)).Return(new[] { s1 });

            solution.UsePublisher(service);

            var version = SemanticVersion.Parse("1.1.2.3");
            solution.Package(s1, version, "artifacts");

            service.AssertWasCalled(x => x.CreatePackage(s1, version, "artifacts"));
        }
Esempio n. 24
0
 public void AddDependency(NugetSpec spec)
 {
     _dependencies.Add(spec);
 }
Esempio n. 25
0
 public ProjectNuspec(Project project, NugetSpec publishes)
 {
     _project   = project;
     _publishes = publishes;
 }
Esempio n. 26
0
 private PackageBuilder symbolsPackageBuilderFor(NugetSpec spec, SemanticVersion version)
 {
     return(packageBuilderFor(spec, version));
 }
Esempio n. 27
0
 public string Package(NugetSpec spec, SemanticVersion version, string outputPath)
 {
     return(Publisher.CreatePackage(spec, version, outputPath));
 }
Esempio n. 28
0
        public void retrieve_the_nuget_specs()
        {
            var s1 = new NugetSpec("Test1", "Test1.nuspec");
            var s2 = new NugetSpec("Test2", "Test2.nuspec");

            var solution = new Solution();

            var service = MockRepository.GenerateStub<IPublishingService>();
            service.Stub(x => x.SpecificationsFor(solution)).Return(new[] {s1, s2});

            solution.UsePublisher(service);

            solution.Specifications.ShouldHaveTheSameElementsAs(s1, s2);
        }
Esempio n. 29
0
 public void AddNugetSpec(NugetSpec spec)
 {
     _specifications.Value.Add(spec);
 }
Esempio n. 30
0
 public string NugetFolderFor(NugetSpec spec)
 {
     return NugetFolderFor(spec.Name);
 }
Esempio n. 31
0
 public string NugetFolderFor(NugetSpec spec)
 {
     return(NugetFolderFor(spec.Name));
 }
 private void verifyVersion(NugetSpec spec, string name, string version)
 {
     spec.FindDependency(name).VersionSpec.ToString().ShouldEqual(version);
 }
Esempio n. 33
0
 public void AddNugetSpec(NugetSpec spec)
 {
     _specifications.Value.Add(spec);
 }
Esempio n. 34
0
        public void get_nuget_directory()
        {
            var solution = new Solution
            {
                SourceFolder = "source",
                Directory = ".".ToFullPath()
            };

            var storage = new StubNugetStorage();
            storage.Add("FubuCore", "0.9.1.37");
            solution.UseStorage(storage);

            var project = new Project("something.csproj");
            var dependency = new Dependency("FubuCore", "0.9.1.37");
            project.AddDependency(dependency);
            solution.AddProject(project);

            var spec = new NugetSpec("FubuCore", "somefile.nuspec");

            solution.NugetFolderFor(spec)
                .ShouldEqual(".".ToFullPath().AppendPath(solution.PackagesDirectory(), "FubuCore"));
        }
Esempio n. 35
0
 public string Package(NugetSpec spec, SemanticVersion version, string outputPath)
 {
     return Publisher.CreatePackage(spec, version, outputPath);
 }
        private static void RunGeneration(IAnnotator annotator, NugetSpec nuspec, Args parsedArgs)
        {
            var version = parsedArgs.Version ?? new Version("1.0.0.0");
            var dir = parsedArgs.Directory ?? new DirectoryInfo(Environment.CurrentDirectory);
            var fixedSpec = nuspec.WithVersion(version);
            annotator.CreateNugetPackage(fixedSpec, dir);

            Console.WriteLine($"Generated version {version}  in {dir.FullName}");
        }