fisher/Makefile

73 lines
2.4 KiB
Makefile
Raw Normal View History

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)
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)
@$(call MSG,"Reset your shell to apply changes")
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
Fisherman v0.2.0 * Improved README, added links to screencasts, updated documentation with new changes and fixed other typos and composition errors. * Removed `fisher update --cache` in favor of `fisher --cache | fisher update` and `fisher uninstall --all` in favor of `fisher --cache | fisher uninstall`. * Fisherman does not move initialization / configuration files following the convention `name`.config.fish to `$fisher_config/functions`, but to `$fisher_config/conf.d` now and evaluates each `*.config.fish` inside at shell start as usual. Closes #13. * Added `fisher --cache[=base]` option to retrieve contents in `$fisher_cache`, eliminating flaky usage of `find(1)`. Closes #11. * Fisherman now generates information about plugins installed via custom URLs. For the description, a shortened version of the URL is used. For the URL the full URL is used. For tags, the URL is fuzzily checked and tags such as _theme_, _plugin_, _config_ and _omf_ are added. The tag _orphan_ is added by default as well. Finally, the author is generated by retrieving the e-mail or username of the author of the first commit in the plugin's repository. Closes #9 and #14. * Changed `--path-in-cache` to `--translate.` This function translates an name or supported URL/URL variation into a path inside `$fisher_cache`. This allows you to treat plugins installed via custom URLs almost like regular plugins if they are installed. Closes #8. * Fixed a bug with `mktemp` failing on some systems. Closes #7. Thanks @tobywf. * Added [CODE_OF_CONDUCT][code_of_conduct]. Closes #6. * Fisherman can now unload themes within the same shell, without having to restart the session. Closes #5. * Fisherman can now load themes within the same shell, without having to restart the session using `exec fish`. Shoddy themes, for example those failing to declare global variables with the `-g` flag still require the session to be reset. See [**related**][bobthefish-19]. Closes #4. * Move `getopts` implementation to `share/getopts.awk`. Closes #3. * Support dots inside URIs in `fisher --validate`. Closes #2.
2016-01-03 03:35:56 +00:00
@awk '!config[$$0]++ || /^$$/' $@.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 $? 2>&1 | sed 's/^ *roff: *//;s|//|/|g'