From a909859374226678bfb9f10f9f37e7ef84fab769 Mon Sep 17 00:00:00 2001 From: kflemin Date: Mon, 30 Aug 2021 15:57:58 -0600 Subject: [PATCH 01/10] update gem for bcl 2.0 --- Rakefile | 267 +++--------------- lib/bcl/component_methods.rb | 468 ++++---------------------------- lib/bcl/tar_ball.rb | 34 --- spec/api/api_components_spec.rb | 246 +++++++---------- spec/api/api_measures_spec.rb | 117 +++----- 5 files changed, 225 insertions(+), 907 deletions(-) diff --git a/Rakefile b/Rakefile index 5d9fb29..5c1ac1a 100644 --- a/Rakefile +++ b/Rakefile @@ -60,43 +60,36 @@ namespace :test do # search with all=false # ensure the same a) and b) as above bcl = BCL::ComponentMethods.new - bcl.login results = bcl.search('Add', 'show_rows=10', false) - puts "there are #{results[:result].count} results" + puts "there are #{results[:result].count} results returned in this response" + puts "there are #{results[:complete_results_count]} total results available for this query" results[:result].each do |res| puts (res[:measure][:name]).to_s end end - desc 'test measure upload' - task :measure_upload do - bcl = BCL::ComponentMethods.new - bcl.login - filename = "#{File.dirname(__FILE__)}/spec/api/resources/measure_original.tar.gz" - valid, res = bcl.push_content(filename, false, 'nrel_measure') - end - - desc 'test the BCL login credentials defined in .bcl/config.yml' - task :bcl_login do + desc 'test search and return ALL versions functionality' + task :search_all_versions do + # search with all=true + # ensure that a) results are returned (> 0) and b) [:measure][:name] is a string + # search with all=false + # ensure the same a) and b) as above bcl = BCL::ComponentMethods.new - bcl.login - end - - desc 'test component spreadsheet' - task :spreadsheet do - bclcomponents = BCL::ComponentFromSpreadsheet.new(File.expand_path('lib/files/Components.xls', __dir__), ['Roofing']) - bclcomponents.save(File.expand_path('lib/files/staged', __dir__)) + results = bcl.search('Add', 'show_rows=10&all_content_versions=1', false) + puts "there are #{results[:result].count} results returned in this response" + puts "there are #{results[:complete_results_count]} total results available for this query" + results[:result].each do |res| + puts (res[:measure][:name]).to_s + end end desc 'test measure download' task :measure_download do # find a component with keyword 'Ashrae' query = 'ashrae' - filter = 'fq[]=bundle:nrel_component&show_rows=3' + filter = 'fq=bundle:nrel_component&show_rows=3' bcl = BCL::ComponentMethods.new - bcl.login - results = bcl.search(query, filter) uids = [] results[:result].each do |result| @@ -111,223 +104,33 @@ namespace :test do f = File.open("#{download_path}/#{uids[0]}.tar.gz", 'wb') f.write(content) end -end - -namespace :bcl do - STAGED_PATH = Pathname.new(Dir.pwd + '/staged') - - # initialize BCL and login - bcl = BCL::ComponentMethods.new - bcl.login - - # to call: rake "bcl:stage_and_upload[/path/to/your/content/directory, true]" - # content_path arg: path to components or measures to upload - # reset flag: - # If TRUE: content in the staged directory will be re-generated and receipt files will be deleted. - # If FALSE, content that already exists in the staged directory will remain and content with receipt files will not be re-uploaded. - desc 'stage and push/update all content in a repo' - task :stage_and_upload, [:content_path, :reset] do |t, args| - options = { reset: false } - options[:content_path] = Pathname.new args[:content_path] - if args[:reset].to_s == 'true' - options[:reset] = true - end - - current_dir = Dir.pwd - - # stage content - Rake.application.invoke_task("bcl:stage_content[#{options[:content_path]}, #{options[:reset]}]") - Dir.chdir(current_dir) - - # upload (new and updated). pass in skip flag - Rake.application.invoke_task("bcl:upload_content[#{options[:reset]}]") - end - # to call: rake "bcl:upload_content[true]" - # TODO: catch errors and continue - desc 'upload/update BCL content' - task :upload_content, [:reset] do |t, args| - # process options - options = { reset: false } - if args[:reset].to_s == 'true' - options[:reset] = true - end - - total_count = 0 - successes = 0 - errors = 0 - skipped = 0 - - # grab all the new measure and component tar files and push to bcl - ['measure', 'component'].each do |content_type| - items = [] - paths = Pathname.glob(STAGED_PATH.to_s + "/push/#{content_type}/*.tar.gz") - paths.each do |path| - # puts path - items << path.to_s - end - - items.each do |item| - puts item.split('/').last - total_count += 1 - - receipt_file = File.dirname(item) + '/' + File.basename(item, '.tar.gz') + '.receipt' - if !options[:reset] && File.exist?(receipt_file) - skipped += 1 - puts 'SKIP: receipt file found' - next - end - - valid, res = bcl.push_content(item, true, "nrel_#{content_type}") - if valid - successes += 1 - else - errors += 1 - if res.key?(:error) - puts " ERROR MESSAGE: #{res[:error]}" - else - puts "ERROR: #{res.inspect.chomp}" - end - end - puts '', '---' - end - end + desc 'test measure download - legacy syntax' + task :measure_download do + # find a component with keyword 'Ashrae' + query = 'ashrae' + filter = 'fq[]=bundle:nrel_component&show_rows=3' - # grab all the updated content (measures and components) tar files and push to bcl - items = [] - paths = Pathname.glob(STAGED_PATH.to_s + '/update/*.tar.gz') - paths.each do |path| - # puts path - items << path.to_s + bcl = BCL::ComponentMethods.new + results = bcl.search(query, filter) + uids = [] + results[:result].each do |result| + uids << result[:component][:uuid] end - items.each do |item| - puts item.split('/').last - total_count += 1 - receipt_file = File.dirname(item) + '/' + File.basename(item, '.tar.gz') + '.receipt' - if !options[:reset] && File.exist?(receipt_file) - skipped += 1 - puts 'SKIP: receipt file found' - next - end - - valid, res = bcl.update_content(item, true) - if valid - successes += 1 - else - errors += 1 - if res.key?(:error) - puts " ERROR MESSAGE: #{res[:error]}" - else - puts "ERROR MESSAGE: #{res.inspect.chomp}" - end - end - puts '', '---' - end + content = bcl.download_component(uids[0]) - puts "****UPLOAD DONE**** #{total_count} total, #{successes} success, #{errors} failures, #{skipped} skipped" + # save as tar.gz + download_path = File.expand_path('lib/files/downloads', __dir__) + FileUtils.mkdir(download_path) if !File.exist? download_path + f = File.open("#{download_path}/#{uids[0]}.tar.gz", 'wb') + f.write(content) end - # to call: rake "bcl:stage_content[/path/to/your/content/directory, true]" - desc 'stage content for BCL' - task :stage_content, [:content_path, :reset] do |t, args| - # process options - options = { reset: false } - options[:content_path] = Pathname.new args[:content_path] - if args[:reset].to_s == 'true' - options[:reset] = true - end - puts "OPTIONS -- content_path: #{options[:content_path]}, reset: #{options[:reset]}" - - FileUtils.mkdir_p(STAGED_PATH) - - # delete existing tarballs if reset is true - if options[:reset] - FileUtils.rm_rf(Dir.glob("#{STAGED_PATH}/*")) - end - - # create new and existing directories - FileUtils.mkdir_p(STAGED_PATH.to_s + '/update') - FileUtils.mkdir_p(STAGED_PATH.to_s + '/push/component') - FileUtils.mkdir_p(STAGED_PATH.to_s + '/push/measure') - - # keep track of noop, update, push - noops = 0 - new_ones = 0 - updates = 0 - - # get all content directories to process - dirs = Dir.glob("#{options[:content_path]}/*") - - dirs.each do |dir| - next if dir.include?('Rakefile') - - current_d = Dir.pwd - content_name = File.basename(dir) - puts '', '---' - puts "Generating #{content_name}" - - Dir.chdir(dir) - - # figure out whether to upload new or update existing - files = Pathname.glob('**/*') - uuid = nil - vid = nil - content_type = 'measure' - - paths = [] - files.each do |file| - # don't tar tests/outputs directory - next if file.to_s.start_with?('tests/output') # From measure testing process - next if file.to_s.start_with?('tests/test') # From openstudio-measure-tester-gem - next if file.to_s.start_with?('tests/coverage') # From openstudio-measure-tester-gem - next if file.to_s.start_with?('test_results') # From openstudio-measure-tester-gem - - paths << file.to_s - if file.to_s =~ /^.{0,2}component.xml$/ || file.to_s =~ /^.{0,2}measure.xml$/ - if file.to_s.match?(/^.{0,2}component.xml$/) - content_type = 'component' - end - # extract uuid and vid - uuid, vid = bcl.uuid_vid_from_xml(file) - end - end - puts "UUID: #{uuid}, VID: #{vid}" - - # note: if uuid is missing, will assume new content - action = bcl.search_by_uuid(uuid, vid) - puts "#{content_name} ACTION TO TAKE: #{action}" - # new content functionality needs to know if measure or component. update is agnostic. - if action == 'noop' # ignore up-to-date content - puts " - WARNING: local #{content_name} uuid and vid match BCL... no update will be performed" - noops += 1 - next - elsif action == 'update' - # puts "#{content_name} labeled as update for BCL" - destination = STAGED_PATH.join(action, "#{content_name}.tar.gz") - updates += 1 - elsif action == 'push' - # puts "#{content_name} labeled as new content for BCL" - destination = STAGED_PATH.join(action, content_type, "#{content_name}.tar.gz") - new_ones += 1 - end - - puts "destination: #{destination}" - - # copy over only if 'reset_receipts' is set to TRUE. otherwise ignore if file exists already - if File.exist?(destination) - if options[:reset] - FileUtils.rm(destination) - BCL.tarball(destination, paths) - else - puts "*** WARNING: File #{content_name}.tar.gz already exists in staged directory... keeping existing file. To overwrite, set reset_receipts arg to true ***" - end - else - BCL.tarball(destination, paths) - end - Dir.chdir(current_d) - end - puts '', "****STAGING DONE**** #{new_ones} new content, #{updates} updates, #{noops} skipped (already up-to-date on BCL)", '' + desc 'test component spreadsheet' + task :spreadsheet do + bclcomponents = BCL::ComponentFromSpreadsheet.new(File.expand_path('lib/files/Components.xls', __dir__), ['Roofing']) + bclcomponents.save(File.expand_path('lib/files/staged', __dir__)) end end diff --git a/lib/bcl/component_methods.rb b/lib/bcl/component_methods.rb index 6bf502f..ae11d26 100644 --- a/lib/bcl/component_methods.rb +++ b/lib/bcl/component_methods.rb @@ -44,121 +44,32 @@ class ComponentMethods def initialize @parsed_measures_path = './measures/parsed' @config = nil - @session = nil - @access_token = nil @http = nil - @api_version = 2.0 - @group_id = nil - @logged_in = false + @api_version = nil + # load configs from file or default load_config - end - def login(username = nil, password = nil, url = nil, group_id = nil) - # figure out what url to use - if url.nil? - url = @config[:server][:url] - end + # configure connection + url = @config[:server][:url] # look for http vs. https if url.include? 'https' port = 443 else port = 80 end + # strip out http(s) url = url.gsub('http://', '') url = url.gsub('https://', '') - if username.nil? || password.nil? - # log in via cached credentials - username = @config[:server][:user][:username] - password = @config[:server][:user][:password] - @group_id = group_id || @config[:server][:user][:group] - puts "logging in using credentials in .bcl/config.yml: Connecting to #{url} on port #{port} as #{username} with group #{@group_id}" - else - @group_id = group_id || @config[:server][:user][:group] - puts "logging in using credentials in function arguments: Connecting to #{url} on port #{port} as #{username} with group #{@group_id}" - end - - if @group_id.nil? - puts '[WARNING] You did not set a group ID in your config.yml file or pass in a group ID. You can retrieve your group ID from the node number of your group page (e.g., https://bcl.nrel.gov/node/32). Will continue, but you will not be able to upload content.' - end - @http = Net::HTTP.new(url, port) @http.verify_mode = OpenSSL::SSL::VERIFY_NONE if port == 443 @http.use_ssl = true end - data = %({"username":"#{username}","password":"#{password}"}) - - login_path = '/api/user/login.json' - headers = { 'Content-Type' => 'application/json' } - - res = @http.post(login_path, data, headers) - - # for debugging: - # res.each do |key, value| - # puts "#{key}: #{value}" - # end - - if res.code == '200' - puts 'Login Successful' - - bnes = '' - bni = '' - junkout = res['set-cookie'].split(';') - junkout.each do |line| - if line.match?(/BNES_SESS/) - bnes = line.match(/(BNES_SESS.*)/)[0] - end - end - - junkout.each do |line| - if line.match?(/BNI/) - bni = line.match(/(BNI.*)/)[0] - end - end - - # puts "DATA: #{data}" - session_name = '' - sessid = '' - json = JSON.parse(res.body) - json.each do |key, val| - if key == 'session_name' - session_name = val - elsif key == 'sessid' - sessid = val - end - end - - @session = session_name + '=' + sessid + ';' + bni + ';' + bnes - - # get access token - token_path = '/services/session/token' - token_headers = { 'Content-Type' => 'application/json', 'Cookie' => @session } - # puts "token_headers = #{token_headers.inspect}" - access_token = @http.post(token_path, '', token_headers) - if access_token.code == '200' - @access_token = access_token.body - else - puts 'Unable to get access token; uploads will not work' - puts "error code: #{access_token.code}" - puts "error info: #{access_token.body}" - end - - # puts "access_token = *#{@access_token}*" - # puts "cookie = #{@session}" - - res - else - - puts "error code: #{res.code}" - puts "error info: #{res.body}" - puts 'continuing as unauthenticated sessions (you can still search and download)' - - res - end + puts "Connecting to BCL at URL: #{@config[:server][:url]}" end # retrieve measures for parsing metadata. @@ -169,10 +80,18 @@ def retrieve_measures(search_term = nil, filter_term = nil, return_all_pages = f # raise "Please login before performing this action" if @session.nil? # make sure filter_term includes bundle - if filter_term.nil? - filter_term = 'fq[]=bundle%3Anrel_measure' - elsif !filter_term.include? 'bundle' - filter_term += '&fq[]=bundle%3Anrel_measure' + if @api_version == 2.0 + if filter_term.nil? + filter_term = 'fq[]=bundle%3Anrel_measure' + elsif !filter_term.include? 'bundle' + filter_term += '&fq[]=bundle%3Anrel_measure' + end + else + if filter_term.nil? + filter_term = 'fq=bundle%3Ameasure' + elsif !filter_term.include? 'bundle' + filter_term += '&fq=bundle%3Ameasure' + end end # use provided search term or nil. @@ -186,183 +105,6 @@ def retrieve_measures(search_term = nil, filter_term = nil, return_all_pages = f end end - # evaluate the response from the API in a consistent manner - def evaluate_api_response(api_response) - valid = false - result = { error: 'could not get json from http post response' } - case api_response.code - when '200' - puts " Response Code: #{api_response.code}" - if api_response.body.empty? - puts ' 200 BUT ERROR: Returned body was empty. Possible causes:' - puts ' - BSD tar on Mac OSX vs gnutar' - result = { error: 'returned 200, but returned body was empty' } - valid = false - else - puts ' 200 - Successful Upload' - result = JSON.parse api_response.body - valid = true - end - when '404' - puts " Error Code: #{api_response.code} - #{api_response.body}" - puts ' - check these common causes first:' - puts " - you are trying to update content that doesn't exist" - puts " - you are not an 'administrator member' of the group you're trying to upload to" - result = JSON.parse api_response.body - valid = false - when '406' - puts " Error Code: #{api_response.code}" - # try to parse the response a bit - error = JSON.parse api_response.body - puts "temp error: #{error}" - if error.key?('form_errors') - if error['form_errors'].key?('field_tar_file') - result = { error: error['form_errors']['field_tar_file'] } - elsif error['form_errors'].key?('og_group_ref][und][0][default') - result = { error: error['form_errors']['og_group_ref][und][0][default'] } - end - else - result = error - end - valid = false - when '500' - puts " Error Code: #{api_response.code}" - result = { error: api_response.message } - # fail 'server exception' - valid = false - else - puts " Response: #{api_response.code} - #{api_response.body}" - valid = false - end - - [valid, result] - end - - # Construct the post parameter for the API content.json end point. - # param(@update) is a boolean that triggers whether to use content_type or uuid - def construct_post_data(filepath, update, content_type_or_uuid) - # TODO: remove special characters in the filename; they create firewall errors - # filename = filename.gsub(/\W/,'_').gsub(/___/,'_').gsub(/__/,'_').chomp('_').strip - - file_b64 = Base64.encode64(File.binread(filepath)) - - data = {} - data['file'] = { - 'file' => file_b64, - 'filesize' => File.size(filepath).to_s, - 'filename' => File.basename(filepath) - } - - data['node'] = {} - - # Only include the content type if this is an update - if update - data['node']['uuid'] = content_type_or_uuid - else - data['node']['type'] = content_type_or_uuid - end - - # TODO: remove this field_component_tags once BCL is fixed - data['node']['field_component_tags'] = { 'und' => '1289' } - data['node']['og_group_ref'] = { 'und' => ['target_id' => @group_id] } - - # NOTE THIS ONLY WORKS IF YOU ARE A BCL SITE ADMIN - data['node']['publish'] = '1' - - data - end - - # pushes component to the bcl and publishes them (if logged-in as BCL Website Admin user). - # username, password, and group_id are set in the ~/.bcl/config.yml file - def push_content(filename_and_path, write_receipt_file, content_type) - raise 'Please login before pushing components' if @session.nil? - raise 'Do not have a valid access token; try again' if @access_token.nil? - - data = construct_post_data(filename_and_path, false, content_type) - - path = '/api/content.json' - headers = { 'Content-Type' => 'application/json', 'X-CSRF-Token' => @access_token, 'Cookie' => @session } - - res = @http.post(path, JSON.dump(data), headers) - - valid, json = evaluate_api_response(res) - - if valid - # write out a receipt file into the same directory of the component with the same file name as - # the component - if write_receipt_file - File.open("#{File.dirname(filename_and_path)}/#{File.basename(filename_and_path, '.tar.gz')}.receipt", 'w') do |file| - file << Time.now.to_s - end - end - end - - [valid, json] - end - - # pushes updated content to the bcl and publishes it (if logged-in as BCL Website Admin user). - # username and password set in ~/.bcl/config.yml file - def update_content(filename_and_path, write_receipt_file, uuid = nil) - raise 'Please login before pushing components' unless @session - - # get the UUID if zip or xml file - version_id = nil - if uuid.nil? - puts File.extname(filename_and_path).downcase - if filename_and_path.match?(/^.*.tar.gz$/i) - uuid, version_id = uuid_vid_from_tarball(filename_and_path) - puts "Parsed uuid out of tar.gz file with value #{uuid}" - end - else - # verify the uuid via regex - unless uuid.match?(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/) - raise "uuid of #{uuid} is invalid" - end - end - raise 'Please pass in a tar.gz file or pass in the uuid' unless uuid - - data = construct_post_data(filename_and_path, true, uuid) - - path = '/api/content.json' - headers = { 'Content-Type' => 'application/json', 'X-CSRF-Token' => @access_token, 'Cookie' => @session } - - res = @http.post(path, JSON.dump(data), headers) - - valid, json = evaluate_api_response(res) - - if valid - # write out a receipt file into the same directory of the component with the same file name as - # the component - if write_receipt_file - File.open("#{File.dirname(filename_and_path)}/#{File.basename(filename_and_path, '.tar.gz')}.receipt", 'w') do |file| - file << Time.now.to_s - end - end - end - - [valid, json] - end - - def push_contents(array_of_components, skip_files_with_receipts, content_type) - logs = [] - array_of_components.each do |comp| - receipt_file = File.dirname(comp) + '/' + File.basename(comp, '.tar.gz') + '.receipt' - log_message = '' - if skip_files_with_receipts && File.exist?(receipt_file) - log_message = "skipping because found receipt #{comp}" - puts log_message - else - log_message = "pushing content #{File.basename(comp, '.tar.gz')}" - puts log_message - valid, res = push_content(comp, true, content_type) - log_message += " #{valid} #{res.inspect.chomp}" - end - logs << log_message - end - - logs - end - # Unpack the tarball in memory and extract the XML file to read the UUID and Version ID def uuid_vid_from_tarball(path_to_tarball) uuid = nil @@ -422,43 +164,18 @@ def uuid_vid_from_xml(path_to_xml) [uuid, vid] end - def update_contents(array_of_tarball_components, skip_files_with_receipts) - logs = [] - array_of_tarball_components.each do |comp| - receipt_file = File.dirname(comp) + '/' + File.basename(comp, '.tar.gz') + '.receipt' - log_message = '' - if skip_files_with_receipts && File.exist?(receipt_file) - log_message = "skipping update because found receipt #{File.basename(comp)}" - puts log_message - else - uuid, vid = uuid_vid_from_tarball(comp) - if uuid.nil? - log_message = "ERROR: uuid not found for #{File.basename(comp)}" - puts log_message - else - log_message = "pushing updated content #{File.basename(comp)}" - puts log_message - valid, res = update_content(comp, true, uuid) - log_message += " #{valid} #{res.inspect.chomp}" - end - end - logs << log_message - end - logs - end - def search_by_uuid(uuid, vid = nil) full_url = '/api/search.json' - action = nil # add api_version - if @api_version < 2.0 - puts "WARNING: attempting to use search with api_version #{@api_version}. Use API v2.0 for this functionality." + if @api_version == 2.0 + # uuid + full_url += "?api_version=#{@api_version}" + full_url += "&fq[]=ss_uuid:#{uuid}" + else + # uuid + full_url += "&fq=uuid:#{uuid}" end - full_url += "?api_version=#{@api_version}" - - # uuid - full_url += "&fq[]=ss_uuid:#{uuid}" res = @http.get(full_url) res = JSON.parse res.body @@ -474,20 +191,9 @@ def search_by_uuid(uuid, vid = nil) else content = content['component'] end - - # TODO: check version_modified date if it exists? - if !vid.nil? && content['vuuid'] == vid - # no update needed - action = 'noop' - else - # vid doesn't match: update existing - action = 'update' - end - else - # no uuid found: push new - action = 'push' end - action + + content end # Simple method to search bcl and return the result as hash with symbols @@ -508,22 +214,30 @@ def search(search_str = nil, filter_str = nil, all = false) full_url += '*.json' end - # add api_version - if @api_version < 2.0 - puts "WARNING: attempting to use search with api_version #{@api_version}. Use API v2.0 for this functionality." + # add api_version (legacy NREL is 2.0, otherwise use new syntax and ignore version) + if @api_version.nil? + # see if we can extract it from filter_str: + tmp = filter_str.match(/api_version=\d{1,}.\d{1,}/) + if tmp + @api_version = tmp.to_s.gsub(/api_version=/, '').to_f + puts "@api_version from filter_str: #{@api_version}" + end end - full_url += "?api_version=#{@api_version}" + + if @api_version == 2.0 + full_url += "?api_version=#{@api_version}" + end + puts "@api_version: #{@api_version}" # add filters - unless filter_str.nil? - # strip out api_version from filters, if included - if filter_str.include? 'api_version=' - filter_str = filter_str.gsub(/api_version=\d{1,}/, '') - filter_str = filter_str.gsub(/&api_version=\d{1,}/, '') + if !filter_str.nil? + # strip out api_version from filters, if included & @api_version is defined + if (filter_str.include? 'api_version=') + filter_str = filter_str.gsub(/&api_version=\d{1,}.\d{1,}/, '') + filter_str = filter_str.gsub(/api_version=\d{1,}.\d{1,}/, '') end full_url = full_url + '&' + filter_str end - # simple search vs. all results if !all puts "search url: #{full_url}" @@ -572,14 +286,16 @@ def delete_receipts(array_of_components) receipt_file = File.dirname(comp) + '/' + File.basename(comp, '.tar.gz') + '.receipt' if File.exist?(receipt_file) FileUtils.remove_file(receipt_file) - end end end def list_all_measures - json = search(nil, 'fq[]=bundle%3Anrel_measure&show_rows=100') - + if @api_version == 2.0 + json = search(nil, 'fq[]=bundle%3Anrel_measure&show_rows=100') + else + json = search(nil, 'fq=bundle%3Ameasure&show_rows=100') + end json end @@ -607,93 +323,27 @@ def load_config config_filename = File.expand_path('~/.bcl/config.yml') if File.exist?(config_filename) - puts "loading config settings from #{config_filename}" + puts "loading URL config from #{config_filename}" @config = YAML.load_file(config_filename) else - # location of template file - FileUtils.mkdir_p(File.dirname(config_filename)) - File.open(config_filename, 'w') { |f| f << default_yaml.to_yaml } - File.chmod(0o600, config_filename) - puts "******** Please fill in user credentials in #{config_filename} file if you need to upload data **********" - # fill in the @config data with the temporary data for now. - @config = YAML.load_file(config_filename) + # use default URL + @config = { + server: { + url: 'https://bcl.nrel.gov' + } + } end end + # unused def default_yaml settings = { server: { - url: 'https://bcl.nrel.gov', - user: { - username: 'ENTER_BCL_USERNAME', - password: 'ENTER_BCL_PASSWORD', - group: 'ENTER_GROUP_ID' - } + url: 'https://bcl.nrel.gov' } } settings end end - - # TODO: make this extend the component_xml class (or create a super class around components) - - def self.gather_components(component_dir, chunk_size = 0, delete_previousgather = false, destination = nil) - if destination.nil? - @dest_filename = 'components' - else - @dest_filename = destination - end - @dest_file_ext = 'tar.gz' - - # store the starting directory - current_dir = Dir.pwd - - # an array to hold reporting info about the batches - gather_components_report = [] - - # go to the directory containing the components - Dir.chdir(component_dir) - - # delete any old versions of the component chunks - FileUtils.rm_rf('./gather') if delete_previousgather - - # gather all the components into array - targzs = Pathname.glob('./**/*.tar.gz') - tar_cnt = 0 - chunk_cnt = 0 - targzs.each do |targz| - if chunk_size != 0 && (tar_cnt % chunk_size) == 0 - chunk_cnt += 1 - end - tar_cnt += 1 - - destination_path = "./gather/#{chunk_cnt}" - FileUtils.mkdir_p(destination_path) - destination_file = "#{destination_path}/#{File.basename(targz.to_s)}" - # puts "copying #{targz.to_s} to #{destination_file}" - FileUtils.cp(targz.to_s, destination_file) - end - - # gather all the .tar.gz files into a single tar.gz - (1..chunk_cnt).each do |cnt| - currentdir = Dir.pwd - - paths = [] - Pathname.glob("./gather/#{cnt}/*.tar.gz").each do |pt| - paths << File.basename(pt.to_s) - end - - Dir.chdir("./gather/#{cnt}") - destination = "#{@dest_filename}_#{cnt}.#{@dest_file_ext}" - puts "tarring batch #{cnt} of #{chunk_cnt} to #{@dest_filename}_#{cnt}.#{@dest_file_ext}" - BCL.tarball(destination, paths) - Dir.chdir(currentdir) - - # move the tarball back a directory - FileUtils.move("./gather/#{cnt}/#{destination}", "./gather/#{destination}") - end - - Dir.chdir(current_dir) - end end diff --git a/lib/bcl/tar_ball.rb b/lib/bcl/tar_ball.rb index 6c44af5..461356a 100644 --- a/lib/bcl/tar_ball.rb +++ b/lib/bcl/tar_ball.rb @@ -36,46 +36,12 @@ module BCL module_function - # tarball multiple paths recursively to destination - def tarball(destination, paths) - # check for filepath length limit - full_destination = File.expand_path(destination) - if full_destination.length > 259 # 256 chars max; "C:\" doesn't count - puts "[TarBall] ERROR cannot generate #{destination} because path exceeds 256 char limit. shorten component name by at least by #{full_destination.length - 259} chars" - return - end - - Zlib::GzipWriter.open(destination) do |gzip| - out = Archive::Tar::Minitar::Output.new(gzip) - - paths.each do |fi| - if File.exist?(fi) - Archive::Tar::Minitar.pack_file(fi, out) - else - puts "[TarBall] ERROR Could not file file: #{fi}" - end - end - out.close - end - end - def extract_tarball(filename, destination) Zlib::GzipReader.open(filename) do |gz| Archive::Tar::Minitar.unpack(gz, destination) end end - def create_zip(_destination, paths) - Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile| - paths.each do |fi| - # Two arguments: - # - The name of the file as it will appear in the archive - # - The original file, including the path to find it - zipfile.add(fi.basename, fi) - end - end - end - def extract_zip(filename, destination, delete_zip = false) Zip::File.open(filename) do |zip_file| zip_file.each do |f| diff --git a/spec/api/api_components_spec.rb b/spec/api/api_components_spec.rb index 5096863..cfbe036 100644 --- a/spec/api/api_components_spec.rb +++ b/spec/api/api_components_spec.rb @@ -41,8 +41,6 @@ context '::Component' do before :all do @cm = BCL::ComponentMethods.new - @username = @cm.config[:server][:user][:username] - @password = @cm.config[:server][:user][:password] # set up faraday object @logger = Logger.new('faraday.log') @@ -61,186 +59,140 @@ end end - context 'when bad login' do - it 'should not authenticate' do - res = @cm.login(@username, 'BAD_PASSWORD') - expect(res.code).to eq('401') + context 'LEGACY API v2.0 - search component information (simple search, returns JSON-parsed hash with symbols only)' do + before :all do + query = 'ashrae.json' + filter = 'fq[]=bundle:nrel_component&show_rows=3&api_version=2.0' + @results = @cm.search(query, filter) end - end - context 'when pushing components before logging in' do - it 'should raise exception' do - expect { @cm.push_content('/dev/null', false, 'nrel_component') }.to raise_exception + it 'should return a valid search' do + # puts "Search results #{@results[:result]}" + expect(@results[:result].count).to eq(3) + expect(@results[:result][0][:component][:name]).to be_a String end - end - context 'when logged in' do - before :all do - @res = @cm.login + it 'should return three results' do + expect(@results[:result].count).to eq 3 end - it 'should return 200' do - expect(@res.code).to eq '200' + it 'should return results in hash with symbols (even when querying in xml)' do + query = 'ashrae.xml' + filter = 'fq[]=bundle:nrel_component&show_rows=3' + expect(@results[:result].count).to be > 0 + expect(@results[:result][0][:component][:name]).to be_a String end + end - it 'should have a valid session' do - expect(@cm.session).to_not be_nil + context 'New API Syntax - search component information (simple search, returns JSON-parsed hash with symbols only)' do + before :all do + query = 'ashrae.json' + filter = 'fq=bundle:component&show_rows=3' + @results = @cm.search(query, filter) end - context 'and search component information (simple search, returns JSON-parsed hash with symbols only, API v2.0 only)' do - before :all do - query = 'ashrae.json' - filter = 'fq[]=bundle:nrel_component&show_rows=3' - @results = @cm.search(query, filter) - end - - it 'should return a valid search' do - puts "Search results #{@results[:result]}" - expect(@results[:result].count).to eq(3) - expect(@results[:result][0][:component][:name]).to be_a String - end - - it 'should return three results' do - expect(@results[:result].count).to eq 3 - end - - it 'should return results in hash with symbols (even when querying in xml)' do - query = 'ashrae.xml' - filter = 'fq[]=bundle:nrel_component&show_rows=3' - expect(@results[:result].count).to be > 0 - expect(@results[:result][0][:component][:name]).to be_a String - end + it 'should return a valid search' do + # puts "Search results #{@results[:result]}" + expect(@results[:result].count).to eq(3) + expect(@results[:result][0][:component][:name]).to be_a String end - # search and iterate through all pages of API - context 'and search component information (all results search, returns JSON-parsed hash with symbols only, API v2.0 only)' do - before :all do - query = 'ashrae.json' - filter = 'fq[]=sm_vid_Component_Tags:Material&fq[]=bundle:nrel_component' - all_pages_flag = true - @results = @cm.search(query, filter, all_pages_flag) - end - - it 'should return a valid search' do - expect(@results[:result].count).to be > 0 - expect(@results[:result][0][:component][:name]).to be_a String - end - - it 'should return over 200 results (to demonstrate iteration over pages)' do - expect(@results[:result].count).to be > 0 - end + it 'should return three results' do + expect(@results[:result].count).to eq 3 end - context 'and download component v2.0' do - before :all do - query = 'ashrae' - filter = 'fq[]=bundle:nrel_component&show_rows=3' - - @results = @cm.search(query, filter) - @uids = [] - @results[:result].each do |result| - @uids << result[:component][:uuid] - end - end - - it 'should have uuid to download' do - expect(@uids.length).to be > 0 - end - - it 'should be able to use get to download multiple components that is valid' do - # need to look like uuids=abc,def - data = "uids=#{@uids.join(',')}" - - res = @faraday.get "/api/component/download?#{data}" - expect(res.status).to eq(200) - expect(res.body).not_to be_nil - end - - it 'should be able to download many components using get' do - data = "uids=#{@uids.first}" - - res = @faraday.get "/api/component/download?#{data}" - expect(res.status).to eq(200) - expect(res.body).not_to be_nil - end + it 'should return results in hash with symbols (even when querying in xml)' do + query = 'ashrae.xml' + filter = 'fq=bundle:component&show_rows=3' + expect(@results[:result].count).to be > 0 + expect(@results[:result][0][:component][:name]).to be_a String + end + end - it 'should be able to use post to download a component that is valid' do - # need to look like uuids=abc,def - data = "uids=#{@uids.first}" + # search and iterate through all pages of API + context 'and search component information (all results search, returns JSON-parsed hash with symbols only, API v2.0 only)' do + before :all do + query = 'ashrae.json' + filter = 'fq=component_tags:Material&fq=bundle:component' + all_pages_flag = true + @results = @cm.search(query, filter, all_pages_flag) + end - res = @faraday.post do |req| - req.url "/api/component/download?#{data}" - req.headers['Content-Type'] = 'application/json' - req.body = data - end + it 'should return a valid search' do + expect(@results[:result].count).to be > 0 + expect(@results[:result][0][:component][:name]).to be_a String + end - expect(res.status).to eq(200) - end + it 'should return over 200 results (to demonstrate iteration over pages)' do + expect(@results[:result].count).to be > 0 end + end - context 'post component' do - it 'should be able to post new component with no ids set' do - filename = "#{File.dirname(__FILE__)}/resources/component_example_no_ids.zip" - valid, res = @cm.push_content(filename, true, 'nrel_component') + context 'Legacy Syntax API v2.0 - Download component' do + before :all do + query = 'ashrae' + filter = 'fq[]=bundle:nrel_component&show_rows=3' - expect(valid).to eq true - expect(res['uuid']).to match /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/ - # expect(res['version_id']).to match /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/ + @results = @cm.search(query, filter) + @uids = [] + @results[:result].each do |result| + @uids << result[:component][:uuid] end + end - it 'should fail when posting a component with a non-unique uuid' do - filename = "#{File.dirname(__FILE__)}/resources/component_example_no_vid.tar.gz" - valid, res = @cm.push_content(filename, true, 'nrel_component') + it 'should have uuid to download' do + expect(@uids.length).to be > 0 + end - expect(valid).to eq(false) - expect(res[:error]).to eq 'There is already content with that UUID.' - end + it 'should be able to use get to download multiple components that is valid' do + # need to look like uuids=abc,def + data = "uids=#{@uids.join(',')}" - it 'should update the component if the uuid already exists' do - filename = "#{File.dirname(__FILE__)}/resources/component_example_no_vid.tar.gz" - valid, res = @cm.update_content(filename, false, nil) - puts res - # note: there is a problem here when not called by jenkins group. can ignore for local testing + res = @faraday.get "/api/component/download?#{data}" + expect(res.status).to eq(200) + expect(res.body).not_to be_nil + end - expect(valid).to eq true - # note: this will not work on both dev and prod BCL - # dev - # expect(res['nid']).to eq '69193' + it 'should be able to download many components using get' do + data = "uids=#{@uids.first}" - expect(res['nid']).to eq '88298' - expect(res['uuid']).to eq '21f13f54-6ad2-438d-b5fc-292b2c8ca321' - end + res = @faraday.get "/api/component/download?#{data}" + expect(res.status).to eq(200) + expect(res.body).not_to be_nil + end + end - it 'should fail when posting component with same uuid/vid components' do - filename = "#{File.dirname(__FILE__)}/resources/component_example.tar.gz" - valid, res = @cm.push_content(filename, true, 'nrel_component') + context 'New Syntax - Download component' do + before :all do + query = 'ashrae' + filter = 'fq=bundle:component&show_rows=3' - expect(valid).to eq(false) - puts res.inspect + @results = @cm.search(query, filter) + @uids = [] + @results[:result].each do |result| + @uids << result[:component][:uuid] end end - context 'posting multiple components' do - it 'should push 2 components' do - files = Pathname.glob("#{File.dirname(__FILE__)}/resources/component_example_*.tar.gz") - log = @cm.push_contents(files, false, 'nrel_component') + it 'should have uuid to download' do + expect(@uids.length).to be > 0 + end - expect(log.size).to eq(2) - end + it 'should be able to use get to download multiple components that is valid' do + # need to look like uuids=abc,def + data = "uids=#{@uids.join(',')}" - it 'should post 0 components when checking receipt files' do - files = Pathname.glob("#{File.dirname(__FILE__)}/resources/component*.tar.gz") - puts "FILES: #{files.inspect}" - log = @cm.push_contents(files, true, 'nrel_component') + res = @faraday.get "/api/component/download?#{data}" + expect(res.status).to eq(200) + expect(res.body).not_to be_nil + end - expect(log.size).to eq(3) + it 'should be able to download many components using get' do + data = "uids=#{@uids.first}" - test = true - log.each do |comp| - test = false if !comp.include?('skipping') && !comp.include?('false') - end - expect(test).to be_a TrueClass - end + res = @faraday.get "/api/component/download?#{data}" + expect(res.status).to eq(200) + expect(res.body).not_to be_nil end end end diff --git a/spec/api/api_measures_spec.rb b/spec/api/api_measures_spec.rb index fe65703..2813b7f 100644 --- a/spec/api/api_measures_spec.rb +++ b/spec/api/api_measures_spec.rb @@ -39,107 +39,54 @@ context '::Measure' do before :all do @cm = BCL::ComponentMethods.new - @username = @cm.config[:server][:user][:username] - @password = @cm.config[:server][:user][:password] end - context 'and when logged in' do - it 'should login if not logged in' do - expect(@cm.logged_in).to eq(false) - - @res = @cm.login - expect(@res.code).to eq('200') - expect(@cm.session).to_not be_nil - end - end - - context 'and uploading measures' do + context 'LEGACY API v2.0 - search measure information (simple search, returns JSON-parsed hash with symbols only)' do before :all do - @cm.login unless @cm.logged_in - end - - # NOTE: must delete "Test Gem Measure" from BCL first each time this is run - it 'should upload a measure' do - filename = "#{File.dirname(__FILE__)}/resources/measure_original.tar.gz" - puts "Filename: #{filename}" - valid, res = @cm.push_content(filename, false, 'nrel_measure') - puts "VALID: #{valid}, RESULTS: #{res.inspect}" - expect(valid).to eq true + query = 'hvac.json' + filter = 'fq[]=bundle:nrel_measure&show_rows=3&api_version=2.0' + @results = @cm.search(query, filter) end - it 'should update a measure' do - filename = "#{File.dirname(__FILE__)}/resources/measure_updated.tar.gz" - valid, res = @cm.update_content(filename, false, nil) - expect(valid).to eq true + it 'should return a valid search' do + # puts "Search results #{@results[:result]}" + expect(@results[:result].count).to eq(3) + expect(@results[:result][0][:measure][:name]).to be_a String end - it 'should fail upload of existing measure (UUID match)' do - filename = "#{File.dirname(__FILE__)}/resources/measure_error_uuidExists.tar.gz" - valid, res = @cm.push_content(filename, false, 'nrel_measure') - expect(valid).to eq false - expect(res[:error]).to eq 'There is already content with that UUID.' + it 'should return three results' do + expect(@results[:result].count).to eq 3 end - it 'should fail update of existing measure with same Version ID (VUUID match)' do - filename = "#{File.dirname(__FILE__)}/resources/measure_error_versionIdExists.tar.gz" - valid, res = @cm.update_content(filename, false, nil) - expect(valid).to eq false - expect(res[:error]).to eq 'There is already content with that Version ID (VUUID).' + it 'should return results in hash with symbols (even when querying in xml)' do + query = 'hvac.xml' + filter = 'fq[]=bundle:nrel_measure&show_rows=3&api_version=2.0' + expect(@results[:result].count).to eq(3) + expect(@results[:result][0][:measure][:name]).to be_a String end - - it 'should fail update with malformed UUID' do - filename = "#{File.dirname(__FILE__)}/resources/measure_updated.tar.gz" - expect { @cm.update_content(filename, false, '1234-1234') }.to raise_error 'uuid of 1234-1234 is invalid' - end - - it 'should fail upload/update with topLevel directory in tar.gz' do - filename = "#{File.dirname(__FILE__)}/resources/measure_error_topLevelFolder.tar.gz" - valid, res = @cm.update_content(filename, false, 'ee1ff23a-c8d0-4998-8a5f-abad5969d46b') - expect(valid).to eq false - expect(res[:error]).to eq 'No XML file was found at the top level of the archive file. Check your archive file to ensure you do not have a parent directory at the top level.' - end - - it 'should fail upload/update with bad attribute in xml' do - filename = "#{File.dirname(__FILE__)}/resources/measure_error_badAttribute.tar.gz" - valid, res = @cm.update_content(filename, false, nil) - expect(valid).to eq false - expect(res[:error]).to eq 'Your file contains an invalid attribute: Attribute Does Not Exist' - end - - it 'should fail upload/update when there is an tag in the xml' do - filename = "#{File.dirname(__FILE__)}/resources/measure_error_errorInXml.tar.gz" - valid, res = @cm.update_content(filename, false, nil) - expect(valid).to eq false - expect(res[:error]).to eq 'Cannot upload content with the \'error\' field set in the XML.' - end - - it 'should fail upload/update when file described in xml is not in tar.gz' do - filename = "#{File.dirname(__FILE__)}/resources/measure_error_missingFile.tar.gz" - valid, res = @cm.update_content(filename, false, nil) - expect(valid).to eq false - expect(res[:error]).to eq 'File: test_gem_measure_test.rb could not be found in the archive.' + end + context 'NEW SYNTAX API - search measure information (simple search, returns JSON-parsed hash with symbols only)' do + before :all do + query = 'hvac.json' + filter = 'fq=bundle:measure&show_rows=3' + @results = @cm.search(query, filter) end - it 'should not be able to update a measure that doesn\'t already exist' do - filename = "#{File.dirname(__FILE__)}/resources/non_uploaded_measure.tar.gz" - valid, res = @cm.update_content(filename, false) - - expect(valid).to eq false - expect(res).to eq ['Node not found'] # TODO: this should be JSON, and fix the double space + it 'should return a valid search' do + # puts "Search results #{@results[:result]}" + expect(@results[:result].count).to eq(3) + expect(@results[:result][0][:measure][:name]).to be_a String end - end - context 'BSD Tarball' do - before :all do - @cm.login unless @cm.logged_in + it 'should return three results' do + expect(@results[:result].count).to eq 3 end - it 'should cause errors' do - filename = "#{File.dirname(__FILE__)}/resources/bsd_created_measure.tar.gz" - valid, res = @cm.push_content(filename, false, 'nrel_measure') - - expect(valid).to eq false - expect(res[:error]).to start_with 'Internal Server Error : An error occurred (0): phar error:' + it 'should return results in hash with symbols (even when querying in xml)' do + query = 'hvac.xml' + filter = 'fq=bundle:measure&show_rows=3' + expect(@results[:result].count).to eq(3) + expect(@results[:result][0][:measure][:name]).to be_a String end end end From 399a103e00b42f8011a240ca1b7735c7944c1515 Mon Sep 17 00:00:00 2001 From: Nicholas Long <1907354+nllong@users.noreply.github.com> Date: Mon, 4 Oct 2021 16:08:05 -0600 Subject: [PATCH 02/10] Updating version for BCL2.0 --- lib/bcl/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bcl/version.rb b/lib/bcl/version.rb index ed2fcd8..8b77570 100644 --- a/lib/bcl/version.rb +++ b/lib/bcl/version.rb @@ -34,5 +34,5 @@ # ******************************************************************************* module BCL - VERSION = '0.7.1'.freeze + VERSION = '0.8.0'.freeze end From 653f5ddaaabc36319a904f74ef2e50b16a682aee Mon Sep 17 00:00:00 2001 From: Nicholas Long <1907354+nllong@users.noreply.github.com> Date: Mon, 4 Oct 2021 16:09:27 -0600 Subject: [PATCH 03/10] Update CHANGELOG.md --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44d1939..69324db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## Version 0.8.0 (Unreleased) +* removed staging, pushing, updating of components +* removed login +* simplified config file to only contain server URL +* removed test to download component via POST (was that needed?) +* code clean-up and test clean-up + ## Version 0.7.1 * Update license to standard OpenStudio 4-clause BSD license * Upgrade dependencies for security From 46a8c9c6c4cb1b6fc530b09c3e9c9b6b1cabb674 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Mon, 13 Mar 2023 16:05:51 +0100 Subject: [PATCH 04/10] Duplicate entry for BCLMeasureArgument: model_dependent is there twice --- schemas/v3/measure_v3.xsd | 5 ----- 1 file changed, 5 deletions(-) diff --git a/schemas/v3/measure_v3.xsd b/schemas/v3/measure_v3.xsd index 83f9967..2b7197b 100644 --- a/schemas/v3/measure_v3.xsd +++ b/schemas/v3/measure_v3.xsd @@ -145,11 +145,6 @@ maximum value - - - true if any of this argument's properties depend on the specific model used. default_value, choice_values, min_value, and max_value will not be populated for dynamic arguments - - From 5d06189823d6680e32def2e65ce624689cafea00 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Mon, 13 Mar 2023 16:06:55 +0100 Subject: [PATCH 05/10] BCLXML writes outputs right after arguments. xs:sequence enforces order cf https://github.com/NREL/OpenStudio/blob/99e001d02545ad4c65938f49b411179418662f9f/src/utilities/bcl/BCLXML.cpp#L635-L654 --- schemas/v3/measure_v3.xsd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/v3/measure_v3.xsd b/schemas/v3/measure_v3.xsd index 2b7197b..9edd038 100644 --- a/schemas/v3/measure_v3.xsd +++ b/schemas/v3/measure_v3.xsd @@ -439,11 +439,11 @@ + - From cb26a65eb4569a4dfd92485f7d7d28d5094e39f0 Mon Sep 17 00:00:00 2001 From: Katherine Fleming <2205659+kflemin@users.noreply.github.com> Date: Mon, 1 May 2023 13:21:03 -0600 Subject: [PATCH 06/10] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69324db..51971fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Change Log ## Version 0.8.0 (Unreleased) +* BCLXML validation: adjust schemas * removed staging, pushing, updating of components * removed login * simplified config file to only contain server URL From 7fdf5d605374b9c638aeb56a3806d1a9bf868b7a Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 1 Feb 2024 11:11:41 +0100 Subject: [PATCH 07/10] remove required_ruby_version --- bcl.gemspec | 2 -- 1 file changed, 2 deletions(-) diff --git a/bcl.gemspec b/bcl.gemspec index 0f96bf2..60fe24c 100644 --- a/bcl.gemspec +++ b/bcl.gemspec @@ -27,8 +27,6 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.required_ruby_version = '~> 2.7.0' - spec.add_dependency 'builder', '3.2.4' spec.add_dependency 'faraday', '~> 1.0.1' spec.add_dependency 'minitar', '~> 0.9' From 9e7db4cca5df79d67c30864a0bef2fa25b68b212 Mon Sep 17 00:00:00 2001 From: kflemin <2205659+kflemin@users.noreply.github.com> Date: Wed, 17 Apr 2024 12:26:53 -0600 Subject: [PATCH 08/10] add ruby 3.2 requirement --- bcl.gemspec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bcl.gemspec b/bcl.gemspec index 60fe24c..10df80d 100644 --- a/bcl.gemspec +++ b/bcl.gemspec @@ -27,6 +27,8 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] + spec.required_ruby_version = '~> 3.2' + spec.add_dependency 'builder', '3.2.4' spec.add_dependency 'faraday', '~> 1.0.1' spec.add_dependency 'minitar', '~> 0.9' @@ -41,6 +43,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'yamler', '0.1.0' spec.add_dependency 'zliby', '0.0.5' + spec.add_development_dependency 'bundler', '>= 2.5.5' spec.add_development_dependency 'rake', '~> 13.0' spec.add_development_dependency 'rspec', '~> 3.9' end From e35639c9e05a9f63e18f12707199bcac75d8b33a Mon Sep 17 00:00:00 2001 From: kflemin <2205659+kflemin@users.noreply.github.com> Date: Wed, 17 Apr 2024 14:04:29 -0600 Subject: [PATCH 09/10] update licenses and gem dependencies for ruby 3.2.2/os3.8.0 --- CHANGELOG.md | 1 + LICENSE.md | 2 +- Rakefile | 34 ++------------------------- bcl.gemspec | 5 ++-- lib/bcl.rb | 34 ++------------------------- lib/bcl/base_xml.rb | 34 ++------------------------- lib/bcl/component.rb | 34 ++------------------------- lib/bcl/component_from_spreadsheet.rb | 34 ++------------------------- lib/bcl/component_methods.rb | 34 ++------------------------- lib/bcl/core_ext.rb | 34 ++------------------------- lib/bcl/tar_ball.rb | 34 ++------------------------- lib/bcl/version.rb | 34 ++------------------------- spec/api/api_components_spec.rb | 34 ++------------------------- spec/api/api_measures_spec.rb | 34 ++------------------------- spec/bcl/component_xml_spec.rb | 34 ++------------------------- spec/bcl/core_ext_spec.rb | 34 ++------------------------- spec/bcl/datatypes_spec.rb | 34 ++------------------------- spec/spec_helper.rb | 34 ++------------------------- 18 files changed, 34 insertions(+), 484 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51971fc..ba621a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * simplified config file to only contain server URL * removed test to download component via POST (was that needed?) * code clean-up and test clean-up +* updated dependencies to support Ruby 3.2.2 & OpenStudio 3.8.0 ## Version 0.7.1 * Update license to standard OpenStudio 4-clause BSD license diff --git a/LICENSE.md b/LICENSE.md index 78354a9..acca5fa 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. All rights reserved. +OpenStudio(R), Copyright (c) 2008-2024, Alliance for Sustainable Energy, LLC. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/Rakefile b/Rakefile index 5c1ac1a..870355f 100644 --- a/Rakefile +++ b/Rakefile @@ -1,36 +1,6 @@ # ******************************************************************************* -# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. -# All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# (1) Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# (2) Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# (3) Neither the name of the copyright holder nor the names of any contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission from the respective party. -# -# (4) Other than as required in clauses (1) and (2), distributions in any form -# of modifications or other derivative works may not use the "OpenStudio" -# trademark, "OS", "os", or any other confusingly similar designation without -# specific prior written permission from Alliance for Sustainable Energy, LLC. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE -# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF -# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC. +# See also https://openstudio.net/license # ******************************************************************************* require 'bundler' diff --git a/bcl.gemspec b/bcl.gemspec index 10df80d..1679855 100644 --- a/bcl.gemspec +++ b/bcl.gemspec @@ -16,7 +16,6 @@ Gem::Specification.new do |spec| spec.metadata = { 'bug_tracker_uri' => 'https://github.com/NREL/bcl-gem/issues', 'changelog_uri' => 'https://github.com/NREL/bcl-gem/blob/develop/CHANGELOG.md', - # 'documentation_uri' => 'https://www.rubydoc.info/gems/openstudio-extension-gem/#{gem.version}', 'source_code_uri' => "https://github.com/NREL/bcl-gem/tree/v#{spec.version}" } @@ -27,7 +26,7 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.required_ruby_version = '~> 3.2' + spec.required_ruby_version = '~> 3.2.2' spec.add_dependency 'builder', '3.2.4' spec.add_dependency 'faraday', '~> 1.0.1' @@ -35,7 +34,7 @@ Gem::Specification.new do |spec| # Measure tester is not used in this project, but this will force dependencies to match versions # requested by OpenStudio. This includes dependencies for running tests/CI - spec.add_dependency 'openstudio_measure_tester', '~> 0.3.1' + spec.add_dependency 'openstudio_measure_tester', '~> 0.4.0' spec.add_dependency 'rexml', '3.2.5' spec.add_dependency 'rubyzip', '~> 2.3.2' spec.add_dependency 'spreadsheet', '1.2.9' diff --git a/lib/bcl.rb b/lib/bcl.rb index 00bdbde..2f00ade 100644 --- a/lib/bcl.rb +++ b/lib/bcl.rb @@ -1,36 +1,6 @@ # ******************************************************************************* -# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. -# All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# (1) Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# (2) Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# (3) Neither the name of the copyright holder nor the names of any contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission from the respective party. -# -# (4) Other than as required in clauses (1) and (2), distributions in any form -# of modifications or other derivative works may not use the "OpenStudio" -# trademark, "OS", "os", or any other confusingly similar designation without -# specific prior written permission from Alliance for Sustainable Energy, LLC. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE -# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF -# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC. +# See also https://openstudio.net/license # ******************************************************************************* require 'pathname' diff --git a/lib/bcl/base_xml.rb b/lib/bcl/base_xml.rb index 627ee9b..9e2dcf3 100644 --- a/lib/bcl/base_xml.rb +++ b/lib/bcl/base_xml.rb @@ -1,36 +1,6 @@ # ******************************************************************************* -# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. -# All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# (1) Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# (2) Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# (3) Neither the name of the copyright holder nor the names of any contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission from the respective party. -# -# (4) Other than as required in clauses (1) and (2), distributions in any form -# of modifications or other derivative works may not use the "OpenStudio" -# trademark, "OS", "os", or any other confusingly similar designation without -# specific prior written permission from Alliance for Sustainable Energy, LLC. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE -# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF -# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC. +# See also https://openstudio.net/license # ******************************************************************************* # KAF 2/13/2018 diff --git a/lib/bcl/component.rb b/lib/bcl/component.rb index b168dc3..910e13a 100644 --- a/lib/bcl/component.rb +++ b/lib/bcl/component.rb @@ -1,36 +1,6 @@ # ******************************************************************************* -# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. -# All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# (1) Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# (2) Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# (3) Neither the name of the copyright holder nor the names of any contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission from the respective party. -# -# (4) Other than as required in clauses (1) and (2), distributions in any form -# of modifications or other derivative works may not use the "OpenStudio" -# trademark, "OS", "os", or any other confusingly similar designation without -# specific prior written permission from Alliance for Sustainable Energy, LLC. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE -# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF -# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC. +# See also https://openstudio.net/license # ******************************************************************************* # Provides programmatic access to the component.xsd schema needed for diff --git a/lib/bcl/component_from_spreadsheet.rb b/lib/bcl/component_from_spreadsheet.rb index 7a96bf6..ddd1869 100644 --- a/lib/bcl/component_from_spreadsheet.rb +++ b/lib/bcl/component_from_spreadsheet.rb @@ -1,36 +1,6 @@ # ******************************************************************************* -# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. -# All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# (1) Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# (2) Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# (3) Neither the name of the copyright holder nor the names of any contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission from the respective party. -# -# (4) Other than as required in clauses (1) and (2), distributions in any form -# of modifications or other derivative works may not use the "OpenStudio" -# trademark, "OS", "os", or any other confusingly similar designation without -# specific prior written permission from Alliance for Sustainable Energy, LLC. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE -# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF -# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC. +# See also https://openstudio.net/license # ******************************************************************************* # Converts a custom Excel spreadsheet format to BCL components for upload diff --git a/lib/bcl/component_methods.rb b/lib/bcl/component_methods.rb index ae11d26..b68d9a9 100644 --- a/lib/bcl/component_methods.rb +++ b/lib/bcl/component_methods.rb @@ -1,36 +1,6 @@ # ******************************************************************************* -# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. -# All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# (1) Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# (2) Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# (3) Neither the name of the copyright holder nor the names of any contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission from the respective party. -# -# (4) Other than as required in clauses (1) and (2), distributions in any form -# of modifications or other derivative works may not use the "OpenStudio" -# trademark, "OS", "os", or any other confusingly similar designation without -# specific prior written permission from Alliance for Sustainable Energy, LLC. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE -# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF -# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC. +# See also https://openstudio.net/license # ******************************************************************************* module BCL diff --git a/lib/bcl/core_ext.rb b/lib/bcl/core_ext.rb index d6db3c0..9bf0686 100644 --- a/lib/bcl/core_ext.rb +++ b/lib/bcl/core_ext.rb @@ -1,36 +1,6 @@ # ******************************************************************************* -# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. -# All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# (1) Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# (2) Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# (3) Neither the name of the copyright holder nor the names of any contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission from the respective party. -# -# (4) Other than as required in clauses (1) and (2), distributions in any form -# of modifications or other derivative works may not use the "OpenStudio" -# trademark, "OS", "os", or any other confusingly similar designation without -# specific prior written permission from Alliance for Sustainable Energy, LLC. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE -# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF -# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC. +# See also https://openstudio.net/license # ******************************************************************************* class String diff --git a/lib/bcl/tar_ball.rb b/lib/bcl/tar_ball.rb index 461356a..e83b769 100644 --- a/lib/bcl/tar_ball.rb +++ b/lib/bcl/tar_ball.rb @@ -1,36 +1,6 @@ # ******************************************************************************* -# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. -# All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# (1) Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# (2) Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# (3) Neither the name of the copyright holder nor the names of any contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission from the respective party. -# -# (4) Other than as required in clauses (1) and (2), distributions in any form -# of modifications or other derivative works may not use the "OpenStudio" -# trademark, "OS", "os", or any other confusingly similar designation without -# specific prior written permission from Alliance for Sustainable Energy, LLC. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE -# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF -# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC. +# See also https://openstudio.net/license # ******************************************************************************* module BCL diff --git a/lib/bcl/version.rb b/lib/bcl/version.rb index 8b77570..16b9a3a 100644 --- a/lib/bcl/version.rb +++ b/lib/bcl/version.rb @@ -1,36 +1,6 @@ # ******************************************************************************* -# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. -# All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# (1) Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# (2) Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# (3) Neither the name of the copyright holder nor the names of any contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission from the respective party. -# -# (4) Other than as required in clauses (1) and (2), distributions in any form -# of modifications or other derivative works may not use the "OpenStudio" -# trademark, "OS", "os", or any other confusingly similar designation without -# specific prior written permission from Alliance for Sustainable Energy, LLC. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE -# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF -# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC. +# See also https://openstudio.net/license # ******************************************************************************* module BCL diff --git a/spec/api/api_components_spec.rb b/spec/api/api_components_spec.rb index cfbe036..d845b4b 100644 --- a/spec/api/api_components_spec.rb +++ b/spec/api/api_components_spec.rb @@ -1,36 +1,6 @@ # ******************************************************************************* -# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. -# All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# (1) Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# (2) Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# (3) Neither the name of the copyright holder nor the names of any contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission from the respective party. -# -# (4) Other than as required in clauses (1) and (2), distributions in any form -# of modifications or other derivative works may not use the "OpenStudio" -# trademark, "OS", "os", or any other confusingly similar designation without -# specific prior written permission from Alliance for Sustainable Energy, LLC. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE -# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF -# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC. +# See also https://openstudio.net/license # ******************************************************************************* require 'spec_helper' diff --git a/spec/api/api_measures_spec.rb b/spec/api/api_measures_spec.rb index 2813b7f..b428095 100644 --- a/spec/api/api_measures_spec.rb +++ b/spec/api/api_measures_spec.rb @@ -1,36 +1,6 @@ # ******************************************************************************* -# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. -# All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# (1) Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# (2) Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# (3) Neither the name of the copyright holder nor the names of any contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission from the respective party. -# -# (4) Other than as required in clauses (1) and (2), distributions in any form -# of modifications or other derivative works may not use the "OpenStudio" -# trademark, "OS", "os", or any other confusingly similar designation without -# specific prior written permission from Alliance for Sustainable Energy, LLC. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE -# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF -# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC. +# See also https://openstudio.net/license # ******************************************************************************* require 'spec_helper' diff --git a/spec/bcl/component_xml_spec.rb b/spec/bcl/component_xml_spec.rb index 741c9fa..a2d2312 100644 --- a/spec/bcl/component_xml_spec.rb +++ b/spec/bcl/component_xml_spec.rb @@ -1,36 +1,6 @@ # ******************************************************************************* -# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. -# All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# (1) Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# (2) Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# (3) Neither the name of the copyright holder nor the names of any contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission from the respective party. -# -# (4) Other than as required in clauses (1) and (2), distributions in any form -# of modifications or other derivative works may not use the "OpenStudio" -# trademark, "OS", "os", or any other confusingly similar designation without -# specific prior written permission from Alliance for Sustainable Energy, LLC. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE -# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF -# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC. +# See also https://openstudio.net/license # ******************************************************************************* require 'spec_helper' diff --git a/spec/bcl/core_ext_spec.rb b/spec/bcl/core_ext_spec.rb index 2b70e44..e27bbcf 100644 --- a/spec/bcl/core_ext_spec.rb +++ b/spec/bcl/core_ext_spec.rb @@ -1,36 +1,6 @@ # ******************************************************************************* -# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. -# All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# (1) Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# (2) Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# (3) Neither the name of the copyright holder nor the names of any contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission from the respective party. -# -# (4) Other than as required in clauses (1) and (2), distributions in any form -# of modifications or other derivative works may not use the "OpenStudio" -# trademark, "OS", "os", or any other confusingly similar designation without -# specific prior written permission from Alliance for Sustainable Energy, LLC. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE -# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF -# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC. +# See also https://openstudio.net/license # ******************************************************************************* require 'spec_helper' diff --git a/spec/bcl/datatypes_spec.rb b/spec/bcl/datatypes_spec.rb index 89ccc7f..15f3c6a 100644 --- a/spec/bcl/datatypes_spec.rb +++ b/spec/bcl/datatypes_spec.rb @@ -1,36 +1,6 @@ # ******************************************************************************* -# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. -# All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# (1) Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# (2) Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# (3) Neither the name of the copyright holder nor the names of any contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission from the respective party. -# -# (4) Other than as required in clauses (1) and (2), distributions in any form -# of modifications or other derivative works may not use the "OpenStudio" -# trademark, "OS", "os", or any other confusingly similar designation without -# specific prior written permission from Alliance for Sustainable Energy, LLC. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE -# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF -# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC. +# See also https://openstudio.net/license # ******************************************************************************* require 'spec_helper' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9355a97..a802607 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,36 +1,6 @@ # ******************************************************************************* -# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. -# All rights reserved. -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# (1) Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# (2) Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# (3) Neither the name of the copyright holder nor the names of any contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission from the respective party. -# -# (4) Other than as required in clauses (1) and (2), distributions in any form -# of modifications or other derivative works may not use the "OpenStudio" -# trademark, "OS", "os", or any other confusingly similar designation without -# specific prior written permission from Alliance for Sustainable Energy, LLC. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE -# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF -# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC. +# See also https://openstudio.net/license # ******************************************************************************* $LOAD_PATH.unshift(File.dirname(__FILE__)) From daf9afce2fae6b5923c6741331129c410a70dc92 Mon Sep 17 00:00:00 2001 From: kflemin <2205659+kflemin@users.noreply.github.com> Date: Thu, 2 May 2024 22:11:44 -0600 Subject: [PATCH 10/10] pin bundler to match other gems --- CHANGELOG.md | 2 +- bcl.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba621a4..24a688f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## Version 0.8.0 (Unreleased) +## Version 0.8.0 * BCLXML validation: adjust schemas * removed staging, pushing, updating of components * removed login diff --git a/bcl.gemspec b/bcl.gemspec index 1679855..084da9a 100644 --- a/bcl.gemspec +++ b/bcl.gemspec @@ -42,7 +42,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'yamler', '0.1.0' spec.add_dependency 'zliby', '0.0.5' - spec.add_development_dependency 'bundler', '>= 2.5.5' + spec.add_development_dependency 'bundler', '2.4.10' spec.add_development_dependency 'rake', '~> 13.0' spec.add_development_dependency 'rspec', '~> 3.9' end