-
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch allows Watson to sync via a simple git repository, making it unnecessary to run a specific backend. Instead, any git repository with write access will do. You can configure a git backend by setting something like: watson config backend.repo [email protected]:user/repo.git If y repository is set, the `sync` command will try using git. If not, the old backend server is used if `server` and `token` are set.
- Loading branch information
Showing
4 changed files
with
125 additions
and
45 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 |
---|---|---|
|
@@ -739,6 +739,9 @@ Example: | |
|
||
$ watson config backend.url http://localhost:4242 | ||
$ watson config backend.token 7e329263e329 | ||
or | ||
$ watson config backend.repo [email protected]:user/repo.git | ||
|
||
$ watson sync | ||
Received 42 frames from the server | ||
Pushed 23 frames to the server | ||
|
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 |
---|---|---|
|
@@ -86,7 +86,21 @@ $ watson config -e | |
|
||
### Backend | ||
|
||
At this time there is no official backend for Watson. We are working on it. But in a near future, you will be able to synchronize Watson with a public (or your private) repository via the [`sync`](./commands.md#sync) command. To configure your repository please set up the `[backend]` section. | ||
You will be able to synchronize Watson with a public (or your private) repository via the [`sync`](./commands.md#sync) command. | ||
To configure your repository please set up the `[backend]` section. | ||
You have two options for synchronization: | ||
|
||
- The [crick](https://github.com/TailorDev/crick) server | ||
- A git repository | ||
|
||
If using crick, set `backend.url` and `backend.token`. | ||
If using a git repository, set `backend.repo`. | ||
|
||
|
||
#### `backend.repo` (default: empty) | ||
|
||
The remote URL of a git repository to clone. | ||
Something like `[email protected]:user/repo.git`. | ||
|
||
#### `backend.url` (default: empty) | ||
|
||
|
@@ -225,8 +239,7 @@ A basic configuration file looks like the following: | |
# Watson configuration | ||
|
||
[backend] | ||
url = https://api.crick.fr | ||
token = yourapitoken | ||
repo = [email protected]:user/repo.git | ||
|
||
[options] | ||
stop_on_start = true | ||
|
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 |
---|---|---|
|
@@ -1519,16 +1519,19 @@ def sync(watson): | |
\b | ||
$ watson config backend.url http://localhost:4242 | ||
$ watson config backend.token 7e329263e329 | ||
or | ||
$ watson config backend.repo [email protected]:user/repo.git | ||
\b | ||
$ watson sync | ||
Received 42 frames from the server | ||
Pushed 23 frames to the server | ||
""" | ||
last_pull = arrow.utcnow() | ||
pulled = watson.pull() | ||
click.echo("Received {} frames from the server".format(len(pulled))) | ||
click.echo("Received {} frames from the server".format(pulled)) | ||
|
||
pushed = watson.push(last_pull) | ||
click.echo("Pushed {} frames to the server".format(len(pushed))) | ||
click.echo("Pushed {} frames to the server".format(pushed)) | ||
|
||
watson.last_sync = arrow.utcnow() | ||
watson.save() | ||
|
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