Skip to content

Commit c450028

Browse files
authored
Merge pull request #149 from jacebrowning/release/v1.3
Release v1.3
2 parents 93eecc7 + e08cddc commit c450028

30 files changed

Lines changed: 716 additions & 256 deletions

.pylint.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[MESSAGES CONTROL]
22

3-
disable=locally-disabled,fixme,too-few-public-methods,too-many-public-methods,invalid-name,global-statement,too-many-ancestors,missing-docstring,no-member
3+
disable=locally-disabled,fixme,too-few-public-methods,too-many-public-methods,invalid-name,global-statement,too-many-ancestors,missing-docstring,no-member,too-many-arguments
44

55
[FORMAT]
66

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Revision History
22

3+
## 1.3 (2017/02/03)
4+
5+
- Added `init` command to generate sample configuration files.
6+
- Added support for post-install scripts on dependencies.
7+
- Updated configuration format to support `null` for links.
8+
39
## 1.2 (2017/01/08)
410

511
- Added preliminary Windows support (@StudioEtrange).

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
### Requirements
66

77
* Make:
8-
* Windows: https://cygwin.com/install.html
9-
* Mac: https://developer.apple.com/xcode
10-
* Linux: https://www.gnu.org/software/make (likely already installed)
8+
* Windows: http://mingw.org/download/installer
9+
* Mac: http://developer.apple.com/xcode
10+
* Linux: http://www.gnu.org/software/make
1111
* Pandoc: http://johnmacfarlane.net/pandoc/installing.html
1212
* Graphviz: http://www.graphviz.org/Download.php
1313

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**The MIT License (MIT)**
44

5-
Copyright © 2016, Jace Browning
5+
Copyright © 2017, Jace Browning
66

77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ watch: install .clean-test ## Continuously run all CI tasks when files chanage
7575

7676
.PHONY: demo
7777
demo: install
78-
$(BIN)/gitman install
79-
$(BIN)/gitman update
78+
$(BIN)/gitman install --force # some scripts have intentional errors
79+
$(BIN)/gitman update --force # some scripts have intentional errors
8080
$(BIN)/gitman list
8181
$(BIN)/gitman lock
8282
$(BIN)/gitman uninstall
@@ -120,7 +120,7 @@ $(PIP): $(PYTHON)
120120
@ touch $@
121121

122122
$(PYTHON):
123-
$(SYS_PYTHON) -m venv --clear $(ENV)
123+
$(SYS_PYTHON) -m venv $(ENV)
124124

125125
# CHECKS #######################################################################
126126

@@ -132,15 +132,15 @@ PYDOCSTYLE := $(BIN)/pydocstyle
132132
check: pylint pycodestyle pydocstyle ## Run linters and static analysis
133133

134134
.PHONY: pylint
135-
pylint: install ## Check for code issues
135+
pylint: install
136136
$(PYLINT) $(PACKAGES) $(CONFIG) --rcfile=.pylint.ini
137137

138138
.PHONY: pycodestyle
139-
pycodestyle: install ## Check for code conventions
139+
pycodestyle: install
140140
$(PYCODESTYLE) $(PACKAGES) $(CONFIG) --config=.pycodestyle.ini
141141

142142
.PHONY: pydocstyle
143-
pydocstyle: install ## Check for docstring conventions
143+
pydocstyle: install
144144
$(PYDOCSTYLE) $(PACKAGES) $(CONFIG)
145145

146146
# TESTS ########################################################################
@@ -152,7 +152,7 @@ COVERAGE_SPACE := $(BIN)/coverage.space
152152
RANDOM_SEED ?= $(shell date +%s)
153153

154154
PYTEST_CORE_OPTS := -ra -vv
155-
PYTEST_COV_OPTS := --cov=$(PACKAGE) --no-cov-on-fail --cov-report=term-missing --cov-report=html
155+
PYTEST_COV_OPTS := --cov=$(PACKAGE) --no-cov-on-fail --cov-report=term-missing:skip-covered --cov-report=html
156156
PYTEST_RANDOM_OPTS := --random --random-seed=$(RANDOM_SEED)
157157

158158
PYTEST_OPTS := $(PYTEST_CORE_OPTS) $(PYTEST_COV_OPTS) $(PYTEST_RANDOM_OPTS)
@@ -162,24 +162,24 @@ FAILURES := .cache/v/cache/lastfailed
162162
REPORTS ?= xmlreport
163163

164164
.PHONY: test
165-
test: test-all
165+
test: test-all ## Run unit and integration tests
166166

167167
.PHONY: test-unit
168-
test-unit: install ## Run the unit tests
168+
test-unit: install
169169
@- mv $(FAILURES) $(FAILURES).bak
170170
$(PYTEST) $(PYTEST_OPTS) $(PACKAGE) --junitxml=$(REPORTS)/unit.xml
171171
@- mv $(FAILURES).bak $(FAILURES)
172172
$(COVERAGE_SPACE) $(REPOSITORY) unit
173173

174174
.PHONY: test-int
175-
test-int: install ## Run the integration tests
175+
test-int: install
176176
@ if test -e $(FAILURES); then TEST_INTEGRATION=true $(PYTEST) $(PYTEST_OPTS_FAILFAST) tests; fi
177177
@ rm -rf $(FAILURES)
178178
TEST_INTEGRATION=true $(PYTEST) $(PYTEST_OPTS) tests --junitxml=$(REPORTS)/integration.xml
179179
$(COVERAGE_SPACE) $(REPOSITORY) integration
180180

181181
.PHONY: test-all
182-
test-all: install ## Run all the tests
182+
test-all: install
183183
@ if test -e $(FAILURES); then TEST_INTEGRATION=true $(PYTEST) $(PYTEST_OPTS_FAILFAST) $(PACKAGES); fi
184184
@ rm -rf $(FAILURES)
185185
TEST_INTEGRATION=true $(PYTEST) $(PYTEST_OPTS) $(PACKAGES) --junitxml=$(REPORTS)/overall.xml
@@ -199,23 +199,23 @@ PDOC_INDEX := docs/apidocs/$(PACKAGE)/index.html
199199
MKDOCS_INDEX := site/index.html
200200

201201
.PHONY: doc
202-
doc: uml pdoc mkdocs ## Run documentation generators
202+
doc: uml pdoc mkdocs ## Generate documentaiton
203203

204204
.PHONY: uml
205-
uml: install docs/*.png ## Generate UML diagrams for classes and packages
205+
uml: install docs/*.png
206206
docs/*.png: $(MODULES)
207207
$(PYREVERSE) $(PACKAGE) -p $(PACKAGE) -a 1 -f ALL -o png --ignore tests
208208
- mv -f classes_$(PACKAGE).png docs/classes.png
209209
- mv -f packages_$(PACKAGE).png docs/packages.png
210210

211211
.PHONY: pdoc
212-
pdoc: install $(PDOC_INDEX) ## Generate API documentaiton with pdoc
212+
pdoc: install $(PDOC_INDEX)
213213
$(PDOC_INDEX): $(MODULES)
214214
$(PDOC) --html --overwrite $(PACKAGE) --html-dir docs/apidocs
215215
@ touch $@
216216

217217
.PHONY: mkdocs
218-
mkdocs: install $(MKDOCS_INDEX) ## Build the documentation site with mkdocs
218+
mkdocs: install $(MKDOCS_INDEX)
219219
$(MKDOCS_INDEX): mkdocs.yml docs/*.md
220220
ln -sf `realpath README.md --relative-to=docs` docs/index.md
221221
ln -sf `realpath CHANGELOG.md --relative-to=docs/about` docs/about/changelog.md
@@ -224,7 +224,7 @@ $(MKDOCS_INDEX): mkdocs.yml docs/*.md
224224
$(MKDOCS) build --clean --strict
225225

226226
.PHONY: mkdocs-live
227-
mkdocs-live: mkdocs ## Launch and continuously rebuild the mkdocs site
227+
mkdocs-live: mkdocs
228228
eval "sleep 3; open http://127.0.0.1:8000" &
229229
$(MKDOCS) serve
230230

README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ $ python setup.py install
3131

3232
## Setup
3333

34-
Create a configuration file (`gitman.yml` or `.gitman.yml`) in the root of your working tree:
34+
Generate a sample configuration file:
35+
36+
```sh
37+
$ gitman init
38+
```
39+
40+
or manually create one (`gitman.yml` or `.gitman.yml`) in the root of your working tree:
3541

3642
```yaml
3743
location: vendor/gitman
@@ -43,6 +49,11 @@ sources:
4349
repo: https://github.com/jonreid/XcodeCoverage
4450
rev: master
4551
link: Tools/XcodeCoverage
52+
- name: trufflehog
53+
repo: https://github.com/dxa4481/truffleHog
54+
rev: master
55+
scripts:
56+
- chmod a+x truffleHog.py
4657
```
4758
4859
Ignore the dependency storage location:
@@ -69,11 +80,12 @@ $ gitman update
6980

7081
which will essentially:
7182

72-
1. create a working tree at `<root>`/`<location>`/`<name>`
73-
2. fetch from `repo` and checkout the specified `rev`
74-
3. symbolically link each `<location>`/`<name>` from `<root>`/`<link>` (if specified)
75-
4. repeat for all nested working trees containing a configuration file
76-
5. record the actual commit SHAs that were checked out (with `--lock` option)
83+
1. Create a working tree at `<root>`/`<location>`/`<name>`
84+
2. Fetch from `repo` and checkout the specified `rev`
85+
3. Symbolically link each `<location>`/`<name>` from `<root>`/`<link>` (if specified)
86+
4. Repeat for all nested working trees containing a configuration file
87+
5. Record the actual commit SHAs that were checked out (with `--lock` option)
88+
6. Run optional post-install scripts for each dependency
7789

7890
where `rev` can be:
7991

bin/verchew

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ from collections import OrderedDict
3636
from subprocess import Popen, PIPE, STDOUT
3737
import logging
3838

39-
__version__ = '0.5'
39+
__version__ = '1.0'
4040

4141
PY2 = sys.version_info[0] == 2
4242
CONFIG_FILENAMES = ['.verchew', '.verchewrc', 'verchew.ini', '.verchew.ini']
@@ -190,12 +190,19 @@ def show(text, start='', end='\n', head=False):
190190
sys.stdout.flush()
191191

192192

193-
def _(word, utf8=None, tty=None):
193+
def _(word, is_tty=None, supports_utf8=None, supports_ansi=None):
194194
"""Format and colorize a word based on available encoding."""
195195
formatted = word
196196

197-
style_support = sys.stdout.encoding == 'UTF-8' if utf8 is None else utf8
198-
color_support = sys.stdout.isatty() if tty is None else tty
197+
if is_tty is None:
198+
is_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
199+
if supports_utf8 is None:
200+
supports_utf8 = sys.stdout.encoding == 'UTF-8'
201+
if supports_ansi is None:
202+
supports_ansi = sys.platform != 'win32' or 'ANSICON' in os.environ
203+
204+
style_support = supports_utf8
205+
color_support = is_tty and supports_ansi
199206

200207
if style_support:
201208
formatted = STYLE.get(word, word)

docs/interfaces/api.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
All of the [command-line interface](cli.md) functionality is available from the Python package by importing `gitman`.
44

5+
## Init
6+
7+
To generate a sample configuration for a new project, call:
8+
9+
```python
10+
gitman.init()
11+
```
12+
513
## Install
614

715
To clone/checkout the specified dependencies, call:
@@ -15,7 +23,8 @@ with optional arguments:
1523
- `*names`: optional list of dependency directory names to filter on
1624
- `root`: specifies the path to the root working tree
1725
- `depth`: number of levels of dependencies to traverse
18-
- `force`: indicates uncommitted changes can be overwritten
26+
- `force`: indicates uncommitted changes can be overwritten and
27+
script errors can be ignored
1928
- `fetch`: indicates the latest branches should always be fetched
2029
- `clean`: indicates untracked files should be deleted from dependencies
2130

@@ -33,7 +42,8 @@ with optional arguments:
3342
- `root`: specifies the path to the root working tree
3443
- `depth`: number of levels of dependencies to traverse
3544
- `recurse`: indicates nested dependencies should also be updated
36-
- `force`: indicates uncommitted changes can be overwritten
45+
- `force`: indicates uncommitted changes can be overwritten and
46+
script errors can be ignored
3747
- `clean`: indicates untracked files should be deleted from dependencies
3848
- `lock`: indicates actual dependency versions should be recorded
3949

docs/interfaces/cli.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
After setting up `gitman` with a [configuration file](../index.md#setup), various commands can be run to manage these Git-controlled source dependencies.
44

5+
## Init
6+
7+
To generate a sample configuration for a new project, run:
8+
9+
```sh
10+
$ gitman init
11+
```
12+
513
## Install
614

715
To clone/checkout the specified dependencies, run:
@@ -34,7 +42,7 @@ It will only fetch from the repository if needed. To always fetch, run:
3442
gitman install --fetch
3543
```
3644

37-
It will exit with an error if there are any uncommitted changes in dependencies. To overwrite all changes, run:
45+
It will exit with an error if there are any uncommitted changes in dependencies or a post-install script fails. To overwrite all changes or ignore script failures, run:
3846

3947
```sh
4048
gitman install --force

docs/interfaces/plugin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Delete all untracked files in dependencies by instead running:
1616
git deps --clean
1717
```
1818

19-
Git will exit with an error if there are any uncommitted changes in dependencies. To overwrite all changes, run:
19+
Git will exit with an error if there are any uncommitted changes in dependencies or a post-install script fails. To overwrite all changes or ignore script failures, run:
2020

2121
```sh
2222
git deps --force

0 commit comments

Comments
 (0)