developer/ruby/DeprecatedMethods.rb
def parse_version_from_cmakelist(cmake_path)
  version_line = nil
  File.open(cmake_path) do |f|
    version_line = f.grep(/project\(OpenStudio VERSION/)
  end

  if version_line.nil?
    raise "Couldn't find 'project(OpenStudio VERSION' in #{cmake_path}"
  elsif !((version_line.class == Array) && (version_line.size == 1))
    raise "Expected to find only one version in #{cmake_path}, found: #{version_line}"
  end
  os_version_str = version_line[0].match(/VERSION\s+(\d+\.\d+\.\d+)/).captures[0]
  return os_version_str
end
# Parse the CMakeLists.txt for the current version
# It greps for 'project(OpenStudio VERSION X.Y.Z)
# It will raise if something goes wrong
#
# @param cmake_path [String] The path to sdk core CMakeLists.txt
# @return [String] the resulting version, eg "2.8.0".
Parse the CMakeLists.txt for the current version
It greps for 'project(OpenStudio VERSION X.Y.Z)
It will raise if something goes wrong
Parse the CMakeLists . txt for the current version It greps for ' project ( OpenStudio VERSION X . Y . Z ) It will raise if something goes wrong
def parse_version_from_cmakelist(cmake_path)
  version_line = nil
  File.open(cmake_path) do |f|
    version_line = f.grep(/project\(OpenStudio VERSION/)
  end
  if version_line.nil?
    raise "Couldn't find 'project(OpenStudio VERSION' in #{cmake_path}"
  elsif !((version_line.class == Array) && (version_line.size == 1))
    raise "Expected to find only one version in #{cmake_path}, found: #{version_line}"
  end
  os_version_str = version_line[0].match(/VERSION\s+(\d+\.\d+\.\d+)/).captures[0]
  return os_version_str
end
def parse_version_from_cmakelist ( cmake_path ) version_line = nil File . open ( cmake_path ) do | f | version_line = f . grep ( / project \( OpenStudio VERSION / ) end if version_line . nil? raise "Couldn't find 'project(OpenStudio VERSION' in #{cmake_path}" elsif ! ( ( version_line . class == Array ) && ( version_line . size == 1 ) ) raise "Expected to find only one version in #{cmake_path}, found: #{version_line}" end os_version_str = version_line [ 0 ] . match ( / VERSION \s +( \d + \. \d + \. \d +) / ) . captures [ 0 ] return os_version_str end
Parse the CMakeLists.txt for the current version
It greps for 'project(OpenStudio VERSION X.Y.Z)
It will raise if something goes wrong
Parse the CMakeLists . txt for the current version It greps for ' project ( OpenStudio VERSION X . Y . Z ) It will raise if something goes wrong
the resulting version, eg "2.8.0".
the resulting version eg " 2 . 8 . 0 " .
String
cmake_path
The path to sdk core CMakeLists.txt
The path to sdk core CMakeLists . txt