Skip to content

Configuration

Charles Greene edited this page Aug 3, 2018 · 4 revisions

Configuration

The gem must have a configuration file. To generate this file you can run the following command:

$ roku --configure

This will create the file '~/.roku_config.json' with a default configuration. Edit this file to add appropriate values. A configuration example with the minimum require fields can be found in this project called 'config.json.min'. The following are default configuration options:

Top Level Configuration

  • devices: information for accessing devices
  • projects: this is a hash of project objects
  • keys: contains keys that will be used for signing packages
  • input_mappings: allows you to change key mappings for the intractive navigator

Device Configuration

  • devices.default: id of the default device
  • devices.<device_id>.ip: ip address of the device
  • devices.<device_id>.user: dev username for the roku device
  • devices.<device_id>.password: dev password for the roku device

Project Configuration

  • projects.default: the key for the default project
  • projects.parent_dir: optional directory path that all projects are relative to
  • projects.<project_id>.parent: optional id of parent project to copy configs from
  • projects.<project_id>.directory: full path of the git repository the houses the roku app
  • projects.<project_id>.app_name: Name used when packaging the app
  • projects.<project_id>.folders: Array of folders to including when building.
  • projects.<project_id>.files: Array of files to including when building.
  • projects.<project_id>.excludes: Array of file to be excluded when packaging or building.
  • projects.<project_id>.stage_method: Which method to use for switching app stages (git or script)
  • projects.<project_id>.stages: a hash of stage objects
  • projects.<project_id>.stages.<stage_id>.branch: name of the branch for the given stage (if stage_method = git). If using stage_method = stage then this can be removed.
  • projects.<project_id>.stages.<stage_id>.script: scripts to use to stage the app (if stage_method = script). If using stage_method = git this can be removed.
  • projects.<project_id>.stages.<stage_id>.script.stage: script run form the app root directory to stage app
  • projects.<project_id>.stages.<stage_id>.script -> unstage: script run form the app root directory to unstage app
  • projects.<project_id>.stages.<stage_id>.key: this can be a string referencing a key in the keys section or a hash of options
  • projects.<project_id>.stages.<stage_id>.key.keyed_pkg: path to a pkg file that has been signed
  • projects.<project_id>.stages.<stage_id>.key.password: password for the signed pkg

Repeatable Stages

If you have a group of stages, or several groups of stages, that just have small changes, you can set them up using the repeat block in the stages object. To create repeatable stages you need to create an object inside the stages object. It must have a key that starts with '!repeat'. This object must have two keys named 'for' and 'stages'. The value for 'for' needs to be an array of strings that represent a key for each group of stages. The objects in 'stages' will be repeated for each key in 'for'. The keys for each object in 'stages' must include the string '{key}' somewhere. If not then they will be overwritten for each successive key. The string '{key}' can also be included anywhere else in the stage and it will be replaced with the key in the 'for' array.

Example:

{
  "projects":{
    "p1": {
      "stages": {
        "!repeat_a": {
          "for": ["a", "b"],
          "stages": {
            "{key}-prod": {
              "branch": "{key}-prod",
              "key": "{key}-prod"
            },
            "{key}-dev": {
              "branch": "{key}-dev",
              "key": "{key}-dev"
            }
          }
        }
      }
    }
  }
}

The above example will create 4 stages "a-prod", "a-dev", "b-prod", "b-dev". Each with the appropriate branch and key.

Key Configuration

  • keys.key_dir: optional directory that all keys are relative to
  • keys.<key_id>.keyed_pkg: path to a pkg file that has been signed
  • keys.<key_id>.password: password for the signed pkg

Input Mapping

The "input_mappings" section is optional but will allow you to override the default input mappings. In the section each key is a key press code. The value is a array with the desired command to run and a human readable key name. To see the key press code for a specific key the --navigate command can be run with the --debug option on to see a print out of all the keys pressed.

Excludes

The configuration provides an excludes parameter. This allows you to define paths that will not be included when building or packaging but included when sideloading. A use for this could be a documentation that is nested in your app but that roku will not allow to be included.