This commit is contained in:
aynic.os 2021-06-01 00:52:21 +02:00
parent e605e033e4
commit f510f626ab
5 changed files with 17 additions and 7 deletions

View File

@ -111,12 +111,11 @@ tests: app-tests ## Test application
up: docker-compose-up app-start ## Create application dockers
.PHONY: update app-update
update: app-update ## Update application
update: update-app app-update ## Update application
# target %: Always fired target
## this target is fired everytime make is runned to call the stack target and
## update COMPOSE_FILE variable with all .yml files of the current project stack
.PHONY: FORCE
%: FORCE stack %-rule-exists ;
# target %-rule-exists: Print a warning message if $* target does not exists

View File

@ -1,7 +1,6 @@
APP_DIR ?= $(CURDIR)
APP_DOMAIN ?= $(ENV)$(addprefix .,$(DOMAIN))
APP_HOST ?= $(APP)$(addprefix .,$(APP_DOMAIN))
APP_NAME ?= $(APP)
APP_PARAMETERS_REPOSITORY ?= $(GIT_PARAMETERS_REPOSITORY)
APP_PATH ?= /$(APP_PATH_PREFIX)
APP_REPOSITORY ?= $(GIT_REPOSITORY)

View File

@ -3,6 +3,7 @@ dollar ?= $
dquote ?= "
quote ?= '
APP ?= $(if $(wildcard .git),$(notdir $(CURDIR)))
APP_NAME ?= $(APP)
APP_TYPE ?= $(if $(SUBREPO),subrepo) $(if $(MYOS),,myos)
APPS ?= $(if $(MONOREPO),$(sort $(patsubst $(MONOREPO_DIR)/%/.git,%,$(wildcard $(MONOREPO_DIR)/*/.git))))
APPS_NAME ?= $(foreach app,$(APPS),$(or $(shell awk -F '=' '$$1 == "APP" {print $$2}' $(or $(wildcard $(MONOREPO_DIR)/$(app)/.env),$(wildcard $(MONOREPO_DIR)/$(app)/.env.$(ENV)),$(MONOREPO_DIR)/$(app)/.env.dist) 2>/dev/null),$(app)))
@ -44,6 +45,7 @@ MAKE_VARS ?= ENV
MONOREPO ?= $(if $(filter myos,$(MYOS)),$(notdir $(CURDIR)),$(if $(APP),$(notdir $(realpath $(CURDIR)/..))))
MONOREPO_DIR ?= $(if $(MONOREPO),$(if $(filter myos,$(MYOS)),$(realpath $(CURDIR)),$(if $(APP),$(realpath $(CURDIR)/..))))
MYOS ?= $(if $(filter $(MAKE_DIR),$(call pop,$(MAKE_DIR))),,$(call pop,$(MAKE_DIR)))
QUIET ?= $(if $(filter false,$(VERBOSE)),--quiet)
RECURSIVE ?= true
SHARED ?= shared
SSH_DIR ?= ${HOME}/.ssh

View File

@ -3,6 +3,7 @@ COLOR_RESET ?= \033[0m
COLOR_GREEN ?= \033[32m
COLOR_BROWN ?= \033[33m
COLOR_BLUE ?= \033[36m
.PHONY: FORCE
##
# HELP

View File

@ -1,11 +1,20 @@
##
# UPDATE
.PHONY: update-parameters
update-app: $(APP) ## Update application source files
.PHONY: update-apps
update-apps:
$(foreach app,$(APPS),$(call make,update-app APP_NAME=$(app)))
$(APP): myos-base
$(call exec,[ -d ../$(APP) ] && cd ../$(APP) && git pull --quiet origin $(BRANCH) || git clone --quiet $(APP_REPOSITORY) ../$(APP))
.PHONY: update-app
update-app: update-app-$(APP_NAME) ; ## Update application source files
.PHONY: update-app-%
update-app-%: myos-base % ;
.PHONY: $(APP)
$(APP): APP_DIR := $(if $(filter myos,$(MYOS)),,../)$(APP)
$(APP):
$(call exec,[ -d $(APP_DIR) ] && cd $(APP_DIR) && git pull $(QUIET) origin $(BRANCH) || git clone $(QUIET) $(APP_REPOSITORY) $(APP_DIR))
## Update /etc/hosts
.PHONY: update-hosts