Class: LearnOpen::Environments::MacEnvironment
Instance Attribute Summary
#environment_vars, #io, #logger, #options, #system_adapter
Class Method Summary
collapse
Instance Method Summary
collapse
#download_lesson, #initialize, #install_dependencies, #managed?, #notify_of_completion, #open_editor, #open_shell, #start_file_backup
Class Method Details
.chrome_installed? ⇒ Boolean
12
13
14
|
# File 'lib/learn_open/environments/mac_environment.rb', line 12
def self.chrome_installed?
File.exists?('/Applications/Google Chrome.app')
end
|
.classify(options) ⇒ Object
4
5
6
7
8
9
10
|
# 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
|
Instance Method Details
#open_jupyter_lab(lesson, location, editor, _clone_only) ⇒ Object
33
34
35
36
|
# 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) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
|
# 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) ⇒ Object
16
17
18
19
|
# 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) ⇒ Object
46
47
48
49
50
51
52
53
54
|
# 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) ⇒ Boolean
38
39
40
|
# 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) ⇒ Boolean
42
43
44
|
# File 'lib/learn_open/environments/mac_environment.rb', line 42
def xcworkspace_file?(lesson)
Dir.glob("#{lesson.to_path}/*.xcworkspace").any?
end
|