Class CLICommandTranspiler
java.lang.Object
org.nustaq.kontraktor.webapp.transpiler.CLICommandTranspiler
- All Implemented Interfaces:
TranspilerHook
- Direct Known Subclasses:
CoffeeScriptTranspiler
public abstract class CLICommandTranspiler extends java.lang.Object implements TranspilerHook
Created by ruedi on 21.05.16.
-
Constructor Summary
Constructors Constructor Description CLICommandTranspiler(java.lang.String endingToLookFor) -
Method Summary
Modifier and Type Method Description protected abstract java.lang.String[]createCMDLine(java.io.File targetJSFile, java.io.File source)voidioPoller(java.io.OutputStream fout, java.io.InputStream in, java.lang.Process proc)protected booleanshouldUpdate(java.io.File targetJSFile, java.io.File source)byte[]transpile(java.io.File f)indicates a file is being accessed. in dev mode this is called always (so its up to the implementation to check for filedate/modification).
-
Constructor Details
-
CLICommandTranspiler
public CLICommandTranspiler(java.lang.String endingToLookFor)
-
-
Method Details
-
transpile
Description copied from interface:TranspilerHookindicates a file is being accessed. in dev mode this is called always (so its up to the implementation to check for filedate/modification). In order to run an external transpiler, just run transpilation synchronous such that the given file is updated and return null. Alternatively an implementation might choose to just transpile dynamically and directly return byte[]. NOTE: transpilation is static. this means in production mode it will be called once on first resource access.- Specified by:
transpilein interfaceTranspilerHook- Parameters:
f- - the file being accessed (after resourcepath resolvment)- Returns:
- either (transpiled) file content or null. Should throw an exception in case an error occured during transpile.
- Throws:
TranspileException
-
shouldUpdate
protected boolean shouldUpdate(java.io.File targetJSFile, java.io.File source) -
createCMDLine
protected abstract java.lang.String[] createCMDLine(java.io.File targetJSFile, java.io.File source) -
ioPoller
public void ioPoller(java.io.OutputStream fout, java.io.InputStream in, java.lang.Process proc)
-