Sha256: 23d19b2450878d07f1b7d0c98df417e1237354244ad9025533a4e64d17b4932f

Contents?: true

Size: 755 Bytes

Versions: 3

Compression:

Stored size: 755 Bytes

Contents

module Firebrew::Firefox
  class Command
    class Executer
      def exec(command)
        [%x[#{command}], $?]
      end
    end
    
    def initialize(config={}, executer = Executer.new)
      @config = config
      @executer = executer
      begin
        result = @executer.exec('"%{firefox}" --version' % @config)
        raise Firebrew::FirefoxCommandError unless result[0] =~ /Mozilla Firefox/
        raise Firebrew::FirefoxCommandError unless result[1] == 0
      rescue SystemCallError
        raise Firebrew::FirefoxCommandError
      end
    end
    
    def version
      return @version if @version.present?
      result = @executer.exec('"%{firefox}" --version' % @config)[0]
      @version = result.match(/[0-9.]+/)[0]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
firebrew-0.1.3 lib/firebrew/firefox/command.rb
firebrew-0.1.2 lib/firebrew/firefox/command.rb
firebrew-0.1.1 lib/firebrew/firefox/command.rb