-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
273 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,50 @@ GET /repositores | |
} | ||
``` | ||
|
||
### 搜索镜像仓库 | ||
|
||
根据关键词搜索镜像仓库,只要关键词匹配到任意镜像仓库名的字符串均会命中。 | ||
|
||
``` | ||
GET /repositores/search/?q=[query] | ||
``` | ||
|
||
#### 参数 | ||
|
||
| 名称 | 类型 | 是否必须 | 描述 | | ||
|---|---|---|---| | ||
| q | String | true | 搜索关键词 | | ||
|
||
#### 返回样例 | ||
|
||
```json | ||
{ | ||
"total": 2, | ||
"data": [ | ||
{ | ||
"name": "coding-coding-docs", | ||
"url": "https://git.coding.net/coding/coding-docs.git", | ||
"mirror_url": "[email protected]:hpr-mirrors/coding-coding-docs.git", | ||
"latest_version": "", | ||
"status": "idle", | ||
"created_at": "2018-03-23 16:27:59 +0800", | ||
"updated_at": "2018-03-23 16:27:59 +0800", | ||
"scheduled_at": "2018-03-23 17:28:02 +0800" | ||
}, | ||
{ | ||
"name": "spf13-viper", | ||
"url": "https://github.com/spf13/viper.git", | ||
"mirror_url": "[email protected]:hpr-mirrors/spf13-viper.git", | ||
"latest_version": "v1.0.2", | ||
"status": "idle", | ||
"created_at": "2018-03-23 16:36:00 +0800", | ||
"updated_at": "2018-03-23 16:36:00 +0800", | ||
"scheduled_at": "2018-03-23 17:36:02 +0800" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### 单个镜像仓库信息 | ||
|
||
``` | ||
|
@@ -180,7 +224,7 @@ GET /info | |
```json | ||
{ | ||
"hpr": { | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"repositroies": { | ||
"total": 2, | ||
"entry": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ hpr 本身是一个命令行工具,因此也提供了一个临时可用的辅 | |
## 运行 Web API 服务器 | ||
|
||
```bash | ||
$ hpr -s | ||
$ hpr -s | ||
# 或者更改端口号 | ||
$ hpr -s --port 8848 | ||
_ | ||
|
@@ -23,17 +23,62 @@ $ hpr -s --port 8848 | |
$ hpr -l | ||
# or | ||
$ hpr --list | ||
2018-04-26 17:05:44 +08:00 INFO listing repositories (2): | ||
* icyleaf-halite | ||
* icyleaf-gitlab.cr | ||
2018-04-28 18:01:32 +08:00 INFO listing repositories (2): | ||
=> Name: icyleaf-gitlab.cr | ||
Path: /Users/icyleaf/data/repositories/icyleaf-gitlab.cr | ||
OriginalUrl: https://github.com/icyleaf/gitlab.cr | ||
MirrorUrl: [email protected]:hpr-mirrors/icyleaf-gitlab.cr.git | ||
Status: idle | ||
CreatedAt: 2018-04-26 17:05:44 +0800 | ||
UpdatedAt: 2018-04-26 17:05:46 +0800 | ||
ScheduledAt: 2018-04-29 05:05:46 +0800 | ||
=> Name: icyleaf-salt | ||
Path: /Users/icyleaf/data/repositories/icyleaf-salt | ||
OriginalUrl: https://github.com/icyleaf/salt.git | ||
MirrorUrl: [email protected]:hpr-mirrors/icyleaf-salt.git | ||
Status: idle | ||
CreatedAt: 2018-04-28 18:00:56 +0800 | ||
UpdatedAt: 2018-04-28 18:00:58 +0800 | ||
ScheduledAt: 2018-05-01 06:00:58 +0800 | ||
``` | ||
## 搜索镜像仓库 | ||
```bash | ||
$ hpr -S icyleaf | ||
# or | ||
$ hpr --search icyleaf | ||
2018-04-28 18:07:34 +08:00 INFO searching repositories ... icyleaf | ||
2018-04-28 18:07:34 +08:00 INFO found repositories (2): | ||
=> Name: icyleaf-gitlab.cr | ||
Path: /Users/icyleaf/data/repositories/icyleaf-gitlab.cr | ||
OriginalUrl: https://github.com/icyleaf/gitlab.cr | ||
MirrorUrl: [email protected]:hpr-mirrors/icyleaf-gitlab.cr.git | ||
Status: idle | ||
CreatedAt: 2018-04-26 17:05:44 +0800 | ||
UpdatedAt: 2018-04-26 17:05:46 +0800 | ||
ScheduledAt: 2018-04-29 05:05:46 +0800 | ||
=> Name: icyleaf-salt | ||
Path: /Users/icyleaf/data/repositories/icyleaf-salt | ||
OriginalUrl: https://github.com/icyleaf/salt.git | ||
MirrorUrl: [email protected]:hpr-mirrors/icyleaf-salt.git | ||
Status: idle | ||
CreatedAt: 2018-04-28 18:00:56 +0800 | ||
UpdatedAt: 2018-04-28 18:00:58 +0800 | ||
ScheduledAt: 2018-05-01 06:00:58 +0800 | ||
``` | ||
## 创建镜像仓库 | ||
```bash | ||
$ hpr --create --url https://github.com/icyleaf/salt.git icyleaf-salt | ||
$ hpr -c -U https://github.com/icyleaf/salt.git icyleaf-salt | ||
# or | ||
$ hpr -c -U https://github.com/icyleaf/salt.git | ||
$ hpr --create --url https://github.com/icyleaf/salt.git | ||
2018-04-26 17:04:39 +08:00 INFO creating repository ... ews-team/icyleaf-salt | ||
2018-04-26 17:04:41 +08:00 INFO cloning https://github.com/icyleaf/salt.cr ... icyleaf-salt | ||
2018-04-26 17:05:44 +08:00 INFO pushing to mirror ... icyleaf-salt | ||
|
@@ -44,6 +89,8 @@ $ hpr -c -U https://github.com/icyleaf/salt.git | |
```bash | ||
$ hpr -u icyleaf-salt | ||
# or | ||
$ hpr --update icyleaf-salt | ||
2018-04-26 17:04:01 +08:00 INFO updating from origin ... icyleaf-salt | ||
2018-04-26 17:04:06 +08:00 INFO pushing to mirror ... icyleaf-salt | ||
2018-04-26 17:04:07 +08:00 INFO update repository ... done | ||
|
@@ -53,6 +100,8 @@ $ hpr -u icyleaf-salt | |
```bash | ||
$ hpr -d icyleaf-salt | ||
# or | ||
$ hpr --delete icyleaf-salt | ||
2018-04-26 17:04:25 +08:00 INFO destroying project ... ews-team/icyleaf-salt | ||
2018-04-26 17:04:25 +08:00 INFO deleting directory ... icyleaf-salt | ||
2018-04-26 17:04:26 +08:00 INFO delete repository ... done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,49 @@ GET /repositores | |
} | ||
``` | ||
|
||
### Search repositories | ||
|
||
Search repositories by given query keywords, returns all include keyword matchs the name of mirrored reposotories. | ||
|
||
``` | ||
GET /repositores/search/?q=[query] | ||
``` | ||
|
||
#### Parameters | ||
|
||
| Name | Type | Required | Description | | ||
|---|---|---|---| | ||
| q | String | true | keyworkd | | ||
|
||
#### Example Response | ||
|
||
```json | ||
{ | ||
"total": 2, | ||
"data": [ | ||
{ | ||
"name": "coding-coding-docs", | ||
"url": "https://git.coding.net/coding/coding-docs.git", | ||
"mirror_url": "[email protected]:hpr-mirrors/coding-coding-docs.git", | ||
"latest_version": "", | ||
"status": "idle", | ||
"created_at": "2018-03-23 16:27:59 +0800", | ||
"updated_at": "2018-03-23 16:27:59 +0800", | ||
"scheduled_at": "2018-03-23 17:28:02 +0800" | ||
}, | ||
{ | ||
"name": "spf13-viper", | ||
"url": "https://github.com/spf13/viper.git", | ||
"mirror_url": "[email protected]:hpr-mirrors/spf13-viper.git", | ||
"latest_version": "v1.0.2", | ||
"status": "idle", | ||
"created_at": "2018-03-23 16:36:00 +0800", | ||
"updated_at": "2018-03-23 16:36:00 +0800", | ||
"scheduled_at": "2018-03-23 17:36:02 +0800" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
### Get a repository info | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ hpr is a command line tool, it also support some commands to manage mirror repos | |
## Run Web API server | ||
|
||
```bash | ||
$ hpr -s | ||
$ hpr -s | ||
# Or customize server port | ||
$ hpr -s --port 8848 | ||
_ | ||
|
@@ -23,17 +23,62 @@ $ hpr -s --port 8848 | |
$ hpr -l | ||
# or | ||
$ hpr --list | ||
2018-04-26 17:05:44 +08:00 INFO listing repositories (2): | ||
* icyleaf-halite | ||
* icyleaf-gitlab.cr | ||
2018-04-28 18:01:32 +08:00 INFO listing repositories (2): | ||
=> Name: icyleaf-gitlab.cr | ||
Path: /Users/icyleaf/data/repositories/icyleaf-gitlab.cr | ||
OriginalUrl: https://github.com/icyleaf/gitlab.cr | ||
MirrorUrl: [email protected]:hpr-mirrors/icyleaf-gitlab.cr.git | ||
Status: idle | ||
CreatedAt: 2018-04-26 17:05:44 +0800 | ||
UpdatedAt: 2018-04-26 17:05:46 +0800 | ||
ScheduledAt: 2018-04-29 05:05:46 +0800 | ||
=> Name: icyleaf-salt | ||
Path: /Users/icyleaf/data/repositories/icyleaf-salt | ||
OriginalUrl: https://github.com/icyleaf/salt.git | ||
MirrorUrl: [email protected]:hpr-mirrors/icyleaf-salt.git | ||
Status: idle | ||
CreatedAt: 2018-04-28 18:00:56 +0800 | ||
UpdatedAt: 2018-04-28 18:00:58 +0800 | ||
ScheduledAt: 2018-05-01 06:00:58 +0800 | ||
``` | ||
## Search repositories | ||
```bash | ||
$ hpr -S icyleaf | ||
# or | ||
$ hpr --search icyleaf | ||
2018-04-28 18:07:34 +08:00 INFO searching repositories ... icyleaf | ||
2018-04-28 18:07:34 +08:00 INFO found repositories (2): | ||
=> Name: icyleaf-gitlab.cr | ||
Path: /Users/icyleaf/data/repositories/icyleaf-gitlab.cr | ||
OriginalUrl: https://github.com/icyleaf/gitlab.cr | ||
MirrorUrl: [email protected]:hpr-mirrors/icyleaf-gitlab.cr.git | ||
Status: idle | ||
CreatedAt: 2018-04-26 17:05:44 +0800 | ||
UpdatedAt: 2018-04-26 17:05:46 +0800 | ||
ScheduledAt: 2018-04-29 05:05:46 +0800 | ||
=> Name: icyleaf-salt | ||
Path: /Users/icyleaf/data/repositories/icyleaf-salt | ||
OriginalUrl: https://github.com/icyleaf/salt.git | ||
MirrorUrl: [email protected]:hpr-mirrors/icyleaf-salt.git | ||
Status: idle | ||
CreatedAt: 2018-04-28 18:00:56 +0800 | ||
UpdatedAt: 2018-04-28 18:00:58 +0800 | ||
ScheduledAt: 2018-05-01 06:00:58 +0800 | ||
``` | ||
## Create a new repository | ||
```bash | ||
$ hpr --create --url https://github.com/icyleaf/salt.git icyleaf-salt | ||
$ hpr -c -U https://github.com/icyleaf/salt.git icyleaf-salt | ||
# or | ||
$ hpr -c -U https://github.com/icyleaf/salt.git | ||
$ hpr --create --url https://github.com/icyleaf/salt.git | ||
2018-04-26 17:04:39 +08:00 INFO creating repository ... ews-team/icyleaf-salt | ||
2018-04-26 17:04:41 +08:00 INFO cloning https://github.com/icyleaf/salt.cr ... icyleaf-salt | ||
2018-04-26 17:05:44 +08:00 INFO pushing to mirror ... icyleaf-salt | ||
|
@@ -44,6 +89,8 @@ $ hpr -c -U https://github.com/icyleaf/salt.git | |
```bash | ||
$ hpr -u icyleaf-salt | ||
# or | ||
$ hpr --update icyleaf-salt | ||
2018-04-26 17:04:01 +08:00 INFO updating from origin ... icyleaf-salt | ||
2018-04-26 17:04:06 +08:00 INFO pushing to mirror ... icyleaf-salt | ||
2018-04-26 17:04:07 +08:00 INFO update repository ... done | ||
|
@@ -53,6 +100,8 @@ $ hpr -u icyleaf-salt | |
```bash | ||
$ hpr -d icyleaf-salt | ||
# or | ||
$ hpr --delete icyleaf-salt | ||
2018-04-26 17:04:25 +08:00 INFO destroying project ... ews-team/icyleaf-salt | ||
2018-04-26 17:04:25 +08:00 INFO deleting directory ... icyleaf-salt | ||
2018-04-26 17:04:26 +08:00 INFO delete repository ... done | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.