From 37f6aed05073c2dc107e55549361ba40ebd4ce97 Mon Sep 17 00:00:00 2001 From: Guillaume Dott Date: Tue, 23 Nov 2021 13:05:20 +0100 Subject: [PATCH] Add init-day.sh script with template.rb --- init-day.sh | 22 ++++++++++++++++++++++ template.rb | 13 +++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 init-day.sh create mode 100755 template.rb diff --git a/init-day.sh b/init-day.sh new file mode 100755 index 0000000..6e13ed9 --- /dev/null +++ b/init-day.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +BASEDIR=$(dirname "$0") + +if [ ! -z "$1" ] +then + DAY=$(printf "%02d" "$1") +else + DAY=$(date +%d) +fi + +cd $BASEDIR/ + +if [ ! -d $DAY ] +then + mkdir $DAY +fi + +if [ ! -f $DAY/script.rb ] +then + sed "s/NB/$DAY/" template.rb >$DAY/script.rb +fi diff --git a/template.rb b/template.rb new file mode 100755 index 0000000..fbce6ca --- /dev/null +++ b/template.rb @@ -0,0 +1,13 @@ +#!/usr/bin/env ruby + +require_relative '../common' + +class DayNB < Day + def part1 + end + + def part2 + end +end + +DayNB.run