Sha256: 9888f6f9c9c8e268f970ccc868a2a9e01e97091dbc4226ed9d6e55e33f97d584
Contents?: true
Size: 1.79 KB
Versions: 1
Compression:
Stored size: 1.79 KB
Contents
module LearnOpen module Environments class IDEEnvironment < BaseEnvironment def managed? true end def open_readme(lesson) when_valid(lesson) do warn_if_necessary(lesson) io.puts "Opening readme..." run_custom_command(:browser_open, {url: lesson.to_url}) end end def open_jupyter_lab(lesson, location, editor) when_valid(lesson) do warn_if_necessary(lesson) io.puts "Opening Jupyter Lesson..." run_custom_command(:browser_open, {url: lesson.to_url}) end end def open_lab(lesson, location, editor) when_valid(lesson) do warn_if_necessary(lesson) case lesson when LearnOpen::Lessons::IosLesson super when -> (l) { valid?(l) } download_lesson(lesson, location) open_editor(lesson, location, editor) start_file_backup(lesson, location) install_dependencies(lesson, location) notify_of_completion open_shell end end end def when_valid(lesson, &block) if valid?(lesson) block.call else on_invalid(lesson) end end def valid?(lesson) lesson.name == environment_vars['LAB_NAME'] end def on_invalid(lesson) io.puts "Opening new window" run_custom_command(:open_lab, {lab_name: lesson.name}) end def run_custom_command(command, message) home_dir = "/home/#{environment_vars['CREATED_USER']}" custom_commands_log = "#{home_dir}/.custom_commands.log" File.open(custom_commands_log, "a") do |f| f.puts({:command => command}.merge(message).to_json) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
learn-open-1.2.22 | lib/learn_open/environments/ide_environment.rb |