Notes on Libraries - AutolabJS/autolabcli GitHub Wiki

I explored some of the node.js libraries and found a few interesting ones. The interesting and relevant libraries are:

  • caporal - framework for building CLI apps; prefer this over commander
  • commander - another framework for creating command line interfaces
  • inquirer - a collection of common interactive command line user interfaces
  • shelljs - portable UNIX shell
  • simple-git - light weight interface for running git commands
  • validator - used for validating domain names and ports
  • preferences - Node.JS Module for handling encrypted user preferences
  • cli-table - allows us to render unicode-aided tables on the command line
  • cli-spinner - used to display spinner when application response is pending
  • chalk - used for terminal string styling
  • request-promise - simplified HTTP request client 'request' with Promise support

The caporal would help us create custom commands of our application. The inquirer would help in giving outputs and receiving inputs of the interactive application. The shelljs would help in passing the commands typed inside the script to the shell and perform error checking on the results. We can use shelljs to execute all other commands including git commands in the Linux shell. We can write JS functions around simple-git library for completing regular git tasks.

We can map these tools to our steps of submission script.

  • caches the credentials of the user (shelljs / simple-git)
  • commits local changes with user provided commit message (simple-git)
  • commits to remote repository using multiple remotes feature of git (shelljs)
  • executes ajax request to webapp front end for evaluation (shelljs + curl request to Autolab webapp)
  • execution node pulls commit from gitlab and evaluates (shelljs)
  • score and logs are committed to eval/ directory of gitlab repo (shelljs)
  • latest commit is pulled from gitlab remote; thus logs become available to user (shelljs)
  • ajax reply is shown to user in nice format (console print)