From 01f60821ea982212f0a685e67a9d1ef1b354a233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miodrag=20Toki=C4=87?= Date: Sun, 3 Feb 2019 17:44:18 +0100 Subject: [PATCH 1/7] Help formatting --- Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 1d40cac..f343341 100644 --- a/Makefile +++ b/Makefile @@ -6,10 +6,11 @@ EXEC_FILES=git-quick-stats .PHONY: test all: - @echo "usage: make install" - @echo " make reinstall" - @echo " make uninstall" - @echo " make test" + @echo "Usage:" + @echo " make install" + @echo " make reinstall" + @echo " make uninstall" + @echo " make test" help: $(MAKE) all From 601986fbe1cbbb931315da5d7602af900556a560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miodrag=20Toki=C4=87?= Date: Sun, 3 Feb 2019 17:57:28 +0100 Subject: [PATCH 2/7] Remove EXEC_FILES Variable doesn't make much sense and makes the code more convoluted. --- Makefile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index f343341..653ada6 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,5 @@ PREFIX ?= /usr/local TASK_DONE = echo -e "\n✓ $@ done\n" -# files that need mode 755 -EXEC_FILES=git-quick-stats .PHONY: test @@ -18,15 +16,15 @@ help: install: mkdir -p $(PREFIX)/bin - install -m 0755 $(EXEC_FILES) $(PREFIX)/bin/$(EXEC_FILES) - git config --global alias.quick-stats '! $(PREFIX)/bin/$(EXEC_FILES)' + install -m 0755 git-quick-stats $(PREFIX)/bin/git-quick-stats + git config --global alias.quick-stats '! $(PREFIX)/bin/git-quick-stats' $(MAKE) man @$(TASK_DONE) uninstall: test -d $(PREFIX)/bin && \ cd $(PREFIX)/bin && \ - rm -f $(EXEC_FILES) && \ + rm -f git-quick-stats && \ git config --global --unset alias.quick-stats @$(TASK_DONE) From 94ea505dbd272d900c59725d352ed6ce5a303a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miodrag=20Toki=C4=87?= Date: Sun, 3 Feb 2019 18:04:13 +0100 Subject: [PATCH 3/7] Replace "mkdir" with "install" Favour "install" over "mkdir" in installation scripts. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 653ada6..549ac89 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ help: @$(TASK_DONE) install: - mkdir -p $(PREFIX)/bin + install -d -m 0755 $(PREFIX)/bin install -m 0755 git-quick-stats $(PREFIX)/bin/git-quick-stats git config --global alias.quick-stats '! $(PREFIX)/bin/git-quick-stats' $(MAKE) man From 190ae631e513df58b990143adb167acb4cffdd2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miodrag=20Toki=C4=87?= Date: Sun, 3 Feb 2019 18:06:31 +0100 Subject: [PATCH 4/7] Straightforward binary removal Remove binary using the full path instead of jumping to directory. --- Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 549ac89..31efb23 100644 --- a/Makefile +++ b/Makefile @@ -22,9 +22,7 @@ install: @$(TASK_DONE) uninstall: - test -d $(PREFIX)/bin && \ - cd $(PREFIX)/bin && \ - rm -f git-quick-stats && \ + rm -f $(PREFIX)/bin/git-quick-stats git config --global --unset alias.quick-stats @$(TASK_DONE) From 7a9e9c7f85ca09d125bee83046c04567bc909cef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miodrag=20Toki=C4=87?= Date: Sun, 3 Feb 2019 18:10:06 +0100 Subject: [PATCH 5/7] Improve man install / uninstall - Create man directory prior to installing the page - Do not force root ownership of the man page - Remove man page when uninstalling --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 31efb23..19c7ee0 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,7 @@ install: uninstall: rm -f $(PREFIX)/bin/git-quick-stats + rm -f $(PREFIX)/share/man/man1/git-quick-stats.1 git config --global --unset alias.quick-stats @$(TASK_DONE) @@ -33,7 +34,8 @@ reinstall: @$(TASK_DONE) man: - install -g 0 -o 0 -m 0644 git-quick-stats.1 /usr/share/man/man1/ + install -d -m 0755 $(PREFIX)/share/man/man1/ + install -m 0644 git-quick-stats.1 $(PREFIX)/share/man/man1/ test: tests/commands_test.sh From 7f3220abb7292346b3b5c80dff264ccfb60d554f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miodrag=20Toki=C4=87?= Date: Mon, 4 Feb 2019 12:40:11 +0100 Subject: [PATCH 6/7] Remove unnecessary Git alias Git is able to find binary by the prefixed "git" name. --- Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Makefile b/Makefile index 19c7ee0..60116db 100644 --- a/Makefile +++ b/Makefile @@ -17,14 +17,12 @@ help: install: install -d -m 0755 $(PREFIX)/bin install -m 0755 git-quick-stats $(PREFIX)/bin/git-quick-stats - git config --global alias.quick-stats '! $(PREFIX)/bin/git-quick-stats' $(MAKE) man @$(TASK_DONE) uninstall: rm -f $(PREFIX)/bin/git-quick-stats rm -f $(PREFIX)/share/man/man1/git-quick-stats.1 - git config --global --unset alias.quick-stats @$(TASK_DONE) reinstall: From 88f970632f0b7f4a93c73d111b48d435c683fba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miodrag=20Toki=C4=87?= Date: Mon, 4 Feb 2019 12:42:21 +0100 Subject: [PATCH 7/7] Add man page to reinstall target Update man page on reinstall as well. Also remove unnecessary uninstall as the "install" command handles this gracefully. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 60116db..6bad512 100644 --- a/Makefile +++ b/Makefile @@ -26,8 +26,8 @@ uninstall: @$(TASK_DONE) reinstall: - @curl -s https://raw.githubusercontent.com/arzzen/git-quick-stats/master/git-quick-stats > git-quick-stats - $(MAKE) uninstall && \ + @curl -sO https://raw.githubusercontent.com/arzzen/git-quick-stats/master/git-quick-stats + @curl -sO https://raw.githubusercontent.com/arzzen/git-quick-stats/master/git-quick-stats.1 $(MAKE) install @$(TASK_DONE)