cbox v0.3.0
cbox
Maps a file directory into CouchDB attachments, and then pushes, pulls, or syncs with a CouchDB instance. Designed to run forever, consume minimal network traffic, and preserve file history while respecting deletions.
It's like an open-source Dropbox.
Installation
It's written in node so you'll need npm. Then:
npm install -g cbox
cbox # prints commands, usageAs an example, to continually sync a local directory to a CouchDB instance:
cbox sync --local {folder} --remote {url} --watchThat's it! cbox will watch files on the remote database and in the local folder, and will sync any changes that occur. To stop syncing, stop the process by pressing Ctrl-C or the like. To save that command for the future, use --save:
cbox sync --save --local {folder} --remote {url} --watch
cbox all # runs all saved jobsCommands
pull: pull files fromremoteintolocalpush: push files fromlocalup toremotesync: push and pull files from and tolocalandremotejobs: list all saved jobsrm: remove a saved job, without modifying any remote or local copyall: run all saved jobs
Options
--local: a local folder, like~/Pictures.--remote: a remote database, like a CouchDB instance.--save: save the given command for later re-use.--watch: continue watching and reacting to changes indefinitely.--config: path to a non-default file to use for saving and reading configuration values. Defaults to~/.cbox.json.--log: indicates level for logging. Choose from error, warn, info, verbose, debug, and silly.
Running on Startup
N.B. These instructions are for *nix systems, like Linux and Mac OS X
Using forever and cron, you can set cbox to run on a regular basis. Like this:
npm install -g forever
echo '@reboot' `which node` `which forever` '--minUptime 1' `which cbox` '--log info' | crontabThat'll run all saved jobs whenever your computer starts. If cbox fails, forever will restart it.
Config
By default, jobs are saved to ~/.cbox.json. It's just JSON, so you can edit it as you please. If it becomes invalid JSON, cbox will get angry. Here's an example config file:
[
{
command: 'pull',
local: '~/Pictures',
remote: 'http://localhost:5984/pictures'
}
]Tests
The tests sync data with a live CouchDB instance running at http://localhost:5984. So, to run the tests, make sure you have an instance listening at that URL.
To run the tests, do npm test.
License
9 years ago



