class Belajar::Terminal::Solutions
Public Instance Methods
open(course_name = '')
click to toggle source
# File lib/belajar/terminal/solutions.rb, line 10 def open(course_name = '') path = File.join(Belajar.config.solutions_path, course_name) unless Dir.exist?(path) text = [ "The course directory \"#{File.basename(path)}\" is not available in", "\"#{File.dirname(path)}\".\n", 'Hint:', 'Run "belajar scaffold" to create empty solution files for all courses.' ] say_warning text.join("\n") unless Loading::Courses.load(Belajar.config.courses_path).empty? Terminal::Courses.new.list end return end if OS.windows? system "explorer '#{path}'" elsif OS.mac? system "open '#{path}'" elsif OS.linux? system "xdg-open '#{path}'" end rescue ConfigurationError => e say_warning e.message end