class LearnOpen::Adapters::SystemAdapter
Public Class Methods
change_context_directory(dir)
click to toggle source
# File lib/learn_open/adapters/system_adapter.rb, line 27 def self.change_context_directory(dir) Dir.chdir(dir) end
open_editor(editor, path:)
click to toggle source
# File lib/learn_open/adapters/system_adapter.rb, line 6 def self.open_editor(editor, path:) system("#{editor} .") end
open_login_shell(shell)
click to toggle source
# File lib/learn_open/adapters/system_adapter.rb, line 10 def self.open_login_shell(shell) exec("#{shell} -l") end
run_command(command)
click to toggle source
# File lib/learn_open/adapters/system_adapter.rb, line 19 def self.run_command(command) system(command) end
run_command_with_capture(command)
click to toggle source
# File lib/learn_open/adapters/system_adapter.rb, line 23 def self.run_command_with_capture(command) Open3.capture3(command) end
spawn(command, block: false)
click to toggle source
# File lib/learn_open/adapters/system_adapter.rb, line 14 def self.spawn(command, block: false) pid = Process.spawn(command, [:out, :err] => File::NULL) Process.waitpid(pid) if block end
Private Class Methods
excluded_dirs()
click to toggle source
# File lib/learn_open/adapters/system_adapter.rb, line 33 def self.excluded_dirs "(node_modules/|\.git/|\.swp?x?$|~$|4913$)" end