Method: TechbookHelper::Helper#create

Defined in:
lib/techbook_helper.rb

#createObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/techbook_helper.rb', line 57

def create

  if is_dir_used?
    puts "We find other files in this directory:".red
    puts "'#{Dir['*'].join("', '")}'".blue
    puts "One book – one folder."
    puts "Are you want #{'delete all'.red} and create new empty book?"
    puts "(yes/no)?"
    unless yes_no_choice
      puts_ok
      return
    end
    clear_current_dir
  end

  unless check_git_dir
    puts 'Looks like git not initialized in current directory'.yellow
  end

  current_dir = Dir.pwd
  puts 'Ok, lest do it.'
  puts "Confirm you wana create TechBook template in directory #{current_dir.green}"
  print '(yes/no) '

  if yes_no_choice
    select_book_name
  else
    puts_ok
  end

end