Cakefile |
|
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. |
fs = require 'fs'
{spawn, exec} = require 'child_process'
glob = require 'glob'
paths =
src: 'src'
dest: './'
option '-w', '--watch', 'Invokes watch with coffee compilation'
|
Internal functions |
cmds =
coffee: './node_modules/coffee-script/bin/coffee'
lint: './node_modules/coffeelint/bin/coffeelint'
test: './node_modules/jasmine/bin/jasmine.js'
doc: './node_modules/docker/docker'
launch = (cmd, args) ->
runner = spawn cmd, args
runner.stdout.pipe process.stdout
runner.stderr.pipe process.stderr
runner.on 'exit', (code, signal) -> process.exit code if code isnt 0
|
Tasks |
task 'build', 'Build MyPads from src repository', (options) ->
args = ['-c', '-o', paths.dest]
args.push '-w' if options.watch
args.push paths.src
launch cmds.coffee, args
task 'lint', 'Linting coffeescript files', ->
glob "#{paths.src}/**/?*.coffee.md", (err, files) ->
launch cmds.lint, files
task 'test', 'Backend testing with jasmine', -> launch cmds.test
task 'doc', 'Technical documentation generation with docker (fork of docco)', ->
launch cmds.doc, ['-I', '-x', 'node_modules,doc', '-i', '-o', 'doc']
task 'default', 'Default tasks', ->
invoke 'build'
invoke 'lint'
invoke 'test'
|