<commit_before>DOCKER=docker -H 127.0.0.1

run: all
	bin/forego start

all: bin/sampid bin/lorne bin/flynn-receive bin/gitreceived bin/discoverd bin/sdutil bin/shelf bin/flynn bin/strowger bin/forego slugbuilder slugrunner storage id_rsa /tmp/keys/vagrant nodejs-example

# Setup

storage:
	mkdir -p storage

id_rsa:
	ssh-keygen -t rsa -N "" -f id_rsa

/home/vagrant/.ssh/id_rsa:
	ssh-keygen -t rsa -f /home/vagrant/.ssh/id_rsa -N ""

/home/vagrant/.ssh/config:
	echo "Host flynn\n    Hostname localhost\n    Port 2022" > ~/.ssh/config

/tmp/keys:
	mkdir -p /tmp/keys

/tmp/keys/vagrant: /home/vagrant/.ssh/id_rsa /home/vagrant/.ssh/config /tmp/keys
	cp /home/vagrant/.ssh/id_rsa.pub /tmp/keys/vagrant

nodejs-example:
	git clone https://github.com/titanous/nodejs-example
	cd nodejs-example && git remote add flynn vagrant@flynn:example

# Projects

bin/sampid: /usr/bin/go bin/discoverd
	go get -v github.com/flynn/sampi/sampid

bin/lorne: /usr/bin/go bin/discoverd
	go get -v github.com/flynn/lorne

bin/flynn-receive: /usr/bin/go bin/discoverd
	go get -v github.com/flynn/flynn-receive

bin/gitreceived: /usr/bin/go
	go get -v github.com/flynn/gitreceive-next/gitreceived

bin/discoverd: /usr/bin/go bin/etcd
	go get -v github.com/flynn/discoverd

bin/sdutil: /usr/bin/go bin/discoverd
	go get -v github.com/flynn/sdutil

bin/shelf: /usr/bin/go
	go get -v github.com/flynn/shelf

bin/flynn-controller: /usr/bin/go bin/discoverd
	go get -v github.com/flynn/flynn-controller

bin/flynn: bin/flynn-cli
	ln -fs `pwd`/bin/flynn-cli bin/flynn

bin/flynn-cli: /usr/bin/go bin/flynn-controller
	go get -v github.com/flynn/flynn-cli

bin/strowger: /usr/bin/go bin/discoverd
	go get -v github.com/flynn/strowger

slugbuilder: /usr/bin/docker
	@${DOCKER} images | grep flynn/slugbuilder > /dev/null || ${DOCKER} pull flynn/slugbuilder

slugrunner: /usr/bin/docker
	@${DOCKER} images | grep flynn/slugrunner > /dev/null || ${DOCKER} pull flynn/slugrunner

# Vendor

bin/forego: /usr/bin/go
	go get -v github.com/ddollar/forego

bin/etcd:
	wget https://github.com/coreos/etcd/releases/download/v0.2.0/etcd-v0.2.0-Linux-x86_64.tar.gz
	tar -zxvf etcd-v0.2.0-Linux-x86_64.tar.gz
	cp etcd-v0.2.0-Linux-x86_64/etcd bin

bin/godeb:
	wget -O godeb.tar.gz https://godeb.s3.amazonaws.com/godeb-amd64.tar.gz
	tar -zxvf godeb.tar.gz
	mkdir -p bin
	mv godeb bin/godeb

/usr/bin/go: bin/godeb
	sudo bin/godeb install 1.2

/etc/default/docker:
	sudo bash -c "echo 'DOCKER_OPTS=\"-H 127.0.0.1\"' > /etc/default/docker"

/usr/bin/docker: /etc/default/docker
	sudo apt-get update
	sudo apt-get install -y lxc-docker
	sudo touch /usr/bin/docker
	sleep 2 # wait for docker to boot

.PHONY: all slugrunner slugbuilder<commit_msg>Use docker via unix socket<commit_after>run: all
	bin/forego start

all: bin/sampid bin/lorne bin/flynn-receive bin/gitreceived bin/discoverd bin/sdutil bin/shelf bin/flynn bin/strowger bin/forego slugbuilder slugrunner storage id_rsa /tmp/keys/vagrant nodejs-example

# Setup

storage:
	mkdir -p storage

id_rsa:
	ssh-keygen -t rsa -N "" -f id_rsa

/home/vagrant/.ssh/id_rsa:
	ssh-keygen -t rsa -f /home/vagrant/.ssh/id_rsa -N ""

/home/vagrant/.ssh/config:
	echo "Host flynn\n    Hostname localhost\n    Port 2022" > ~/.ssh/config

/tmp/keys:
	mkdir -p /tmp/keys

/tmp/keys/vagrant: /home/vagrant/.ssh/id_rsa /home/vagrant/.ssh/config /tmp/keys
	cp /home/vagrant/.ssh/id_rsa.pub /tmp/keys/vagrant

nodejs-example:
	git clone https://github.com/titanous/nodejs-example
	cd nodejs-example && git remote add flynn vagrant@flynn:example

# Projects

bin/sampid: /usr/bin/go bin/discoverd
	go get -v github.com/flynn/sampi/sampid

bin/lorne: /usr/bin/go bin/discoverd
	go get -v github.com/flynn/lorne

bin/flynn-receive: /usr/bin/go bin/discoverd
	go get -v github.com/flynn/flynn-receive

bin/gitreceived: /usr/bin/go
	go get -v github.com/flynn/gitreceive-next/gitreceived

bin/discoverd: /usr/bin/go bin/etcd
	go get -v github.com/flynn/discoverd

bin/sdutil: /usr/bin/go bin/discoverd
	go get -v github.com/flynn/sdutil

bin/shelf: /usr/bin/go
	go get -v github.com/flynn/shelf

bin/flynn-controller: /usr/bin/go bin/discoverd
	go get -v github.com/flynn/flynn-controller

bin/flynn: bin/flynn-cli
	ln -fs `pwd`/bin/flynn-cli bin/flynn

bin/flynn-cli: /usr/bin/go bin/flynn-controller
	go get -v github.com/flynn/flynn-cli

bin/strowger: /usr/bin/go bin/discoverd
	go get -v github.com/flynn/strowger

slugbuilder: /usr/bin/docker
	@docker images | grep flynn/slugbuilder > /dev/null || docker pull flynn/slugbuilder

slugrunner: /usr/bin/docker
	@docker images | grep flynn/slugrunner > /dev/null || docker pull flynn/slugrunner

# Vendor

bin/forego: /usr/bin/go
	go get -v github.com/ddollar/forego

bin/etcd:
	wget https://github.com/coreos/etcd/releases/download/v0.2.0/etcd-v0.2.0-Linux-x86_64.tar.gz
	tar -zxvf etcd-v0.2.0-Linux-x86_64.tar.gz
	cp etcd-v0.2.0-Linux-x86_64/etcd bin

bin/godeb:
	wget -O godeb.tar.gz https://godeb.s3.amazonaws.com/godeb-amd64.tar.gz
	tar -zxvf godeb.tar.gz
	mkdir -p bin
	mv godeb bin/godeb

/usr/bin/go: bin/godeb
	sudo bin/godeb install 1.2

/usr/bin/docker:
	sudo apt-get update
	sudo apt-get install -y lxc-docker
	sudo touch /usr/bin/docker
	sleep 2 # wait for docker to boot

.PHONY: all slugrunner slugbuilder
{'fraction_non_alphanumeric': 0.13734068860566864, 'fraction_numerical': 0.015217804831653034, 'mean_word_length': 3.3275720164609055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1125158', 'n_tokens_mistral': 2423, 'n_tokens_neox': 2307, 'n_words': 465}