Sha256: abc9cf4638420f4c1f78e6d4c47a854f69ef3353ca78e8a46c611435068d0cbe
Contents?: true
Size: 1.13 KB
Versions: 22
Compression:
Stored size: 1.13 KB
Contents
require 'open-uri' module Beaker module Options #A set of functions to determine the PE version to use during testing module PEVersionScraper # Scrape the PE version (such as 3.0) from the file at dist_dir/version_file # # Version file is of the format # # 3.0.1-3-g57b669e # # @param [String] dist_dir The directory containing the version_file # @param [String] version_file The file to scrape # # @return [String, nil] The PE version in the version_file or nil if not found # @raise [ArgumentError] Raises if version_file does not exist or cannot be opened def self.load_pe_version dist_dir, version_file version = nil begin open("#{dist_dir}/#{version_file}") do |file| while line = file.gets if /(\w.*)/ =~ line then version = $1.strip end end end rescue Errno::ENOENT, OpenURI::HTTPError => e raise ArgumentError, "Failure to examine #{dist_dir}/#{version_file}\n\t\t#{e.to_s}" end return version end end end end
Version data entries
22 entries across 22 versions & 1 rubygems