Skip to content

Commit

Permalink
fix: Boilerplate generation (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
obalunenko committed Dec 5, 2023
1 parent de7b343 commit 639a395
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
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."

0 comments on commit 639a395

Please sign in to comment.