'make git-hooks' to install hooks

This commit is contained in:
Trent Mick 2015-09-01 10:55:39 -07:00
parent d76535b4d2
commit d9b104de4b
3 changed files with 50 additions and 13 deletions

View File

@ -32,6 +32,10 @@ test:
test-integration: test-integration:
./node_modules/.bin/tape test/integration/*.test.js ./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 .PHONY: dumpvar
dumpvar: dumpvar:
@if [[ -z "$(VAR)" ]]; then \ @if [[ -z "$(VAR)" ]]; then \

View File

@ -1,15 +1,13 @@
Triton # Triton
======
`triton` is a tool for Joyent's Triton (a.k.a. SmartDataCenter), either for on-premises installations `triton` is a CLI tool for Joyent's Triton (a.k.a. SmartDataCenter), either for
of Triton or Joyent's Public Cloud (<https://my.joyent.com>, on-premises installations of Triton or Joyent's Public Cloud
<http://www.joyent.com/products/compute-service>). (<https://my.joyent.com>, <http://www.joyent.com/products/compute-service>).
**This project is experimental and probably broken. For now, please look **This project is experimental and probably broken. For now, please look
at [node-smartdc](https://github.com/joyent/node-smartdc).** at [node-smartdc](https://github.com/joyent/node-smartdc).**
Installation ## Installation
------------
1. Install [node.js](http://nodejs.org/). 1. Install [node.js](http://nodejs.org/).
2. `npm install -g git://github.com/joyent/node-triton` 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 Before you can used the CLI you'll need a Joyent account, an SSH key uploaded
and `triton` configured with those account details. and `triton` configured with those account details.
Setup ## Setup
-----
TODO TODO
Example ## Example
-------
Get a quick overview of your account Get a quick overview of your account
@ -74,13 +70,13 @@ Or non-interactively
joyent_20150826T120743Z 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. - 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`. - 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 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 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 - 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 a signature of `function (options, callback)` instead of the sometimes
haphazard extra arguments. 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

22
tools/pre-commit.sh Executable file
View File

@ -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