Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
Added install.sh script; Changelog entry; Changelog parenths fixes; R…
Browse files Browse the repository at this point in the history
…EAMDE addition
  • Loading branch information
astromechza committed Jan 25, 2018
1 parent ad20f95 commit aa9d47c
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 15 deletions.
35 changes: 20 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,47 @@ IMPROVEMENTS:

# v0.4.1

NEW FEATURES:

* Added `install.sh` script. ([#1533](https://github.com/golang/dep/pull/1533))

BUG FIXES:

* Fix per-project prune option handling ([#1570](https://github.com/golang/dep/pull/1570))

# v0.4.0

NEW FEATURES:

* Absorb `dep prune` into `dep ensure`. ([#944](https://github.com/golang/dep/issues/944))
* Add support for importing from [glock](https://github.com/robfig/glock) based projects. ([#1422](https://github.com/golang/dep/pull/1422)
* Add support for importing from [govendor](https://github.com/kardianos/govendor) based projects. ([#815](https://github.com/golang/dep/pull/815)
* Add support for importing from [govendor](https://github.com/kardianos/govendor) based projects. ([#815](https://github.com/golang/dep/pull/815))
* Allow override of cache directory location using environment variable `DEPCACHEDIR`. ([#1234](https://github.com/golang/dep/pull/1234))
* Add support for template output in `dep status`. ([#1389](https://github.com/golang/dep/pull/1389)
* Each element in a multi-item TOML array is output on its own line. ([#1461](https://github.com/golang/dep/pull/1461)
* Add support for template output in `dep status`. ([#1389](https://github.com/golang/dep/pull/1389))
* Each element in a multi-item TOML array is output on its own line. ([#1461](https://github.com/golang/dep/pull/1461))

BUG FIXES:

* Releases targeting Windows now have a `.exe` suffix. ([#1291](https://github.com/golang/dep/pull/1291)
* Adaptively recover from dirty and corrupted git repositories in cache. ([#1279](https://github.com/golang/dep/pull/1279)
* Suppress git password prompts in more places. ([#1357](https://github.com/golang/dep/pull/1357)
* Fix `-no-vendor` flag for `ensure -update`. ([#1361](https://github.com/golang/dep/pull/1361)
* Validate `git ls-remote` output and ignore all malformed lines. ([#1379](https://github.com/golang/dep/pull/1379)
* Support [gopkg.in version zero](http://labix.org/gopkg.in#VersionZero). ([#1243](https://github.com/golang/dep/pull/1243)
* Fix how dep status print revision constraints. ([#1421](https://github.com/golang/dep/pull/1421)
* Add optional `-v` flag to ensure sub command's syntax. ([#1458](https://github.com/golang/dep/pull/1458)
* Allow URLs containing ports in `Gopkg.toml` `source` fields. ([#1509](https://github.com/golang/dep/pull/1509)
* Releases targeting Windows now have a `.exe` suffix. ([#1291](https://github.com/golang/dep/pull/1291))
* Adaptively recover from dirty and corrupted git repositories in cache. ([#1279](https://github.com/golang/dep/pull/1279))
* Suppress git password prompts in more places. ([#1357](https://github.com/golang/dep/pull/1357))
* Fix `-no-vendor` flag for `ensure -update`. ([#1361](https://github.com/golang/dep/pull/1361))
* Validate `git ls-remote` output and ignore all malformed lines. ([#1379](https://github.com/golang/dep/pull/1379))
* Support [gopkg.in version zero](http://labix.org/gopkg.in#VersionZero). ([#1243](https://github.com/golang/dep/pull/1243))
* Fix how dep status print revision constraints. ([#1421](https://github.com/golang/dep/pull/1421))
* Add optional `-v` flag to ensure sub command's syntax. ([#1458](https://github.com/golang/dep/pull/1458))
* Allow URLs containing ports in `Gopkg.toml` `source` fields. ([#1509](https://github.com/golang/dep/pull/1509))

IMPROVEMENTS:

* Log as dependencies are pre-fetched during dep init. ([#1176](https://github.com/golang/dep/pull/1176))
* Make the gps package importable. ([#1349](https://github.com/golang/dep/pull/1349))
* Improve file copy performance by not forcing a file sync. ([#1408](https://github.com/golang/dep/pull/1408)
* Improve file copy performance by not forcing a file sync. ([#1408](https://github.com/golang/dep/pull/1408))
* Skip empty constraints during import. ([#1414](https://github.com/golang/dep/pull/1349))
* Handle errors when writing status output. ([#1420](https://github.com/golang/dep/pull/1420))
* Add constraint for locked projects in `dep status`. ([#962](https://github.com/golang/dep/pull/962)
* Add constraint for locked projects in `dep status`. ([#962](https://github.com/golang/dep/pull/962))
* Make external config importers error tolerant. ([#1315](https://github.com/golang/dep/pull/1315))
* Show LATEST and VERSION as the same type in status. ([#1515](https://github.com/golang/dep/pull/1515)
* Show LATEST and VERSION as the same type in status. ([#1515](https://github.com/golang/dep/pull/1515))
* Warn when [[constraint]] rules that will have no effect. ([#1534](https://github.com/golang/dep/pull/1534))

# v0.3.2
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ $ brew install dep
$ brew upgrade dep
```

On other platforms you can use the `install.sh` script:

```sh
$ curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
```

It will install into your `$GOPATH/bin` directory by default or any other directory you specify using the `INSTALL_DIRECTORY` environment variable.

If your platform is not supported, you'll need to build it manually or let the team know and we'll consider adding your platform
to the release builds.

If you're interested in hacking on `dep`, you can install via `go get`:

```sh
Expand Down
135 changes: 135 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
#!/bin/sh

# This install script is intended to download and install the latest available
# release of the dep dependency manager for Golang.
#
# It attempts to identify the current platform and an error will be thrown if
# the platform is not supported.
#
# Environment variables:
# - INSTALL_DIRECTORY (optional): defaults to $GOPATH/bin
# - DEP_RELEASE_TAG (optional): defaults to fetching the latest release
#
# You can install using this script:
# $ curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh

set -e

RELEASES_URL="https://github.com/golang/dep/releases"

downloadJSON() {
url="$2"

echo "Fetching $url.."
if type curl > /dev/null; then
response=$(curl -s -L -w 'HTTPSTATUS:%{http_code}' -H 'Accept: application/json' "$url")
body=$(echo "$response" | sed -e 's/HTTPSTATUS\:.*//g')
code=$(echo "$response" | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
elif type wget > /dev/null; then
temp=$(mktemp)
body=$(wget -q --header='Accept: application/json' -O - --server-response --content-on-error "$url" 2> "$temp")
code=$(awk '/^ HTTP/{print $2}' < "$temp")
else
echo "Neither curl nor wget was available to perform http requests."
exit 1
fi
if [ "$code" != 200 ]; then
echo "Request failed with code $code"
exit 1
fi

eval "$1='$body'"
}

downloadFile() {
url="$1"
destination="$2"

echo "Fetching $url.."
if type curl > /dev/null; then
code=$(curl -s -w '%{http_code}' -L "$url" -o "$destination")
elif type wget > /dev/null; then
code=$(wget -q -O "$destination" --server-response "$url" 2>&1 | awk '/^ HTTP/{print $2}')
else
echo "Neither curl nor wget was available to perform http requests."
exit 1
fi

if [ "$code" != 200 ]; then
echo "Request failed with code $code"
exit 1
fi
}

findGoBinDirectory() {
if [ -z "$GOPATH" ]; then
echo "Installation requires \$GOPATH to be set for your Golang environment."
exit 1
fi
if [ -z "$GOBIN" ]; then
GOBIN="$GOPATH/bin"
fi
if [ ! -d "$GOBIN" ]; then
echo "Installation requires your GOBIN directory $GOBIN to exist. Please create it."
exit 1
fi
eval "$1='$GOBIN'"
}

initArch() {
ARCH=$(uname -m)
case $ARCH in
amd64) ARCH="amd64";;
x86_64) ARCH="amd64";;
i386) ARCH="386";;
*) echo "Architecture ${ARCH} is not supported by this installation script"; exit 1;;
esac
echo "ARCH = $ARCH"
}

initOS() {
OS=$(uname | tr '[:upper:]' '[:lower:]')

case "$OS" in
darwin) OS='darwin';;
linux) OS='linux';;
freebsd) OS='freebsd';;
mingw*) OS='windows';;
msys*) OS='windows';;
*) echo "OS ${OS} is not supported by this installation script"; exit 1;;
esac
echo "OS = $OS"
}

# identify platform based on uname output
initArch
initOS

if [ -z "$INSTALL_DIRECTORY" ]; then
findGoBinDirectory INSTALL_DIRECTORY
fi
echo "Will install into $INSTALL_DIRECTORY"

# assemble expected release artifact name
BINARY="dep-${OS}-${ARCH}"

# if DEP_RELEASE_TAG was not provided, assume latest
if [ -z "$DEP_RELEASE_TAG" ]; then
downloadJSON LATEST_RELEASE "$RELEASES_URL/latest"
DEP_RELEASE_TAG=$(echo "${LATEST_RELEASE}" | tr -s '\n' ' ' | sed 's/.*"tag_name":"//' | sed 's/".*//' )
fi
echo "Release Tag = $DEP_RELEASE_TAG"

# fetch the real release data to make sure it exists before we attempt a download
downloadJSON RELEASE_DATA "$RELEASES_URL/tag/$DEP_RELEASE_TAG"

BINARY_URL="$RELEASES_URL/download/$DEP_RELEASE_TAG/$BINARY"
DOWNLOAD_FILE=$(mktemp)

downloadFile "$BINARY_URL" "$DOWNLOAD_FILE"

echo "Setting executable permissions."
chmod +x "$DOWNLOAD_FILE"

echo "Moving executable to $INSTALL_DIRECTORY/dep"
mv "$DOWNLOAD_FILE" "$INSTALL_DIRECTORY/dep"

0 comments on commit aa9d47c

Please sign in to comment.