It's a primitive """clone""" of rsync for ComputerCraft. I needed a program that would incrementally download files off of a static website served by nginx, onto my in-game computer.
To set up your website, simply enable JSON autoindexing in nginx. For instance:
location /ccst/ {
autoindex on;
autoindex_format json;
try_files $uri $uri.html $uri/ =404;
}
Note that the format used must be JSON, as this program does not support HTML or XML indexes.
Download the program and rxi's Lua JSON library onto your computer with wget
:
wget https://raw.githubusercontent.com/rxi/json.lua/master/json.lua json.lua
wget https://gist.githubusercontent.com/liquidev/40e7532fdc6424f31960207a64e9699b/raw/7572f4accd348de048be4e53aedd0f49759e1497/10-rsync.lua rsync.lua
Usage is as follows:
rsync <url> <directory>
For instance, to rsync https://example.com/my_project/
into the directory my_project
:
rsync https://example.com/my_project/ my_project
CCrsync works by recursively walking JSON indexes generated by nginx to determine which files need to be downloaded. The files' modification dates (mtime
fields) are saved in an index.json
file inside the provided directory, which is read upon the next time CCrsync is executed to skip downloading files that have not changed since the last sync.
As of now CCrsync is super primitive; it does not even attempt to remove files that don't exist anymore. Consider this more of a proof of concept than a usable development tool.