<commit_before># we need this for `make pkg`, since we do some directory traversal
SHELL:=/bin/bash

BASH_M4=completions/kbsecret.bash.m4
BASH_M4_OUT=completions/kbsecret.bash
ZSH_M4=completions/kbsecret.zsh.m4
ZSH_M4_OUT=completions/kbsecret.zsh
FISH_M4=completions/kbsecret.fish.m4
FISH_M4_OUT=completions/kbsecret.fish

override CMDS+=$(shell echo bin/kbsecret* | xargs basename -a | \
					sed 's/^kbsecret-\{0,1\}//g')

M4FLAGS:=-D__KBSECRET_INTROSPECTABLE_COMMANDS="$(CMDS)"

PKG=pkg
GEM_DEPS=$(PKG)/deps
PKGS=deb rpm pacman

.PHONY: all
all: completions doc man test

.PHONY: completions
completions: bash zsh fish

.PHONY: doc
doc:
	yardoc
	yard stats --list-undoc

.PHONY: man
man: ronnpp
	ronn --manual="KBSecret Manual" --html --roff man/*.ronn

.PHONY: ronnpp
ronnpp:
	for f in man/*.ronnpp; do ./man/ronnpp < $$f > man/$$(basename $$f .ronnpp).ronn; done

.PHONY: pkg
pkg: $(PKGS)

$(PKGS): prep-gems
	pushd . && \
	mkdir -p $(PKG)/$@ && \
	cd $(PKG)/$@ && \
	find ../deps/cache -name "*.gem" | \
		xargs -rn1 fpm -d ruby -d rubygems \
		--prefix $$(gem environment gemdir) \
		-s gem -t $@ && \
	popd

prep-gems:
	mkdir -p pkg/deps
	gem install --norc --no-ri --no-rdoc --install-dir $(GEM_DEPS) kbsecret

.PHONY: test
test:
	rake test

.PHONY: bash
bash:
	m4 $(M4FLAGS) $(BASH_M4) > $(BASH_M4_OUT)

.PHONY: zsh
zsh: # XXX: implement

.PHONY: fish
fish: # XXX: implement

.PHONY: clean
clean:
	rm -f $(BASH_M4_OUT) $(ZSH_M4_OUT) $(FISH_M4_OUT)
	rm -rf doc/
	rm -rf man/*.html man/*.1 man/*.ronn
	rm -rf pkg/<commit_msg>Makefile: Don't prefix packages with "rubygems-".<commit_after># we need this for `make pkg`, since we do some directory traversal
SHELL:=/bin/bash

BASH_M4=completions/kbsecret.bash.m4
BASH_M4_OUT=completions/kbsecret.bash
ZSH_M4=completions/kbsecret.zsh.m4
ZSH_M4_OUT=completions/kbsecret.zsh
FISH_M4=completions/kbsecret.fish.m4
FISH_M4_OUT=completions/kbsecret.fish

override CMDS+=$(shell echo bin/kbsecret* | xargs basename -a | \
					sed 's/^kbsecret-\{0,1\}//g')

M4FLAGS:=-D__KBSECRET_INTROSPECTABLE_COMMANDS="$(CMDS)"

PKG=pkg
GEM_DEPS=$(PKG)/deps
PKGS=deb rpm pacman

.PHONY: all
all: completions doc man test

.PHONY: completions
completions: bash zsh fish

.PHONY: doc
doc:
	yardoc
	yard stats --list-undoc

.PHONY: man
man: ronnpp
	ronn --manual="KBSecret Manual" --html --roff man/*.ronn

.PHONY: ronnpp
ronnpp:
	for f in man/*.ronnpp; do ./man/ronnpp < $$f > man/$$(basename $$f .ronnpp).ronn; done

.PHONY: pkg
pkg: $(PKGS)

$(PKGS): prep-gems
	pushd . && \
	mkdir -p $(PKG)/$@ && \
	cd $(PKG)/$@ && \
	find ../deps/cache -name "*.gem" | \
		xargs -rn1 fpm -d ruby -d rubygems \
		--no-gem-fix-name --no-gem-fix-dependencies \
		--prefix $$(gem environment gemdir) \
		-s gem -t $@ && \
	popd

prep-gems:
	mkdir -p pkg/deps
	gem install --norc --no-ri --no-rdoc --install-dir $(GEM_DEPS) kbsecret

.PHONY: test
test:
	rake test

.PHONY: bash
bash:
	m4 $(M4FLAGS) $(BASH_M4) > $(BASH_M4_OUT)

.PHONY: zsh
zsh: # XXX: implement

.PHONY: fish
fish: # XXX: implement

.PHONY: clean
clean:
	rm -f $(BASH_M4_OUT) $(ZSH_M4_OUT) $(FISH_M4_OUT)
	rm -rf doc/
	rm -rf man/*.html man/*.1 man/*.ronn
	rm -rf pkg/
{'fraction_non_alphanumeric': 0.16793650793650794, 'fraction_numerical': 0.013333333333333334, 'mean_word_length': 3.5014285714285713, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '991936', 'n_tokens_mistral': 1510, 'n_tokens_neox': 1420, 'n_words': 332}