Skip to content

Commit

Permalink
Merge pull request #94 from dokku/master
Browse files Browse the repository at this point in the history
Release 0.12.0
  • Loading branch information
josegonzalez authored May 19, 2022
2 parents 5dec1af + 52d35d0 commit 3a27594
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 12 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# Change Log
All notable changes to this project will be documented in this file.

## [0.12.0](https://github.com/dokku/plugn/compare/v0.11.0...v0.12.0) - 2022-05-19

### Fixed

- @josegonzalez Ignore plugins that do not have a .git directory when performing updates #90
- @josegonzalez Add the plugin to the safe.directory list #92

### Changed

- @josegonzalez Do not require PLUGIN_PATH to fetch version #91
- @josegonzalez Log when a plugin trigger is not executable #93

## [0.11.0](https://github.com/dokku/plugn/compare/v0.10.0...v0.11.0) - 2022-05-16

### Changed
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ MAINTAINER_NAME = Jose Diaz-Gonzalez
REPOSITORY = plugn
HARDWARE = $(shell uname -m)
SYSTEM_NAME = $(shell uname -s | tr '[:upper:]' '[:lower:]')
BASE_VERSION ?= 0.11.0
BASE_VERSION ?= 0.12.0
IMAGE_NAME ?= $(MAINTAINER)/$(REPOSITORY)
PACKAGECLOUD_REPOSITORY ?= dokku/dokku-betafish

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

```shell
wget -qO /tmp/plugn_latest.tgz https://github.com/dokku/plugn/releases/download/v0.11.0/plugn_0.11.0_linux_amd64.tgz
wget -qO /tmp/plugn_latest.tgz https://github.com/dokku/plugn/releases/download/v0.12.0/plugn_0.12.0_linux_amd64.tgz
tar xzf /tmp/plugn_latest.tgz -C /usr/local/bin
```

Expand Down
16 changes: 13 additions & 3 deletions bashenv/plugn.bash
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ update() {
declare plugin="$1" committish="$2"
[[ ! -d "$PLUGIN_PATH/available/$plugin" ]] && echo "Plugin ($plugin) not installed" && exit 1
pushd "$PLUGIN_PATH/available/$plugin" &>/dev/null
[[ ! -d ".git" ]] && echo "Plugin ($plugin) not managed by git" && exit 0

if ! git config --global --get-all safe.directory | grep -q "$PLUGIN_PATH/available/$plugin"; then
git config --global --add safe.directory "$PLUGIN_PATH/available/$plugin"
fi

[[ -z "$committish" ]] && [[ ! $(git symbolic-ref HEAD) ]] && echo "Plugin pinned to $(< ./.plugin_committish)" && exit 0
git checkout master &> /dev/null
git pull &> /dev/null
Expand Down Expand Up @@ -82,9 +88,13 @@ trigger() {
declare hook="$1"; shift
shopt -s nullglob
for plugin in $PLUGIN_PATH/enabled/*; do
if [[ -x "$plugin/$hook" ]]; then
eval "$(config-export $(basename $plugin))"
$plugin/$hook "$@"
if [[ -f "$plugin/$hook" ]]; then
if [[ -x "$plugin/$hook" ]]; then
eval "$(config-export $(basename $plugin))"
$plugin/$hook "$@"
else
echo "Trigger '$hook' is not executable, skipping plugin ($(basename $plugin))" 1>&2
fi
fi
done
shopt -u nullglob
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.

8 changes: 6 additions & 2 deletions plugn.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,23 @@ func TomlSet(args []string) {
f.Close()
}

func isArg(argument string) bool {
return len(os.Args) > 1 && os.Args[1] == argument
}

func main() {
os.Setenv("PLUGN_VERSION", Version)
if data, err := ioutil.ReadFile(".plugn"); err == nil {
if path, err := filepath.Abs(string(data)); err == nil {
os.Setenv("PLUGIN_PATH", path)
}
}
if os.Getenv("PLUGIN_PATH") == "" {
if !isArg("version") && os.Getenv("PLUGIN_PATH") == "" {
fmt.Println("!! PLUGIN_PATH is not set in environment")
os.Exit(2)
}
PluginPath = os.Getenv("PLUGIN_PATH")
if len(os.Args) > 1 && os.Args[1] == "gateway" {
if isArg("gateway") {
runGateway()
return
}
Expand Down

0 comments on commit 3a27594

Please sign in to comment.