2
1
mirror of https://github.com/kdabir/has.git synced 2024-11-10 21:26:50 +01:00
has/Makefile
Virgil 36e11e238f Freshen Makefile and update README.md (#31)
Details:

* Freshen Makefile and update README.md

- [x] Add `sudo` to revelvant commands
- [x] Use named languages (bash) in fenced codeblocks
- [x] Use `console` in fenced codeblocks for command output

- [x] Use `install` with permission mode

The permissions on `has` were 777 from `git clone`.

- [x] Add option to use $PREFIX

What if I don't want to install to /usr/local/bin?

`make PREFIX=$HOME/.local install` now works.

- [x] Add `update` target for `git pull`
- [x] Include .PHONY targets

* Freshen Makefile and update README.md

- [x] Add `sudo` to revelvant commands
- [x] Use named languages (bash) in fenced codeblocks
- [x] Use `console` in fenced codeblocks for command output

- [x] Use `install` with permissions set

The permissions on `has` were 777 from `git clone`.

- [x] Add option to use $PREFIX

What if I don't want to install to /usr/local/bin?

`make PREFIX=$HOME/.local install` now works.

- [x] Add `update` target for `git pull`
- [x] Include .PHONY targets

- [x] Add tests for Makefile changes
- [x] Uses `bats` variables for directories

- ✓ make install creates a valid installation
- ✓ ..even if has is missing from directory
- ✓ make update runs git pull

* Update .hastest.bats

temp remove "git pull" check.

* Update travis to use bats-core 1.10

Do not be concerned about dirty working tree when running make update.

* Change version output to non-blinking.

* Update travis to use bats-core 1.10

Do not be concerned about dirty working tree when running make update.

* Working makefile

* Use `[[` and `@` for the $lines match.

* `make install` MacOS friendly again
2019-04-04 16:09:17 +05:30

39 lines
732 B
Makefile

# Makefile for has
# https://github.com/kdabir/has
# PREFIX is an environment variable.
# Use default value if not set.
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
test : has
bats .hastest.bats
has :
# ensure 'has' in repo
git checkout --force -- has
install : has
# install 'has' in specified directory
chmod 755 has && \
mkdir --verbose --parents $(DESTDIR)$(PREFIX)/bin && \
cp --verbose --update has $(DESTDIR)$(PREFIX)/bin/has
# update: has
update : update-fetch has
update-fetch : update-force
# update repo from upstream
git fetch --verbose --force
update-force :
# remove local repo 'has' to force update
rm --force has
uninstall :
rm --force /usr/local/bin/has
.PHONY: test install uninstall update