Build Status Gem Gem

Smartdust CLI client

smartdust-logo-text-2021.png Documentation: https://docs.smartdust.me/docs/cli-client.

Automation client for connecting to Smartdust Lab devices via adb from a terminal. Designed with the following scenario in mind:

  1. Connect to remote devices
  2. Do something with the device via adb (Instrumentation Test, adb install, etc)
  3. Disconnect from device

Due to it being a console tool, it's very easy to use it for test automation in a CI\CD pipeline, for example in Jenkins.

Allows for filtering by any device description parameter as well as listing all available values of a given parameter e.g. all unique names of devices in the lab instance.

Installation from source

Prequisities

  • Ruby along with RubyGems installed - versions higher than 3.0.2 are not guaranteed to work
  • Android dependencies:
    • adb (Android Debug Bridge)
  • iOS dependencies:

Installation

From RubyGems

  • Install as a Ruby Gem: gem install smartdust-client

From sources

  • Open your terminal
  • "cd" into the directory where the repository is cloned
  • Run the following commands: (adding "sudo" might be needed)
  • gem build smartdust-client.gemspec
  • gem install smartdust-client-1.2.0.gem (or different version, see output of the previous command)

Usage

NAME
    smartdust-client - Smartdust Lab client (version 1.2.0)

SYNOPSIS
    smartdust-client [global options] command [command options] [arguments...]

GLOBAL OPTIONS
    --help             - Show this message
    --log=arg          - Log file (default: none)
    --pid=arg          - PID file (default: none)
    -t, --token=arg    - Authorization token, can also be set by environment variable SD_TOKEN (default: none)
    -u, --url=arg      - URL to Smartdust Lab, can also be set by environment variable SD_URL (default: none)
    -v, --[no-]verbose - Be verbose

COMMANDS
    clean      - Frees all devices that are assigned to current user in Smartdust Lab. Doesn't modify local adb
    connect    - Search for a device available in Smartdust Lab and attach it to local adb server
    disconnect - Disconnect device(s) from local adb server and remove device(s) from user devices in Smartdust Lab
    help       - Shows a list of commands or help for one command
    keys       - Show available keys for filtering
    trustme    - Add adb public key into Smartdust Lab
    values     - Show known values for the filtering key
  • Authorization token can be obtained from the Smartdust Lab web interface in Settings -> Keys
  • When connecting with this tool for the first time, have the Smartdust Lab web interface open to accept adding a new ADB key. This is necessary for every new machine that hasn't connected yet to Remote Debug on a given Lab instance.

Development

  • Install Ruby 3.0.2
  • Install Ruby Bundler: gem install bundler -v 1.17.3
  • Run bundle install in the project directory (might require adjusting directory permissions or sudo)
  • Run the program with bundle exec ruby lib/stf.rb

License

The gem is available as open source under the terms of the MIT License.