Module: SeleniumPrep::System::Path

Defined in:
lib/selenium-prep/system/path.rb

Class Method Summary collapse

Class Method Details

.pathObject



36
37
38
39
# File 'lib/selenium-prep/system/path.rb', line 36

def self.path
  ConfigChecker.new
  ENV['PATH']
end

.setObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/selenium-prep/system/path.rb', line 7

def self.set
  ConfigChecker.new
  case ENV['SE_OS_TYPE']
  when 'win32', 'win64'
    system("set path=%path%;#{ENV['SE_DOWNLOAD_LOCATION']}")
    system('reg.exe ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path /t REG_EXPAND_SZ /d %path% /f')

    broadcast_windows_system_message
    ENV['PATH'] = "#{ENV['PATH']};#{ENV['SE_DOWNLOAD_LOCATION']}"
  when 'mac32', 'linux32', 'linux64'
    unless set?
      unless bash_updated?
        system("echo 'export PATH=$PATH:#{ENV['SE_DOWNLOAD_LOCATION']}' | sudo tee -a ~/.bash_profile")
      end
      system('source ~/.bash_profile')
      ENV['PATH'] = "#{ENV['PATH']}:/#{ENV['SE_DOWNLOAD_LOCATION']}"
    end
  end
end

.set?Boolean

Returns:

  • (Boolean)


27
28
29
30
31
32
33
34
# File 'lib/selenium-prep/system/path.rb', line 27

def self.set?
  case ENV['SE_OS_TYPE']
  when 'win32', 'win64'
    path.include?(ENV['SE_DOWNLOAD_LOCATION'])
  when 'mac32', 'linux32', 'linux64'
    path.include?(ENV['SE_DOWNLOAD_LOCATION']) && bash_updated?
  end
end