コード例 #1
0
        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);
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: FileSystemNugetFeed.cs プロジェクト: ventaur/ripple
        public void DumpLatest()
        {
            var latest = GetLatest();
            var topic  = new LatestFileNugets(latest, Directory);

            RippleLog.DebugMessage(topic);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        // 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);
            });
        }
コード例 #8
0
        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");
            }
        }
コード例 #9
0
ファイル: CsProjFile.cs プロジェクト: ventaur/ripple
        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);
        }
コード例 #10
0
        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);
            });
        }
コード例 #11
0
        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);
        }
コード例 #12
0
ファイル: NugetFeed.cs プロジェクト: coinmaketcap/ripple-2
        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));
        }
コード例 #13
0
ファイル: NugetOperation.cs プロジェクト: ventaur/ripple
        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);
        }
コード例 #14
0
ファイル: IPublishingService.cs プロジェクト: ventaur/ripple
        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);
        }
コード例 #16
0
        public override bool Execute(DescribeInput input)
        {
            RippleLog.Verbose(true);

            var solution = Solution.For(input);

            RippleLog.DebugMessage(solution);

            return(true);
        }
コード例 #17
0
        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));
        }
コード例 #18
0
        public void EachSolution(Action <Solution> configure)
        {
            var solutions = FindSolutions();

            solutions.Each(solution =>
            {
                RippleLog.Debug("Solution " + solution.Name);
                configure(solution);
            });
        }
コード例 #19
0
ファイル: RemoveCommand.cs プロジェクト: yvesgoeleven/ripple
        public override bool Execute(RemoveInput input)
        {
            RippleLog.Info("Trying to remove {0}".ToFormat(input.Nuget));

            return(RippleOperation
                   .For <RemoveInput>(input)
                   .Step <RemoveNuget>()
                   .ForceSave()
                   .Execute());
        }
コード例 #20
0
        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()));
            }));
        }
コード例 #21
0
        public void Apply(Solution solution)
        {
            RippleLog.Verbose(VerboseFlag);

            if (CacheFlag.IsNotEmpty())
            {
                solution.UseCache(new NugetFolderCache(solution, CacheFlag.ToFullPath()));
            }

            ApplyTo(solution);
        }
コード例 #22
0
ファイル: CleanCommand.cs プロジェクト: coinmaketcap/ripple-2
        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);
        }
コード例 #23
0
        public void AssertIsValid()
        {
            var result = Validate();

            if (result.IsValid())
            {
                return;
            }
            ;

            RippleLog.InfoMessage(result);
            RippleAssert.Fail("Validation failed");
        }
コード例 #24
0
ファイル: CreatePackages.cs プロジェクト: yvesgoeleven/ripple
        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();
            });
        }
コード例 #25
0
        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);
        }
コード例 #26
0
ファイル: FileSystemNugetFeed.cs プロジェクト: ventaur/ripple
        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));
        }
コード例 #27
0
ファイル: NugetPlanBuilder.cs プロジェクト: ventaur/ripple
        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);
        }
コード例 #28
0
        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));
        }
コード例 #29
0
        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());
        }
コード例 #30
0
        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);
            });
        }