class LearnOpen::Environments::MacEnvironment

Public Class Methods

chrome_installed?() click to toggle source
# File lib/learn_open/environments/mac_environment.rb, line 12
def self.chrome_installed?
  File.exists?('/Applications/Google Chrome.app')
end
classify(options) click to toggle source
# File lib/learn_open/environments/mac_environment.rb, line 4
def self.classify(options)
  if chrome_installed?
    MacWithChromeEnvironment.new(options)
  else
    self.new(options)
  end
end

Public Instance Methods

open_jupyter_lab(lesson, location, editor, _clone_only) click to toggle source
# File lib/learn_open/environments/mac_environment.rb, line 33
def open_jupyter_lab(lesson, location, editor, _clone_only)
  io.puts "Opening Jupyter Lesson..."
  system_adapter.run_command("open -a Safari #{lesson.to_url}")
end
open_lab(lesson, location, editor, clone_only) click to toggle source
# File lib/learn_open/environments/mac_environment.rb, line 21
def open_lab(lesson, location, editor, clone_only)
  case lesson
  when LearnOpen::Lessons::IosLesson
    download_lesson(lesson, location)
    open_xcode(lesson)
    notify_of_completion
    open_shell unless clone_only
  else
    super
  end
end
open_readme(lesson) click to toggle source
# File lib/learn_open/environments/mac_environment.rb, line 16
def open_readme(lesson)
  io.puts "Opening readme..."
  system_adapter.run_command("open -a Safari #{lesson.to_url}")
end
open_xcode(lesson) click to toggle source
# File lib/learn_open/environments/mac_environment.rb, line 46
def open_xcode(lesson)
  io.puts "Opening lesson..."
  system_adapter.change_context_directory("#{lesson.to_path}")
  if xcworkspace_file?(lesson)
    system_adapter.run_command("cd #{lesson.to_path} && open *.xcworkspace")
  elsif xcodeproj_file?(lesson)
    system_adapter.run_command("cd #{lesson.to_path} && open *.xcodeproj")
  end
end
xcodeproj_file?(lesson) click to toggle source
# File lib/learn_open/environments/mac_environment.rb, line 38
def xcodeproj_file?(lesson)
  Dir.glob("#{lesson.to_path}/*.xcodeproj").any?
end
xcworkspace_file?(lesson) click to toggle source
# File lib/learn_open/environments/mac_environment.rb, line 42
def xcworkspace_file?(lesson)
  Dir.glob("#{lesson.to_path}/*.xcworkspace").any?
end