Skip to content

Commit 7bd2604

Browse files
authored
Merge pull request #204 from NREL/update_license_year_2025
update copyright year in LICENSE file
2 parents 37891e9 + 518160d commit 7bd2604

File tree

13 files changed

+37
-31
lines changed

13 files changed

+37
-31
lines changed

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ AllCops:
44
- init_templates/**/*
55
- lib/measures/**/resources/*
66
- lib/openstudio/extension/core/**/*
7+
TargetRubyVersion: 3.2.2
78

89
require: rubocop-performance
910
inherit_from:
1011
- http://s3.amazonaws.com/openstudio-resources/styles/rubocop_v4.yml
11-

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# OpenStudio(R) Extension Gem
2+
## Version 0.9.2
3+
* Updating LICENSE.md in doc_templates to use 2025 for the year
4+
* Fixed some rubocop offenses
25

36
## Version 0.9.1
47
* Updating faraday to 1.10.4 to remove deprecation notice

Gemfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
source 'http://rubygems.org'
22

3+
# Specify your gem's dependencies in openstudio-extension.# gemspec commented out to avoid circular dependency during bundle install
4+
# gemspec
5+
36
# Specify your gem's dependencies in openstudio-extension.gemspec
47

58
# line below used for testing when need to test against branch instead of release of standards. Should be commented out prior to merge to develop
@@ -8,3 +11,5 @@ source 'http://rubygems.org'
811
gemspec
912

1013
# gem 'openstudio-standards', '= 0.2.17.rc1', :github => 'NREL/openstudio-standards', :ref => '3.5.0_changes'
14+
15+
gem 'rubocop-performance', '~> 1.20'

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export RUBYLIB=/Applications/OpenStudio-3.1.0/Ruby
8585

8686
|OpenStudio Extension Gem|OpenStudio|Ruby|
8787
|:--------------:|:----------:|:--------:|
88+
| 0.9.2 | 3.10 | 3.2.2 |
8889
| 0.8.0 | 3.8 | 3.2 |
8990
| 0.7.1 | 3.7 | 2.7 |
9091
| 0.7.0 | 3.7 | 2.7 |

doc_templates/LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
OpenStudio(R), Copyright (c) 2008, 2023 Alliance for Sustainable Energy, LLC.
1+
OpenStudio(R), Copyright (c) 2008, 2025 Alliance for Sustainable Energy, LLC.
22

33
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
44

lib/change_log.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ def process
8989
end
9090
end
9191

92-
@closed_issues.sort! { |x, y| x.number <=> y.number }
93-
@new_issues.sort! { |x, y| x.number <=> y.number }
94-
@accepted_pull_requests.sort! { |x, y| x.number <=> y.number }
95-
@total_open_pull_requests.sort! { |x, y| x.number <=> y.number }
92+
@closed_issues.sort_by!(&:number)
93+
@new_issues.sort_by!(&:number)
94+
@accepted_pull_requests.sort_by!(&:number)
95+
@total_open_pull_requests.sort_by!(&:number)
9696
rescue StandardError => e
9797
puts e.message
9898
ChangeLog.help
@@ -122,6 +122,6 @@ def print_issues
122122
puts "\nAccepted Pull Requests: #{@accepted_pull_requests.length}"
123123
@accepted_pull_requests.each { |issue| puts print_issue(issue) }
124124

125-
puts "\nAll Open Issues: #{@total_open_issues.length} (" + @total_open_issues.map { |issue| "\##{issue.number}" }.join(', ') + ')'
125+
puts "\nAll Open Issues: #{@total_open_issues.length} (#{@total_open_issues.map { |issue| "\##{issue.number}" }.join(', ')})"
126126
end
127127
end

lib/openstudio/extension.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ def self.all_extensions
5656
# DLM: consider calling Bundler.require in this method
5757
# do not call Bundler.require when requiring this file, only when calling this method
5858
result = []
59-
59+
6060
ObjectSpace.each_object(::Class) do |obj|
6161
next if !obj.ancestors.include?(OpenStudio::Extension::Extension)
62+
6263
result << obj
6364
end
6465

lib/openstudio/extension/rake_task.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class RakeTask < Rake::TaskLib
1414
attr_accessor :name, :measures_dir, :core_dir, :doc_templates_dir, :files_dir
1515

1616
def initialize(*args, &task_block)
17+
super
1718
@name = args.shift || :openstudio
1819

1920
setup_subtasks(@name)
@@ -124,11 +125,7 @@ def setup_subtasks(name)
124125
bcl = ::BCL::ComponentMethods.new
125126

126127
# check for env var specifying keyword first
127-
if ENV['bcl_search_keyword']
128-
keyword = ENV['bcl_search_keyword']
129-
else
130-
keyword = 'Space'
131-
end
128+
keyword = ENV['bcl_search_keyword'] || 'Space'
132129
num_results = 10
133130
# bcl.search params: search_string, filter_string, return_all_results?
134131
puts "searching BCL measures for keyword: #{keyword}"

lib/openstudio/extension/runner.rb

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
require 'open3'
1010
require 'openstudio'
1111
require 'yaml'
12-
require 'fileutils'
1312
require 'parallel'
1413
require 'bcl'
1514

@@ -48,7 +47,7 @@ def initialize(dirname = Dir.pwd, bundle_without = [], options = {})
4847
runner_config = OpenStudio::Extension::RunnerConfig.new(dirname)
4948
# use the default values overriden with runner.conf values where not
5049
# nil nor empty strings
51-
@options = @options.merge(runner_config.options.reject{|k, v| v.nil? || (v.kind_of?(String) && v === '')})
50+
@options = @options.merge(runner_config.options.reject { |k, v| v.nil? || (v.is_a?(String) && v == '') })
5251
end
5352

5453
if !options.empty?
@@ -61,8 +60,8 @@ def initialize(dirname = Dir.pwd, bundle_without = [], options = {})
6160
@dirname = File.absolute_path(dirname)
6261

6362
# use passed options, otherwise assume @dirname
64-
@gemfile_path = !@options.key?(:gemfile_path) || @options[:gemfile_path] === '' ? File.join(@dirname, 'Gemfile') : @options[:gemfile_path]
65-
@bundle_install_path = !@options.key?(:bundle_install_path) || @options[:bundle_install_path] === '' ? File.join(@dirname, '.bundle/install/') : @options[:bundle_install_path]
63+
@gemfile_path = !@options.key?(:gemfile_path) || @options[:gemfile_path] == '' ? File.join(@dirname, 'Gemfile') : @options[:gemfile_path]
64+
@bundle_install_path = !@options.key?(:bundle_install_path) || @options[:bundle_install_path] == '' ? File.join(@dirname, '.bundle/install/') : @options[:bundle_install_path]
6665
@original_dir = Dir.pwd
6766

6867
# gemfile directory
@@ -100,7 +99,7 @@ def initialize(dirname = Dir.pwd, bundle_without = [], options = {})
10099

101100
# check existing config
102101
needs_config = true
103-
if conf_bpath = Bundler.configured_bundle_path.explicit_path
102+
if (conf_bpath = Bundler.configured_bundle_path.explicit_path)
104103
puts 'bundler config exists'
105104
needs_config = false
106105

@@ -362,7 +361,7 @@ def list_measures(measures_dir)
362361
puts "#{measures.length} MEASURES FOUND"
363362
measures.each do |measure|
364363
name = measure.split('/')[-2]
365-
puts name.to_s
364+
puts name
366365
end
367366
end
368367

@@ -497,9 +496,9 @@ def update_copyright(root_dir, doc_templates_dir)
497496
FileUtils.cp(File.join(doc_templates_dir, 'LICENSE.md'), File.join(root_dir, 'LICENSE.md'))
498497
end
499498

500-
ruby_regex = /^\#\s?[\#\*]{12,}.*copyright.*?\#\s?[\#\*]{12,}\s*$/mi
501-
erb_regex = /^<%\s*\#\s?[\#\*]{12,}.*copyright.*?\#\s?[\#\*]{12,}\s*%>$/mi
502-
js_regex = /^\/\* @preserve.*copyright.*?\*\//mi
499+
ruby_regex = /^\#\s?[\#*]{12,}.*copyright.*?\#\s?[\#*]{12,}\s*$/mi
500+
erb_regex = /^<%\s*\#\s?[\#*]{12,}.*copyright.*?\#\s?[\#*]{12,}\s*%>$/mi
501+
js_regex = %r{^/\* @preserve.*copyright.*?\*/}mi
503502

504503
filename = File.join(doc_templates_dir, 'copyright_ruby.txt')
505504
puts "Copyright file path: #{filename}"
@@ -542,14 +541,13 @@ def update_copyright(root_dir, doc_templates_dir)
542541
{ glob: "#{root_dir}/**/*.js.erb", license: js_header_text, regex: js_regex }
543542
]
544543
# This is the bundle deployment folder
545-
excluded_subfolders = ['vendor'].map{|d| "#{root_dir}/vendor/bundle"}
546-
544+
excluded_subfolders = ['vendor'].map { |d| "#{root_dir}/vendor/bundle" }
547545

548546
puts "Encoding.default_external = #{Encoding.default_external}"
549547
puts "Encoding.default_internal = #{Encoding.default_internal}"
550548

551549
paths.each do |path|
552-
Dir[path[:glob]].reject{|f| excluded_subfolders.any?{|d| f[d]} }.each do |dir_file|
550+
Dir[path[:glob]].reject { |f| excluded_subfolders.any? { |d| f[d] } }.each do |dir_file|
553551
puts "Updating license in file #{dir_file}"
554552
f = File.read(dir_file)
555553
if f.match?(path[:regex])

lib/openstudio/extension/runner_config.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def self.default_config(dirname)
6969
run_simulations: true,
7070
verbose: false,
7171
gemfile_path: '',
72-
bundle_install_path: get_local_bundle_config_path(dirname),
72+
bundle_install_path: get_local_bundle_config_path(dirname)
7373
}
7474
end
7575

@@ -81,7 +81,7 @@ def self.default_config(dirname)
8181
def self.init(dirname)
8282
runner_conf_file = File.join(dirname, FILENAME)
8383
if File.exist?(runner_conf_file)
84-
puts "runner.conf already exists, saving a runner.conf.bak, previous config:"
84+
puts 'runner.conf already exists, saving a runner.conf.bak, previous config:'
8585
puts File.read(runner_conf_file)
8686
FileUtils.cp(runner_conf_file, "#{FILENAME}.bak")
8787
end

0 commit comments

Comments
 (0)