Top Level Namespace

Defined Under Namespace

Modules: AocRb

Instance Method Summary collapse

Instance Method Details

#ensure_aoc_start_in_binObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/aoc_rb/app.rb', line 31

def ensure_aoc_start_in_bin
  bin_path = File.join(Dir.pwd, 'bin/aoc')

  return unless File.exist?(bin_path)

  unless File.read(bin_path).include?('AocRb::App.start')
    puts "Adding missing `AocRb::App.start` line to `bin/aoc`..."

    File.open(bin_path, 'a') do |file|
      file.puts "\nAocRb::App.start\n"
    end

    puts "`AocRb::App.start` has been added to `bin/aoc`.\n\nPlease re-run your aoc command."
  end
end