Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Boilerplate generation #290

Merged
merged 1 commit into from
Dec 5, 2023
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
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,9 @@ new-version: vet test-regression build
open-advent-homepage:
./scripts/browser-opener.sh -u 'https://adventofcode.com/'

gen-boilerplate:
./scripts/codegen/puzzle-boilerplate.sh
.PHONY: gen-boilerplate

.DEFAULT_GOAL := help

2 changes: 1 addition & 1 deletion internal/puzzles/solutions/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func createNewFromTemplate(purl string) error {
const (
perms = 0o766
perms = 0o655
yearLen = 4
dayLen = 2
)
Expand Down
17 changes: 17 additions & 0 deletions scripts/codegen/puzzle-boilerplate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -Eeuo pipefail

SCRIPT_NAME="$(basename "$0")"
SCRIPT_DIR="$(dirname "$0")"
REPO_ROOT="$(cd "${SCRIPT_DIR}" && git rev-parse --show-toplevel)"
SCRIPTS_DIR="${REPO_ROOT}/scripts"

source "${SCRIPTS_DIR}/helpers-source.sh"

cd ${REPO_ROOT}/internal/puzzles/solutions || exit 1

go test -v -run Test_createNewFromTemplate

echo "${SCRIPT_NAME} done."