diff --git a/Rakefile b/Rakefile index d708427534..3a8b753730 100644 --- a/Rakefile +++ b/Rakefile @@ -160,24 +160,8 @@ namespace :data do spreadsheet_titles = spreadsheets_ashrae + spreadsheets_deer + spreadsheets_comstock + spreadsheets_cbes spreadsheet_titles = spreadsheet_titles.uniq - desc 'Check Google Drive configuration' - task 'apicheck' do - check_google_drive_configuration - end - - desc 'Download OpenStudio_Standards spreadsheets from Google Drive' - task 'download' do - download_google_spreadsheets(spreadsheet_titles) - end - - desc 'Download OpenStudio_Standards spreadsheets and generate JSONs' - task 'update' do - download_google_spreadsheets(spreadsheet_titles) - export_spreadsheet_to_json(spreadsheet_titles) - end - desc 'Generate JSONs from OpenStudio_Standards spreadsheets' - task 'update:manual' do + task 'update' do export_spreadsheet_to_json(spreadsheet_titles) end diff --git a/data/standards/manage_OpenStudio_Standards.rb b/data/standards/manage_OpenStudio_Standards.rb index 29163e5a88..c9e396225e 100644 --- a/data/standards/manage_OpenStudio_Standards.rb +++ b/data/standards/manage_OpenStudio_Standards.rb @@ -201,53 +201,6 @@ def standard_directory_name_from_template(template) return directory_name end -# checks whether your authorization credentials are set up to access the spreadsheets -# @return [Boolean] returns true if api is working, false if not -def check_google_drive_configuration - require 'google_drive' - client_config_path = File.join(Dir.home, '.credentials', "client_secret.json") - unless File.exist? client_config_path - puts "Unable to locate client_secret.json file at #{client_config_path}." - return false - end - puts 'attempting to access spreadsheets...' - puts 'if you get an SSL error, disconnect from the VPN and try again' - session = GoogleDrive::Session.from_config(client_config_path) - - # Gets list of remote files - session.files.each do |file| - puts file.title if file.title.include? 'OpenStudio' - end - - puts 'Spreadsheets accessed successfully' - return true -end - -# Downloads the OpenStudio_Standards.xlsx from Google Drive -# @note This requires you to have a client_secret.json file saved in your -# username/.credentials folder. To get one of these files, please contact -# marley.praprost@nrel.gov -def download_google_spreadsheets(spreadsheet_titles) - require 'google_drive' - client_config_path = File.join(Dir.home, '.credentials', "client_secret.json") - unless File.exist? client_config_path - puts "Unable to locate client_secret.json file at #{client_config_path}." - return false - end - - session = GoogleDrive::Session.from_config(client_config_path) - - # Gets list of remote files - session.files.each do |file| - if spreadsheet_titles.include?(file.title) - puts "Found #{file.title}" - file.export_as_file("#{File.dirname(__FILE__)}/#{file.title}.xlsx") - puts "Downloaded #{file.title} to #{File.dirname(__FILE__)}/#{file.title}.xlsx" - end - end - return true -end - def exclusion_list file_path = "#{__dir__}/exclude_list.csv" csv_file = CSV.read(file_path, headers:true) diff --git a/docs/DeveloperInformation.md b/docs/DeveloperInformation.md index cc6fd5c3b1..d8b80b6cd9 100644 --- a/docs/DeveloperInformation.md +++ b/docs/DeveloperInformation.md @@ -48,7 +48,7 @@ This project uses [Rake](http://rake.rubyforge.org/) to run tasks from the termi - `bundle exec rake build` # Build openstudio-standards-X.X.XX.gem into the pkg directory - `bundle exec rake clean` # Remove any temporary products - `bundle exec rake clobber` # Remove any generated files -- `bundle exec rake data:update:manual` # Generate JSONs from OpenStudio_Standards spreadsheets +- `bundle exec rake data:update` # Generate JSONs from OpenStudio_Standards spreadsheets locally downloaded to data/standards - `bundle exec rake data:export:jsons` # Export JSONs from OpenStudio_Standards to data library - `bundle exec rake data:update:costing` # Update RS-Means Database - `bundle exec rake doc` # Generate the documentation diff --git a/openstudio-standards.gemspec b/openstudio-standards.gemspec index 7e1e38044c..e641c0eb1e 100644 --- a/openstudio-standards.gemspec +++ b/openstudio-standards.gemspec @@ -24,12 +24,14 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'nokogiri', '<= 1.6.8.1' spec.add_development_dependency 'parallel_tests', '<= 2.32.0' elsif RUBY_VERSION < '2.7' - spec.add_development_dependency 'bundler', '~> 2.1' + spec.add_development_dependency 'public_suffix', '~> 4.0.7' spec.add_development_dependency 'nokogiri', '<= 1.11.7' + spec.add_development_dependency 'bundler', '~> 2.1' spec.add_development_dependency 'parallel_tests', '~> 3.0.0' elsif RUBY_VERSION < '3.2' + spec.add_development_dependency 'nokogiri', '~> 1.15' + spec.add_development_dependency 'public_suffix', '~> 5.1.1' spec.add_development_dependency 'bundler', '~> 2.1.4' - spec.add_development_dependency 'nokogiri', '~> 1.11' spec.add_development_dependency 'parallel_tests', '~> 3.7.0' else spec.add_development_dependency 'bundler', '~> 2.4.10' @@ -38,7 +40,6 @@ Gem::Specification.new do |spec| end spec.add_development_dependency 'aes', '0.5.0' spec.add_development_dependency 'codecov' - spec.add_development_dependency 'google_drive' spec.add_development_dependency 'minitest', '~> 5.14.0' spec.add_development_dependency 'minitest-ci' spec.add_development_dependency 'minitest-parallel_fork'