jsc, a Ruby REST API to Google Closure Compiler web service

by sub
http://github.com/sub/jsc

DESCRIPTION:

A simple and clear Ruby REST API to Google Closure Compiler service.

FEATURES:

The package comes with a jsc commands which accepts several options, run

jsc --help

for help.

More in details:

  • Ruby API actually is a single function call (ex: JSCompiler.compile(file_name, “statistics”, “SIMPLE_OPTIMIZATIONS”) )

  • Handling of JSON responses, parse and print them (same output of the Google web interface!)

  • Handling of Server Errors responses

  • Compile a piece of code, a file or a whole directory

  • Emacs snippet to compile code your code for errors and warnings

Check Google API Reference for more info about accepted parameters.

SYNOPSIS:

Compile a file:

ruby bin/jsc -f js/compiled_code.js

Compile a file, check for errors:

ruby bin/jsc -f js/errors.js -e

Compile a file, check for warnings:

ruby bin/jsc -f js/warnings.js -w

Compile a file and get compression stats:

ruby bin/jsc -f js/compiled_code.js -s

Compile a piece of code, check for errors:

ruby bin/jsc -e "function("

NOTE: the library is a single file, so you can include it and just call the JSCompiler.compile(file_name, operations, compilation_level) function everywhere in your code. Check the plugins dir for samples or snippets. UPDATE 20091212: bin file plugins/bin/google_closure_compiler not working at the moment due to changes in project name and structure

EMACS SNIPPETS

Wants to compile your code right from Emacs?

Copy

plugins/jsc.el

to your emacs load-path and restart Emacs.

Now, select the code to compile and run:

  • CcJe to check for errors

  • CcJw to check for warnings.

REQUIREMENTS:

No requirements

INSTALL:

Create your gem with:

rake gem:package

In order to install it, run:

rake gem:install

LICENSE:

GNU General Public License (GPLv3)