App Development using local IDE

You can develop the application locally by using your favourite IDE. The development scheme is shown in the following diagram.

local-dev-scheme.jpeg

  • The most important tool is the synchronization application (sync-app). This is a java application and supported on Mac, Linux and Windows. The sync-app is responsible for keeping files and folders up-to-date locally and on trillo.io
  • The sync-app is generally available as a zip and can downloaded from this link
  • The zip file has following contents
    • README.md
    • config.json
    • trillo-repo-sync-1.0-all.jar
    • Java API class files which methods are used inside every Trillo functions as "func."
  • Unzip this file in a new folder and follow the README.md to run it locally.
  • if everything worked then your source code will be replicated locally. Now you can edit the source using your favorite IDE. Once famous IDE is Visual Studio Code (VSCode) - https://code.visualstudio.com
  • You can find all sorts of plugins to develop in VSCode. One of the relevant plugin is called Jshell extension. Using this extension, all trillo functions MVEL will be syntax highlighted. MVEL and Java9's jshell are very similar. Once the plugin is installed, then go the preferences and associate Files with extensions *.script to jshell (shown below).

jshell.jpg

associate-jshell.jpg

jshell-editing

Developing with the Sync App

  • Download the zip from above link into your download folder.
  • Create a folder "./trillo" in your home folder.
  • Create two sub folders "./trillo/src" and "./trillo/sync"
  • "./trillo/src" will be your trillo.io's workspace
  • "./trillo/sync" will be folder where you will run the sync-app.
  • Copy the sync-app zip file from the download folder to "./trillo/sync"
    cp ~/Downloads/trillo-repo-sync-1.0.zip ./trillo/sync
  • Change directory to "./trillo/sync" and unzip sync-app
    ~/trillo/sync
    ▶ unzip trillo-repo-sync-1.0.zip
  • Go back to your home folder and run vscode from command-line as below.
    ~
    ▶ code ./trillo
  • Take a look at the README.md and in config.json, add your trillo.io's username, password and workspace names. Note: Windows-Users: the path separator should be "\" e.g., "C:\Users\saqib\trillo\src".

readme

  • Enter into the terminal shell inside ~/trillo/sync and run following command. If the config.json is correct then sync-app will start as shown below,.
    java -jar *.jar

sync-start

  • Once the sync is started, you will notice that the "src" folder is updated with the latest workspace code (at trillo.io). From there onwards, as long as sync-app is running the source will be updated bidirectionally. Remember to create resources at trillo.io and then update them locally.

src-updated

bi-directional-updates

Trillo "func" API methods

There are two classes whose methods can be used as "func." API calls in any Trillo function. Use these methods interfaces as reference when calling inside your functions.

func-apis