Updates 'make help'. (#7982)

* Updates 'make help'.

* Updates description of all.
This commit is contained in:
Martin Kraft
2017-12-20 14:49:45 -05:00
committed by Joram Wilander
parent dcc2016755
commit e561f727c8
2 changed files with 46 additions and 70 deletions

View File

@@ -91,11 +91,11 @@ ALL_PACKAGES_COMMA=$(TE_PACKAGES_COMMA)
endif
all: run
all: run ## Alias for 'run'.
include build/*.mk
start-docker:
start-docker: ## Starts the docker containers for local development.
@echo Starting docker containers
@if [ $(shell docker ps -a | grep -ci mattermost-mysql) -eq 0 ]; then \
@@ -174,7 +174,7 @@ ifeq ($(BUILD_ENTERPRISE_READY),true)
fi
endif
stop-docker:
stop-docker: ## Stops the docker containers for local development.
@echo Stopping docker containers
@if [ $(shell docker ps -a | grep -ci mattermost-mysql) -eq 1 ]; then \
@@ -207,7 +207,7 @@ stop-docker:
docker stop mattermost-elasticsearch > /dev/null; \
fi
clean-docker:
clean-docker: ## Deletes the docker containers for local development.
@echo Removing docker containers
@if [ $(shell docker ps -a | grep -ci mattermost-mysql) -eq 1 ]; then \
@@ -246,7 +246,7 @@ clean-docker:
docker rm -v mattermost-elasticsearch > /dev/null; \
fi
govet:
govet: ## Runs govet against all packages.
@echo Running GOVET
$(GO) vet $(GOFLAGS) $(TE_PACKAGES) || exit 1
@@ -254,7 +254,7 @@ ifeq ($(BUILD_ENTERPRISE_READY),true)
$(GO) vet $(GOFLAGS) $(EE_PACKAGES) || exit 1
endif
gofmt:
gofmt: ## Runs gofmt against all packages.
@echo Running GOFMT
@for package in $(TE_PACKAGES) $(EE_PACKAGES); do \
@@ -271,11 +271,11 @@ gofmt:
done
@echo "gofmt success"; \
store-mocks:
store-mocks: ## Creates mock files.
go get github.com/vektra/mockery/...
GOPATH=$(shell go env GOPATH) $(shell go env GOPATH)/bin/mockery -dir store -all -output store/storetest/mocks -note 'Regenerate this file using `make store-mocks`.'
update-jira-plugin:
update-jira-plugin: ## Updates Jira plugin.
go get github.com/jteeuwen/go-bindata/...
curl -s https://api.github.com/repos/mattermost/mattermost-plugin-jira/releases/latest | grep browser_download_url | grep darwin-amd64 | cut -d '"' -f 4 | wget -qi - -O plugin.tar.gz
$(shell go env GOPATH)/bin/go-bindata -pkg jira -o app/plugin/jira/plugin_darwin_amd64.go plugin.tar.gz
@@ -286,7 +286,7 @@ update-jira-plugin:
rm plugin.tar.gz
gofmt -s -w ./app/plugin/jira
update-zoom-plugin:
update-zoom-plugin: ## Updates Zoom plugin.
go get github.com/jteeuwen/go-bindata/...
curl -s https://api.github.com/repos/mattermost/mattermost-plugin-zoom/releases/latest | grep browser_download_url | grep darwin-amd64 | cut -d '"' -f 4 | wget -qi - -O plugin.tar.gz
$(shell go env GOPATH)/bin/go-bindata -pkg zoom -o app/plugin/zoom/plugin_darwin_amd64.go plugin.tar.gz
@@ -297,12 +297,12 @@ update-zoom-plugin:
rm plugin.tar.gz
gofmt -s -w ./app/plugin/zoom
check-licenses:
check-licenses: ## Checks license status.
./scripts/license-check.sh $(TE_PACKAGES) $(EE_PACKAGES)
check-style: govet gofmt check-licenses
check-style: govet gofmt check-licenses ## Runs govet and gofmt against all packages.
test-te-race:
test-te-race: ## Checks for race conditions in the team edition.
@echo Testing TE race conditions
@echo "Packages to test: "$(TE_PACKAGES)
@@ -312,7 +312,7 @@ test-te-race:
$(GO) test $(GOFLAGS) -race -run=$(TESTS) -test.timeout=4000s $$package || exit 1; \
done
test-ee-race:
test-ee-race: ## Checks for race conditions in the enterprise edition.
@echo Testing EE race conditions
ifeq ($(BUILD_ENTERPRISE_READY),true)
@@ -332,19 +332,19 @@ ifeq ($(BUILD_ENTERPRISE_READY),true)
rm -f config/*.key
endif
test-server-race: test-te-race test-ee-race
test-server-race: test-te-race test-ee-race ## Checks for race conditions.
do-cover-file:
do-cover-file: ## Creates the test coverage report file.
@echo "mode: count" > cover.out
test-te: do-cover-file
test-te: do-cover-file ## Runs tests in the team edition.
@echo Testing TE
@echo "Packages to test: "$(TE_PACKAGES)
find . -name 'cprofile*.out' -exec sh -c 'rm "{}"' \;
$(GO) test $(GOFLAGS) -run=$(TESTS) $(TESTFLAGS) -v -timeout=2000s -covermode=count -coverpkg=$(ALL_PACKAGES_COMMA) -exec $(ROOT)/scripts/test-xprog.sh $(TE_PACKAGES)
find . -name 'cprofile*.out' -exec sh -c 'tail -n +2 {} >> cover.out ; rm "{}"' \;
test-ee: do-cover-file
test-ee: do-cover-file ## Runs tests in the enterprise edition.
@echo Testing EE
ifeq ($(BUILD_ENTERPRISE_READY),true)
@@ -356,55 +356,55 @@ ifeq ($(BUILD_ENTERPRISE_READY),true)
rm -f config/*.key
endif
test-server: test-te test-ee
test-server: test-te test-ee ## Runs tests.
internal-test-web-client:
internal-test-web-client: ## Runs web client tests.
$(GO) run $(GOFLAGS) $(PLATFORM_FILES) test web_client_tests
run-server-for-web-client-tests:
run-server-for-web-client-tests: ## Tests the server for web client.
$(GO) run $(GOFLAGS) $(PLATFORM_FILES) test web_client_tests_server
test-client:
test-client: ## Test client app.
@echo Running client tests
cd $(BUILD_WEBAPP_DIR) && $(MAKE) test
test: test-server test-client
test: test-server test-client ## Runs all checks and tests below (except race detection and postgres).
cover:
cover: ## Runs the golang coverage tool. You must run the unit tests first.
@echo Opening coverage info in browser. If this failed run make test first
$(GO) tool cover -html=cover.out
$(GO) tool cover -html=ecover.out
run-server: start-docker
run-server: start-docker ## Starts the server.
@echo Running mattermost for development
mkdir -p $(BUILD_WEBAPP_DIR)/dist/files
$(GO) run $(GOFLAGS) $(GO_LINKER_FLAGS) $(PLATFORM_FILES) --disableconfigwatch &
run-cli: start-docker
run-cli: start-docker ## Runs CLI.
@echo Running mattermost for development
@echo Example should be like 'make ARGS="-version" run-cli'
$(GO) run $(GOFLAGS) $(GO_LINKER_FLAGS) $(PLATFORM_FILES) ${ARGS}
run-client:
run-client: ## Runs the webapp.
@echo Running mattermost client for development
ln -nfs $(BUILD_WEBAPP_DIR)/dist client
cd $(BUILD_WEBAPP_DIR) && $(MAKE) run
run-client-fullmap:
run-client-fullmap: ## Runs the webapp with source code mapping (slower; better debugging).
@echo Running mattermost client for development with FULL SOURCE MAP
cd $(BUILD_WEBAPP_DIR) && $(MAKE) run-fullmap
run: run-server run-client
run: run-server run-client ## Runs the server and webapp.
run-fullmap: run-server run-client-fullmap
run-fullmap: run-server run-client-fullmap ## Same as run but with a full sourcemap for client.
stop-server:
stop-server: ## Stops the server.
@echo Stopping mattermost
ifeq ($(BUILDER_GOOS_GOARCH),"windows_amd64")
@@ -421,24 +421,24 @@ else
done
endif
stop-client:
stop-client: ## Stops the webapp.
@echo Stopping mattermost client
cd $(BUILD_WEBAPP_DIR) && $(MAKE) stop
stop: stop-server stop-client
stop: stop-server stop-client ## Stops server and client.
restart: restart-server restart-client
restart: restart-server restart-client ## Restarts the server and webapp.
restart-server: | stop-server run-server
restart-server: | stop-server run-server ## Restarts the mattermost server to pick up development change.
restart-client: | stop-client run-client
restart-client: | stop-client run-client ## Restarts the webapp.
run-job-server:
run-job-server: ## Runs the background job server.
@echo Running job server for development
$(GO) run $(GOFLAGS) $(GO_LINKER_FLAGS) $(PLATFORM_FILES) jobserver --disableconfigwatch &
config-ldap:
config-ldap: ## Configures LDAP.
@echo Setting up configuration for local LDAP
@sed -i'' -e 's|"LdapServer": ".*"|"LdapServer": "dockerhost"|g' config/config.json
@@ -452,12 +452,12 @@ config-ldap:
@sed -i'' -e 's|"UsernameAttribute": ".*"|"UsernameAttribute": "uid"|g' config/config.json
@sed -i'' -e 's|"IdAttribute": ".*"|"IdAttribute": "uid"|g' config/config.json
config-reset:
config-reset: ## Resets the config/config.json file to the default.
@echo Resetting configuration to default
rm -f config/config.json
cp config/default.json config/config.json
clean: stop-docker
clean: stop-docker ## Clean up everything except persistant server data.
@echo Cleaning
rm -Rf $(DIST_ROOT)
@@ -482,16 +482,16 @@ clean: stop-docker
rm -f imports/imports.go
rm -f cmd/platform/cprofile*.out
nuke: clean clean-docker
nuke: clean clean-docker ## Clean plus removes persistant server data.
@echo BOOM
rm -rf data
setup-mac:
setup-mac: ## Adds macOS hosts entries for Docker.
echo $$(boot2docker ip 2> /dev/null) dockerhost | sudo tee -a /etc/hosts
todo:
todo: ## Display TODO and FIXME items in the source code.
@! ag --ignore Makefile --ignore-dir vendor --ignore-dir runtime TODO
@! ag --ignore Makefile --ignore-dir vendor --ignore-dir runtime XXX
@! ag --ignore Makefile --ignore-dir vendor --ignore-dir runtime FIXME
@@ -502,3 +502,7 @@ ifeq ($(BUILD_ENTERPRISE_READY),true)
@! ag --ignore Makefile --ignore-dir vendor --ignore-dir runtime FIXME enterprise/
@! ag --ignore Makefile --ignore-dir vendor --ignore-dir runtime "FIX ME" enterprise/
endif
## Help documentatin à la https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' ./Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

View File

@@ -1,28 +0,0 @@
help:
@echo "-----------------------------------------------------------------------------------------------"
@echo "------------------------------------- Makefile Help -------------------------------------------"
@echo "-----------------------------------------------------------------------------------------------"
@echo ""
@echo " General:"
@echo "make run Build and run the Mattermost server for development"
@echo "make run-fullmap Same as run but with a full sourcemap for client"
@echo "make stop Stops server and client."
@echo "make restart-server Restarts the mattermost server to pick up development change."
@echo "make clean Clean up everything except persistant server data"
@echo "make nuke clean plus removes persistant server data"
@echo ""
@echo " Testing:"
@echo "make test Runs all checks and tests below (except race detection and postgres)"
@echo "make govet Runs govet against all packages"
@echo "make gofmt Runs gofmt against all packages"
@echo "make check-style Runs govet and gofmt against all packages"
@echo "make check-server-race Runs the unit tests with race detection mode on"
@echo "make test-postgres Runs the unit tests against a postgres database"
@echo "make cover Runs the golang coverage tool. You must run the unit tests first."
@echo ""
@echo " Docker:"
@echo "make start-docker Starts the docker containers for local development"
@echo "make stop-docker Stops the docker containers for local development"
@echo "make clean-docker Deletes the docker containers for local development"
@echo ""
@echo "-----------------------------------------------------------------------------------------------"