diff --git a/Makefile b/Makefile index 9c2dff8..7fd1631 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,10 @@ test: test-integration: ./node_modules/.bin/tape test/integration/*.test.js +.PHONY: git-hooks +git-hooks: + [[ -e .git/hooks/pre-commit ]] || ln -s ./tools/pre-commit.sh .git/hooks/pre-commit + .PHONY: dumpvar dumpvar: @if [[ -z "$(VAR)" ]]; then \ diff --git a/README.md b/README.md index 617aec1..b261101 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,13 @@ -Triton -====== +# Triton -`triton` is a tool for Joyent's Triton (a.k.a. SmartDataCenter), either for on-premises installations -of Triton or Joyent's Public Cloud (, -). +`triton` is a CLI tool for Joyent's Triton (a.k.a. SmartDataCenter), either for +on-premises installations of Triton or Joyent's Public Cloud +(, ). **This project is experimental and probably broken. For now, please look at [node-smartdc](https://github.com/joyent/node-smartdc).** -Installation ------------- +## Installation 1. Install [node.js](http://nodejs.org/). 2. `npm install -g git://github.com/joyent/node-triton` @@ -22,13 +20,11 @@ Verify that installed and is on your PATH: Before you can used the CLI you'll need a Joyent account, an SSH key uploaded and `triton` configured with those account details. -Setup ------ +## Setup TODO -Example -------- +## Example Get a quick overview of your account @@ -74,13 +70,13 @@ Or non-interactively joyent_20150826T120743Z -### node-triton differences with node-smartdc +## node-triton differences with node-smartdc - There is a single `sdc` command instead of a number of `sdc-FOO` commands. - The `SDC_USER` envvar is accepted in preference to `SDC_ACCOUNT`. -### cloudapi2.js differences with node-smartdc/lib/cloudapi.js +## cloudapi2.js differences with node-smartdc/lib/cloudapi.js The old node-smartdc module included an lib for talking directly to the SDC Cloud API (node-smartdc/lib/cloudapi.js). Part of this module (node-sdc) is a @@ -96,3 +92,18 @@ differences and backward incompatibilities are discussed here. - All (all? at least at the time of this writing) methods in cloudapi2.js have a signature of `function (options, callback)` instead of the sometimes haphazard extra arguments. + + +## Development Hooks + +Before commiting be sure to: + + make check # lint and style checks + make test # run unit tests + +A good way to do that is to install the stock pre-commit hook in your +clone via: + + make git-hooks + + diff --git a/tools/pre-commit.sh b/tools/pre-commit.sh new file mode 100755 index 0000000..48f2d61 --- /dev/null +++ b/tools/pre-commit.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +# +# Copyright (c) 2015, Joyent, Inc. +# + +# +# A suggested git pre-commit hook for developers. Install it via: +# +# make git-hooks +# + +set -o errexit +set -o pipefail + +make check +make test