lib/firebrew/firefox/command.rb in firebrew-0.2.0 vs lib/firebrew/firefox/command.rb in firebrew-0.3.0

- old
+ new

@@ -1,6 +1,7 @@ require 'shellwords' +require 'os' module Firebrew::Firefox class Command class Executer def exec(command) @@ -10,27 +11,27 @@ def initialize(config={}, executer = Executer.new) @config = config @executer = executer begin - result = if ENV['OS'].nil? then - @executer.exec('%{firefox} --version' % self.escaped_config) - else + result = if OS.windows? then @executer.exec('"%{firefox}" --version' % @config) + else + @executer.exec('%{firefox} --version' % self.escaped_config) end raise Firebrew::FirefoxCommandError, 'Command is not Firefox: %{firefox}' % @config unless result[0] =~ /Mozilla Firefox/ raise Firebrew::FirefoxCommandError, 'Command is not Firefox: %{firefox}' % @config unless result[1] == 0 rescue SystemCallError raise Firebrew::FirefoxCommandError, 'Firefox command not found: %{firefox}' % @config end end def version return @version unless @version.nil? - result = if ENV['OS'].nil? then - @executer.exec('%{firefox} --version' % self.escaped_config)[0] - else + result = if OS.windows? then @executer.exec('"%{firefox}" --version' % @config)[0] + else + @executer.exec('%{firefox} --version' % self.escaped_config)[0] end @version = result.match(/[0-9.]+/)[0] end protected