-
Notifications
You must be signed in to change notification settings - Fork 1
Using CodeSync
In order to use CodeSync, we assume you have currently installed and configured the server and the client. If so, ensure that the server application is running. CodeSync is always triggered by the client, however, the server needs to be running (the webserver must be listening) in order to respond to the client whenever it makes requests.
On the client, open a terminal/command line and reach the folder where you put the CodeSync files, for example C:/codesync. Then, you can issue python codesync.py command, followed by attributes. Supported attributes are: -v2, -port, -op and -sync. See the following reference for more help.
-
python codesync.py -v2 other-attributes- You can use the -v2 attribute combined with other attribute by adding it first. It just tells the client to explicitely use CodeSync version 2. This is not necessary, but it might be a desired feature for future versions to allow backward interoperability. -
python codesync.py -port tcp-port- Just like the -v2 command, this attribute can be prepended to other attributes and it tells to query the server on a custom TCP port. By default, the server will be queried on port 80. This field is optional -
python codesync.py -op custom-url- This command command can be used to explicitely execute a query. It just make an HTTP request to the specified URL and then interprets the results. You should type a the path in the url, but not the hostname (exclude the first http://example.com/ and keep everything else, the CodeSync server configured will be polled). To gain more information about how the URL should be formatted, refer to the implementer's guide at http://alessandromaggio.com/project/codesync/ -
python codesync.py -sync all- This command poll the server to synchronize all projects for this device -
python codesync.py -sync project project-name- Use this command to sync a specific project -
python codesync.py -sync folder folder-name- Use this command to sync a specific folder, which must be part of a project. You should enter the full absolute or relative path to the folder (local). -
python codesync.py -sync file file-name- Use this command to sync a specific file, which must be part of a project. You should enter the full absolute or relative path to the file (local). -
python codesync.pyorpython codesync.py --help- Shows a quick command reference
In version 2, the CodeSync synchronization will synchronize files only when the last edit time between server and client differs (either pushing or pulling the file). However, only files present on the server are synchronized. This means that if you create a new file on a client device, it will not be pushed to the server. Moreover, if you delete a file on the server, the deletion will not be propagated on the clients. If you delete a file on a client, the file will be pulled back from the server at the next synchronization. Natively, CodeSync does not put in place any special treatment if you configure more clients with the same device name. They will work just fine, but you may occasionally lose some minor changes if you do trigger all of them to synchronize at once.
Even if these may seem limitations at a first glance, remember that CodeSync is not an alternative to Google Drive, OneDrive or GitHub. Instead, it has been designed to allow coders to work on a single workstation and have their IoT devices automatically synchronized. Because of that, major changes will be propagated unidirectionally and only minor file fixes will be propagated from the client(s) to the server.
CodeSync in its version 2 is provided as-is, due to its open source nature and the target users it has been designed to be simple and flexible, but we cannot guarantee that every function is actually tested under any possible scenario