Skip to content
This repository was archived by the owner on Jun 6, 2023. It is now read-only.

Commit fcebb6d

Browse files
committed
更新教程
1 parent 2fcca3a commit fcebb6d

7 files changed

Lines changed: 89 additions & 129 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,4 @@ cython_debug/
155155
/debug
156156
/.cache.json
157157
/config.yml
158+
/.state.json

README.md

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@
22

33
> 此项目的状态文件与[文件更新助手实用小工具](https://github.com/updater-for-minecraft/Tool)的缓存文件格式不兼容!建议删除后重新上传
44
5-
对象存储文件上传助手。利用服务商提供的对象存储命令行工具进行上传(理论上支持所有服务商)
5+
对象存储助手。利用服务商提供的对象存储命令行工具进行上传(理论上支持所有服务商)
66

77
具体作用是将本地文件同步到桶里,软件会自动计算出文件差异。然后仅上传或者删除有改动的文件
88

99
软件同步方式是:本地到对象存储的**单向同步**,不会删除桶里的现有文件(但还是建议提前做备份)
1010

11-
根据你使用的对象存储服务商,选择不同的教程:
12-
13-
1. [腾讯云](docs/tutorial-tencent.md)
14-
1511
## 启动参数
1612

1713
```shell
@@ -56,3 +52,65 @@ commands.upload-dir: apath, rpath, source, workdir, variables
5652
| apath | 绝对路径 |
5753
| rpath | 相对路径 |
5854

55+
## 配置参考
56+
57+
```yaml
58+
# 状态文件的文件名,注意不能填写子路径(支持自定义变量)
59+
# 状态文件:保存了桶里现有文件的结构,大小,校验等信息的文件
60+
# 状态文件是用来计算本地与桶里的文件差异的(因此对象存储助手不会去实际遍历桶里的对象)
61+
state-file: $state
62+
63+
# 开启后仅文件内容发生变动的文件会直接上传,跳过删除步骤
64+
# 关闭后会先删除,再上传
65+
overlay-mode: true
66+
67+
# 开启后对比文件时,优先对比修改时间,再对比内容校验
68+
# 关闭后每次都会对比文件内容的校验
69+
fast-comparison: true
70+
71+
# 开启后会将状态文件保存到本地,后续会从本地直接读取,而不会从桶里下载
72+
# 关闭后则每次从桶里实时获取
73+
use-local-state: true
74+
75+
# 执行commands选项下的命令行时使用的线程并发数
76+
threads: 4
77+
78+
# 文件过滤器,是一个正则表达式
79+
# 不匹配的文件会被忽略,不会被上传或者删除。留空则不启用
80+
file-filter:
81+
82+
# 自定义变量(注意这只是个简单的文本替换,并不是环境变量,也并不支持使用环境变量)
83+
# 支持变量嵌套
84+
variables:
85+
state: .state.json
86+
cli: coscli-windows.exe
87+
bucket: 'cos://sdfs-1254063044'
88+
89+
# 用来操作桶里文件的命令行
90+
# 如果命令行为空则不执行任何操作
91+
commands:
92+
# 手动指定命令行的工作目录
93+
# 如果为空则沿用对象存储助手的工作目录
94+
_workdir:
95+
96+
# 命令行stdout编码参数,一般使用utf-8
97+
_encoding: utf-8
98+
99+
# 下载状态文件时使用的命令行
100+
download-state: $cli cp $bucket/$state $state
101+
102+
# 上传缓存时使用的命令行
103+
upload-state: $cli cp "$apath" $bucket/$state
104+
105+
# 删除桶里文件时使用的命令行
106+
delete-file: $cli rm "$bucket/$rpath" --force
107+
108+
# 删除桶里目录时使用的命令行
109+
delete-dir:
110+
111+
# 上传文件到桶里时使用的命令行
112+
upload-file: $cli sync "$apath" "$bucket/$rpath"
113+
114+
# 在桶里创建目录时使用的命令行
115+
make-dir:
116+
```

docs/configuration.md

Lines changed: 0 additions & 62 deletions
This file was deleted.

docs/tutorial-tencent.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

docs/workflow.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

examples/config.aliyun.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
state-file: $state
2+
overlay-mode: true
3+
fast-comparison: true
4+
use-local-state: false
5+
threads: 4
6+
file-filter:
7+
8+
variables:
9+
state: .state.json
10+
cli: ossutil64.exe
11+
bucket: 'oss://sdfdsfewffwefwefwefwef'
12+
13+
commands:
14+
_workdir:
15+
_encoding: utf-8
16+
download-state: $cli cp $bucket/$state $state --force
17+
upload-state: $cli cp "$apath" $bucket/$state --force
18+
delete-file: $cli rm "$bucket/$rpath" --force
19+
delete-dir:
20+
upload-file: $cli cp "$apath" "$bucket/$rpath" --force
21+
make-dir:

examples/config.tencent.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
state-file: $state
22
overlay-mode: true
33
fast-comparison: true
4-
use-local-state: true
4+
use-local-state: false
55
threads: 4
66
file-filter:
77

@@ -13,9 +13,9 @@ variables:
1313
commands:
1414
_workdir:
1515
_encoding: utf-8
16-
download-state: $cli cp $bucket/$state $state
17-
upload-state: $cli cp "$apath" $bucket/$state
16+
download-state: $cli cp $bucket/$state $state --force
17+
upload-state: $cli cp "$apath" $bucket/$state --force
1818
delete-file: $cli rm "$bucket/$rpath" --force
1919
delete-dir:
20-
upload-file: $cli sync "$apath" "$bucket/$rpath"
20+
upload-file: $cli sync "$apath" "$bucket/$rpath" --force
2121
make-dir:

0 commit comments

Comments
 (0)