developer/ruby/CheckOSMVersions.rb
# Parse the Version object in an OSM
# Does this by loading the file and grepping the version object (does not rely
# on 'openstudio' bindings)
# Will raise if something goes wrong
#
# @param cmake_path [osm_path] The path to OSM
# @return [String] the resulting version, eg "2.8.0"
Parse the Version object in an OSM
Does this by loading the file and grepping the version object (does not rely
on 'openstudio' bindings)
Will raise if something goes wrong
Parse the Version object in an OSM Does this by loading the file and grepping the version object ( does not rely on ' openstudio ' bindings ) Will raise if something goes wrong
def parse_osm_version(osm_path)
  this_version = File.read(osm_path).scan(/OS:Version,.*?(\d+\.\d+\.\d+)\s*;/m)
  if !((this_version.class == Array) && (this_version.size == 1) &&
       (this_version[0].class == Array) && (this_version[0].size == 1))
    raise "Something went wrong looking for version in #{osm_path},"
          "found: #{this_version}"
  end
  osm_version_str = this_version[0][0]
  return osm_version_str
end
def parse_osm_version ( osm_path ) this_version = File . read ( osm_path ) . scan ( / OS:Version,.*?( \d + \. \d + \. \d +) \s *; /m ) if ! ( ( this_version . class == Array ) && ( this_version . size == 1 ) && ( this_version [ 0 ] . class == Array ) && ( this_version [ 0 ] . size == 1 ) ) raise "Something went wrong looking for version in #{osm_path}," "found: #{this_version}" end osm_version_str = this_version [ 0 ] [ 0 ] return osm_version_str end
Parse the Version object in an OSM
Does this by loading the file and grepping the version object (does not rely
on 'openstudio' bindings)
Will raise if something goes wrong
Parse the Version object in an OSM Does this by loading the file and grepping the version object ( does not rely on ' openstudio ' bindings ) Will raise if something goes wrong
the resulting version, eg "2.8.0"
the resulting version eg " 2 . 8 . 0 "
String
osm_path
<not_specific>
cmake_path
<not_specific>
The path to OSM
The path to OSM