aoc-helper/lib/tasks/part_two.rb

18 lines
408 B
Ruby
Raw Permalink Normal View History

2022-12-02 18:57:54 +01:00
require "tty-prompt"
2022-12-03 11:47:03 +01:00
require "tty-file"
require "ostruct"
require_relative("templates")
2022-12-02 18:57:54 +01:00
def part_two(prompt, day)
2022-12-03 11:47:03 +01:00
result = prompt.ask("Part two example result")
day_name = "day_#{day}"
TTY::File.copy_file("#{day_name}/impl.rb","#{day_name}/impl_2.rb")
TTY::File.replace_in_file "#{day_name}/test.rb", /example_result_2/, result
puts "Done - run with:"
puts "ruby #{day_name}/test.rb 2"
end