From d4f93698103163e6c17157cc3144c5d5eb9e9c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20Ka=CC=88mper?= Date: Mon, 5 Dec 2022 10:15:33 +0100 Subject: [PATCH] =?UTF-8?q?Writes=20solution=20file=20scaffold,=20if=20fil?= =?UTF-8?q?es=20doesn=E2=80=99t=20already=20exist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stephan Kämper --- lib/advent_of_code_cli/commands/scaffold.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/advent_of_code_cli/commands/scaffold.rb b/lib/advent_of_code_cli/commands/scaffold.rb index 77b95df..92cc718 100644 --- a/lib/advent_of_code_cli/commands/scaffold.rb +++ b/lib/advent_of_code_cli/commands/scaffold.rb @@ -4,8 +4,11 @@ module AdventOfCode module Commands class Scaffold < Command def execute - say("Creating file: #{solution_file_name}...") - create_file(solution_file_name, solution_file_contents) + + unless File.exist?(solution_file_name) + say("Creating file: #{solution_file_name}...") + create_file(solution_file_name, solution_file_contents) + end unless Dir.exist?("inputs") say("Creating inputs directory...")