<commit_before># Install
#   sudo GOPATH=$GOPATH make install
#
# Packages
#   NOTICE: Backup your run.conf before run the following command
#   sudo GOPATH=$GOPATH make packages VERSION="X.Y.Z"
#
# Other
#   make test
#   sudo make clean
#   sudo make purge
#   sudo GOPATH=$GOPATH make reinstall

.PHONY: help test install clean purge reinstall packages deb

RUN_CONF=/etc/run.conf
RUN_BIN=/usr/bin/run
DATA_DIR=/usr/local/run

DEB_DIR=packages/deb

BUILD=go build
MAIN=run.go

PACKAGES=linux_amd64 linux_386 linux_arm \
		 darwin_amd64 darwin_386 \
		 freebsd_amd64 freebsd_386

DEB_FLAG=-y --install=no --fstrans=yes --nodoc --backup=no \
		 --maintainer="<EMAIL>" --pkglicense=MIT \
		 --pkgversion=`date +"%Y%m%d"` --pkgrelease=$(VERSION) \
		 --pkgaltsource="https://github.com/runscripts/run"

help:
	echo 'sudo GOPATH=$$GOPATH make install'

test:
	cd utils && go test -cover -v

install:
	$(_OS) $(_ARCH) $(BUILD) -o $(RUN_BIN) $(MAIN)
	[ -e $(RUN_CONF) ] || cp run.conf $(RUN_CONF)
	mkdir -p $(DATA_DIR) && chmod 777 $(DATA_DIR)
	cp LICENSE $(DATA_DIR)

clean:
	rm -f $(RUN_BIN)
	rm -rf $(DATA_DIR)

purge: clean
	rm -f $(RUN_CONF)

reinstall: purge install

packages: deb $(PACKAGES)

$(PACKAGES):
	echo $@ | awk -F_ '{print "mkdir -p packages/"$$1"_"$$2}' | bash
	echo $@ | awk -F_ '{print "CGO_ENABLED=0 GOOS="$$1" GOARCH="$$2" $(BUILD) -o packages/"$$1"_"$$2"/run $(MAIN)"}' | bash

deb:
	[ -n "$(VERSION)" ] && [ `whoami` = 'root' ]
	make purge
	mkdir -p $(DEB_DIR) && rm -rf $(DEB_DIR)/*.deb
	checkinstall $(DEB_FLAG) --arch="amd64" make install _OS="GOOS=linux" _ARCH="GOARCH=amd64"
	checkinstall $(DEB_FLAG) --arch="386" make install _OS="GOOS=linux" _ARCH="GOARCH=386"
	mv *.deb $(DEB_DIR)
<commit_msg>chmod 666 run.conf in makefile<commit_after># Install
#   sudo GOPATH=$GOPATH make install
#
# Packages
#   NOTICE: Backup your run.conf before run the following command
#   sudo GOPATH=$GOPATH make packages VERSION="X.Y.Z"
#
# Other
#   make test
#   sudo make clean
#   sudo make purge
#   sudo GOPATH=$GOPATH make reinstall

.PHONY: help test install clean purge reinstall packages deb

RUN_CONF=/etc/run.conf
MAC_RUN_CONF=/usr/local/etc/run.conf
RUN_BIN=/usr/bin/run
DATA_DIR=/usr/local/run

DEB_DIR=packages/deb

BUILD=go build
MAIN=run.go

PACKAGES=linux_amd64 linux_386 linux_arm \
		 darwin_amd64 darwin_386 \
		 freebsd_amd64 freebsd_386

DEB_FLAG=-y --install=no --fstrans=yes --nodoc --backup=no \
		 --maintainer="<EMAIL>" --pkglicense=MIT \
		 --pkgversion=`date +"%Y%m%d"` --pkgrelease=$(VERSION) \
		 --pkgaltsource="https://github.com/runscripts/run"

help:
	echo 'sudo GOPATH=$$GOPATH make install'

test:
	cd utils && go test -cover -v

install:
	$(_OS) $(_ARCH) $(BUILD) -o $(RUN_BIN) $(MAIN)
	[ -e $(RUN_CONF) ] || cp run.conf $(RUN_CONF) && chmod 666 $(RUN_CONF)
	mkdir -p $(DATA_DIR) && chmod 777 $(DATA_DIR)
	cp LICENSE $(DATA_DIR)

clean:
	rm -f $(RUN_BIN)
	rm -rf $(DATA_DIR)

purge: clean
	rm -f $(RUN_CONF)
	rm -f $(MAC_RUN_CONF)

reinstall: purge install

packages: deb $(PACKAGES)

$(PACKAGES):
	echo $@ | awk -F_ '{print "mkdir -p packages/"$$1"_"$$2}' | bash
	echo $@ | awk -F_ '{print "CGO_ENABLED=0 GOOS="$$1" GOARCH="$$2" $(BUILD) -o packages/"$$1"_"$$2"/run $(MAIN)"}' | bash

deb:
	[ -n "$(VERSION)" ] && [ `whoami` = 'root' ]
	make purge
	mkdir -p $(DEB_DIR) && rm -rf $(DEB_DIR)/*.deb
	checkinstall $(DEB_FLAG) --arch="amd64" make install _OS="GOOS=linux" _ARCH="GOARCH=amd64"
	checkinstall $(DEB_FLAG) --arch="386" make install _OS="GOOS=linux" _ARCH="GOARCH=386"
	mv *.deb $(DEB_DIR)
{'fraction_non_alphanumeric': 0.17658674188998588, 'fraction_numerical': 0.021438645980253877, 'mean_word_length': 4.124277456647399, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '2570036', 'n_tokens_mistral': 1526, 'n_tokens_neox': 1390, 'n_words': 353}