Developing with Ksync

Blank 8/10/2019 02:56 - 8/10/2019 02:56
Developers

With Kademi you can edit files live on the server and see the results instantly in your websites by connecting with webdav and using desktop tools, or use our browser based editing. You get complete version history on the server, and you can use branches to develop without affecting your production site, and then click a button to deploy when its done.

So thats all pretty good and easy and for much of the time thats all you need. But sometimes you really want to work locally. If you're on Mac and you want to use git to manage source code you need real local files, and if you want to use grunt etc then you need local files too.

Kademi provides a sync tool called KSync to support local development. This tool does bi-directional real time file sync, so as you edit files locally they are immediately sent to the server. Changes made on the server are also down-synced so you have the latest changes.

We recommend using KSync3 which is stable now.

KSync3

This version is a major rearchiteture, using cryptographic algorithms for changes detection rather then the path based approach of the original ksync. The result (should be!) faster and more robust. It is a purlely command line tool and functions similar to git, in the sense that it has options for checkout, push and pull, and also has a sync command which runs continuously.

This is a jar file which is executed the same as ksync, ie
java -jar ksync3.jar ...(options)}

You will probably want to create a shell script to execute it. On linux create this as something like ksync.sh, assuming ksync3.jar is in your home directory and java(1.8+) is installed:

java -jar ~/ksync.jar $1 $2 $3 $4 $5

KSync3 operations

DOWNLOAD CROSSPLATFORM INSTALLER  DOWNLOAD WINDOWS INSTALLER  DOWNLOAD KSYNC3

If you use one of the installers it will also register a URI schema on your computer so that you can use links like ksync://<base64 encoded parameters>

 

Command Description Example
checkout [url] [user] Download a remote repository to the current local directory. Meta information is held in a directory called .ksync inside the local directory
cd test-project             
~/ksync.sh -command checkout -url http://myaccount.admin.kademi.com.au/repositories/mysite/version1
            
sync

Continuously monitor for local changes. When a change is detected do an immediate push.

Sync will never modify local files

If modifications are detected on the server the push will fail, and ksync will tell you to pull

../ksync.sh -command sync
pull Download updates and apply to the local working copy. ../ksync.sh -command pull
push Upload local updates, after doing a pull and merge ../ksync.sh -command push

 

Deploying libs and apps with KSync

If you want your app or lib to be in the Kademi Marketplace you need to publish it. Note that this is not required to use libs and apps within your account.

The deployment tool is designed to work with libs, apps and themes in the following structure. Note the version folder, you must have just one version folder inside an asset

Please ensure that

  • You execute from a folder which contains the 3 folders - apps, libs and themes
  • Do not attempt to publish an already published version
  • Host URL - this is the account which owns the app/lib/theme you want to deploy. It will be published to the marketplace by this account
  • Your user name
  • Your password

 

Here is an example of deploying a single lib (leadman-lib) from the command line:

          This asks for 3 inputs: