orite - 自以为是的 Python rsync 包装器
项目描述
奥利特
用 Python 编写的持久 rsync 包装器
保存配置文件,然后同步您的远程和本地文件夹/文件。该项目旨在集中同步方法、配置一次、添加选项并使其变得简单。
为此,请使用 orite 运行:
orite -^
为此,请使用 rsync 运行:
rsync --human-readable --info=flist --stats --archive --verbose --partial -ic --progress --dry-run /Users/username/Documents/websites/site_name/stack/folder/ username@127.68.551.54:/home/stack/folder --exclude-from="exclude.txt"
ōrite 在毛利语中是“相同”的意思
它的发音是这样的,而不是“哦,对”。
问题
Transmit 和 Cyberduck 等 FTP 应用程序是不错的应用程序,可以同步内容,但速度很慢。
CLI 工具 rsync 非常适合此用途,因为它速度极快。问题是要输入很多内容。要记住很多标志,以及用户名、IP 地址、远程路径和排除文件路径。我还发现很难记住在本地路径上包含斜线并在远程路径上排除斜线。这意味着可以将整个 repo 复制到错误的文件夹中,或者只是在其他东西中松散。
我曾经使用 Git 和一个名为 fabric 的 Python 库来做这种事情。运行 fabfile 将提交、推送、登录到远程服务器,然后拉取并重新启动。虽然它是准确的,但它有点笨重,而且速度也不是很快。我从那个开始运行一个直接的 shell 脚本。我最终在我制作的每个文件夹中都有这个脚本的变体。
这就是奥瑞特的用武之地。
安装
pip3 install orite
或者在你的 bash 配置文件中下载 orite 文件夹和别名 orite.py。
alias orite='python3 path-to-orite-folder/orite.py'
如果你没有点子。
sudo easy_install pip
您还需要安装 Python 3。
更新
pip3 install orite --upgrade --no-cache-dir
怎么跑?
在要同步的文件夹上方的目录中运行 orite。
如果您没有在此目录中使用过 orite,系统会提示您放置一个配置文件和一个排除文件。
上传
orite -^
去下载
orite -v
默认情况下,orite 将以空运行模式运行。使用该-r
标志来覆盖它并真正进行同步。
帮助菜单可以使用
orite -h
这将输出以下可选参数:
-h, --help show this help message and exit
-s, --sections Print the section of the config file to the screen
-v, --remote_to_local
Download. Sync the remote folder to the local folder.
Think of -v as a down arrow.
-^, --local_to_remote
Upload. Sync the local folder to the remote folder.
Think of -^ as an up arrow.
-d, --dry_run Do a dry run. This is the default
-r, --for_real Not a dry run, do it for real
--ssh Login using SSH
--sftp Login using SFTP
-C, --initial_copy Copy the local folder for use in diff.
-R, --remote_to_remote_copy
Sync the remote folder to the local remote copy
-D, --diff Compare the local folder to the local remote copy
多台服务器——一个配置文件
您可以使配置文件具有多个服务器或文件夹位置。例如,我的 DEFAULT 文件夹是我的 Django 安装,而在一个非常独立的位置是我的 CSS 文件夹。
orite -^
将上传(在试运行模式下)到我的默认设置,并且
orite CSS -^
将上传到我的 CSS 部分设置。
在文本编辑器中打开配置文件。像这样在底部添加一个部分标签
[CSS]
然后path_to_local_folder = /path/
在下一行和path_to_remote_folder = /path/
之后的行中添加。如果您的 CSS 设置与默认设置位于同一服务器上,则无需再次添加这些详细信息。不用说,如果它们在不同的服务器上,也可以将这些设置添加到本节中。
添加任意数量的部分。
运行orite -s
以打印出配置文件中的所有部分。
改进/增强
使用 oritewatch
并让它监视本地目录的更改。
watch -d 'ls path-to-dir/css/ | orite CSS -^'
如果您在 Mac 上并且 CLI 中没有手表。使用Homebrew安装它。
brew install watch
有关手表使用的简要概述watch -h
并阅读类似的内容
有关更多问题和建议的增强功能,请查看问题选项卡。
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
内置分布
orite- 0.0.18 -py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | a4827c7293ba414393a072706226d0b9aaf063ac9f46dfa04fb27c9fc5d26e59 |
|
MD5 | d022ace2355dca36078f4f628e126e2c |
|
布莱克2-256 | 8c08fc80aafbc2ee85f58c3ded9d6b09889ee6c89fe30c39b99ced989c918152 |