Skip to content

Building

Ben Coleman edited this page May 4, 2018 · 7 revisions
  1. Install the Go programming language - Needs v1.7+
  2. Run go get -u github.com/nebloc/gitdo

This will install it to your $GOPATH/bin, but without any version numbers. It will also install the necessary dependencies. Open the $GOPATH/src/github.com/nebloc/gitdo directory, and run git submodule update --init to retrieve the docs and Trello plugin. Then on Linux or Mac, make install will build, and move folders to the correct location.

Installing Plugins and Hooks

As we have installed Gitdo to $GOPATH/bin, which should be a part of your $PATH as outlined in the How to Write Go Code docs, we just need to copy the Plugins and Hooks.

Gitdo has it's home folder in either %AppData%\Gitdo or ~/.gitdo (For this doc, replace $GITDO with the correct one). The folder should look like:

$GITDO/
  plugins/
    List of plugins
  hooks/
    pre-commit
    post-Commit
    push
  1. Create $GITDO directory, i.e. mkdir ~/.gitdo
  2. Copy the hooks folder into the directory, i.e. cp -r ./hooks ~/.gitdo
  3. Copy the plugins folder into the directory, i.e. cp -r ./plugins ~/.gitdo
Version numbers

Optionally, running this command will change the version number to 0.0.0-A5-Hash where hash is the current commit hash

go install -ldflags "-X main.version=0.0.0-A5-$(git rev-parse --short HEAD)"

Testing

Run unit tests using the command go test github.com/nebloc/gitdo/app/... The unit tests need a lot of work at the moment, and do use the temporary directory to create folders with git and hg repositories.

Example build:

Check that GOPATH is set, go version is higher than 1.7, and Gitdo is not installed

$ echo $GOPATH && go version && gitdo
/Users/bencoleman/go
go version go1.10.2 darwin/amd64
zsh: command not found: gitdo

Go get Gitdo (verbose, update, and download only flags)

$ go get -u -v -d github.com/nebloc/gitdo
github.com/nebloc/gitdo (download)
github.com/fatih/color (download)
github.com/spf13/cobra (download)
github.com/spf13/pflag (download)

Move into the directory and get the documentation and Trello plugin

$ cd $GOPATH/src/github.com/nebloc/gitdo/

$ git submodule update --init

On Linux or Mac, run the make command to move the plugins and hooks to ~/.gitdo and compile Gitdo to /usr/local/bin

$ make install
mkdir -p ~/.gitdo
cp -r ./resources/hooks ~/.gitdo/hooks/
cp -r ./resources/plugins ~/.gitdo/plugins/
go build -ldflags '-X "main.version=0.1.0 (b24fc27.20180504.103950)"' -o /usr/local/bin/gitdo .
Clone this wiki locally