burp-brightscript
lightweight processor for roku brightscript projects
Last updated 7 months ago by georgejecook .
MIT · Original npm · Tarball · package.json
$ cnpm install burp-brightscript -g
SYNC missed versions from official npm registry.

Burp - Lightweight script processing for Roku brightscript projects

codecov Build Status GitHub NPM

Links

Development

Burp is an independent open-source project, maintained exclusively by volunteers.

You might want to help! Get in touch via the slack group, or raise issues.

What is Burp?

It's a simple tool for executing regex replacements on source code files, a bit like awk. The killer feature is that it understands brightscript syntax, so it knows what line and function it's in. It can be used from command line, or from a js environment (such as when using gulp for building)

Usage

From javascript/typescript/node

Gulp typescript example

The following working gulpfile can be found in my roku MVVM spike; but the process is as follows.

  • npm install burp-brightscript --save-dev
  • Add the following to the top of gulpfile.ts `import { BurpConfig, BurpProcessor } from "burp-brightscript";
  • Create a task to process your files, with the desired regex replacements, such as:
export function addDevLogs(cb) {
 let config: BurpConfig = {
   "sourcePath": "build/.roku-deploy-staging",
   // "sourcePath": "build/wtf",
   "globPattern": "**/*.brs",
   "replacements": [
     {
       "regex": "(^.*(logInfo|logError|logVerbose|logDebug)\\((\\s*\"))",
       "replacement": "$1#FullPath# "
     },
     {
       "regex": "(^.*(logMethod)\\((\\s*\"))",
       "replacement": "$1#FullPath# "
     }
   ]
 }
 const processor = new BurpProcessor(config);
 processor.processFiles();
 cb();
}

From command line

  • Install burp globally with npm install -g burp-brightscript
  • Create a config file for your source, such as burpConfig.json containing:
export function addDevLogs(cb) {
  let config: BurpConfig = {
    "sourcePath": "build/.roku-deploy-staging",
    // "sourcePath": "build/wtf",
    "globPattern": "**/*.brs",
    "replacements": [
      {
        "regex": "(^.*(logInfo|logError|logVerbose|logDebug)\\((\\s*\"))",
        "replacement": "$1#FullPath# "
      },
      {
        "regex": "(^.*(logMethod)\\((\\s*\"))",
        "replacement": "$1#FullPath# "
      }
    ]
  }
  const processor = new BurpProcessor(config);
  processor.processFiles();
  cb();
}
  • Execute Burp burp burpConfig.json

Replacement values

You can use the following constants in your regex replacements:

  • #FullPath# - full path of file
  • #LineNumber# - line number of replacement
  • #FileName# - filename of replacement
  • #FunctionName# - function name of replacement
  • #CommentLine# - will result in the line being commented out

Why call it Burp?

I like the name. It doesn't mean anything.

Why did you make this?

I also made rLog and needed a tool that could process source files to insert the line number and function name. I figured this is a more generally useful way of doing it, which other's might leverage in their own tool-chains and build processes.

Current Tags

  • 0.3.2                                ...           latest (7 months ago)
  • 0.3.1                                ...           next (7 months ago)

5 Versions

  • 0.3.2                                ...           7 months ago
  • 0.3.1                                ...           7 months ago
  • 0.3.0                                ...           7 months ago
  • 0.2.0                                ...           9 months ago
  • 0.1.0                                ...           9 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 7
Dependencies (9)
Dev Dependencies (27)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |