Class: AdventOfCodeGenerator::Commands::GenerateDay

Inherits:
Thor::Group
  • Object
show all
Includes:
BaseCommand, Thor::Actions
Defined in:
lib/advent_of_code_generator/commands/generate_day.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BaseCommand

#day, #day_name, #input_file_path, #solution_file_path, #year

Class Method Details

.source_rootObject



14
15
16
# File 'lib/advent_of_code_generator/commands/generate_day.rb', line 14

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#create_day_directoryObject



18
19
20
21
22
23
# File 'lib/advent_of_code_generator/commands/generate_day.rb', line 18

def create_day_directory
  unless Dir.exist?(day_name)
    say "Creating day #{day} directory"
    Dir.mkdir(day_name)
  end
end

#create_input_fileObject



30
31
32
33
# File 'lib/advent_of_code_generator/commands/generate_day.rb', line 30

def create_input_file
  say "Creating day #{day} input file"
  create_file input_file_path, fetch_input
end

#create_solution_fileObject



25
26
27
28
# File 'lib/advent_of_code_generator/commands/generate_day.rb', line 25

def create_solution_file
  say "Creating day #{day} solution file"
  template('templates/empty_day.tt', solution_file_path)
end

#prints_doneObject



35
36
37
# File 'lib/advent_of_code_generator/commands/generate_day.rb', line 35

def prints_done
  say 'Generation done, enjoy !', :blue
end