Skip to content

Commit

Permalink
Merge pull request #20 from dokku/master
Browse files Browse the repository at this point in the history
release 0.3.0
  • Loading branch information
josegonzalez authored Mar 19, 2017
2 parents b59ca45 + 7f05b26 commit dca66b3
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 20 deletions.
12 changes: 4 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
# Change Log
All notable changes to this project will be documented in this file.

## [Unreleased][unreleased]
### Fixed

## [0.3.0] - 2017-03-19
### Added

### Removed

### Changed
- @josegonzalez Add support for downloading via tar.gz #19

## [0.2.2] - 2016-09-16
### Fixed
Expand Down Expand Up @@ -49,7 +44,8 @@ All notable changes to this project will be documented in this file.
### Changed
- @progrium rename to plugn

[unreleased]: https://github.com/dokku/plugn/compare/v0.2.2...HEAD
[unreleased]: https://github.com/dokku/plugn/compare/v0.3.0...HEAD
[0.3.0]: https://github.com/dokku/plugn/compare/v0.2.2...v0.3.0
[0.2.2]: https://github.com/dokku/plugn/compare/v0.2.1...v0.2.2
[0.2.1]: https://github.com/dokku/plugn/compare/v0.1.0...v0.2.1
[0.1.0]: https://github.com/dokku/plugn/compare/ae7f4c92579ec64d7cf3d3bd76cb6207dd8d3ed9...v0.1.0
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
NAME = plugn
HARDWARE = $(shell uname -m)
VERSION ?= 0.2.2
VERSION ?= 0.3.0
IMAGE_NAME ?= $(NAME)
BUILD_TAG ?= dev

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Hook system that lets users extend your application with plugins

## Installation
```
$ wget -qO /tmp/plugn_latest.tgz https://github.com/dokku/plugn/releases/download/v0.2.2/plugn_0.2.2_linux_x86_64.tgz
$ wget -qO /tmp/plugn_latest.tgz https://github.com/dokku/plugn/releases/download/v0.3.0/plugn_0.3.0_linux_x86_64.tgz
$ tar xzf /tmp/plugn_latest.tgz -C /usr/local/bin
```

Expand Down
35 changes: 30 additions & 5 deletions bashenv/plugn.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,34 @@ version() {
install() {
declare desc="Install a new plugin from a Git URL"
declare url="$1" name="$2"
cd "$PLUGIN_PATH/available"
git clone "$url" $2
cd - > /dev/null
local basefilename downloader args contents cwd
basefilename="$(basename "$url")"
pushd "$PLUGIN_PATH/available" &>/dev/null
if [[ "$basefilename" == *.tar.gz ]] || [[ "$basefilename" == *.tgz ]]; then
which curl > /dev/null 2>&1 && downloader="curl" && args="-sL"
which wget > /dev/null 2>&1 && downloader="wget" && args="-q --max-redirect=1 -O-"

if [[ -z "$downloader" ]]; then
echo "Please install either curl or wget to install via tar.gz" 1>&2
exit 1
fi
mkdir -p "$2" && \
"$downloader" $args "$url" | tar xz -C "$2" && \
pushd "$2" &>/dev/null
# make sure we untarred a single dir into our target
contents_dirs=($(find . -maxdepth 1 -not -path '.' -type d))
contents_files=($(find . -maxdepth 1 -type f))
if [[ "${#contents_dirs[@]}" -eq 1 ]] && [[ "${#content_files[@]}" -eq 0 ]]; then
pushd ./* &>/dev/null && \
find . -maxdepth 1 -not -path '.' -exec mv -f {} ../ \;
cwd="$PWD"
popd &>/dev/null
rmdir "$cwd"
fi
else
git clone "$url" $2
fi
popd &> /dev/null
}

uninstall() {
Expand All @@ -23,7 +48,7 @@ update() {
declare desc="Update plugin and optionally pin to commit/tag/branch"
declare plugin="$1" committish="$2"
[[ ! -d "$PLUGIN_PATH/available/$plugin" ]] && echo "Plugin ($plugin) not installed" && exit 1
cd "$PLUGIN_PATH/available/$plugin"
pushd "$PLUGIN_PATH/available/$plugin" &>/dev/null
[[ -z "$committish" ]] && [[ ! $(git symbolic-ref HEAD) ]] && echo "Plugin pinned to $(< ./.plugin_committish)" && exit 0
git checkout master &> /dev/null
git pull &> /dev/null
Expand All @@ -36,7 +61,7 @@ update() {
else
echo "Plugin ($plugin) updated"
fi
cd - > /dev/null
popd &> /dev/null
}

list() {
Expand Down
10 changes: 5 additions & 5 deletions bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions tests/functional/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,21 @@ T_plugn-install-enable-disable() {
plugn list | grep disabled | grep smoke-test-plugin"
}

T_plugn-install-enable-disable-targz() {
plugn-test-pass "test-install-enable-disable" "
plugn init && \
plugn install https://github.com/dokku/smoke-test-plugin/archive/v0.3.0.tar.gz smoke-test-plugin && \
plugn enable smoke-test-plugin && \
plugn list | grep enabled | grep smoke-test-plugin && \
plugn disable smoke-test-plugin && \
plugn list | grep disabled | grep smoke-test-plugin"
}

T_plugn-trigger() {
plugn-test-pass "test-trigger" "
plugn init && \
plugn install https://github.com/dokku/smoke-test-plugin && \
plugn update smoke-test-plugin v0.3.0 && \
plugn enable smoke-test-plugin && \
plugn list && \
plugn trigger trigger | grep 'triggered smoke-test-plugin'"
Expand Down

0 comments on commit dca66b3

Please # to comment.