Giter Site home page Giter Site logo

jitter's Introduction

Jitter

Simple continuous compilation for CoffeeScript, from the author of CoffeeScript: Accelerated JavaScript Development.

Jitter watches for new files and changes to files in the CoffeeScript source directory you specify, and compiles new JavaScript files as needed. No flags, no worries, just the sweet CoffeeScript compilation you need when you need it.

Bonus! Jitter gives you Growl notifications when compilation fails! See below for details.

Extra bonus! Jitter lets you automatically compile and run a second set of code after each successful compilation. That means that console-based tests are a breeze.

Extra, extra bonus! Jitter only replaces JS files when necessary (that is, when your CoffeeScript and JavaScript are out of sync). So no more meaningless timestamp changes!

Installing

You'll need to install Node.js and npm, the Node Package Manager. If you don't already have CoffeeScript installed (check with require('coffee-script') from Node), run

npm install -g coffee-script

(The -g flag tells npm that you want to do a global install, rather than just making the library available to a particular project.) And adding Jitter is just as easy:

npm install -g jitter

Make sure that the bin directory that coffee and jitter are installed to is on your PATH.

From source

To build and install Jitter from source:

git clone git://github.com/TrevorBurnham/Jitter.git
cd Jitter
npm install -g

Usage

Let's say you have a bunch of *.coffee files in the coffee directory, and want to compile them to the js directory. Then run:

jitter coffee js

Jitter runs in the background until you terminate it (Ctrl+C), watching for new changes.

Or let's say you want to take *.coffee files from the src directory and compile them to the current directory. Then run

jitter src .

To automatically run your tests after each change, specify a test directory:

jitter coffee js test

To generate source maps alongside the JavaScript files (Coffee will add the directives automatically):

jitter coffee js -m

To compile the JavaScript without the top-level function safety wrapper:

jitter coffee js -b

As an example, this would watch the coffee folder, compile into the js folder, generate sourcemaps, and run the tests:

jitter coffee js test -m

If you don't want to hear a beep sound on errors, pass '-s' as an option:

jitter coffee js -s

Tests will be compiled to js in place, then executed with node. Tests are automatically re-executed when changed.

Growl notifications

Jitter will display a growl notification whenever compilation fails, provided that you have growlnotify installed and on your PATH. This allows you to run Jitter silently in the background, not worrying about it until you get a syntax error.

Growl notifications are also shown if an error is encountered while running a test, including uncaught AssertionErrors.

Credits

Originally written by Trevor Burnham. Updated to CoffeeScript 0.9 by cj. Growl notification code pulled from work by Andrey Tarantsov. Post-compile hook code added by Scott Wadden (hiddenbek). Various patches by Nao izuka (iizukanao). Source maps support by Aria Minaei (AriaMinaei).

Copyright

Copyright (c) 2011 Trevor Burnham http://trevorburnham.com

Based on command.coffee by Jeremy Ashkenas http://jashkenas.github.com/coffee-script/documentation/docs/command.html

MIT licensed:

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

jitter's People

Contributors

ariaminaei avatar cj avatar dsrw avatar iizukanao avatar kenpratt avatar maffoobristol avatar notatestuser avatar purge avatar trevorburnham avatar unixbeard avatar wavded 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  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  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jitter's Issues

Better intro

It takes a while to get watching/testing/maps running with other tools. Jitter is perhaps the fastest way to get a project started with CoffeeScript. We should mention that in the intro.

Compile errors do not indicate filename or path

If there is an error while compiling a coffeescript file, Jitter output does not indicate which file caused the compile error. Compare this to the standard cofeescript compiler which gives you a full path/filename to the file which did not compile correctly.

This seems like an oversight as it is very difficult to use Jitter in practice -- is this the expected behavior?

Tests only run if test file changes

  1. Add the following directory/file structure:
    /myProject/coffee
    /myProject/coffee/aClass.coffee
    /myProject/coffee/tests/aClass_test.coffee (contains console.log "test should run")
    /myProject/src

  2. Run in myProject directory: jitter coffee src src/tests

  3. Edit /myProject/coffee/aClass.coffee and save, the following output is displayed from jitter:
    Recompiled coffee/aClass.coffee

n.b. test is not run

  1. Edit /myProject/coffee/tests/aClass_test.coffee (change to console.log "test will run") and save, the following output is displayed from jitter:
    Recompiled coffee/tests/aClass_test.coffee
    Running src/tests/aClass_test.js
    test will run

n.b. test run on edit of test file

  1. Edit /myProject/coffee/aClass.coffee and save, the following output is displayed from jitter:
    Recompiled coffee/aClass.coffee
    Running src/tests/aClass_test.js
    test will run

n.b. test run on all recompiles after test has been altered.

Target directory does not exist error...but it does

I'm trying to run jitter on OS X 10.7 and getting a weird failure. Jitter claims that the output directory doesn't exist, but it definitely does :). Has this ever been seen/reported before?

bsharon@skinny: ~/src/Bueller [⚡ master] $ jitter --bare /Users/bsharon/src/Bueller/py/static/js /Users/bsharon/src/Bueller/build/website/js
Target directory '/Users/bsharon/src/Bueller/build/website/js' does not exist.
bsharon@skinny: ~/src/Bueller [⚡ master] $ ls -ld /Users/bsharon/src/Bueller/build/website/js
drwxr-xr-x  2 bsharon  staff  68 Oct 26 15:43 /Users/bsharon/src/Bueller/build/website/js/

package versions:

├─┬ [email protected] 
│ ├── [email protected] 
│ └── [email protected] 

Use fs.watch() instead of fs.watchFile()

I often use fs_usage to monitor what apps are misbehaving on my system when my battery life seems to be running down faster than usual. And I've noticed that jitter will cause a lot of repeated filesystem activity when it's running, which for me is always.

I believe this is because jitter uses fs.watchFile(), which is polling-based on the Mac.

Can jitter be made to use fs.watch() instead? This is what coffee --watch uses and is the only reason I can't use jitter!

notify-send for linux peeps

Saw you had growl notifications, adding libnotify for Linux pretty simple, here is the command opts:

Usage:
  notify-send [OPTION...] <SUMMARY> [BODY] - create a notification

Help Options:
  -?, --help                        Show help options

Application Options:
  -u, --urgency=LEVEL               Specifies the urgency level (low, normal, critical).
  -t, --expire-time=TIME            Specifies the timeout in milliseconds at which to expire the notification.
  -i, --icon=ICON[,ICON...]         Specifies an icon filename or stock icon to display.
  -c, --category=TYPE[,TYPE...]     Specifies the notification category.
  -h, --hint=TYPE:NAME:VALUE        Specifies basic extra data to pass. Valid types are int, double, string and byte.
  -v, --version                     Version of the package.

e.g. at its basic implementation you could do notify-send "My Message"

Just a thought for us linux guys, if its interesting to you I can make a pull request.

Cannot call method apply of undefined

I've installed the latest node, coffeescript, and jitter. I get the following:

$ jitter coffee/ js/

/usr/local/lib/node_modules/jitter/node_modules/sink/lib/sink.js:42
    return cb ? func.apply(this, args.concat([function() {
                     ^
TypeError: Cannot call method 'apply' of undefined
    at /usr/local/lib/node_modules/jitter/node_modules/sink/lib/sink.js:42:22
    at Array.0 (/usr/local/lib/node_modules/jitter/node_modules/sink/lib/sink.js:9:14)
    at /usr/local/lib/node_modules/jitter/node_modules/sink/lib/sink.js:20:27
    at /usr/local/lib/node_modules/jitter/lib/jitter.js:111:7
    at Object.run (/usr/local/lib/node_modules/jitter/lib/jitter.js:96:12)
    at Object.<anonymous> (/usr/local/lib/node_modules/jitter/bin/jitter:8:26)
    at Module._compile (module.js:446:26)
    at Object..js (module.js:464:10)
    at Module.<anonymous> (module.js:353:31)
    at Function._load (module.js:311:12)
    at Array.0 (module.js:484:10)
    at EventEmitter._tickCallback (node.js:190:38)

I have the following:

  • Mac OSX Mountain Lion
  • node 0.6.18
  • CoffeeScript 1.6.3

Any suggestions?

Cakefile broken

When I run the cakefile:

[peterconerly@Jitter]$ cake jitter
{ run: [Function] }

/Users/peterconerly/code/Jitter/Cakefile:9
    return jitter('src', 'lib');
           ^
TypeError: object is not a function
  at Object.action (/Users/peterconerly/code/Jitter/Cakefile:9:12)
  at helpers.extend.invoke (/opt/local/lib/node_modules/coffee-script/lib/coffee-script/cake.js:42:26)
  at Object.exports.run (/opt/local/lib/node_modules/coffee-script/lib/coffee-script/cake.js:68:21)
  at Object.<anonymous> (/opt/local/lib/node_modules/coffee-script/bin/cake:7:38)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Function.Module.runMain (module.js:497:10)
  at startup (node.js:119:16)
  at node.js:906:3

Looks like we should be calling jitter.run instead-- I tried that, but the options aren't configured correctly so... I just ran with jitter on the command line since I already have a global version installed.

jitter is broken with node 0.4.1 / npm 0.3.1

due to dep. to sink, which is broken:

info fetch http://registry.npmjs.org/sink/-/sink-0.1.0.tgz
npm ERR! couldn't read package.json in /tmp/npm-1298834509217/1298834509217-0.8205640104133636/contents/package
npm ERR! Error installing [email protected]
npm ERR! Error: Failed to parse json
npm ERR! Unexpected token ILLEGAL
npm ERR! at jsonParseFail (/opt/local/lib/node/.npm/npm/0.3.9/package/lib/utils/read-json.js:89:11)
npm ERR! at /opt/local/lib/node/.npm/npm/0.3.9/package/lib/utils/read-json.js:82:14
npm ERR! at P (/opt/local/lib/node/.npm/npm/0.3.9/package/lib/utils/read-json.js:62:40)
npm ERR! at cb (/opt/local/lib/node/.npm/npm/0.3.9/package/lib/utils/graceful-fs.js:31:9)
npm ERR! at [object Object]. (fs.js:86:5)
npm ERR! at [object Object].emit (events.js:39:17)
npm ERR! at afterRead (fs.js:843:12)
npm ERR! JSON.parse
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse Note that package.json must be actual JSON, not
npm ERR! JSON.parse just a JavaScript object.
npm ERR! JSON.parse
npm ERR! JSON.parse This changed in npm 0.3.0, and is not a bug in npm.
npm ERR! JSON.parse Tell the package author to fix their package.json file.
npm ERR! JSON.parse

Add --join

How about adding --join like in coffee-command so that selected files will be compiled in to a single file with a single namespace?

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.