lib/learn_open/environments/base_environment.rb in learn-open-1.2.21 vs lib/learn_open/environments/base_environment.rb in learn-open-1.2.22

- old
+ new

@@ -10,33 +10,43 @@ @system_adapter = options.fetch(:system_adapter) { LearnOpen.system_adapter } @logger = options.fetch(:logger) { LearnOpen.logger } @options = options end + def managed? + false + end + def open_jupyter_lab(lesson, location, editor) :noop end def open_lab(lesson, location, editor) case lesson when LearnOpen::Lessons::IosLesson io.puts "You need to be on a Mac to work on iOS lessons." else - download_lesson(lesson, location) - open_editor(lesson, location, editor) - install_dependencies(lesson, location) - notify_of_completion - open_shell + case download_lesson(lesson, location) + when :ok, :noop + open_editor(lesson, location, editor) + install_dependencies(lesson, location) + notify_of_completion + open_shell + when :ssh_unauthenticated + io.puts 'Failed to obtain an SSH connection!' + else + raise LearnOpen::Environments::UnknownLessonDownloadError + end end end def install_dependencies(lesson, location) DependencyInstallers.run_installers(lesson, location, self, options) end def download_lesson(lesson, location) - LessonDownloader.call(lesson, location, options) + LessonDownloader.call(lesson, location, self, options) end def open_editor(lesson, location, editor) io.puts "Opening lesson..." system_adapter.change_context_directory(lesson.to_path) @@ -58,10 +68,10 @@ def warn_if_necessary(lesson) return unless lesson.later_lesson io.puts 'WARNING: You are attempting to open a lesson that is beyond your current lesson.' - io.print 'Are you sure you want to continue? [Yn]: ' + io.print 'Are you sure you want to continue? [Y/n]: ' warn_response = io.gets.chomp.downcase exit if !['yes', 'y'].include?(warn_response) end end