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")) }); }
public PackageParams(NugetSpec spec, SemanticVersion version, string outputPath, bool createSymbols) { Spec = spec; Version = version; OutputPath = outputPath; CreateSymbols = createSymbols; }
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"); }
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" }; }
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; }
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); }
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); }
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); } }
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))); }
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")); }
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)); }
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); }
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); }); }
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 }); }
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")); }
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); } }
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")); }
public void AddDependency(NugetSpec spec) { _dependencies.Add(spec); }
public ProjectNuspec(Project project, NugetSpec publishes) { _project = project; _publishes = publishes; }
private PackageBuilder symbolsPackageBuilderFor(NugetSpec spec, SemanticVersion version) { return(packageBuilderFor(spec, version)); }
public string Package(NugetSpec spec, SemanticVersion version, string outputPath) { return(Publisher.CreatePackage(spec, version, outputPath)); }
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 AddNugetSpec(NugetSpec spec) { _specifications.Value.Add(spec); }
public string NugetFolderFor(NugetSpec spec) { return NugetFolderFor(spec.Name); }
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); }
public void AddNugetSpec(NugetSpec spec) { _specifications.Value.Add(spec); }
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")); }
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}"); }