minimalistic task manager

Minimalistic task manager.

browserify = bin 'browserify/cmd'
uglify = bin 'uglify-js/uglifyjs'
target 'dist.js''entry.js'->
    browserify 'entry.js -o dist.js'
target 'dist.min.js''dist.js'->
    uglify 'dist.js -o dist.min.js'
task 'clean'->
    rm '-rf logs/*.txt'

$ npm install -g indev

Create a new Devfile, and code your tasks in JavaScript or CoffeeScript.

task 'run'->
    exec 'node app'


task('run', function(){
    exec('node app');

To run:

$ indev run

ShellJS is available in Devfiles globally.

task 'hello/world'->
    mkdir '-p''hello/world'
    write 'hello/world/README.txt''Hello World!'
    cd 'lib'
    cp 'stuff/*''../hello/world'
    ls './'(file) ->
        debug "Copied lib/#{file} to hello/world/."

The parameters after a task name considered as files to watch. Following task will watch run.js and lib/ and restart the task on any change:

task 'start''lib''run.js'->
    exec.async 'node app'

The first parameter of the given callback will have the list of changed files;

task 'watch''lib/**/*.js''run.js'(files) ->
    files.forEach (file) ->
        debug "#{file} has been changed."

target is an alias that would make your tasks look more meaningful.

target 'dist.js''index.js''lib'->
    exec 'onejs index -o dist.js'
uglify = cmd "uglifyjs"
task "minify"->
  uglify "src.js -o min.js"
  debug "done"

All commands are run synchronously by default. Use async method to change it:

staticServer = cmd.async "python -m SimpleHTTPServer"
apiServer = cmd.async "node server"
all "api-server""serve-static"
task "api-server"->
    debug "api server up"
task "serve-static"->
    debug "static server up"

Calling indev on this file will start these two servers at the time.

stylus = bin "stylus" # node_modules/stylus/bin/stylus 
uglify = bin "uglify-js/uglifyjs" # node_modules/uglify-js/bin/uglifyjs 
serve = bin.async "serve" # node_modules/serve/bin/serve 
target "dist.js"->
    uglify "index.js -o dist.js"
target "style.css"->
    stylus "style.styl"
target "serve"->
all 'run''public/js''public/css'
task 'run''./app.js''./lib'->
    exec.async 'node app'
target 'public/js''javascripts'->
    cd 'frontend'
    exec 'browserify javascripts/main.js -o public/bundle.js'
target 'public/css''styles'->
    cd 'frontend'
    exec 'stylus styles -o public/css'

To run all tasks:

$ indev

To run specific tasks;

$ indev public/js public/css

Define aliases to type less:

alias 'assets''public/js''public/css'
$ indev assets
$ DEBUG=indev:* indev