Giter Club home page Giter Club logo

ukor's Introduction



Ukor

A build tool for Roku projects

Features:

  • Multiple flavors
  • Install to device
  • Project and local configuration properties
  • Save installation targets and authentication details
  • Set default install targets
  • Search for Rokus on your local network

Questions?

Join us in the #tooling channel on the Roku Developers Slack.

Requirements

  • Node v7.6 or higher.

Project setup

You can install Ukor via NPM.

npm install -g @willowtreeapps/ukor

A Ukor project is organized in a single src folder with properties files in order to configure Ukor. The src folder contains a single main folder which contain the default built sources, optional customized flavor sources as well as test sources.

/Project
- src/
  - main/
    - components/
    - source/
    - anyThingYouWant/
    - constants.yaml
  - flavor1/
  - flavor2/
  - test/
  - testflavor1/
- ukor.properties
- ukor.local

The ukor.properties file is the main ukor configuration file for the project and should be version controlled. The ukor.local file is a local properties file that contains local customizations for ukor overriding the ukor.properties file. This file is not expected to be version controlled.

The constants.yaml file is per-flavor. In the file, you can define strings (or even any text to insert into a file), and can be identified with @{some.category.id} in brightscript OR xml source files.

Example properties (yaml)

buildDir: 'build'
sourceDir: 'src'
preBuild: 'scripts/main.js'
mainFlavor: 'flavorName'
flavors: {
  flavorName: {
    src: ['flavor', 'main']
  },
  flavorNameRelease: {
    base: 'flavorName',
    src: ['release']
  }
}
rokus: {
  roku2: {
    serial: '123123123',
    auth: {
      user: 'rokudev',
      pass: 'YourPassword'
    }
  }
}

Constants

Each flavor can contain string resources specified in the YAML format by providing constants.yaml file. Strings can be referenced by their path specified in any .xml or .brs source files. For example,

Given a constants.yaml file:

strings:
  contactSupport: 'contact support at 555-555-5555'
  login:
    signIn: 'Sign in now!'

Strings can be references in a *.brs file using the following interpolation syntax @{ <your_resource_here> }. For example,

supportLabel.text = "@{strings.contactSupport}"
loginLabel.text = "@{strings.login.signIn}"

The final generated *.brs source file will have the strings inlined like so.

supportLabel.text = "contact support at 555-555-555"
loginLabel.text = "Sign in now!"

Usage

Usage: ukor [options] [command]


  Commands:

    make [flavors...]             Bundle your channel into a zip to the build directory
    install [flavor] [roku] [-c]  Bundle then deploy your channel to a named roku
    package <flavor> <roku>       Package a channel flavor with a roku device
    rekey <roku>                  Rekey your device (an packageReference is required)
    lint <flavor>                 Lint a channel flavor
    console [roku]                Launch the Telnet console for the named roku
    debugger [roku]               Launch the Telnet debugger for the named roku
    find                          Search for rokus on the network
    init [flavors...]             Initialize a ukor project
    test                          Run the tests
    validate                      Validate ukor.properties and ukor.local
    help [cmd]                    display help for [cmd]

  Options:

    -h, --help     output usage information

    -v, --verbose  Turn on verbose logging

Quick reference

  • I want to make a new project
ukor init
  • I want to build my project
ukor make [flavor]
  • I want to install my project on a device
ukor install [flavor] [device]

or

ukor install [flavor] [ip address] --auth=[username]:[password]
  • I want to package my project using a device
ukor package [flavor] [device]

or

ukor package [flavor] [ip address] --auth=[username]:[password]
  • I want to rekey my device
ukor rekey [device]

or

ukor package [ip address] --auth=[username]:[password]

NOTE: you will need to define a packageReference and packageKey in ukor.properties.yaml. packageReference represent device id and packageKey does for password

Testing

Ukor uses UnitTestFramework.brs as part of its unit test runner and test reporting feature. This is especially useful if you plan on having Continuous Integration as part of your workflow.

Setup

First, copy the modified UnitTestFramework.brs in lib/brs/ to your src/test/source/ folder, so it loads at startup for when testing.

Note that the original UnitTestFramework.brs can be found here

Next, dd the following snippet in your startup function, after screen.show() but before the event loop

if params.RunTests = "true"
  runner = TestRunner()
  if params.host <> invalid
    runner.logger.SetServer(params.host, params.port)
  else
    runner.logger.SetServerURL(params.url)
  end if
  ' other setup if needed
  runner.run()
end if

You should now be able to execute your test suite using the test command.

ukor test [flavor] [roku]

What's happening?

Basically, we modified the rokudev UnitTestFramework.brs file to make a JSON of test results, and then POST that to the specified server. ukor test [flavor] builds and deploys the specified flavor with the test src folder, and then restarts the channel with parameters to run tests and point the results to the client machine. ukor will log the results, and also output results in xml and junit format to .out/tests/ukorTests.[xml|junit].

notes:

  • Ukor now copies UnitTestFramework.brs with ukor init!
  • UnitTestFramework.brs is now up to date with the rokudev repo!

Contributing to Ukor

Contributions and suggestions are more than welcome. Please see our Code of Conduct as well as our Contributing Guidelines for more information.

ukor's People

Contributors

cazacutudor avatar drazmo avatar nishtahir avatar nsillik avatar pixshatterer avatar vannuysm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ukor's Issues

VS Code integration

is there any way to integrate with VS Code? There is VS Code extension for brightscript language that allows to write code, compile and run the app, but with ukor it would be awesome to have some flavor picker on the VS Code UI

Possible typo in generated `ukor.properties.yaml`

The generated ukor.properties.yaml file after running ukor init looks like it may have a typo:

name: roku
version: 0.0.1
buildDir: build
sourceDir: src
defaults:
  falvor: main # Should this be `flavor` instead of `falvor`?
flavors:
  main:
    src:
      - main

Support multiple unit test frameworks

Currently unit testing support is deprecated.

I propose to add support for multiple testing frameworks (Rooibos, Unit Test Framework v1;v2), so the user can have flexibility in using ukor for running specs.

Add ukor.local example

Ukor throws a warning about not having a ukor.local probably shouldn't do this. But also should have an example of the ukor local in the readme.

defaults:
  roku: keep_swimming
  flavor: newsRelease

How I can setup and create new project or debug my existing project?

How I can setup and create new project or debug my existing project?

I am always getting below issue:

C:\WINDOWS\system32>Ukor init
C:\Users\Krishna.Kumar\AppData\Roaming\npm\node_modules\@willowtreeapps\ukor\bin\ukor-init.js:4
  fs.mkdir('./src', () => {
                     ^
SyntaxError: Unexpected token )
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3
C:\WINDOWS\system32>ukor make
C:\Users\Krishna.Kumar\AppData\Roaming\npm\node_modules\@willowtreeapps\ukor\bin\ukor-make.js:15
let args = program.args
    ^^^^
SyntaxError: Unexpected identifier
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

Tried on Linux and got error while running ukor init and ukor make command. Please help on this.

Hi
I also tried on Linux and when running below command, getting error
ukor init

Error:
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3

Need help to install my app on Roku.

ukor install snagfilms ... --auth=---------:------

I have provide ip address and auth properly while running above command.

Getting this as response and app is not showing on roku as installed app.

warn: failed to read ./ukor.local
info: make flavor: snagfilms
warn: Skipping Wist: No Wist configuration found.

Error while init project

Hi,
i'm using mac os. 10.13.5. I get this error while calling ukor init:

/usr/local/lib/node_modules/@willowtreeapps/ukor/bin/ukor-init.js:28
    if (err && err.code !== 'EEXIST') throw err
                                      ^

Error: ENOENT: no such file or directory, copyfile '/usr/local/lib/node_modules/@willowtreeapps/ukor/lib/raw/default.properties' -> './src/test/source/ukor.properties'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.