<commit_before>.PHONY: all build lint test run console update_lsc clean

all: build seed lint test run console update_lsc attach clean

ifeq ($(OS),Windows_NT)
  detectedOS := Windows
else
  detectedOS := $(shell sh -c 'uname -s 2>/dev/null || echo not')
endif

docker-compose := docker-compose
docker := docker
ifeq ($(detectedOS),Linux)
  docker-compose := sudo -E docker-compose
  docker := sudo -E docker
endif

container ?= web

build:
	$(docker-compose) run web bundle install
	$(docker-compose) run web yarn install
	$(docker-compose) build
	$(docker-compose) run web rails db:migrate
	@[ -e tmp/seed ] || make seed
	$(docker-compose) run web skylight disable_dev_warning

seed:
	$(docker-compose) run web bash -c "bundle exec rails db:migrate && bundle exec rails db:seed"
	@echo "# The presence of this file tells the splits-io Makefile to not re-seed data." > tmp/seed

lint:
	git diff-tree -r --no-commit-id --name-only head origin/master | xargs $(docker-compose) run web rubocop --force-exclusion

test:
	$(docker-compose) run -e RAILS_ENV=test web bundle exec rspec $(path)

run: # Run docker-compose up, but work around Ctrl-C sometimes not stopping containers. See https://github.com/docker/compose/issues/3317#issuecomment-416552656
	bash -c "trap '$(docker-compose) stop' EXIT; $(docker-compose) up"

console:
	$(docker-compose) run web rails console

profile:
	$(docker-compose) run -e RAILS_ENV=profiling web rake assets:precompile
	$(docker-compose) run -e RAILS_ENV=profiling --service-ports web rails s
	$(docker-compose) run -e RAILS_ENV=profiling web rake assets:clobber

derailed:
	$(docker-compose) run -e RAILS_ENV=profiling $(env) web bundle exec derailed $(command)
<commit_msg>Adjust makefile behavior (#583)<commit_after>.PHONY: all build seed lint test run console profile derailed update_lsc attach clean

all: build run

ifeq ($(OS),Windows_NT)
  detectedOS := Windows
else
  detectedOS := $(shell sh -c 'uname -s 2>/dev/null || echo not')
endif

docker-compose := docker-compose
docker := docker
ifeq ($(detectedOS),Linux)
  docker-compose := sudo -E docker-compose
  docker := sudo -E docker
endif

container ?= web

build:
	$(docker-compose) run web bundle install
	$(docker-compose) run web yarn install
	$(docker-compose) build
	$(docker-compose) run web rails db:migrate
	@[ -e tmp/seed ] || make seed
	$(docker-compose) run web skylight disable_dev_warning
	$(docker-compose) stop

seed:
	$(docker-compose) run web bash -c "bundle exec rails db:migrate && bundle exec rails db:seed"
	@echo "# The presence of this file tells the splits-io Makefile to not re-seed data." > tmp/seed

lint:
	git diff-tree -r --no-commit-id --name-only head origin/master | xargs $(docker-compose) run web rubocop --force-exclusion

test:
	$(docker-compose) run -e RAILS_ENV=test web bundle exec rspec $(path)

run: # Run docker-compose up, but work around Ctrl-C sometimes not stopping containers. See https://github.com/docker/compose/issues/3317#issuecomment-416552656
	bash -c "trap '$(docker-compose) stop' EXIT; $(docker-compose) up"

console:
	$(docker-compose) run web rails console

profile:
	$(docker-compose) run -e RAILS_ENV=profiling web rake assets:precompile
	$(docker-compose) run -e RAILS_ENV=profiling --service-ports web rails s
	$(docker-compose) run -e RAILS_ENV=profiling web rake assets:clobber

derailed:
	$(docker-compose) run -e RAILS_ENV=profiling $(env) web bundle exec derailed $(command)

{'fraction_non_alphanumeric': 0.1188953488372093, 'fraction_numerical': 0.009011627906976745, 'mean_word_length': 4.488038277511961, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5459335', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1157, 'n_words': 388}