class Belajar::Terminal::Welcome

Public Class Methods

about() click to toggle source
# File lib/belajar/terminal/welcome.rb, line 10
def self.about
  new.about
end
run() click to toggle source
# File lib/belajar/terminal/welcome.rb, line 6
def self.run
  new.run
end

Public Instance Methods

about() click to toggle source
# File lib/belajar/terminal/welcome.rb, line 35
def about
  empty_line
  say Terminal.text :about
  empty_line
  say `belajar help`
end
run() click to toggle source
# File lib/belajar/terminal/welcome.rb, line 14
def run
  empty_line
  say Terminal.text :welcome
  empty_line
  say 'For now, let’s setup the belajar paths.'
  Belajar::Terminal::Setup.new.init

  show_setup_list_announcement
  show_courses_list_announcement

  courses = Loading::Courses.load(Belajar.config.courses_path)

  if courses.empty?
    show_courses_download_announcement
    show_solutions_open_announcement
  end

  empty_line
  show_learn_announcement
end

Private Instance Methods

show_courses_download_announcement() click to toggle source
# File lib/belajar/terminal/welcome.rb, line 64
def show_courses_download_announcement
  command = 'belajar courses download'
  text = [
    'Oh! You don’t have any courses, yet?',
    "Just enter \"#{command}\" to download the basic Belajar course:"
  ].join("\n")

  get_command(command, text)
end
show_courses_list_announcement() click to toggle source
# File lib/belajar/terminal/welcome.rb, line 54
def show_courses_list_announcement
  command = 'belajar courses list'
  text = [
    "Well done. Now, type \"#{command}\" to see what courses are",
    'available in your belajar folder:'
  ].join("\n")

  get_command(command, text)
end
show_learn_announcement() click to toggle source
# File lib/belajar/terminal/welcome.rb, line 85
def show_learn_announcement
  command = 'belajar learn'
  text = [
    'Congratulations! You learned the first steps of using belajar.',
    "To continue and start learning Ruby type \"#{command}\":"
  ].join("\n")

  get_command(command, text)
end
show_setup_list_announcement() click to toggle source
# File lib/belajar/terminal/welcome.rb, line 44
def show_setup_list_announcement
  command = 'belajar setup list'
  text = [
    'The courses path and solutions path have been added to your settings.',
    "Just list your current settings with the \"#{command}\" command:"
  ].join("\n")

  get_command(command, text)
end
show_solutions_open_announcement() click to toggle source
# File lib/belajar/terminal/welcome.rb, line 74
def show_solutions_open_announcement
  command = 'belajar solutions open'
  text = [
    'When downloading a course, Belajar scaffolds empty solution files',
    "for your code on the fly.\n",
    "Type \"#{command}\" to open your solutions folder:"
  ].join("\n")

  get_command(command, text)
end