fisher/Makefile
Jorge Bucaran ee0338d5b0
Ahoy! Fisherman gets a super patch v0.3.1
This patch contains several amends for 0.3.0 and
other minor documentation corrections.  Major
documentation revision and rewrite.

fisher help shows fisher(1) by default now.

Fix a critical bug that was causing fisher uninstall
--force to remove not the symbolic link, but the
actual files. Closes #24

Rename orphan tag to custom for plugins installed
using a custom URL.

warning Remove fisher --link flag and create symbolic
links by default for local paths. The user does not
have to worry about symbolic links or whether the
copy is as symbolic link or not anymore. If the user
tries to install a local path, then the best thing
to do is to create a symbolic link. This also
eliminates the need to call update.

warning Remove fisher --cache and fisher --validate.
Now, that these options are separated into their own
function and they are intentionally private, there
is no need for them.
2016-01-10 16:13:46 +09:00

80 lines
2.6 KiB
Makefile

SHELL:=/bin/bash -O nullglob
XDG_CONFIG_HOME ?= $$HOME/.config
FISH_CONFIG := $(XDG_CONFIG_HOME)/fish/config.fish
FISHER_HOME := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
FISHER_CONFIG := $(XDG_CONFIG_HOME)/fisherman
FISHER_CACHE := $(FISHER_CONFIG)/cache
MAN := $(FISHER_HOME)/man
MAN1 := $(wildcard $(MAN)/man1/*.md)
MAN5 := $(wildcard $(MAN)/man5/*.md)
MAN7 := $(wildcard $(MAN)/man7/*.md)
DOCS := $(MAN1:%.md=%.1) $(MAN5:%.md=%.5) $(MAN7:%.md=%.7)
INDEX := $(FISHER_CACHE)/.index
AUTHORS = $(FISHER_HOME)/AUTHORS.md
VERSION = `cat $(FISHER_HOME)/VERSION`
MSG = printf "\033[47m\033[30m%s\033[0m\n" $(1)
TILDEIFY = sed "s|$$HOME|~|"
.PHONY: all test flush uninstall release
all: $(FISH_CONFIG) $(FISHER_CACHE) $(AUTHORS) $(DOCS)
@if [ ! -s $(INDEX) ]; then\
echo "Downloading the index for the first time...";\
fish -c "fisher_update --index";\
fi
@$(call MSG,"Reset your shell and type 'fisher <command>' to use Fisherman")
@fish -c "fisher help -a" | sed -n '3,$$p'
test:
@fish -c "fishtape test/*.fish"
flush:
@rm -rf $(FISHER_CONFIG)/*
uninstall:
@echo "Removing configuration from $(FISH_CONFIG)" | $(TILDEIFY)
@sed -E '/set (fisher_home|fisher_config) /d;/source \$$fisher_home/d' \
$(FISH_CONFIG) > $(FISH_CONFIG).tmp
@mv $(FISH_CONFIG).tmp $(FISH_CONFIG)
@$(call MSG,"Reset your shell to apply changes.")
release: $(FISHER_HOME)
@if [ "`git -C $^ status --short --porcelain | xargs`" = "M VERSION" ]; then\
echo "`git -C $^ describe --abbrev=0 2>/dev/null || echo \*` -> $(VERSION)";\
sed "s/fisherman-v.\..\..-00B9FF/fisherman-v$(VERSION)-00B9FF/" $^/README.md > $^/README.md.swap;\
mv $^/README.md.swap $^/README.md;\
git -C $^ add README.md;\
git -C $^ add $^/VERSION;\
git -C $^ commit --quiet -m $(VERSION);\
git -C $^ tag $(VERSION) -m v$(VERSION) --force >/dev/null;\
else\
echo "Commit changes and update VERSION to tag a new release.";\
fi
$(FISH_CONFIG):
@echo "Adding configuration to $@" | $(TILDEIFY)
@mkdir -p $(dir $@) && touch $@
@echo "set fisher_home $(FISHER_HOME)" | sed "s|/$$||;s|$$HOME|~|" > $@.fisher
@echo "set fisher_config $(FISHER_CONFIG)" | sed "s|$$HOME|~|" >> $@.fisher
@echo "source \$$fisher_home/config.fish" >> $@.fisher
@awk 'FNR==NR{ print; a[$$0]; next } !($$0 in a) || /^$$/' $@.fisher $@ > $@.tmp
@mv $@.tmp $@ && rm $@.fisher
$(FISHER_CACHE):
@[ -d $@ ] || echo "Creating $@" | $(TILDEIFY)
@mkdir -p $@
$(AUTHORS): $(FISHER_HOME)
@echo "# Authors" > $@
@git -C $^ shortlog -sne | cut -f2- | \
sed -E 's/([^<>]+)<([^<>]*)>/* \1 \&lt;[\2](mailto:\2)\&gt;/' >> $@
%.1 %.5 %.7: %.md
-@ronn --manual=fisherman --roff $? 1>&2 2> /dev/null