| 1 | package App::SD::CLI::Command::Help::Sync; | ||
| 2 | use Any::Moose; | ||
| 3 | extends 'App::SD::CLI::Command::Help'; | ||
| 4 | |||
| 5 | sub run { | ||
| 6 | my $self = shift; | ||
| 7 | $self->print_header('Sharing ticket databases'); | ||
| 8 | my ${cmd}= $self->cli->get_script_name; | ||
| 9 | |||
| 10 | print <<EOF | ||
| 11 | |||
| 12 | ${cmd}clone --from http://example.com/path/to/sd | ||
| 13 | Create a new copy (replica) of a published SD replica from an | ||
| 14 | http, ftp or file URL. | ||
| 15 | |||
| 16 | ${cmd}pull --from http://example.com/path/to/sd | ||
| 17 | Integrate changes from a published SD replica over http, ftp or | ||
| 18 | file URL. | ||
| 19 | |||
| 20 | ${cmd}pull --all (or -a) | ||
| 21 | Integrate changes from all replicas this replica has pulled from | ||
| 22 | before. | ||
| 23 | |||
| 24 | ${cmd}pull --local (or -l) | ||
| 25 | Integrate changes from all replicas currently announcing themselves | ||
| 26 | on the local network using Bonjour. | ||
| 27 | |||
| 28 | ${cmd}publish --to jesse\@server:path/to/destination | ||
| 29 | Publish a copy of this replica to a remote server using rsync. | ||
| 30 | |||
| 31 | ${cmd}publish --html --replica --to jesse\@server:path/to/destination | ||
| 32 | Publish a copy of this replica, including a static html representation, | ||
| 33 | to a remote server using rsync. | ||
| 34 | |||
| 35 | ${cmd}server --port 9876 | ||
| 36 | Start an sd replica server on port 9876. This command will make your | ||
| 37 | replica browsable and pullable by anyone with remote access to your | ||
| 38 | computer. Changes will only be accepted from the local machine. | ||
| 39 | |||
| 40 | To clone from this replica use: | ||
| 41 | |||
| 42 | ${cmd}clone --from http://hostname_for_server:9876/replica/ | ||
| 43 | |||
| 44 | Adjust port to the server, and notice the /replica/ path. | ||
| 45 | |||
| 46 | ${cmd}browser --port 9876 | ||
| 47 | Do the same as the server command, but also open up the server's | ||
| 48 | front page in your browser. | ||
| 49 | |||
| 50 | SD can sync to external systems as well as itself. Currently, there | ||
| 51 | are foreign replica types for: | ||
| 52 | |||
| 53 | RT (http://bestpractical.com/rt) | ||
| 54 | Hiveminder (http://hiveminder.com/) | ||
| 55 | Trac (http://trac.edgewall.com) | ||
| 56 | Google Code (http://code.google.com) | ||
| 57 | GitHub (http://github.com). | ||
| 58 | |||
| 59 | Read-only support is available for: | ||
| 60 | |||
| 61 | Redmine (http://redmine.org) | ||
| 62 | |||
| 63 | If you're interested in building a replica type for your bug | ||
| 64 | tracker, you should get in touch with SD's developers (see | ||
| 65 | http://syncwith.us/contact). | ||
| 66 | |||
| 67 | The RT server is specified as as rt:serveraddress|Queue|Query | ||
| 68 | |||
| 69 | ${cmd}clone --from "rt:http://rt3.fsck.com|rt3|Owner='jesse'" | ||
| 70 | Create a local replica and pull data from a foreign replica. | ||
| 71 | |||
| 72 | ${cmd}push --to "rt:http://rt3.fsck.com|rt3|Owner='jesse'" | ||
| 73 | Push changes to the given foreign replica. Foreign replica | ||
| 74 | schemas will vary based on the replica type. | ||
| 75 | |||
| 76 | ${cmd}pull --from "rt:http://rt3.fsck.com|rt3|Owner='jesse'" | ||
| 77 | Pull changes from a foreign replica to be merged into the | ||
| 78 | local replica. | ||
| 79 | |||
| 80 | Cloning from Google Code | ||
| 81 | |||
| 82 | ${cmd}clone --from gcode:k9mail | ||
| 83 | |||
| 84 | Cloning from Trac | ||
| 85 | |||
| 86 | ${cmd}clone --from trac:https://trac.parrot.org/parrot | ||
| 87 | |||
| 88 | Cloning from GitHub | ||
| 89 | |||
| 90 | ${cmd}clone --from github:miyagawa/remedie | ||
| 91 | |||
| 92 | SD uses LWP for HTTP access, so it supports any form of authentication | ||
| 93 | LWP can use. For instance, you can push and pull from a remote trac | ||
| 94 | that uses x509 client certificates by setting the HTTPS_CERT_FILE and | ||
| 95 | HTTPS_KEY_FILE environment variables, and specifying an empty password | ||
| 96 | when SD prompts you. For more information, see the documentation for | ||
| 97 | LWP and Crypt::SSLeay. | ||
| 98 | |||
| 99 | SD also supports naming replicas, so you can push, pull, and publish | ||
| 100 | to short, human-friendly names instead of URLs. When a replica is | ||
| 101 | initialized, cloned, or published, a [replica "name"] section is created in | ||
| 102 | the replica-specific configuration file (replica_root/config). Its name is, by | ||
| 103 | default, the URL you passed to the command. You can change this to a more | ||
| 104 | memorable name with: | ||
| 105 | |||
| 106 | ${cmd}config edit | ||
| 107 | |||
| 108 | You can then use sync commands like this: | ||
| 109 | |||
| 110 | ${cmd}pull --from name | ||
| 111 | ${cmd}push --to name | ||
| 112 | ${cmd}publish --to name | ||
| 113 | |||
| 114 | For pull and push, the given name is substituted with the value of the | ||
| 115 | replica.name.url config variable. For publish, replica.name.publish-url | ||
| 116 | is used. If different urls are needed for push and pull for a given | ||
| 117 | replica, you can override replica.name.url with replica.name.push-url | ||
| 118 | and/or replica.name.pull-url. | ||
| 119 | |||
| 120 | EOF | ||
| 121 | |||
| 122 | } | ||
| 123 | |||
| 124 | # ${cmd}server --writable --port 9876 | ||
| 125 | # ${cmd}server -w -p 9876 | ||
| 126 | # Start an sd replica server on port 9876, with UNAUTHENTICATED, | ||
| 127 | # PUBLIC WRITE ACCESS via HTTP POST. This command will make your | ||
| 128 | # replica modifiable, browsable and pullable by ANYONE with remote | ||
| 129 | # access to your computer. | ||
| 130 | |||
| 131 | __PACKAGE__->meta->make_immutable; | ||
| 132 | no Any::Moose; | ||
| 133 | |||
| 134 | 1; | ||
| 135 |