Skip to content

Commit bffc1ec

Browse files
committed
Initial commit - v0.1.0
0 parents  commit bffc1ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1244
-0
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
indent_style = space
12+
indent_size = 2
13+
14+
[Makefile]
15+
indent_style = tab

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor
2+
.DS_Store

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
sudo: required
3+
dist: trusty
4+
language: python
5+
python: "2.7"
6+
7+
before_install:
8+
- sudo apt-get update -qq
9+
10+
install:
11+
- sudo apt-get -y install git
12+
- pip install ansible
13+
- make setup
14+
15+
script:
16+
- make test

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 Tom Marshall
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
PREFIX ?= /usr/local
2+
3+
install: bin/git-diff-ansible-vault
4+
@cp -p $< $(PREFIX)/$<
5+
6+
uninstall:
7+
@rm -f $(PREFIX)/bin/git-diff-ansible-vault
8+
9+
setup:
10+
@rm -rf vendor
11+
@mkdir -p vendor
12+
git clone --depth 1 git://github.com/sstephenson/bats.git vendor/bats
13+
14+
test:
15+
vendor/bats/bin/bats test
16+
17+
.PHONY: install uninstall setup test

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Git Diff Ansible Vault
2+
3+
[![Build Status](https://travis-ci.org/tommarshall/git-diff-ansible-vault.svg?branch=master)](https://travis-ci.org/tommarshall/git-diff-ansible-vault)
4+
5+
Running `git diff` on files encrypted with ansible vault results in some pretty unhelpful output.
6+
7+
`git-diff-ansible-vault` is custom git command that detects files encrypted with ansible vault within the diff, and safely decrypts them to reveal the true changes.
8+
9+
![git-diff-ansible-vault animated demo](https://github.com/tommarshall/git-diff-ansible-vault/blob/master/img/demo.gif)
10+
11+
## Installation
12+
13+
```sh
14+
$ git clone https://github.com/tommarshall/git-diff-ansible-vault.git
15+
$ cd git-diff-ansible-vault
16+
$ [sudo] make install
17+
```
18+
19+
By default, `git-diff-ansible-vault` is installed under `/usr/local`. To install it at an alternate location, specify a `PREFIX` when calling make. See the [Makefile](./Makefile) for details.
20+
21+
## Usage
22+
23+
```sh
24+
# diff uncommitted changes
25+
$ git diff-ansible-vault
26+
27+
# specify a revision and restrict the diff to a path
28+
$ git diff-ansible-vault -r master..some-branch -p path/to/dir
29+
30+
# specify a vault password file to avoid prompt (will look for .vault-pass by default)
31+
$ git diff-ansible-vault --vault-password-file .vaultpass
32+
33+
# show full usage information and options
34+
$ git diff-ansible-vault -h
35+
```
36+
37+
### Options
38+
39+
```
40+
-r, --revision <revision> show diff for git revision, e.g. master..some-branch
41+
-p, --path <path> restrict diff to path, e.g. support/config.yml
42+
--vault-password-file <path> vault password file path, defaults to .vault-pass
43+
--vault-only restrict diff to vault files only
44+
--color, --colour turn on coloured output
45+
--no-color, --no-colour turn off coloured diff
46+
--verbose display verbose output
47+
-v, --version output program version
48+
-h, --help output help information
49+
```
50+
51+
## Dependencies
52+
53+
Ansible 1.8 or newer, as the scritpt relies on `ansible-vault view`.
54+
55+
You'll need [colordiff](http://www.colordiff.org/) if you want colored output.
56+
57+
`brew install colordiff` on OS X, `apt-get install colordiff` on Debian/Ubuntu.
58+
59+
## Credits
60+
61+
* [JonathonMA's `ansible-vault-git-diff` script](https://gist.github.com/JonathonMA/83cf96008c078d5f907a)

0 commit comments

Comments
 (0)