Sha256: 31bd78ae62b30c57650f003defe2b64d53379ac8131bb00d3b62ad37b27383c4

Contents?: true

Size: 440 Bytes

Versions: 6

Compression:

Stored size: 440 Bytes

Contents

require 'shellwords'

module Mate
  module Bin
    class << self
      def v1
        mate_version(/^mate r\d+/) or abort 'Can\'t find mate binary v1'
      end

      def v2
        mate_version(/^mate 2.\d+/) or abort 'Can\'t find mate binary v2'
      end

    private

      def mate_version(regexp)
        IO.popen('which -a mate', &:readlines).map(&:strip).find{ |bin| `#{bin.shellescape} -v` =~ regexp }
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mate-2.2.0 lib/mate/bin.rb
mate-2.1.1 lib/mate/bin.rb
mate-2.1.0 lib/mate/bin.rb
mate-2.0.2 lib/mate/bin.rb
mate-2.0.1 lib/mate/bin.rb
mate-2.0.0 lib/mate/bin.rb