Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

An interpreter for the BrightScript language that runs on non-Roku platforms.

License

NotificationsYou must be signed in to change notification settings

sjbarag/brs

Repository files navigation

Table of Contentsgenerated withDocToc

BRS: Off-Roku BrightScript

An interpreter for the BrightScript language that runs on non-Roku platforms.

CircleCINPM Version

Installation

The BRS project is published as anode package, so usenpm:

$ npm install -g brs

oryarn if that's your preference:

$ yarn global add brs

Usage

This repo provides thebrs executable, which operates in two ways.

REPL

An interactive BrightScript REPL (Read-Execute-Print Loop) is available by runningbrs with no arguments, e.g.:

$ brsbrs> ?"Dennis Ritchie said ""Hello, World!"""Dennis Ritchie said "Hello, World!"

Quit by entering^D (Control-D).

Executing a file

BRS can execute an arbitrary BrightScript file as well! Simply pass the file to thebrs executable, e.g.:

$ cat hello-world.brs?"Dennis Ritchie said ""Hello, World!"""$ brs hello-world.brsDennis Ritchie said "Hello, World!"

Sure, but why?

TheRoku series of media streaming devices are wildly popular amongst consumers, and severalverypopularstreamingservices offer Channels for the Roku platform. Unfortunately, Roku chanelsmust be written in a language called BrightScript, which is only executable directly on a Roku device. BRS hopes to change that by allowing Roku developers to test their code on their own machines, thus improving the quality of their channels and the end-user's experience as a whole.

So can I use this to watch TV without a Roku?

Nope! The BRS project currently has no intention of emulating the Roku user interface, integrating with the Roku store, or emulating content playback. In addition to likely getting this project in legal trouble, that sort of emulation is a ton of work.

Building from source

The BRS project follows pretty standardnode development patterns, with the caveat that it usesyarn for dependency management.

Prerequisites

BRS builds (and runs) innode, so you'll need toinstall that first.

Once that's ready, installyarn. Installing it withnpm is probably the simplest:

$ npm install -g yarn

Setup

  1. Clone this repo:

    $ git clone https://github.com/sjbarag/brs.git
  2. Install dependencies:

    $ yarn install# or just `yarn`
  3. Getbrs onto yourPATH:

    $ yarn link

The build-test-clean dance

Build

This project is written in TypeScript, so it needs to be compiled before it can be executed.yarn build compiles files insrc/ into JavaScript and TypeScript declarations, and puts them inlib/ andtypes/ respectively.

$ yarn build$ ls lib/index.js (and friends)$ ls types/index.d.ts (and friends)

Alternatively, you can run the build step in "watch" mode. This will runyarn build for you automatically, every time it detects source file changes:

$ yarn watch

This is often useful for testing that local changes work in your BrightScript project, without having to runyarn build over and over.

Testing

Tests are written in plain-old JavaScript withFacebook's Jest, and can be run with thetest target:

$ yarntest# tests start running

Note that only test files ending in.test.js will be executed byyarn test.

Cleaning

Compiled output inlib/ andtypes/ can be removed with theclean target:

$ yarn clean$ ls lib/ls: cannot access'lib': No such file or directory$ ls types/ls: cannot access'types': No such file or directory

All Together

Thanks to thenpm-run-all package, it's trivially easy to combine these into a sequence of tasks without relying on shell semantics:

$ yarn run-s clean buildtest

Documentation

For the most part,brs attempts to emulate BrightScript as closely as possible. However, there are certain implementation gaps. Also, in the spirit of unit testing, there are a few extensions that will help with testing. All of our documentation for APIs, extensions, gaps, and more is hosted on our docs site,hulu.github.io/roca.


[8]ページ先頭

©2009-2025 Movatter.jp