module OpenstudioStandards
Module to apply QAQC
checks to a model
Module to apply QAQC
checks to a model
Module to apply QAQC
checks to a model
Module to apply QAQC
checks to a model
Module to apply QAQC
checks to a model
Module to apply QAQC
checks to a model
Module to apply QAQC
checks to a model
Module to apply QAQC
checks to a model
Module to apply QAQC
checks to a model
Module to apply QAQC
checks to a model
Module to apply QAQC
checks to a model
Methods to create and modify parametric schedules
Constants
- VERSION
Public Class Methods
get_run_env()
click to toggle source
DLM: not sure where this code should go
# 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()
click to toggle source
# 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)
click to toggle source
# 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