Skip to content

Commit

Permalink
Merge pull request #1825 from NREL/fix/bundler_dependency_version
Browse files Browse the repository at this point in the history
Fix gem dependencies for CI
  • Loading branch information
mdahlhausen authored Oct 9, 2024
2 parents ebad829 + f497f27 commit 40e923b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 68 deletions.
18 changes: 1 addition & 17 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
47 changes: 0 additions & 47 deletions data/standards/manage_OpenStudio_Standards.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
# [email protected]
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)
Expand Down
2 changes: 1 addition & 1 deletion docs/DeveloperInformation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions openstudio-standards.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand Down

0 comments on commit 40e923b

Please sign in to comment.