File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /.gopath
2+ /bin
3+ /libexec
4+ /log
5+ /repositories
6+ /vendor
Original file line number Diff line number Diff line change 1+ brew "go"
Original file line number Diff line number Diff line change 1+ ROOTDIR := $(abspath $(CURDIR ) )
2+ export ROOTDIR
3+
4+ GO := $(CURDIR ) /script/go
5+ GOFMT := $(CURDIR ) /script/gofmt
6+
7+ BIN := libexec
8+
9+ GOBIN := $(abspath $(BIN ) )
10+ export GOBIN
11+
12+ GOFLAGS := \
13+ --tags "static" \
14+ -ldflags "-X main.BuildVersion=$(shell git rev-parse HEAD) -X main.BuildDescribe=$(shell git describe --tags --always --dirty) "
15+ GO_CMDS := \
16+ $(BIN ) /git-sizer
17+ GO_PKGS := $(shell cd .gopath/src; find github.com/github/git-sizer/ -type f -name '* .go' | xargs -n1 dirname | sort -u)
18+ SHELL_CMDS :=
19+ RUBY_CMDS :=
20+ DEPS := \
21+ github.com/stretchr/testify
22+ GO_SRCS := $(shell find src -type f -name '* .go')
23+
24+ TEST_SH_RUNNERS := 2
25+
26+ .PHONY : all
27+ all : $(GO_CMDS ) $(SHELL_CMDS ) $(RUBY_CMDS )
28+
29+ libexec/% : bin/% $(GO_SRCS )
30+ $(GO ) install $(GOFLAGS ) github.com/github/git-sizer/$*
31+
32+ .PRECIOUS : bin/%
33+ bin/% : src/shim.sh
34+ mkdir -p bin
35+ cp $< bin/$*
36+ chmod +x bin/$*
37+
38+ .PHONY : $(SHELL_CMDS )
39+ $(SHELL_CMDS ) : $(BIN ) /% : bin/% .sh
40+ cp $< $@
41+
42+ .PHONY : $(RUBY_CMDS )
43+ $(RUBY_CMDS ) : $(BIN ) /% : bin/% .rb
44+ cp $< $@
45+
46+ .PHONY : deps
47+ deps :
48+ $(GO ) get $(DEPS )
49+
50+ .PHONY : test
51+ test : gotest shtest
52+
53+ .PHONY : gotest
54+ gotest :
55+ $(GO ) test -timeout 60s $(GOFLAGS ) $(GO_PKGS )
56+
57+ .PHONY : shtest
58+ shtest : libexec/git-sizer
59+ ls -1 test/test-* .sh | xargs -I % -P $(TEST_SH_RUNNERS ) -n 1 $(SHELL ) % --batch
60+
61+ .PHONY : gofmt
62+ gofmt :
63+ find src test -name " *.go" -print0 | xargs -0 $(GOFMT ) -l -w | sed -e ' s/^/Fixing /'
64+
65+ .PHONY : goimports
66+ goimports :
67+ find src -name " *.go" -print0 | xargs -0 goimports -l -w -e
68+
69+ .PHONY : govet
70+ govet :
71+ $(GO ) vet $(GO_PKGS )
72+
73+ .PHONY : clean
74+ clean :
75+ rm -rf bin libexec
Original file line number Diff line number Diff line change 1+ # git-sizer
2+
3+ Is your Git repository busting at the seams?
4+
5+ ## Getting started
6+
7+ 1 . Build:
8+
9+ script/bootstrap
10+ make
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ cd $( dirname " $0 " ) /..
6+
7+ if [[ " $( uname -s) " = " Darwin" ]]; then
8+ brew bundle
9+ fi
10+ script/ensure-go-installed
11+
12+ rm -f .gopath/src/github.com/github/git-sizer
13+ mkdir -p .gopath/src/github.com/github
14+ ln -s " $PWD /src" .gopath/src/github.com/github/git-sizer
15+
16+ make deps
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ cd $( dirname " $0 " ) /..
6+
7+ make
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ cd $( dirname " $0 " ) /..
6+
7+ script/install-vendored-go
8+ script/bootstrap
9+ script/build
10+ make test
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ ROOTDIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd ) "
4+
5+ # Is go installed, and at least 1.7?
6+ go_ok () {
7+ case " $( go version 2> /dev/null | sed -n ' s/.*go\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/p' | head -n 1) " in
8+ " " |0.* |1.[0123456])
9+ false ;;
10+ * )
11+ true ;;
12+ esac
13+ }
14+
15+ # If a local go is installed, use it.
16+ set_up_vendored_go () {
17+ GO_VERSION=go1.8.1
18+ VENDORED_GOROOT=" $ROOTDIR /vendor/$GO_VERSION /go"
19+ if [ -x " $VENDORED_GOROOT /bin/go" ]; then
20+ export GOROOT=" $VENDORED_GOROOT "
21+ export PATH=" $GOROOT /bin:$PATH "
22+ fi
23+ }
24+
25+ set_up_vendored_go
26+
27+ if ! go_ok; then
28+ script/install-vendored-go > /dev/null || exit 1
29+ set_up_vendored_go
30+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ export ROOTDIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd ) "
6+ . $ROOTDIR /script/ensure-go-installed
7+ export GOPATH=$ROOTDIR /.gopath
8+
9+ exec " $( basename $0 ) " " $@ "
Original file line number Diff line number Diff line change 1+ go
You can’t perform that action at this time.
0 commit comments