Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nerve.rc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export DATA_BAG_DIR=/Users/martin/Dropbox/airbnb/src/chef/data_bags
export COOKBOOK_DIR=/Users/martin/Dropbox/airbnb/src/chef/cookbooks
export COOKBOOK_DIR=/Users/martin/Dropbox/airbnb/src/chef/cookbooks
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
hooks:
- id: standardrb
name: StandardRB
entry: bundle exec standardrb --fix
entry: rbenv exec bundle exec standardrb --fix
language: system
types: [ruby]
pass_filenames: true
4 changes: 2 additions & 2 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ make fix # Auto-fix violations
Install pre-commit hooks to auto-format code on commit:

```bash
pre-commit install
make hooks
```

See `.pre-commit-config.yaml` for the list of hooks.
This uses the repo's `.venv` for pre-commit. If you already have `pre-commit` on your PATH, `pre-commit install` also works. See `.pre-commit-config.yaml` for the list of hooks.

## Running Nerve Locally

Expand Down
21 changes: 13 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ endif
DOCKER_IMAGE := $(DOCKER_REGISTRY)nerve-dev
RUBY_VERSION := 3.2
VENV := .venv
BUNDLE := rbenv exec bundle

.PHONY: help
help: ## Show this help
Expand All @@ -27,17 +28,21 @@ setup-docker: ## Build Docker development image

.PHONY: setup-local
setup-local: $(VENV) ## Install dependencies locally via bundler
bundle install
$(VENV)/bin/pre-commit install
$(BUNDLE) install
$(MAKE) hooks

$(VENV): ## Create Python venv for pre-commit
python3 -m venv $(VENV)
$(VENV)/bin/pip install pre-commit

.PHONY: hooks
hooks: $(VENV) ## Install pre-commit hooks
$(VENV)/bin/pre-commit install

.PHONY: test
test: ## Run test suite
@if [ -f Gemfile.lock ] && bundle check >/dev/null 2>&1; then \
bundle exec rspec; \
@if [ -f Gemfile.lock ] && $(BUNDLE) check >/dev/null 2>&1; then \
$(BUNDLE) exec rspec; \
else \
$(MAKE) test-docker; \
fi
Expand All @@ -48,16 +53,16 @@ test-docker: ## Run tests in Docker container

.PHONY: lint
lint: ## Check code style with StandardRB
bundle exec standardrb
$(BUNDLE) exec standardrb

.PHONY: fix
fix: ## Auto-fix code style issues
bundle exec standardrb --fix
$(BUNDLE) exec standardrb --fix

.PHONY: console
console: ## Start interactive Ruby console
@if bundle check >/dev/null 2>&1; then \
bundle exec pry -r ./lib/nerve; \
@if $(BUNDLE) check >/dev/null 2>&1; then \
$(BUNDLE) exec pry -r ./lib/nerve; \
else \
docker run --rm -it $(DOCKER_IMAGE) bundle exec pry -r ./lib/nerve; \
fi
Expand Down