-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathversion.rb
33 lines (30 loc) · 1.2 KB
/
version.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# frozen_string_literal: true
# Collection of methods related to software versions.
module Version
OS_HPXML_Version = '1.10.0' # Version of the OS-HPXML workflow
OS_Version = '3.9.1' # Required version of OpenStudio (can be 'X.X' or 'X.X.X')
HPXML_Version = '4.0' # HPXML schemaVersion
# Checks whether the version of OpenStudio that is running OpenStudio-HPXML
# meets the version requirements; throws an error if not.
#
# @return [nil]
def self.check_openstudio_version
if not OpenStudio.openStudioVersion.start_with? OS_Version
if OS_Version.count('.') == 2
fail "OpenStudio version #{OS_Version} is required. Found version: #{OpenStudio.openStudioVersion}"
else
fail "OpenStudio version #{OS_Version}.X is required. Found version: #{OpenStudio.openStudioVersion}"
end
end
end
# Checks whether the version of the HPXML file running through OpenStudio-HPXML
# meets the version requirements; throws an error if not.
#
# @param hpxml_version [String] Version of HPXML input file
# @return [nil]
def self.check_hpxml_version(hpxml_version)
if hpxml_version != HPXML_Version
fail "HPXML version #{HPXML_Version} is required."
end
end
end