feat(platform): add ScoopInstaller support

Resolves #207
This commit is contained in:
xixu-me committed 2026-03-08 13:05:15 +08:00
1 parent 1ed4de50e7
commit 6f0d7e15f8
6 files changed
+161 -1

No files matched your search

+33
View File
@@ -36,6 +36,7 @@
[![Apache](https://img.shields.io/badge/Apache-D22128?logo=apache&logoColor=white)](#apache-software-download-acceleration)
[![Gradle](https://img.shields.io/badge/Gradle-02303A?logo=gradle&logoColor=white)](#gradle-package-acceleration)
[![Homebrew](https://img.shields.io/badge/Homebrew-FBB040?logo=homebrew&logoColor=black)](#homebrew-package-acceleration)
[![Scoop](https://img.shields.io/badge/Scoop-D7D4DB)](#scoop-package-acceleration)
[![RubyGems](https://img.shields.io/badge/RubyGems-E9573F?logo=rubygems&logoColor=white)](#ruby-package-acceleration)
[![CRAN](https://img.shields.io/badge/CRAN-276DC3?logo=r&logoColor=white)](#r-package-acceleration)
[![CPAN](https://img.shields.io/badge/CPAN-0073A1?logo=perl&logoColor=white)](#perl-package-acceleration)
@@ -239,6 +240,7 @@ Using the pre-deployed instance **`xget.xi-xu.me`** or your own deployed instanc
| Apache | `apache` | `https://downloads.apache.org/...` | `https://xget.xi-xu.me/apache/...` |
| Gradle | `gradle` | `https://plugins.gradle.org/...` | `https://xget.xi-xu.me/gradle/...` |
| Homebrew | `homebrew` | `https://github.com/Homebrew/...` | `https://xget.xi-xu.me/homebrew/...` |
| Scoop | `scoop` | `https://github.com/ScoopInstaller/...` | `https://xget.xi-xu.me/scoop/...` |
| RubyGems | `rubygems` | `https://rubygems.org/...` | `https://xget.xi-xu.me/rubygems/...` |
| CRAN | `cran` | `https://cran.r-project.org/...` | `https://xget.xi-xu.me/cran/...` |
| CPAN | `cpan` | `https://www.cpan.org/...` | `https://xget.xi-xu.me/cpan/...` |
@@ -499,6 +501,22 @@ https://ghcr.io/v2/homebrew/core/git/manifests/2.39.0
https://xget.xi-xu.me/homebrew/bottles/v2/homebrew/core/git/manifests/2.39.0
```
#### Scoop
```url
# Scoop default bucket original URL
https://github.com/ScoopInstaller/Main
# Converted (add scoop prefix)
https://xget.xi-xu.me/scoop/Main
# Scoop core repository original URL
https://github.com/ScoopInstaller/Scoop.git
# Converted (add scoop prefix)
https://xget.xi-xu.me/scoop/Scoop.git
```
#### RubyGems
```url
@@ -1362,6 +1380,21 @@ echo $HOMEBREW_API_DOMAIN
echo $HOMEBREW_BOTTLE_DOMAIN
```
### Scoop Package Acceleration
#### Access Official Scoop Repositories Through Xget
```bash
# Clone the Scoop core repository through Xget
git clone https://xget.xi-xu.me/scoop/Scoop.git
# Add the default main bucket through Xget
scoop bucket add main https://xget.xi-xu.me/scoop/Main
# Add another official bucket through Xget
scoop bucket add extras https://xget.xi-xu.me/scoop/Extras
```
### Ruby Package Acceleration
#### Configure RubyGems to Use Xget Mirror
+33
View File
@@ -36,6 +36,7 @@
[![Apache](https://img.shields.io/badge/Apache-D22128?logo=apache&logoColor=white)](#apache-软件下载加速)
[![Gradle](https://img.shields.io/badge/Gradle-02303A?logo=gradle&logoColor=white)](#gradle-包管理加速)
[![Homebrew](https://img.shields.io/badge/Homebrew-FBB040?logo=homebrew&logoColor=black)](#homebrew-包管理加速)
[![Scoop](https://img.shields.io/badge/Scoop-D7D4DB)](#scoop-包管理加速)
[![RubyGems](https://img.shields.io/badge/RubyGems-E9573F?logo=rubygems&logoColor=white)](#ruby-包管理加速)
[![CRAN](https://img.shields.io/badge/CRAN-276DC3?logo=r&logoColor=white)](#r-包管理加速)
[![CPAN](https://img.shields.io/badge/CPAN-0073A1?logo=perl&logoColor=white)](#perl-包管理加速)
@@ -239,6 +240,7 @@ classDiagram
| Apache | `apache` | `https://downloads.apache.org/...` | `https://xget.xi-xu.me/apache/...` |
| Gradle | `gradle` | `https://plugins.gradle.org/...` | `https://xget.xi-xu.me/gradle/...` |
| Homebrew | `homebrew` | `https://github.com/Homebrew/...` | `https://xget.xi-xu.me/homebrew/...` |
| Scoop | `scoop` | `https://github.com/ScoopInstaller/...` | `https://xget.xi-xu.me/scoop/...` |
| RubyGems | `rubygems` | `https://rubygems.org/...` | `https://xget.xi-xu.me/rubygems/...` |
| CRAN | `cran` | `https://cran.r-project.org/...` | `https://xget.xi-xu.me/cran/...` |
| CPAN | `cpan` | `https://www.cpan.org/...` | `https://xget.xi-xu.me/cpan/...` |
@@ -499,6 +501,22 @@ https://ghcr.io/v2/homebrew/core/git/manifests/2.39.0
https://xget.xi-xu.me/homebrew/bottles/v2/homebrew/core/git/manifests/2.39.0
```
#### Scoop
```url
# Scoop 默认 bucket 原始 URL
https://github.com/ScoopInstaller/Main
# 转换后(添加 scoop 前缀)
https://xget.xi-xu.me/scoop/Main
# Scoop 核心仓库原始 URL
https://github.com/ScoopInstaller/Scoop.git
# 转换后(添加 scoop 前缀)
https://xget.xi-xu.me/scoop/Scoop.git
```
#### RubyGems
```url
@@ -1362,6 +1380,21 @@ echo $HOMEBREW_API_DOMAIN
echo $HOMEBREW_BOTTLE_DOMAIN
```
### Scoop 包管理加速
#### 通过 Xget 访问官方 Scoop 仓库
```bash
# 通过 Xget 克隆 Scoop 核心仓库
git clone https://xget.xi-xu.me/scoop/Scoop.git
# 通过 Xget 添加默认 main bucket
scoop bucket add main https://xget.xi-xu.me/scoop/Main
# 通过 Xget 添加其他官方 bucket
scoop bucket add extras https://xget.xi-xu.me/scoop/Extras
```
### Ruby 包管理加速
#### 配置 RubyGems 使用 Xget 镜像
+33
View File
@@ -36,6 +36,7 @@
[![Apache](https://img.shields.io/badge/Apache-D22128?logo=apache&logoColor=white)](#apache-軟體下載加速)
[![Gradle](https://img.shields.io/badge/Gradle-02303A?logo=gradle&logoColor=white)](#gradle-軟體包管理加速)
[![Homebrew](https://img.shields.io/badge/Homebrew-FBB040?logo=homebrew&logoColor=black)](#homebrew-軟體包管理加速)
[![Scoop](https://img.shields.io/badge/Scoop-D7D4DB)](#scoop-軟體包管理加速)
[![RubyGems](https://img.shields.io/badge/RubyGems-E9573F?logo=rubygems&logoColor=white)](#ruby-軟體包管理加速)
[![CRAN](https://img.shields.io/badge/CRAN-276DC3?logo=r&logoColor=white)](#r-軟體包管理加速)
[![CPAN](https://img.shields.io/badge/CPAN-0073A1?logo=perl&logoColor=white)](#perl-軟體包管理加速)
@@ -239,6 +240,7 @@ classDiagram
| Apache | `apache` | `https://downloads.apache.org/...` | `https://xget.xi-xu.me/apache/...` |
| Gradle | `gradle` | `https://plugins.gradle.org/...` | `https://xget.xi-xu.me/gradle/...` |
| Homebrew | `homebrew` | `https://github.com/Homebrew/...` | `https://xget.xi-xu.me/homebrew/...` |
| Scoop | `scoop` | `https://github.com/ScoopInstaller/...` | `https://xget.xi-xu.me/scoop/...` |
| RubyGems | `rubygems` | `https://rubygems.org/...` | `https://xget.xi-xu.me/rubygems/...` |
| CRAN | `cran` | `https://cran.r-project.org/...` | `https://xget.xi-xu.me/cran/...` |
| CPAN | `cpan` | `https://www.cpan.org/...` | `https://xget.xi-xu.me/cpan/...` |
@@ -499,6 +501,22 @@ https://ghcr.io/v2/homebrew/core/git/manifests/2.39.0
https://xget.xi-xu.me/homebrew/bottles/v2/homebrew/core/git/manifests/2.39.0
```
#### Scoop
```url
# Scoop 預設 bucket 原始 URL
https://github.com/ScoopInstaller/Main
# 轉換後(新增 scoop 前綴)
https://xget.xi-xu.me/scoop/Main
# Scoop 核心儲存庫原始 URL
https://github.com/ScoopInstaller/Scoop.git
# 轉換後(新增 scoop 前綴)
https://xget.xi-xu.me/scoop/Scoop.git
```
#### RubyGems
```url
@@ -1362,6 +1380,21 @@ echo $HOMEBREW_API_DOMAIN
echo $HOMEBREW_BOTTLE_DOMAIN
```
### Scoop 軟體包管理加速
#### 透過 Xget 存取官方 Scoop 儲存庫
```bash
# 透過 Xget 複製 Scoop 核心儲存庫
git clone https://xget.xi-xu.me/scoop/Scoop.git
# 透過 Xget 新增預設 main bucket
scoop bucket add main https://xget.xi-xu.me/scoop/Main
# 透過 Xget 新增其他官方 bucket
scoop bucket add extras https://xget.xi-xu.me/scoop/Extras
```
### Ruby 軟體包管理加速
#### 配置 RubyGems 使用 Xget 鏡像
+20
View File
@@ -44,6 +44,7 @@
* - `homebrew` - Homebrew repositories (github.com/Homebrew)
* - `homebrew-api` - Homebrew API (formulae.brew.sh/api)
* - `homebrew-bottles` - Homebrew bottles (ghcr.io)
* - `scoop` - Scoop repositories (github.com/ScoopInstaller)
* - `rubygems` - RubyGems (rubygems.org)
* - `cran` - R CRAN (cran.r-project.org)
* - `cpan` - Perl CPAN (cpan.org)
@@ -152,6 +153,7 @@ export const PLATFORMS = {
homebrew: 'https://github.com/Homebrew',
'homebrew-api': 'https://formulae.brew.sh/api',
'homebrew-bottles': 'https://ghcr.io',
scoop: 'https://github.com/ScoopInstaller',
rubygems: 'https://rubygems.org',
cran: 'https://cran.r-project.org',
cpan: 'https://www.cpan.org',
@@ -268,6 +270,10 @@ export const SORTED_PLATFORMS = Object.keys(PLATFORMS).sort((a, b) => {
* transformPath('/homebrew/api/formula/git.json', 'homebrew-api')
* // Returns: '/formula/git.json'
* @example
* // Scoop repository paths (pass-through)
* transformPath('/scoop/Main/blob/master/bucket/git.json', 'scoop')
* // Returns: '/Main/blob/master/bucket/git.json'
* @example
* // Unknown platform (no transformation)
* transformPath('/unknown/path', 'nonexistent')
* // Returns: '/unknown/path'
@@ -389,5 +395,19 @@ export function transformPath(path, platformKey) {
}
}
/**
* Special handling for Scoop repositories
*
* Scoop's official buckets and core repository are hosted under the
* ScoopInstaller organization on GitHub. Paths are passed through as-is.
*
* Example: `/Main`, `/Main.git/info/refs`, `/Extras/blob/master/bucket/7zip.json`
*/
if (platformKey === 'scoop') {
if (transformedPath.startsWith('/')) {
return transformedPath;
}
}
return transformedPath;
}
+28
View File
@@ -0,0 +1,28 @@
import { describe, expect, it } from 'vitest';
import { transformPath } from '../../src/config/platforms.js';
describe('Scoop path transformation', () => {
it('should handle default bucket repository paths correctly', () => {
const path = '/scoop/Main.git/info/refs?service=git-upload-pack';
const result = transformPath(path, 'scoop');
expect(result).toBe('/Main.git/info/refs?service=git-upload-pack');
});
it('should handle bucket manifest paths correctly', () => {
const path = '/scoop/Main/blob/master/bucket/git.json';
const result = transformPath(path, 'scoop');
expect(result).toBe('/Main/blob/master/bucket/git.json');
});
it('should handle additional official bucket paths correctly', () => {
const path = '/scoop/Extras/tree/master/bucket';
const result = transformPath(path, 'scoop');
expect(result).toBe('/Extras/tree/master/bucket');
});
it('should handle Scoop core repository paths correctly', () => {
const path = '/scoop/Scoop/archive/refs/heads/master.zip';
const result = transformPath(path, 'scoop');
expect(result).toBe('/Scoop/archive/refs/heads/master.zip');
});
});
+14 -1
View File
@@ -16,7 +16,8 @@ describe('Platform Configuration', () => {
'npm',
'pypi',
'conda',
'homebrew'
'homebrew',
'scoop'
];
requiredPlatforms.forEach(platform => {
@@ -143,6 +144,14 @@ describe('Platform Configuration', () => {
'/v2/distroless/base/manifests/latest'
);
});
it('should transform Scoop paths correctly', () => {
expect(transformPath('/scoop/Main.git/info/refs', 'scoop')).toBe('/Main.git/info/refs');
expect(transformPath('/scoop/Main/blob/master/bucket/git.json', 'scoop')).toBe(
'/Main/blob/master/bucket/git.json'
);
});
});
describe('Platform Base URLs', () => {
@@ -191,6 +200,10 @@ describe('Platform Configuration', () => {
expect(PLATFORMS['conda-community']).toBe('https://conda.anaconda.org');
});
it('should have correct Scoop base URL', () => {
expect(PLATFORMS.scoop).toBe('https://github.com/ScoopInstaller');
});
it('should have correct container registry base URLs', () => {
expect(PLATFORMS['cr-ghcr']).toBe('https://ghcr.io');
expect(PLATFORMS['cr-gcr']).toBe('https://gcr.io');