mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
restructure to build individual binaries
This commit is contained in:
2
plugins/repo/.gitignore
vendored
Normal file
2
plugins/repo/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/commands
|
||||
/subcommands/*
|
||||
@@ -1,5 +1,8 @@
|
||||
.PHONY: build-in-docker build clean
|
||||
|
||||
GO_REPO_ROOT ?= /go/src/github.com/dokku/dokku
|
||||
BUILD_IMAGE ?= golang:1.7.1
|
||||
|
||||
build-in-docker: clean
|
||||
docker run --rm \
|
||||
-v $$PWD/../..:$(GO_REPO_ROOT) \
|
||||
@@ -7,8 +10,17 @@ build-in-docker: clean
|
||||
$(BUILD_IMAGE) \
|
||||
bash -c "make build" || exit $$?
|
||||
|
||||
build:
|
||||
cd src && go build -a -o ../commands
|
||||
build: commands subcommands
|
||||
subcommands: subcommands/gc subcommands/purge-cache
|
||||
|
||||
commands: **/**/commands.go
|
||||
go build -a -o commands src/commands/commands.go
|
||||
|
||||
subcommands/gc: **/**/**/gc.go
|
||||
go build -a -o subcommands/gc src/subcommands/gc/gc.go
|
||||
|
||||
subcommands/purge-cache: **/**/**/purge-cache.go
|
||||
go build -a -o subcommands/purge-cache src/subcommands/purge-cache/purge-cache.go
|
||||
|
||||
clean:
|
||||
rm -f commands
|
||||
rm -rf commands subcommands
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
[[ " help repo:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
source "$PLUGIN_AVAILABLE_PATH/repo/internal-functions"
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
case "$1" in
|
||||
help | repo:help)
|
||||
repo_help_cmd "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
||||
;;
|
||||
|
||||
esac
|
||||
@@ -33,10 +33,6 @@ func main() {
|
||||
usage()
|
||||
case "help":
|
||||
fmt.Print(helpContent)
|
||||
case "repo:gc":
|
||||
gitGC()
|
||||
case "repo:purge-cache":
|
||||
purgeCache()
|
||||
default:
|
||||
dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT"))
|
||||
if err != nil {
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
// runs 'git gc --aggressive' against the application's repo
|
||||
func gitGC() {
|
||||
func main() {
|
||||
flag.Parse()
|
||||
appName := flag.Arg(1)
|
||||
if appName == "" {
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
// deletes the contents of the build cache stored in the repository
|
||||
func purgeCache() {
|
||||
func main() {
|
||||
flag.Parse()
|
||||
appName := flag.Arg(1)
|
||||
if appName == "" {
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
||||
|
||||
repo_gc() {
|
||||
declare desc="runs 'git gc --aggressive' against the application's repo"
|
||||
local cmd="repo:gc"
|
||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
||||
local APP="$2"; local APP_DIR="$DOKKU_ROOT/$APP"
|
||||
verify_app_name "$APP"
|
||||
|
||||
GIT_DIR="$APP_DIR" git gc --aggressive
|
||||
}
|
||||
|
||||
repo_gc "$@"
|
||||
Reference in New Issue
Block a user