Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Minimalist-omakase build tool for node.js projects
JavaScript

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
conf
lib
test
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
package.json

README.md

Bob http://travis-ci.org/cliffano/bob

Convention-based build tool for Node.js projects.

This is handy for building (linting, testing the code, checking test code coverage, generating documentation, packaging artifact, etc) a Node.js project, with a minimal-or-zero configuration, by following a set of common convention.

There are two Bob modes, human and robot. By default Bob runs in human mode, generating output in human-readable format (e.g. test result in a plain text list). When robot mode is used, Bob will generate output in machine-parsable format (e.g. test result in XML), which is handy when you're using a continuous integration server that consumes XML files for rendering reports and charts.

Bob works on OS X and *nix, requires Cygwin on Windows.

Installation

npm install -g bob

Project Convention

A project must contain:

  • package.json file, with at least name and version info
  • lib/ directory, containing *.js source files
  • test/ directory, containing *.js test files

Usage

Run Bob from project directory: (same level as package.json file)

bob clean lint test coverage ...

Run Bob in robot mode: (if unspecified, BOB_MODE defaults to human)

BOB_MODE=robot bob clean lint test coverage

Run Bob with verbose output: (display make arguments and shell commands)

BOB_MODE=robot bob --verbose clean lint test coverage

Run Bob with specific environment: (if unspecified, NODE_ENV defaults to development)

NODE_ENV=production bob start

Targets

Target Description Types Parameters
dep Install dependencies specified in package.json file by executing npm install . . - -
rmdep Remove dependencies in node_modules directory. - -
tools Global install the tools used by Bob (e.g. jshint, nodelint, mocha, vows, etc). - -
rmtools Remove global installation of those tools. - -
clean Delete .bob directory and *.log files. - -
lint Lint *.js files in lib/ and test/ directories. jshint (default), nodelint bin, opts, files
style Run style checker against *.js files in lib/ directory. jscheckstyle (default) bin, opts, files
test Execute *.js test files in test/ directory. mocha (default), vows. If {scripts.test} is configured in package.json, then npm test will be executed instead. bin, opts, files
coverage Check code coverage. mocha (default), vows bin, opts, files
package Create a .tar.gz package file in .bob/artifact/ directory, along with md5 and sha1 checksums of the artifact file. - src
publish Publish artifact file to an artifact repository. npm (default), ivy ivy: user, key, host, port, dir
send Send the artifact file to a remote server. scp (default), ftp user, key, host, port, dir
stop Stop the app by executing node {name}.js stop . If scripts.stop is configured in package.json, then npm stop will be executed instead. - -
start Start the app by executing node {name}.js start . If scripts.start is configured in package.json, then npm start will be executed instead. - -
restart Restart the app by executing node {name}.js restart . If scripts.restart is configured in package.json, then npm restart will be executed instead. - -
status Display app status by executing node {name}.js status . - -
versionup Upgrade patch version number in package.json file. - -
versionup-minor Upgrade minor version number in package.json file. - -
versionup-major Upgrade major version number in package.json file. - -
nuke Kill all processes with command containing the word 'node' . - -

Config

To override the default setting, create .bob.json file in project directory (same level as package.json file). Target type and parameters can be overridden, here are some examples:

To use nodelint instead of the default jshint when running bob lint:

{
  "lint": {
    "type": "nodelint"
  }
}

To use nodelint instead of the default jshint, and to lint the files in src directory instead of the default lib and test directories, when running bob lint:

{
  "lint": {
    "type": "nodelint",
    "files": "src"
  }
}

Continuous Integration

Travis CI

Configure Bob in .travis.yml file:

before_install: "npm install -g bob"
script: "bob clean lint test coverage"

Jenkins CI

Configure Bob in a Jenkins job with shell script build step:

npm install -g bob
bob clean lint test coverage
Something went wrong with that request. Please try again.