Class: Firefox::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/firefox/base.rb

Class Method Summary collapse

Class Method Details

.bin_pathObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/firefox/base.rb', line 10

def bin_path
  return ENV['FIREFOX_PATH'] if ENV['FIREFOX_PATH']
  
  @bin_path = ''
  case platform(RUBY_PLATFORM)
  when :osx
    @bin_path = '/Applications/Firefox.app/Contents/MacOS/firefox-bin'
  when :win
    @bin_path = '"C:\Program Files\Mozilla Firefox\firefox.exe"'
  when :linux
    @bin_path = '/usr/bin/firefox'
  else
    raise UnsupportedOSError, "I don't really know what OS you're on, sorry"
  end
end

.platform(host_os) ⇒ Object



26
27
28
29
30
31
# File 'lib/firefox/base.rb', line 26

def platform(host_os)
  return :osx if host_os =~ /darwin/
  return :linux if host_os =~ /linux/
  return :windows if host_os =~ /mingw32|mswin32/
  return :unknown
end