<commit_before>APP:=thrift_server

.DEFAULT_GOAL:=build

APP_RUN:=docker run --rm -t -v $(CURDIR):/usr/src/app $(APP)

gen-rb/echo_service.rb: echo_service.thrift
	docker run --rm -t -v $(CURDIR):/data registry.platform.saltside.io/platform/thrift:0.9.2 \
		-o /data --gen rb /data/$<

.PHONY: thrift
thrift: gen-rb/echo_service.rb

tmp/image: Dockerfile Gemfile lib/thrift_server/version.rb thrift_server.gemspec
	docker build -t $(APP) .
	mkdir -p $(@D)
	docker inspect -f '{{.Id}}' $(APP) >> $@

.PHONY: build
build: tmp/image

.PHONY: test-unit
test-unit: tmp/image
	$(APP_RUN) bundle exec rake

.PHONY: test-network
test-network: tmp/image
	-@docker stop server > /dev/null 2>&1
	-@docker rm -v server > /dev/null 2>&1
	docker run -d --name server -v $(CURDIR):/usr/src/app $(APP) ruby echo_server.rb
	docker run --rm -t -v $(CURDIR):/usr/src/app --link server:server $(APP) ruby echo_client.rb server 9090

.PHONY: test-ci
test-ci: test-unit test-network

.PHONY: clean
clean:
	-docker stop server > /dev/null 2>&1
	-docker rm -v server > /dev/null 2>&1
	@mkdir -p tmp<commit_msg>Add thrift dependency to test-network<commit_after>APP:=thrift_server

.DEFAULT_GOAL:=build

APP_RUN:=docker run --rm -t -v $(CURDIR):/usr/src/app $(APP)

gen-rb/echo_service.rb: echo_service.thrift
	docker run --rm -t -v $(CURDIR):/data registry.platform.saltside.io/platform/thrift:0.9.2 \
		-o /data --gen rb /data/$<

.PHONY: thrift
thrift: gen-rb/echo_service.rb

tmp/image: Dockerfile Gemfile lib/thrift_server/version.rb thrift_server.gemspec
	docker build -t $(APP) .
	mkdir -p $(@D)
	docker inspect -f '{{.Id}}' $(APP) >> $@

.PHONY: build
build: tmp/image

.PHONY: test-unit
test-unit: tmp/image
	$(APP_RUN) bundle exec rake

.PHONY: test-network
test-network: tmp/image gen-rb/echo_service.rb
	-@docker stop server > /dev/null 2>&1
	-@docker rm -v server > /dev/null 2>&1
	docker run -d --name server -v $(CURDIR):/usr/src/app $(APP) ruby echo_server.rb
	docker run --rm -t -v $(CURDIR):/usr/src/app --link server:server $(APP) ruby echo_client.rb server 9090

.PHONY: test-ci
test-ci: test-unit test-network

.PHONY: clean
clean:
	-docker stop server > /dev/null 2>&1
	-docker rm -v server > /dev/null 2>&1
	@mkdir -p tmp
{'fraction_non_alphanumeric': 0.1676430824695809, 'fraction_numerical': 0.013519603424966201, 'mean_word_length': 3.5121951219512195, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '3236750', 'n_tokens_mistral': 925, 'n_tokens_neox': 878, 'n_words': 236}