-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from uzh-dqbm-cmi/config
Add config for easier command line usage
- Loading branch information
Showing
3 changed files
with
184 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,49 @@ | ||
# code_sync | ||
Python utility for syncing code to a remote machine in the background | ||
`code_sync` auto-syncs your code changes in a local directory to a remote machine, | ||
so that you can edit your code in your local editor and instantly run those change on a remote machine. | ||
|
||
Under the hood, `code_sync` is running an `rsync` command whenever `watchdog` notices changes to the code. | ||
|
||
## Installation | ||
`pip install code_sync` | ||
|
||
After installing this package, the `code_sync` tool will be available from the command line. | ||
|
||
|
||
## Usage | ||
|
||
After installing this package, the `code_sync` tool will be available from the command line. | ||
#### Register a project | ||
code_sync --register <project> | ||
This will prompt you to enter the local directory to sync, | ||
the remote machines to sync to, | ||
and the destination path on the remote to sync the files to. | ||
|
||
Once you register a project with `code_sync`, it will remember that configuration. | ||
|
||
#### code_sync a registered project | ||
code_sync <project> | ||
This command will use the configuration you set for the project when you registered it. | ||
|
||
The `code_sync` script allows you to auto-sync any changes to code in a local directory to a remote machine. | ||
Under the hood, it is running an `rsync` command whenever `watchdog` notices changes to the code. | ||
#### List all projects registered to code_sync | ||
code_sync --list | ||
|
||
### Example usage | ||
Assuming you have defined `my_remote_machine` in your ssh config: | ||
#### Run code_sync with specific parameters | ||
code_sync --local_dir <mylocaldir/> --remote_dir <myremotedir/> --target <ssh_remote> --port 2222\n | ||
|
||
`code_sync --local_dir mylocaldir/ --remote_dir myremotedir/ --target my_remote_machine --port 2222` | ||
|
||
### Notes | ||
**Starting** | ||
* In order to run `code_sync`, you must have an ssh connection open in another window. Once you've entered your password there, `code_sync` uses that connection. | ||
* When you start this script, nothing will happen until a file in the `local_dir` is touched. This is normal! | ||
* In order to run `code_sync`, you must have an ssh connection open in another window. | ||
Once you've entered your password there, `code_sync` uses that connection. | ||
* When you start this script, nothing will be synced until a file in the `local_dir` is touched. This is normal! | ||
* The destination dir must exist already, but need not be empty. | ||
|
||
**Stopping** | ||
* You can safely quit `code_sync` with control-c. | ||
|
||
**About `code_sync` + `git`** | ||
* `code_sync` does not sync files that are excluded by `.gitignore`, if present in the local directory. | ||
It also does not sync `.git` and `.ipynb` files. | ||
* The destination directory should not be treated as an active git repo. | ||
The destination dir must exist already, but need not already be empty. | ||
If the destination directory is a git repo already, it will be overwritten with the "git state" of the local git directory. | ||
* **Do not run git commands from the destination terminal** on the destination directory. | ||
The destination dir will have its contents synced to exactly match the local dir, including when you checkout a different branch on local. | ||
* The sync command adheres to any filters set by `.gitignore` files within the specified directories. | ||
It also excludes `.git` and `.ipynb` files. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters