Rap command guide

rap is a production tool. You can use rap to install, config, and deploy applications.

  • Note: This document describes command usage for the lastest updated Ruff SDK. If your SDK has not updated, please click here.

Project

Initialization

rap init [project-type]

This command creates a Ruff project. You may need to use the command in the project directory.

Arguments

  • project-type refers to the three types of Ruff projects:
  • app is a Ruff application.
  • driver is a Ruff driver.
  • module is a Ruff module.
  • board is a Ruff board description.

The default value is app if the parameter is missing.

Package management

Install Ruff package

Please use the following command to install a Ruff package:

rap install [package[@version]...] [options...]
  • When one or more application packages are specified, the package(s) will be installed and saved in package.json.
  • If no package name is entered as an argument, all packages specified in package.json will be installed.

Package

  • package is the name of the package you want to install, for example, your-package-name. You may add @version as an additional argument to specify the version of the package, as follows: your-module-name@1.0.0`. Make sure you have entered the full version name and number.

Options

  • --save - it saves the package as dependencies
  • --save-dev,--dev- it saves the package as dev dependencies.
  • --npm- it is installed from an NPM respository.

Note: If using options, you may need to check your code manually for the compatibility.

Remove Ruff package

To remove the Ruff package, please use the following command:

rap uninstall <package...>

It will uninstall the specified Ruff packages and will remove corresponding settings in package.json.

  • package refers to the name of the package you want to uninstall.

Options

  • --save-dev, --dev - it removes dev dependencies in package.json.

Publish

To publish your package to the Rap Registry), please use the following command:

rap publish

If you do not want to publish certain files, you can modify .rapignore file.

Application

Deployment

Please use following command to deploy your code to any devices with an installed Ruff OS:

rap deploy [hostname] [options...]

The deployment will stop any application that are running on the device.

Options

  • -s, --start - it automatically runs your code after the deployment.

Start

The following command will start application that have been already deployed:

rap start [hostname]
  • hostname - IP address or hostname for the device (It is optional if a default device is set).

Stop

please use the following command to stop a running application,:

rap stop [hostname]
  • hostname - IP address or hostname for the device (It is ptional if a default device is set).

Restart

Please use the following command to restart a running application:

rap restart [hostname*]
  • hostname - IP address or hostname for the device (It is ptional if a default device is set).

Log

Please use following command to open an application log:

rap log [hostname]
  • hostname - IP address or hostname for the device (It is ptional if a default device is set).

Console

Please use following command to start a console that allows you to check variables or to run Ruff code such as $(‘led’).turnOn():

rap console [hostname*]
  • hostname - IP address or hostname for the device (It is ptional if a default device is set).

Device

Add

Plese use following command to add a device:

rap device add <device-id> [options...]

Drivers and dependencied will be searched and installed.

  • device-id - ID of the device. When a device ID is specified, you may use $(id) in your code to select the device.

Options

  • -m, --model <model> - the model name of the device. It is used to search for corresponding driver support in repository.
  • -l, --local-driver <path> - add local drivers.

Update

Please use the following command to upadate the existing driver of the device:

rap device update <device-id> [options...]

Firmware

Upadate

Please download the firmware you want from the Download Page and then use the following command to update Ruff firmware:

rap system upgrade <hostname> <firmware-binary-file>

Note:it will erase all information on the board and reset (back to the factory setting).

Hardware Layout

Layout

Please use following command to generate a hardware layout in JSON format and save in ruff_box.json:

rap layout [options...]

Ruff uses this layout descrption to connect ports and devices.

Options

  • --visual - visual and editable format of the layout.

User Management

Add Users

If you want to publish a package, you need to sign up at Rap Registry. The following command will save registered information on your local machine for later use:

rap add-user

Ruff Board

Wifi

Broadcast SSID and password to nearby Ruff boards with the following command:

rap wifi

Find A Board

Please make sure the dev machine and the board are connected to the same WiFi AP to search Ruff boards within your current LAN. Then use this command:

rap scan [-t, --timeout <timeout>]

Please wait and be patient because the command takes a moment to process.

If you are in a Ruff project directory, you may pick a device and set it up as default when the scan is completed. Once the default device is setup, you do not need to enter a hostname for command.

Option

  • -t, --timeout <timeout>- the default scanning time is 10 seconds.

Rename

Please use the following command to change the name from Ruff:

rap rename <new-name> [hostname]
  • new-name - the new name of the device
  • hostname - IP address or hostname for the device (it is optional if a default device is set).

Setting

Config

Config rap settings with the folowing command:

rap config set <key> <value>
  • key - key of the setting.
  • value- value you want to set to.

Option

Get Settings

Get current Rap settings by using following command:

rap config get [key]

If the key is not given, all settings will be returned.

  • key - the key of the settings you want to get.

Delete Settings

Please use following command to delete Rap settings:

rap config delete <key>
  • key - the key of settings that you want to delete.