public override bool Execute(BatchPublishInput input) { RippleLog.Info("Looking for *.nupkg files in " + input.Directory); var files = new FileSystem() .FindFiles(input.Directory, new FileSet { Include = "*.nupkg" }) .ToArray(); _index = 0; _count = files.Count(); var publisher = PublishingService.Basic(); var report = new PublishReport(); files.Each(file => { _index++; RippleLog.Info("Trying to publish {0}, {1} or {2}".ToFormat(file, _index, _count)); var detail = publisher.PublishPackage(input.ServerFlag, file, input.ApiKeyFlag); report.Add(detail); }); RippleLog.InfoMessage(report); if (!report.IsSuccessful()) { RippleAssert.Fail("Failure publishing packages"); } return(true); }
public IPackage ExplodeTo(string directory) { var explodedDirectory = ExplodedDirectory(directory); RippleLog.Info("Exploding to " + explodedDirectory); var fileSystem = new FileSystem(); fileSystem.CreateDirectory(explodedDirectory); fileSystem.ForceClean(explodedDirectory); var package = new ZipPackage(_path); package.GetFiles().Each(file => { var target = explodedDirectory.AppendPath(file.Path); fileSystem.CreateDirectory(target.ParentDirectory()); using (var stream = new FileStream(target, FileMode.Create, FileAccess.Write)) { file.GetStream().CopyTo(stream); } }); fileSystem.CopyToDirectory(_path, explodedDirectory); fileSystem.DeleteFile(_path); var newFile = Path.Combine(explodedDirectory, Path.GetFileName(_path)); return(new ZipPackage(newFile)); }
public ReferenceStatus AddReference(string name, string hintPath) { if (hintPath.IsNotEmpty()) { hintPath = hintPath.Trim(); } var reference = FindReference(name); if (reference == null) { reference = new AssemblyReference(name, hintPath); _project.Add(reference); } var original = reference.HintPath; reference.HintPath = hintPath; if (original.IsNotEmpty()) { original = original.Trim(); } var status = string.Equals(original, hintPath, StringComparison.OrdinalIgnoreCase) ? ReferenceStatus.Unchanged : ReferenceStatus.Changed; if (status == ReferenceStatus.Changed) { RippleLog.Debug("HintPath changed: " + original + " to " + hintPath); _project.Remove(reference); _project.Add(reference); } return(status); }
public void DumpLatest() { var latest = GetLatest(); var topic = new LatestFileNugets(latest, Directory); RippleLog.DebugMessage(topic); }
public override bool Execute(PublishInput input) { var report = new PublishReport(); input.EachSolution(solution => { RippleLog.Info("Building nuget files for " + solution.Name); var artifactDirectory = solution.Directory.AppendPath(input.ArtifactsFlag); RippleLog.Info("Cleaning out any existing nuget files before continuing"); new FileSystem().CleanDirectory(artifactDirectory); solution.Specifications.Each(nuget => { RippleLog.Info("Creating and publishing Nuget for " + nuget.Name); var packageFile = solution.Package(new PackageParams(nuget, SemanticVersion.Parse(input.Version), artifactDirectory, input.CreateSymbolsFlag)); var detail = solution.Publisher.PublishPackage(input.ServerFlag, packageFile, input.ApiKey); report.Add(detail); }); }); RippleLog.InfoMessage(report); if (!report.IsSuccessful()) { RippleAssert.Fail("Failure publishing packages"); } return(true); }
public override bool Execute(FindNugetsInput input) { var solution = Solution.For(input); var feeds = FeedRegistry.FeedsFor(solution); var results = feeds.SelectMany(feed => { return(feed .FindAllLatestByName(input.Nuget) .Select(nuget => new SearchResult { Nuget = nuget, Provenance = feed.Repository })); }); results .OrderBy(x => x.Nuget.Name) .ThenBy(x => x.Nuget.Version) .Each(result => { RippleLog.Info("{0}, {1} ({2})".ToFormat(result.Nuget.Name, result.Nuget.Version, result.Provenance.Source)); }); return(true); }
// Tested manually. public void Execute(IRippleStepRunner runner) { string packageFolder; try { packageFolder = _destination.NugetFolderFor(_nuget); } catch (ArgumentOutOfRangeException exc) { RippleLog.Error(ToString(), exc); throw; } runner.CleanDirectory(packageFolder); _nuget.PublishedAssemblies.Each(x => { var request = new FileCopyRequest { From = x.Directory, Matching = new FileSet { Include = x.Pattern }, To = packageFolder.AppendPath(x.SubFolder.Replace('/', Path.DirectorySeparatorChar)) }; runner.CopyFiles(request); }); }
public void CreateSymbolsPackage(PackageParams ctx) { var symbolsBuilder = symbolsPackageBuilderFor(ctx.Spec, ctx.Version); // remove unnecessary files when building the symbols package ExcludeFilesForSymbolPackage(symbolsBuilder.Files); if (!symbolsBuilder.Files.Any()) { RippleLog.Info("No symbols could be generated for {0} since no symbol files could be found. This is expected if this is a code only package".ToFormat(ctx.Spec.Name)); return; } var nupkgSymbolsFileName = Path.Combine(ctx.OutputPath, "{0}.{1}.symbols.nupkg".ToFormat(ctx.Spec.Name, ctx.Version)); var package = createPackage(symbolsBuilder, nupkgSymbolsFileName); 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("Symbols package failed validation"); } }
public ReferenceStatus AddReference(string name, string hintPath) { if (hintPath.IsNotEmpty()) { hintPath = hintPath.Trim(); } Reference reference = FindReference(name); if (reference == null) { reference = new Reference { Name = name }; _references.Value.Add(reference); } string original = reference.HintPath; reference.HintPath = hintPath; if (original.IsNotEmpty()) { original = original.Trim(); } var status = string.Equals(original, hintPath, StringComparison.OrdinalIgnoreCase) ? ReferenceStatus.Unchanged : ReferenceStatus.Changed; if (status == ReferenceStatus.Changed) { RippleLog.Info("HintPath changed: " + original + " to " + hintPath); } return(status); }
private void fixProject(Project project) { project.Dependencies.Each(dep => { var package = _packages[dep.Name]; if (package == null) { RippleLog.Debug("Could not find the IPackage for " + dep.Name); return; } var assemblies = package.AssemblyReferences; if (assemblies == null) { return; } var explicitRefs = package.PackageAssemblyReferences; if (explicitRefs.Any()) { project.Proj.AddAssemblies(dep, explicitRefs, assemblies); return; } project.Proj.AddAssemblies(dep, assemblies); }); }
public void DownloadTo(string directory) { var file = directory.AppendPath(getFileName()); var client = new WebClient(); RippleLog.Info("Downloading {0} to {1}".ToFormat(Url, file)); client.DownloadFile(Url, file); }
protected override IRemoteNuget findLatest(Dependency query) { RippleLog.Debug("Searching for {0} from {1}".ToFormat(query, _url)); var candidates = repository.Search(query.Name, query.DetermineStability(Stability) == NugetStability.Anything) .Where(x => query.Name == x.Id).OrderBy(x => x.Id).ToList(); return(candidates.LatestNuget(query.VersionSpec)); }
public void Execute(SolutionInput input, IRippleStepRunner runner) { var nugetRunner = new NugetStepRunner(Solution); var aggregatePlan = PlanFor(input.As <INugetOperationContext>(), Solution); RippleLog.InfoMessage(aggregatePlan); aggregatePlan.Execute(nugetRunner); }
public void PublishPackage(string file, string apiKey) { var packageServer = new PackageServer("https://nuget.org/", "ripple"); var package = new OptimizedZipPackage(file); RippleLog.Info("Publishing " + file + " with " + apiKey); packageServer.PushPackage(apiKey, package, (int)60.Minutes().TotalMilliseconds); }
public void updates_dependency() { RippleLog.Verbose(true); theSolution .FeedService .DependenciesFor(new Dependency("FubuTransportation", "0.9.0.1"), UpdateMode.Float) .ShouldHaveCount(1); }
public override bool Execute(DescribeInput input) { RippleLog.Verbose(true); var solution = Solution.For(input); RippleLog.DebugMessage(solution); return(true); }
public SolutionGraph ReadFrom(string folder) { folder = findCorrectFolder(folder); RippleLog.Info("Trying to read a Ripple SolutionGraph from " + folder); var solutions = readSolutions(folder); return(new SolutionGraph(solutions)); }
public void EachSolution(Action <Solution> configure) { var solutions = FindSolutions(); solutions.Each(solution => { RippleLog.Debug("Solution " + solution.Name); configure(solution); }); }
public override bool Execute(RemoveInput input) { RippleLog.Info("Trying to remove {0}".ToFormat(input.Nuget)); return(RippleOperation .For <RemoveInput>(input) .Step <RemoveNuget>() .ForceSave() .Execute()); }
private static Task restore(Dependency query, Solution solution, List <INugetFile> nugets) { return(Task.Factory.StartNew(() => { var nuget = solution.Restore(query); RippleLog.Debug("Downloading " + nuget); nugets.Add(nuget.DownloadTo(solution, solution.PackagesDirectory())); })); }
public void Apply(Solution solution) { RippleLog.Verbose(VerboseFlag); if (CacheFlag.IsNotEmpty()) { solution.UseCache(new NugetFolderCache(solution, CacheFlag.ToFullPath())); } ApplyTo(solution); }
public override bool Execute(CleanInput input) { input.EachSolution(solution => { RippleLog.Info("Cleaning Solution {0} at {1}".ToFormat(solution.Name, solution.Directory)); solution.Clean(input.ModeFlag); }); return(true); }
public void AssertIsValid() { var result = Validate(); if (result.IsValid()) { return; } ; RippleLog.InfoMessage(result); RippleAssert.Fail("Validation failed"); }
protected override void execute(CreatePackagesInput input, IRippleStepRunner runner) { new FileSystem().CreateDirectory(input.DestinationFlag); Solution.Specifications.Each(spec => { var version = input.VersionFlag; RippleLog.Info("Building the nuget spec file at " + spec.Filename + " as version " + version); Solution.Package(new PackageParams(spec, SemanticVersion.Parse(version), input.DestinationFlag, input.CreateSymbolsFlag)); ConsoleWriter.PrintHorizontalLine(); }); }
public static string BranchUrl(Feed feed) { var branchUrl = feed.Url; if (branchUrl.Contains(BranchPlaceholder)) { var branchName = BranchDetector.Current(); branchUrl = branchUrl.Replace(BranchPlaceholder, branchName); RippleLog.Debug("Detected branch feed: {0}. Current branch is {1}. Setting url to {2}".ToFormat(feed, branchName, branchUrl), false); } return(branchUrl); }
protected override IRemoteNuget find(Dependency query) { RippleLog.Debug("Searching for {0} in {1}".ToFormat(query, _directory)); SemanticVersion version; if (!SemanticVersion.TryParse(query.Version, out version)) { RippleLog.Debug("Could not find exact for " + query); return(null); } return(findMatching(nuget => query.MatchesName(nuget.Name) && nuget.Version == version)); }
private NugetPlan buildPlan(NugetPlanRequest request, Dependency parent = null) { var plan = new NugetPlan(); var target = request.Dependency; var solution = request.Solution; var key = target.Copy(); if (key.IsFloat()) { key = target.AsFloat(); } if (_planCache.Has(key)) { return(_planCache[key]); } _planCache.Fill(key, plan); RippleLog.Info("* Analyzing " + target); if (target.Version.IsEmpty()) { var remote = solution.FeedService.NugetFor(target); target.Version = remote.Version.ToString(); } if (request.UpdatesCurrentDependency()) { updateDependency(plan, request); } else if (!solution.Dependencies.Has(target.Name)) { plan.AddStep(new InstallSolutionDependency(target)); } projectInstallations(plan, parent, request); var nugetDependencies = solution.FeedService.DependenciesFor(target, target.Mode); nugetDependencies.Each(x => { var childPlan = buildPlan(request.CopyFor(x), target); plan.Import(childPlan); }); return(plan); }
private void updateDependency(NugetPlan plan, NugetPlanRequest request) { var target = request.Dependency; var solution = request.Solution; var configured = solution.Dependencies.Find(target.Name); if (!request.ShouldUpdate(configured)) { RippleLog.Info("Warning: This operation requires {0} to be updated to {1} but it is marked as fixed. Use the force option to correct this.".ToFormat(target.Name, target.Version)); return; } plan.AddStep(new UpdateDependency(target)); }
private IEnumerable <IRemoteNuget> loadLatestFeed(int page) { var toSkip = (page - 1) * 100; var url = Url + FindAllLatestCommand.ToFormat(toSkip); RippleLog.Debug("Retrieving latest from " + url); var client = new WebClient(); var text = client.DownloadString(url); var document = new XmlDocument(); document.LoadXml(text); return(new NugetXmlFeed(document).ReadAll(this).ToArray()); }
public void Execute(RippleInput input, IRippleStepRunner runner) { var missing = runner.Get <DownloadedNugets>(); if (missing.Any()) { Solution.AssertNoLockedFiles(); } missing.Each(nuget => { var dir = Solution.PackagesDirectory(); RippleLog.Debug("Exploding " + nuget.ToString()); nuget.ExplodeTo(dir); }); }