bcmd 0.6.19__tar.gz → 0.6.21__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of bcmd might be problematic. Click here for more details.

Files changed (40) hide show
  1. {bcmd-0.6.19 → bcmd-0.6.21}/PKG-INFO +1 -1
  2. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/tasks/docs.py +6 -7
  3. bcmd-0.6.21/bcmd/tasks/project.py +71 -0
  4. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd.egg-info/PKG-INFO +1 -1
  5. {bcmd-0.6.19 → bcmd-0.6.21}/pyproject.toml +1 -1
  6. bcmd-0.6.19/bcmd/tasks/project.py +0 -34
  7. {bcmd-0.6.19 → bcmd-0.6.21}/MANIFEST.in +0 -0
  8. {bcmd-0.6.19 → bcmd-0.6.21}/README.md +0 -0
  9. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/__init__.py +0 -0
  10. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/common/__init__.py +0 -0
  11. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/common/func.py +0 -0
  12. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/common/secret.py +0 -0
  13. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/resources/project/main.py +0 -0
  14. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/tasks/__init__.py +0 -0
  15. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/tasks/bin.py +0 -0
  16. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/tasks/code.py +0 -0
  17. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/tasks/crypto.py +0 -0
  18. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/tasks/download.py +0 -0
  19. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/tasks/image.py +0 -0
  20. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/tasks/json.py +0 -0
  21. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/tasks/lib.py +0 -0
  22. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/tasks/math.py +0 -0
  23. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/tasks/mirror.py +0 -0
  24. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/tasks/pdf.py +0 -0
  25. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/tasks/proxy.py +0 -0
  26. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/tasks/time.py +0 -0
  27. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/tasks/upgrade.py +0 -0
  28. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/tasks/wasabi.py +0 -0
  29. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd/utils/__init__.py +0 -0
  30. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd.egg-info/SOURCES.txt +0 -0
  31. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd.egg-info/dependency_links.txt +0 -0
  32. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd.egg-info/entry_points.txt +0 -0
  33. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd.egg-info/requires.txt +0 -0
  34. {bcmd-0.6.19 → bcmd-0.6.21}/bcmd.egg-info/top_level.txt +0 -0
  35. {bcmd-0.6.19 → bcmd-0.6.21}/setup.cfg +0 -0
  36. {bcmd-0.6.19 → bcmd-0.6.21}/test/__init__.py +0 -0
  37. {bcmd-0.6.19 → bcmd-0.6.21}/test/conftest.py +0 -0
  38. {bcmd-0.6.19 → bcmd-0.6.21}/test/test_pdf.py +0 -0
  39. {bcmd-0.6.19 → bcmd-0.6.21}/test/test_proxy.py +0 -0
  40. {bcmd-0.6.19 → bcmd-0.6.21}/test/test_wasabi.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcmd
3
- Version: 0.6.19
3
+ Version: 0.6.21
4
4
  Summary: Commands for Beni
5
5
  Author-email: Beni Mang <benimang@126.com>
6
6
  Maintainer-email: Beni Mang <benimang@126.com>
@@ -47,7 +47,7 @@ async def build(
47
47
 
48
48
 
49
49
  async def init(path: Path):
50
- global projectPath, docsPath, vitepressDistPath, distPath, deployPath, conf, zipFile
50
+ global projectPath, docsPath, vitepressDistPath, distPath, deployPath, zipFile
51
51
 
52
52
  # 初始化目录路径
53
53
  projectPath = path
@@ -62,10 +62,10 @@ async def init(path: Path):
62
62
  bpath.remove(vitepressDistPath)
63
63
 
64
64
  # 更新配置
65
- infoTomlFile = deployPath / 'info.toml'
66
- if not infoTomlFile.exists():
67
- btask.abort('部署文件不存在', infoTomlFile)
68
- conf.update(await bfile.readToml(infoTomlFile))
65
+ projectTomlFile = projectPath / 'project.toml'
66
+ if not projectTomlFile.exists():
67
+ btask.abort('部署文件不存在', projectTomlFile)
68
+ conf.update(await bfile.readToml(projectTomlFile))
69
69
 
70
70
  # 整理特殊的字段
71
71
  zipFile = distPath / f'{conf['domain']}_{now}.7z'
@@ -115,8 +115,7 @@ async def vitepressBuild(outputPath: Path):
115
115
 
116
116
 
117
117
  async def makeDeploy(outputPath: Path):
118
- bpath.copy(projectPath / 'deploy', outputPath)
119
- bpath.remove(outputPath / 'info.toml')
118
+ bpath.copy(deployPath, outputPath)
120
119
 
121
120
  # 删除配置里面加密和删除非字符串的配置,剩下的内容用于替换文件名和文件内容
122
121
  dataDict: dict[str, Any] = pickle.loads(pickle.dumps(conf))
@@ -0,0 +1,71 @@
1
+ import getpass
2
+ import os
3
+ from pathlib import Path
4
+ from typing import Final
5
+
6
+ from beni import bcolor, bcrypto, bexecute, bfile, bpath, btask
7
+ from beni.bfunc import syncCall
8
+ from typer import Argument, Option
9
+
10
+ app: Final = btask.newSubApp('项目相关')
11
+
12
+
13
+ @app.command()
14
+ @syncCall
15
+ async def init(
16
+ path: Path = Argument(Path.cwd(), help='workspace 路径'),
17
+ deep: int = Option(3, '--deep', '-d', help='探索深度'),
18
+ ):
19
+ '找出项目执行初始化 pnpm install 和 uv sync --all-extras'
20
+
21
+ initSubFolder(path, deep)
22
+
23
+
24
+ @app.command()
25
+ @syncCall
26
+ async def https_cert(
27
+ path: Path = Argument(Path.cwd(), help='https证书路径'),
28
+ no_commit: bool = Option(False, '--no-commit', help='不执行提交操作'),
29
+ ):
30
+ '更新 https 证书,将证书文件加密并且改名为 {domain}.key 或 {domain}.pem,将下载下来的文件直接放到目录后执行'
31
+ fileList = list(path.glob('**/*.key')) + list(path.glob('**/*.pem'))
32
+ fileList = list(filter(lambda x: x.stem != '{domain}', fileList))
33
+ btask.assertTrue(fileList, '没有找到需要处理的证书文件')
34
+
35
+ # 处理密码输入
36
+ while True:
37
+ password = getpass.getpass('请输入密码:')
38
+ if not password:
39
+ continue
40
+ repassword = getpass.getpass('请重复输入密码:')
41
+ if password == repassword:
42
+ break
43
+ else:
44
+ bcolor.printRed('两次密码输入不一样')
45
+
46
+ # 文件加密处理
47
+ for file in fileList:
48
+ content = await bfile.readText(file)
49
+ content = bcrypto.encryptText(content, password)
50
+ toFile = file.parent / f'{{domain}}{file.suffix}'
51
+ bcolor.printGreen('更新文件', toFile)
52
+ await bfile.writeText(toFile, content)
53
+ bcolor.printYellow('删除文件', file)
54
+ bpath.remove(file)
55
+
56
+ if not no_commit:
57
+ await bexecute.run(f'TortoiseGitProc.exe /command:commit /path:{path}/ /logmsg:"更新https证书文件"')
58
+
59
+
60
+ def initSubFolder(path: Path, deep: int):
61
+ uvLockFile = path / 'uv.lock'
62
+ pnpmLockFile = path / 'pnpm-lock.yaml'
63
+ if uvLockFile.exists():
64
+ with bpath.changePath(path):
65
+ os.system('uv sync --all-extras')
66
+ elif pnpmLockFile.exists():
67
+ with bpath.changePath(path):
68
+ os.system('pnpm install')
69
+ elif deep > 1:
70
+ for subPath in bpath.listDir(path):
71
+ initSubFolder(subPath, deep - 1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcmd
3
- Version: 0.6.19
3
+ Version: 0.6.21
4
4
  Summary: Commands for Beni
5
5
  Author-email: Beni Mang <benimang@126.com>
6
6
  Maintainer-email: Beni Mang <benimang@126.com>
@@ -3,7 +3,7 @@
3
3
 
4
4
  [project]
5
5
  name = 'bcmd'
6
- version = '0.6.19'
6
+ version = '0.6.21'
7
7
  description = 'Commands for Beni'
8
8
  requires-python = '>=3.10'
9
9
  keywords = ['benimang', 'beni', 'bcmd']
@@ -1,34 +0,0 @@
1
- import os
2
- from pathlib import Path
3
- from typing import Final
4
-
5
- from beni import btask, bpath
6
- from beni.bfunc import syncCall
7
- from typer import Argument, Option
8
-
9
- app: Final = btask.newSubApp('项目相关')
10
-
11
-
12
- @app.command()
13
- @syncCall
14
- async def init(
15
- path: Path = Argument(Path.cwd(), help='workspace 路径'),
16
- deep: int = Option(3, '--deep', '-d', help='探索深度'),
17
- ):
18
- '找出项目执行初始化 pnpm install 和 uv sync --all-extras'
19
-
20
- initSubFolder(path, deep)
21
-
22
-
23
- def initSubFolder(path: Path, deep: int):
24
- uvLockFile = path / 'uv.lock'
25
- pnpmLockFile = path / 'pnpm-lock.yaml'
26
- if uvLockFile.exists():
27
- with bpath.changePath(path):
28
- os.system('uv sync --all-extras')
29
- elif pnpmLockFile.exists():
30
- with bpath.changePath(path):
31
- os.system('pnpm install')
32
- elif deep > 1:
33
- for subPath in bpath.listDir(path):
34
- initSubFolder(subPath, deep - 1)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes