The class handling the browser application and all of its schemes
use a call back mechanism to get the right app_list that is decided by the host_os_family class.
# File lib/launchy/applications/browser.rb, line 40 40: def app_list 41: host_os_family.app_list( self ) 42: end
Get the full commandline of what we are going to add the uri to
# File lib/launchy/applications/browser.rb, line 53 53: def browser_cmdline 54: possibilities = (browser_env + app_list).flatten 55: possibilities.each do |p| 56: Launchy.log "#{self.class.name} : possibility : #{p}" 57: end 58: if browser = possibilities.shift then 59: Launchy.log "#{self.class.name} : Using browser value '#{browser}'" 60: return browser 61: end 62: raise Launchy::CommandNotFoundError, "Unable to find a browser command. If this is unexpected, #{Launchy.bug_report_message}" 63: end
# File lib/launchy/applications/browser.rb, line 44 44: def browser_env 45: return [] unless ENV['BROWSER'] 46: browser_env = ENV['BROWSER'].split( File::PATH_SEPARATOR ) 47: browser_env.flatten! 48: browser_env.delete_if { |b| b.nil? || (b.strip.size == 0) } 49: return browser_env 50: end
# File lib/launchy/applications/browser.rb, line 65 65: def cmd_and_args( uri, options = {} ) 66: cmd = browser_cmdline 67: args = [ uri.to_s ] 68: if cmd =~ /%s/ then 69: cmd.gsub!( /%s/, args.shift ) 70: end 71: return [cmd, args] 72: end
# File lib/launchy/applications/browser.rb, line 19 19: def cygwin_app_list 20: [ 'cmd /C start /b' ] 21: end
# File lib/launchy/applications/browser.rb, line 23 23: def darwin_app_list 24: [ find_executable( "open" ) ] 25: end
# File lib/launchy/applications/browser.rb, line 27 27: def nix_app_list 28: app_list = ] xdg-open ] 29: if nix_de = Launchy::Detect::NixDesktopEnvironment.detect then 30: app_list << nix_de.browser 31: app_list << nix_de.fallback_browsers 32: end 33: app_list.flatten! 34: app_list.delete_if { |b| b.nil? || (b.strip.size == 0) } 35: app_list.collect { |bin| find_executable( bin ) }.find_all { |x| not x.nil? } 36: end
final assembly of the command and do %s substitution www.catb.org/~esr/BROWSER/index.html
# File lib/launchy/applications/browser.rb, line 76 76: def open( uri, options = {} ) 77: cmd, args = cmd_and_args( uri, options ) 78: run( cmd, args ) 79: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.