protected override async Task ExecuteCore()
        {
            if (Directory.Exists(destination))
            {
                Log.Warning("{Url}{Folder} was already downloaded. Skipping download.", repositoryUrl, relativePath);
                return;
            }

            var branch = await gitHubClient.Repository.Branch.Get(repoInfo.Owner, repoInfo.Repository, branchName);

            var commit      = branch.Commit;
            var downloadUrl = GitHubMixin.GetCommitDownloadUrl(repositoryUrl, commit.Sha);

            var downloadeOn = DateTimeOffset.Now;

            using (var stream = await downloader.GetStream(downloadUrl, progressObserver))
            {
                var relative = repoInfo.Repository + "-" + commit.Sha + "/" + relativePath;
                await zipExtractor.ExtractRelativeFolder(stream, relative, destination);
            }

            SaveMetadata(new
            {
                Repository   = repoInfo,
                Commit       = commit.Sha,
                Branch       = branch.Name,
                DownloadedOn = downloadeOn,
            });
        }
        protected override async Task ExecuteCore()
        {
            if (Directory.Exists(ArtifactPath))
            {
                Log.Warning("{Pack} was already downloaded. Skipping download.", repository);
                return;
            }

            var branch = await gitHubClient.Repository.Branch.Get(repoInfo.Owner, repoInfo.Repository, branchName);

            var commit      = branch.Commit;
            var downloadUrl = GitHubMixin.GetCommitDownloadUrl(repositoryUrl, commit.Sha);

            var downloadeOn = DateTimeOffset.Now;

            using (var stream = await downloader.GetStream(downloadUrl, progressObserver))
            {
                await zipExtractor.ExtractFirstChildToFolder(stream, ArtifactPath, progressObserver);
            }

            SaveMetadata(new
            {
                Repository   = repoInfo,
                Commit       = commit.Sha,
                Branch       = branch.Name,
                DownloadedOn = downloadeOn,
            });
        }
        protected override async Task ExecuteCore()
        {
            if (Directory.Exists(ArtifactPath))
            {
                Log.Warning("{Pack} was already downloaded. Skipping download.", ArtifactPath);
                return;
            }

            var repoInf  = GitHubMixin.GetRepoInfo(repoUrl);
            var releases = await gitHubClient.Repository.Release.GetAll(repoInf.Owner, repoInf.Repository);

            var latestRelease = releases.OrderByDescending(x => x.CreatedAt).First();
            var asset         = latestRelease.Assets.First(x => string.Equals(x.Name, assetName, StringComparison.OrdinalIgnoreCase));

            await downloader.Download(asset.BrowserDownloadUrl, ArtifactPath, progressObserver);

            SaveMetadata(new
            {
                asset.Name,
                asset.Id,
                asset.Size,
                asset.UpdatedAt,
                asset.Label,
                asset.Url,
            });
        }
示例#4
0
        public async Task Execute()
        {
            if (fileSystemOperations.DirectoryExists(destination))
            {
                Log.Warning("UEFI was already downloaded. Skipping download.");
                return;
            }

            using (var stream = await GitHubMixin.GetBranchZippedStream("https://github.com/andreiw/RaspberryPiPkg", progressObserver: progressObserver))
            {
                await extractor.ExtractRelativeFolder(stream, GetMostRecentDirEntry, destination, progressObserver);
            }
        }
示例#5
0
        public async Task Execute()
        {
            if (fileSystemOperations.DirectoryExists(destination))
            {
                Log.Warning("{Url}{Folder} was already downloaded. Skipping download.", url, relativePath);
                return;
            }

            using (var stream = await GitHubMixin.GetBranchZippedStream(downloader, url, progressObserver: progressObserver))
            {
                await zipExtractor.ExtractRelativeFolder(stream, relativePath, destination);
            }
        }
 protected FetchGitHubBase(string repositoryUrl, string branchName, IZipExtractor zipExtractor,
                           IDownloader downloader,
                           IGitHubClient gitHubClient, IOperationProgress progressObserver, IDeploymentContext deploymentContext,
                           IFileSystemOperations fileSystemOperations, IOperationContext operationContext) : base(deploymentContext, fileSystemOperations, operationContext)
 {
     this.repositoryUrl    = repositoryUrl;
     this.branchName       = branchName;
     this.zipExtractor     = zipExtractor;
     this.downloader       = downloader;
     this.progressObserver = progressObserver;
     this.gitHubClient     = gitHubClient;
     repoInfo   = GitHubMixin.GetRepoInfo(repositoryUrl);
     repository = repoInfo.Repository;
 }
        public async Task RelativeExtract()
        {
            var extractor = new ZipExtractor(new FileSystemOperations());

            using (var httpClient = new HttpClient())
            {
                var downloader = new Downloader(httpClient);
                using (var stream = await downloader.GetStream(GitHubMixin.GetCommitDownloadUrl("https://github.com/driver1998/bsp", "56f3b82d97ab9629689bfe8dad9fbf09fdbd0499")))
                {
                    var relPath = "bsp-56f3b82d97ab9629689bfe8dad9fbf09fdbd0499/prebuilt";
                    await extractor.ExtractRelativeFolder(stream, relPath, "Downloaded\\BSP");
                }
            }
        }
示例#8
0
        public async Task RelativeExtract()
        {
            var extractor = new ZipExtractor(new FileSystemOperations());

            using (var httpClient = new HttpClient())
            {
                var downloader = new Downloader(httpClient);
                var stream     = await GitHubMixin.GetBranchZippedStream(downloader, "https://github.com/gus33000/MSM8994-8992-NT-ARM64-Drivers.git");

                using (stream)
                {
                    await extractor.ExtractRelativeFolder(stream, "bsp-master/prebuilt", @"Downloaded\Drivers");
                }
            }
        }
        public async Task Execute()
        {
            if (Directory.Exists(folderPath))
            {
                Log.Warning("{Pack} was already downloaded. Skipping download.", repository);
                return;
            }

            var openZipStream = await GitHubMixin.GetBranchZippedStream(downloader, repoBaseUrl, branch, progressObserver);

            using (var stream = openZipStream)
            {
                await extractor.ExtractFirstChildToFolder(stream, folderPath, progressObserver);
            }
        }
        public FetchGitHubBase(string repoBaseUrl, string branch, IZipExtractor extractor, IDownloader downloader,
                               IDownloadProgress progressObserver)
        {
            this.repoBaseUrl      = repoBaseUrl;
            this.branch           = branch;
            this.extractor        = extractor;
            this.downloader       = downloader;
            this.progressObserver = progressObserver;
            var repoInfo = GitHubMixin.GetRepoInfo(repoBaseUrl);

            repository = repoInfo.Repository;
            var folderName = repository;

            folderPath = Path.Combine(SubFolder, folderName);
        }
 public FetchGitHubFolder(string repositoryUrl, string branchName, string relativePath, string destination,
                          IZipExtractor zipExtractor, IDownloader downloader, IGitHubClient gitHubClient,
                          IOperationProgress progressObserver, IDeploymentContext deploymentContext,
                          IFileSystemOperations fileSystemOperations, IOperationContext operationContext) : base(deploymentContext, fileSystemOperations, operationContext)
 {
     this.repositoryUrl    = repositoryUrl;
     this.branchName       = branchName;
     this.relativePath     = relativePath;
     this.destination      = destination;
     this.zipExtractor     = zipExtractor;
     this.downloader       = downloader;
     this.gitHubClient     = gitHubClient;
     this.progressObserver = progressObserver;
     repoInfo     = GitHubMixin.GetRepoInfo(repositoryUrl);
     ArtifactName = $"{repoInfo.Owner}-{repoInfo.Repository}";
 }
示例#12
0
        public async Task Execute()
        {
            if (Directory.Exists(folderPath))
            {
                Log.Warning("{Pack} was already downloaded. Skipping download.", folderPath);
                return;
            }

            var repoInf = GitHubMixin.GetRepoInfo(repoUrl);
            var latest  = await gitHubClient.Repository.Release.GetLatest(repoInf.Owner, repoInf.Repository);

            var asset = latest.Assets.First(x => string.Equals(x.Name, assetName, StringComparison.OrdinalIgnoreCase));

            using (var stream = await downloader.GetStream(asset.BrowserDownloadUrl, progressObserver))
            {
                await extractor.ExtractFirstChildToFolder(stream, folderPath, progressObserver);
            }
        }