Sha256: bde01f095676b0ed13ca4a6e87fa7a32c9d07d4d9a0c3d591c750c3dceb43c86

Contents?: true

Size: 751 Bytes

Versions: 1

Compression:

Stored size: 751 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

1 entries across 1 versions & 1 rubygems

Version Path
firebrew-0.1.0 lib/firebrew/firefox/command.rb