Skip to content
Wollok Command Line Interface project
Shell Wollok
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
images Still missing jar files - adding wollok format command - #8 Jun 23, 2019
includes
jars Updating Wollok JARs library from Travis Job 567201496 Aug 3, 2019
util v2.0 - Enhanced verbose output with colours - checking only against e… Jun 13, 2019
wsanity-check-examples Sanity check examples new folder May 24, 2019
.gitignore Enhanced check for travis failing May 15, 2019
.travis.yml Fixing generateCI & sanity check (renamed) scripts. Added comments. E… May 24, 2019
README.md
generateCI.sh Adding game jars Aug 1, 2019
runPrograms.sh v2.1 - Reporting total, failure and error count, clean stacktrace Jun 14, 2019
runTests.sh
wast.sh Relative path May 23, 2019
wchecker.sh v2.0 - Enhanced verbose output with colours - checking only against e… Jun 13, 2019
wformat.sh Still missing jar files - adding wollok format command - #8 Jun 23, 2019
winterpreter.sh v2.0 - Enhanced verbose output with colours - checking only against e… Jun 13, 2019
wollok Still missing jar files - adding wollok format command - #8 Jun 23, 2019
wollok-cli.lastUpdated
wrepl.sh
wsanity-check.sh v2.0 - Enhanced verbose output with colours - checking only against e… Jun 13, 2019
wserver-stop.sh
wserver.sh

README.md

Wollok Command-Line Interface Project

Build Status Latest release

The main purpose of this project is to provide a command line interface (CLI) for Wollok developers & users, in order to foster any kind of automation (like CI workflow or developing bash scripts). Wollok is a pedagogical tool for teaching object-oriented programming, and it is IDE based. Although, you can also run checker, interpreter and interactive console without a graphical user interface.

Installation

If you want to use it in your computer,

  • you must have a Linux-like operating system
  • clone this repo into any local folder
  • and add that local folder to your PATH environment variable (and into your bash profile)
export PATH="$PATH:<<pathWhereThisRepoWasCloned>>"

Then you can move to any other folder and use all executable bash files, as explained below.

Scripts

The root folder provides all Wollok bash commands:

  • wollok test & wollok run: runs all the test/programs from the current folder (see below)
  • repl: invoke Wollok interactive REPL console, using an optional .wlk file
  • format: run Wollok formatter for recommended indentation and space code style
  • check: builds and validates any wollok file
  • ast: outputs the current Abstract Syntax Tree, according to Wollok grammatical rules
  • you'll also find Wollok server scripts.

Here's an example of running

  • all tests from a project,
  • all programs from a project,

A second demo shows

  • running interactive console without any file,
  • running interactive console using pepita, our main character for the very first example in Wollok,
  • checker for pepita.wlk (since no output was given all tests passed succesfully),
  • and AST analyzer for pepita.wlk and saving output into a file

And finally you can see formatter in action:

jars folder

In jars folder we put all necessary Java jar files in order to run in a standalone computer without installing the whole Wollok development environment.

Travis integration & scripts

  • wollok test
  • wollok run

are suitable for using it in Travis scripts. They both start building all .wlk files, so even if your tests are passing or your program is working fine, ensure you have no errors in Problems tab (in your Wollok IDE).

image

Otherwise, your build will fail.

It then will run either all the tests files or all the programs. Any kind of error prevents a succesful build to happen.

An example of Travis output:

image

Example 1: running tests in a Wollok Project

If your Wollok project has several test files, your .travis.yml should look like this:

language: generic

sudo: required

script:
    - git clone https://github.com/uqbar-project/wollok-cli
    - export PATH="$PATH:./wollok-cli"
    - wollok test

Example 2: running a program inside a Wollok Project

If your Wollok project has no test file but a program, then your .travis.yml should look like this:

language: generic

sudo: required

script:
    - git clone https://github.com/uqbar-project/wollok-cli
    - export PATH="$PATH:./wollok-cli"
    - wollok run

Or, if you have both programs and tests, you could simply do a

language: generic

sudo: required

script:
    - git clone https://github.com/uqbar-project/wollok-cli
    - export PATH="$PATH:./wollok-cli"
    - wollok run && wollok test

Testing Wollok CLI: Sanity check

Having https://github.com/wollok/introPepita as a witness case, these are the test cases:

  • pepita.wlk not compiling => build failed
  • missing import pepita.* in test file => build failed
  • validator errors in pepita.wlk like having a constructor in an object definition => build failed
  • tests failing with assertion errors => build failed
  • test failing with runtime errors (like division by zero or null parameters in operations like +) => build failed
  • passing tests => build passed
  • warning issues in pepita.wlk (but no errors) => build passed

Updating to a new version of Wollok

Whenever Wollok has a new stable release, you can update all jars from jars folder running generateCI.sh script. You must provide just one argument, the location of root Wollok development environment folder.

For example, if you have this folder structure:

  |- wollok-cli
     |- generateCI script bash file
  |   ...
  |- wollok-dev
     |- wollok
        |- wollok development environment files ...
  |-

This is the way you should call the script:

generateCI.sh ../wollok-dev/wollok

Or, if you are in wollok-dev/wollok folder, simply run

generateCI.sh .

Don't add the trailing / character for wollok root folder. After running the script, you can tests if everything went smooth:

wsanity-check.sh

Another useful scripts

They are all in util folder:

  • cloneAllProjects.sh: clones all projects from Wollok organization

Adding Travis to whole repository

If you want to add .travis.yml to all projects in a single organization (for example, wollok), you can use this scripts in util folder:

  • cloneAllProjects.sh: for cloning all repos in a single organization
  • addTravisInAllProjects.sh: searches for .travis.yml files in each project and adds the corresponding (tests or programs), and also adds Travis badge to README.md (creating or appending to an existing README file)
  • pushingAllTravis.sh: pushes all changes into Github repositories again

Future steps


- Powered by Uqbar - http://www.uqbar.org
You can’t perform that action at this time.