Module: OpenstudioStandards
- Defined in:
- lib/openstudio-standards/qaqc/eui.rb,
lib/openstudio-standards.rb,
lib/openstudio-standards/version.rb,
lib/openstudio-standards/qaqc/hvac.rb,
lib/openstudio-standards/space/space.rb,
lib/openstudio-standards/qaqc/envelope.rb,
lib/openstudio-standards/geometry/group.rb,
lib/openstudio-standards/qaqc/reporting.rb,
lib/openstudio-standards/qaqc/schedules.rb,
lib/openstudio-standards/weather/modify.rb,
lib/openstudio-standards/geometry/create.rb,
lib/openstudio-standards/geometry/modify.rb,
lib/openstudio-standards/hvac/cbecs_hvac.rb,
lib/openstudio-standards/qaqc/calibration.rb,
lib/openstudio-standards/schedules/create.rb,
lib/openstudio-standards/schedules/modify.rb,
lib/openstudio-standards/daylighting/space.rb,
lib/openstudio-standards/sql_file/sql_file.rb,
lib/openstudio-standards/weather/stat_file.rb,
lib/openstudio-standards/qaqc/weather_files.rb,
lib/openstudio-standards/geometry/create_bar.rb,
lib/openstudio-standards/qaqc/create_results.rb,
lib/openstudio-standards/qaqc/internal_loads.rb,
lib/openstudio-standards/sql_file/energy_use.rb,
lib/openstudio-standards/weather/information.rb,
lib/openstudio-standards/constructions/create.rb,
lib/openstudio-standards/constructions/modify.rb,
lib/openstudio-standards/geometry/information.rb,
lib/openstudio-standards/qaqc/zone_conditions.rb,
lib/openstudio-standards/schedules/parametric.rb,
lib/openstudio-standards/sql_file/unmet_hours.rb,
lib/openstudio-standards/geometry/create_shape.rb,
lib/openstudio-standards/schedules/information.rb,
lib/openstudio-standards/sql_file/fenestration.rb,
lib/openstudio-standards/constructions/information.rb,
lib/openstudio-standards/hvac/air_loop/information.rb,
lib/openstudio-standards/infiltration/infiltration.rb,
lib/openstudio-standards/thermal_zone/thermal_zone.rb,
lib/openstudio-standards/qaqc/service_water_heating.rb,
lib/openstudio-standards/create_typical/enumerations.rb,
lib/openstudio-standards/create_typical/create_typical.rb,
lib/openstudio-standards/constructions/materials/modify.rb,
lib/openstudio-standards/infiltration/nist_infiltration.rb,
lib/openstudio-standards/create_typical/space_type_blend.rb,
lib/openstudio-standards/create_typical/space_type_ratios.rb,
lib/openstudio-standards/hvac/setpoint_managers/information.rb,
lib/openstudio-standards/constructions/materials/information.rb,
lib/openstudio-standards/service_water_heating/create_water_use.rb,
lib/openstudio-standards/service_water_heating/create_water_heater.rb,
lib/openstudio-standards/service_water_heating/create_piping_losses.rb,
lib/openstudio-standards/service_water_heating/create_water_heating_loop.rb
Overview
Module to apply QAQC checks to a model
Defined Under Namespace
Modules: Constructions, CreateTypical, Daylighting, Geometry, HVAC, Infiltration, QAQC, Schedules, ServiceWaterHeating, Space, SqlFile, ThermalZone, Weather
Constant Summary collapse
- VERSION =
'0.7.0'.freeze
Class Method Summary collapse
-
.get_run_env ⇒ Object
DLM: not sure where this code should go.
- .git_revision ⇒ Object
- .run_command(command) ⇒ Object
Class Method Details
.get_run_env ⇒ Object
DLM: not sure where this code should go
610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 |
# File 'lib/openstudio-standards.rb', line 610 def self.get_run_env # blank out bundler and gem path modifications, will be re-setup by new call new_env = {} new_env['BUNDLER_ORIG_MANPATH'] = nil new_env['BUNDLER_ORIG_PATH'] = nil new_env['BUNDLER_VERSION'] = nil new_env['BUNDLE_BIN_PATH'] = nil new_env['RUBYLIB'] = nil new_env['RUBYOPT'] = nil # DLM: preserve GEM_HOME and GEM_PATH set by current bundle because we are not supporting bundle # requires to ruby gems will work, will fail if we require a native gem new_env['GEM_PATH'] = nil new_env['GEM_HOME'] = nil # DLM: for now, ignore current bundle in case it has binary dependencies in it # bundle_gemfile = ENV['BUNDLE_GEMFILE'] # bundle_path = ENV['BUNDLE_PATH'] # if bundle_gemfile.nil? || bundle_path.nil? new_env['BUNDLE_GEMFILE'] = nil new_env['BUNDLE_PATH'] = nil new_env['BUNDLE_WITHOUT'] = nil # else # new_env['BUNDLE_GEMFILE'] = bundle_gemfile # new_env['BUNDLE_PATH'] = bundle_path # end return new_env end |
.git_revision ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/openstudio-standards/version.rb', line 2 def self.git_revision cmd = 'git' exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| exts.each do |ext| exe = "#{path}/#{cmd}#{ext}" if File.executable?(exe) revision = `"#{exe}" -C "#{__dir__}" rev-parse --short HEAD` return revision.strip! end end end return 'git-not-found-on-this-system' end |
.run_command(command) ⇒ Object
640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 |
# File 'lib/openstudio-standards.rb', line 640 def self.run_command(command) stdout_str, stderr_str, status = Open3.capture3(get_run_env, command) if status.success? OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.command', "Successfully ran command: '#{command}'") # puts "stdout: #{stdout_str}" # puts "stderr: #{stderr_str}" return true else OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.command', "Error running command: '#{command}'") OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.command', "stdout: #{stdout_str}") OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.command', "stderr: #{stderr_str}") # Print the ENV for debugging final_env = [] env_changes = get_run_env ENV.each do |env_var, val| next if env_changes.key?(env_var) && env_changes[env_var].nil? final_env << "#{env_var} = #{val}" end OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.command', "command's modified ENV: \n #{final_env.join("\n")}") # List the gems available to openstudio at this point cli_path = OpenStudio.getOpenStudioCLI cmd = "\"#{cli_path}\" gem_list" stdout_str_2, stderr_str_2, status_2 = Open3.capture3(get_run_env, cmd) OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.command', "Gems available to openstudio cli according to (openstudio gem_list): \n #{stdout_str_2}") return false end end |