openstudio-extension 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b97c709824bf3884fb41b661e80677e74e968e21d8af1b5fc45fbece3c419b9
4
- data.tar.gz: c225a47bec7fb5d176be730e7e3d21a17b0acdf455f71f5cad41853abbbda684
3
+ metadata.gz: 567f2008ed2e8d3fab092b962d34f0d2a59881d8617839ba8ed977dc2cfddc4b
4
+ data.tar.gz: d575f3db0ff84c9a2d8af9030976b6fad068903b63c9ab5daa6717cc5902a96d
5
5
  SHA512:
6
- metadata.gz: 43720385e7e367fa63f21775d66b69ff52df63c289f5155f65b1d49023cf184ab854bfbde63254596aad9986b3d8b4db5ad358f17c121ea9153bd9fa7aefa66a
7
- data.tar.gz: 2fc1e01489b19a2797465e682dc86a387697e1c3cfc34ce6110994300213cf3b50de8cfa0b62983c21c360ed5537ce9ff7b03b023ea074590a73e4a813834155
6
+ metadata.gz: 194ecd22b5cbc12c75133487c21b0df4dd1ad746d270819a2558d9c8c1831b8558faa9e6a581ca1f7890894be4e5059fb9e730c7e714b8f912cbebaa0689934e
7
+ data.tar.gz: b2193e267204d75bbdda44eaee353727eb20b75cb9923d649ddb5e740e97de5926b8b5f1e47e58c78b123bed7c33f1602dcc1b0ce4583c68006efdfe5392f2b0
data/.rubocop.yml CHANGED
@@ -5,6 +5,7 @@ AllCops:
5
5
  - lib/measures/**/resources/*
6
6
  - lib/openstudio/extension/core/**/*
7
7
 
8
+ require: rubocop-performance
8
9
  inherit_from:
9
- - http://s3.amazonaws.com/openstudio-resources/styles/rubocop_v3.yml
10
+ - http://s3.amazonaws.com/openstudio-resources/styles/rubocop_v4.yml
10
11
 
data/CHANGELOG.md CHANGED
@@ -1,7 +1,14 @@
1
1
  # OpenStudio Extension Gem
2
2
 
3
+ ## Version 0.4.3
4
+
5
+ * Update measure tester gem which upgrades Rubocop to 1.15
6
+ * Update styles to v4 based on new version of Rubocop
7
+
3
8
  ## Version 0.4.2
4
9
 
10
+ * Fixes [#113](https://github.com/NREL/openstudio-extension-gem/issues/113) Fix bad args behavior on bar_from_building_type_ratios
11
+ * Fixes [#103](https://github.com/NREL/openstudio-extension-gem/issues/103) make check_upstream_measure_for_arg more robust for non string arguments
5
12
  * Updatd version of openstudio-standards for development to openstudio-standards 0.2.13
6
13
  * Added ASHRAE 90.1 2016 and 2019 to get_doe_templates method in os_lib_model_generation.rb file. This method is used by a number of measures to generate allowable argument values
7
14
 
data/Gemfile CHANGED
@@ -3,7 +3,6 @@ source 'http://rubygems.org'
3
3
  # Specify your gem's dependencies in openstudio-extension.gemspec
4
4
 
5
5
  # 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
6
- #gem 'openstudio-standards', github: 'NREL/openstudio-standards', branch: 'fix/901_2016_2019_properties' # for os_lib unit tests
6
+ # gem 'openstudio-standards', github: 'NREL/openstudio-standards', branch: 'fix/901_2016_2019_properties' # for os_lib unit tests
7
7
 
8
8
  gemspec
9
-
data/Rakefile CHANGED
@@ -45,10 +45,10 @@ desc 'Initialize a new gem'
45
45
  task :init_new_gem do
46
46
  puts 'Initializing a new extension gem'
47
47
  print "\n Enter the name of the new gem directory (ex: openstudio-something-gem. Should end with '-gem'): "
48
- gem_name = STDIN.gets.chomp
48
+ gem_name = $stdin.gets.chomp
49
49
 
50
50
  print "\n Enter the path (full or relative to this repo) where you want the new gem directory to be created: "
51
- dir_path = STDIN.gets.chomp
51
+ dir_path = $stdin.gets.chomp
52
52
 
53
53
  # check if directory already exists at path, if so error
54
54
  full_dir_name = dir_path + gem_name
@@ -61,7 +61,7 @@ task :init_new_gem do
61
61
  end
62
62
 
63
63
  # copy file structure
64
- FileUtils.cp('.gitignore', full_dir_name + '/.gitignore')
64
+ FileUtils.cp('.gitignore', "#{full_dir_name}/.gitignore")
65
65
  FileUtils.cp_r(File.join(File.dirname(__FILE__), 'init_templates/template_gemfile.txt'), File.join(full_dir_name, 'Gemfile'))
66
66
  FileUtils.cp_r(File.join(File.dirname(__FILE__), 'doc_templates'), full_dir_name)
67
67
 
data/lib/change_log.rb CHANGED
@@ -144,7 +144,7 @@ class ChangeLog
144
144
  puts "Total Open Issues: #{@total_open_issues.length}"
145
145
  puts "Total Open Pull Requests: #{@total_open_pull_requests.length}"
146
146
  puts "\nDate Range: #{@start_date.strftime('%m/%d/%y')} - #{@end_date.strftime('%m/%d/%y')}:"
147
- puts "\nNew Issues: #{@new_issues.length} (" + @new_issues.map(&:number).join(', ') + ')'
147
+ puts "\nNew Issues: #{@new_issues.length} (#{@new_issues.map(&:number).join(', ')})"
148
148
 
149
149
  puts "\nClosed Issues: #{@closed_issues.length}"
150
150
  @closed_issues.each { |issue| puts print_issue(issue) }
@@ -209,11 +209,9 @@ module OpenStudio
209
209
  def self.set_measure_argument(osw, measure_dir_name, argument_name, argument_value, step_name = nil)
210
210
  result = false
211
211
  osw[:steps].each do |step|
212
- if step[:measure_dir_name] == measure_dir_name
213
- if step_name.nil? || step[:name] == step_name
214
- step[:arguments][argument_name.to_sym] = argument_value
215
- result = true
216
- end
212
+ if step[:measure_dir_name] == measure_dir_name && (step_name.nil? || step[:name] == step_name)
213
+ step[:arguments][argument_name.to_sym] = argument_value
214
+ result = true
217
215
  end
218
216
  end
219
217
 
@@ -239,10 +237,8 @@ module OpenStudio
239
237
  def self.measure_in_osw(osw, measure_dir_name, step_name = nil)
240
238
  result = false
241
239
  osw[:steps].each do |step|
242
- if step[:measure_dir_name] == measure_dir_name
243
- if step_name.nil? || step[:name] == step_name
244
- result = true
245
- end
240
+ if step[:measure_dir_name] == measure_dir_name && (step_name.nil? || step[:name] == step_name)
241
+ result = true
246
242
  end
247
243
  end
248
244
 
@@ -55,7 +55,7 @@ module OpenStudio
55
55
  @root_dir = @extension.root_dir
56
56
  # Catch if measures_dir is nil, then just make it an empty string
57
57
  @measures_dir = @extension.measures_dir || ''
58
- @staged_path = @measures_dir + '/staged'
58
+ @staged_path = "#{@measures_dir}/staged"
59
59
  @core_dir = @extension.core_dir
60
60
  @doc_templates_dir = @extension.doc_templates_dir
61
61
  @files_dir = @extension.files_dir
@@ -201,9 +201,9 @@ module OpenStudio
201
201
  end
202
202
 
203
203
  # create new and existing directories
204
- FileUtils.mkdir_p(@staged_path.to_s + '/update')
205
- FileUtils.mkdir_p(@staged_path.to_s + '/push/component')
206
- FileUtils.mkdir_p(@staged_path.to_s + '/push/measure')
204
+ FileUtils.mkdir_p("#{@staged_path}/update")
205
+ FileUtils.mkdir_p("#{@staged_path}/push/component")
206
+ FileUtils.mkdir_p("#{@staged_path}/push/measure")
207
207
 
208
208
  # keep track of noop, update, push
209
209
  noops = 0
@@ -215,6 +215,7 @@ module OpenStudio
215
215
 
216
216
  dirs.each do |dir|
217
217
  next if dir.include?('Rakefile') || File.basename(dir) == 'staged'
218
+
218
219
  current_d = Dir.pwd
219
220
  content_name = File.basename(dir)
220
221
  puts '', '---'
@@ -235,6 +236,7 @@ module OpenStudio
235
236
  next if file.to_s.start_with?('tests/test') # From openstudio-measure-tester-gem
236
237
  next if file.to_s.start_with?('tests/coverage') # From openstudio-measure-tester-gem
237
238
  next if file.to_s.start_with?('test_results') # From openstudio-measure-tester-gem
239
+
238
240
  paths << file.to_s
239
241
  if file.to_s =~ /^.{0,2}component.xml$/ || file.to_s =~ /^.{0,2}measure.xml$/
240
242
  if file.to_s.match?(/^.{0,2}component.xml$/)
@@ -246,21 +248,22 @@ module OpenStudio
246
248
  end
247
249
  puts "UUID: #{uuid}, VID: #{vid}"
248
250
 
249
- # note: if uuid is missing, will assume new content
251
+ # NOTE: if uuid is missing, will assume new content
250
252
  action = bcl.search_by_uuid(uuid, vid)
251
253
  puts "#{content_name} ACTION TO TAKE: #{action}"
252
254
  # new content functionality needs to know if measure or component. update is agnostic.
253
- if action == 'noop' # ignore up-to-date content
255
+ case action
256
+ when 'noop' # ignore up-to-date content
254
257
  puts " - WARNING: local #{content_name} uuid and vid match BCL... no update will be performed"
255
258
  noops += 1
256
259
  next
257
- elsif action == 'update'
260
+ when 'update'
258
261
  # puts "#{content_name} labeled as update for BCL"
259
- destination = @staged_path + '/' + action + '/' + "#{content_name}.tar.gz"
262
+ destination = "#{@staged_path}/#{action}/#{content_name}.tar.gz"
260
263
  updates += 1
261
- elsif action == 'push'
264
+ when 'push'
262
265
  # puts "#{content_name} labeled as new content for BCL"
263
- destination = @staged_path + '/' + action + '/' + content_type + "/#{content_name}.tar.gz"
266
+ destination = "#{@staged_path}/#{action}/#{content_type}/#{content_name}.tar.gz"
264
267
  new_ones += 1
265
268
  end
266
269
 
@@ -309,7 +312,7 @@ module OpenStudio
309
312
  puts item.split('/').last
310
313
  total_count += 1
311
314
 
312
- receipt_file = File.dirname(item) + '/' + File.basename(item, '.tar.gz') + '.receipt'
315
+ receipt_file = "#{File.dirname(item)}/#{File.basename(item, '.tar.gz')}.receipt"
313
316
  if !reset && File.exist?(receipt_file)
314
317
  skipped += 1
315
318
  puts 'SKIP: receipt file found'
@@ -333,7 +336,7 @@ module OpenStudio
333
336
 
334
337
  # grab all the updated content (measures and components) tar files and push to bcl
335
338
  items = []
336
- paths = Pathname.glob(@staged_path.to_s + '/update/*.tar.gz')
339
+ paths = Pathname.glob("#{@staged_path}/update/*.tar.gz")
337
340
  paths.each do |path|
338
341
  # puts path
339
342
  items << path.to_s
@@ -342,7 +345,7 @@ module OpenStudio
342
345
  puts item.split('/').last
343
346
  total_count += 1
344
347
 
345
- receipt_file = File.dirname(item) + '/' + File.basename(item, '.tar.gz') + '.receipt'
348
+ receipt_file = "#{File.dirname(item)}/#{File.basename(item, '.tar.gz')}.receipt"
346
349
  if !reset && File.exist?(receipt_file)
347
350
  skipped += 1
348
351
  puts 'SKIP: receipt file found'
@@ -121,15 +121,15 @@ module OpenStudio
121
121
 
122
122
  # test to see if bundle is installed
123
123
  check_bundle = run_command('bundle -v', get_clean_env)
124
- if !check_bundle
125
- raise "Failed to run command 'bundle -v', check that bundle is installed" if !File.exist?(@dirname)
124
+ if !check_bundle && !File.exist?(@dirname)
125
+ raise "Failed to run command 'bundle -v', check that bundle is installed"
126
126
  end
127
127
 
128
128
  # TODO: check that ruby version is correct
129
129
 
130
130
  # check existing config
131
131
  needs_config = true
132
- if File.exist?('./.bundle/config') # checking wrt gemfile_dir
132
+ if File.exist?('./.bundle/config') # checking wrt gemfile_dir
133
133
  puts 'config exists'
134
134
  needs_config = false
135
135
  config = YAML.load_file('./.bundle/config')
@@ -166,10 +166,8 @@ module OpenStudio
166
166
  end
167
167
 
168
168
  needs_update = needs_config || needs_platform
169
- if !needs_update
170
- if !File.exist?('Gemfile.lock') || File.mtime(@gemfile_path) > File.mtime('Gemfile.lock')
171
- needs_update = true
172
- end
169
+ if !needs_update && (!File.exist?('Gemfile.lock') || File.mtime(@gemfile_path) > File.mtime('Gemfile.lock'))
170
+ needs_update = true
173
171
  end
174
172
 
175
173
  puts "needs_update = #{needs_update}"
@@ -241,7 +239,7 @@ module OpenStudio
241
239
  puts "Error running command: '#{command}'"
242
240
  puts "stdout: #{stdout_str}"
243
241
  puts "stderr: #{stderr_str}"
244
- STDOUT.flush
242
+ $stdout.flush
245
243
  result = false
246
244
  end
247
245
  ensure
@@ -318,10 +316,10 @@ module OpenStudio
318
316
 
319
317
  puts 'SYSTEM CALL:'
320
318
  puts the_call
321
- STDOUT.flush
319
+ $stdout.flush
322
320
  result = run_command(the_call, get_clean_env)
323
321
  puts "DONE, result = #{result}"
324
- STDOUT.flush
322
+ $stdout.flush
325
323
 
326
324
  return result
327
325
  end
@@ -358,10 +356,10 @@ module OpenStudio
358
356
 
359
357
  puts 'SYSTEM CALL:'
360
358
  puts the_call
361
- STDOUT.flush
359
+ $stdout.flush
362
360
  result &&= run_command(the_call, get_clean_env)
363
361
  puts "DONE, result = #{result}"
364
- STDOUT.flush
362
+ $stdout.flush
365
363
  end
366
364
 
367
365
  return result
@@ -425,7 +423,7 @@ module OpenStudio
425
423
  measures = Dir.glob(File.join(measures_dir, '**/**/resources/*.rb'))
426
424
  end
427
425
 
428
- # Note: some older measures like AEDG use 'OsLib_SomeName' instead of 'os_lib_some_name'
426
+ # NOTE: some older measures like AEDG use 'OsLib_SomeName' instead of 'os_lib_some_name'
429
427
  # this script isn't replacing those copies
430
428
 
431
429
  # loop through resource files
@@ -523,11 +521,9 @@ module OpenStudio
523
521
  return false
524
522
  end
525
523
 
526
- if File.exist?(File.join(doc_templates_dir, 'LICENSE.md'))
527
- if File.exist?(File.join(root_dir, 'LICENSE.md'))
528
- puts 'updating LICENSE.md in root dir'
529
- FileUtils.cp(File.join(doc_templates_dir, 'LICENSE.md'), File.join(root_dir, 'LICENSE.md'))
530
- end
524
+ if File.exist?(File.join(doc_templates_dir, 'LICENSE.md')) && File.exist?(File.join(root_dir, 'LICENSE.md'))
525
+ puts 'updating LICENSE.md in root dir'
526
+ FileUtils.cp(File.join(doc_templates_dir, 'LICENSE.md'), File.join(root_dir, 'LICENSE.md'))
531
527
  end
532
528
 
533
529
  ruby_regex = /^\#\s?[\#\*]{12,}.*copyright.*?\#\s?[\#\*]{12,}\s*$/mi
@@ -593,7 +589,7 @@ module OpenStudio
593
589
  puts ' CANNOT add license to file automatically, add it manually and it will update automatically in the future'
594
590
  next
595
591
  end
596
- File.open(dir_file, 'w') { |write| write << f.insert(0, path[:license] + "\n") }
592
+ File.open(dir_file, 'w') { |write| write << f.insert(0, "#{path[:license]}\n") }
597
593
  end
598
594
  end
599
595
  end
@@ -631,7 +627,7 @@ module OpenStudio
631
627
 
632
628
  if @options[:run_simulations]
633
629
  cli = OpenStudio.getOpenStudioCLI
634
- out_log = run_osw_path + '.log'
630
+ out_log = "#{run_osw_path}.log"
635
631
  # if Gem.win_platform?
636
632
  # # out_log = "nul"
637
633
  # else
@@ -655,10 +651,10 @@ module OpenStudio
655
651
 
656
652
  puts 'SYSTEM CALL:'
657
653
  puts the_call
658
- STDOUT.flush
654
+ $stdout.flush
659
655
  result = run_command(the_call, get_clean_env)
660
656
  puts "DONE, result = #{result}"
661
- STDOUT.flush
657
+ $stdout.flush
662
658
  else
663
659
  puts 'simulations are not performed, since to the @options[:run_simulations] is set to false'
664
660
  end
@@ -35,6 +35,6 @@
35
35
 
36
36
  module OpenStudio
37
37
  module Extension
38
- VERSION = '0.4.2'.freeze
38
+ VERSION = '0.4.3'.freeze
39
39
  end
40
40
  end
@@ -31,8 +31,8 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency 'bcl', '~> 0.7.0'
32
32
  spec.add_dependency 'bundler', '>= 2.1.0'
33
33
  spec.add_dependency 'octokit', '~> 4.18.0' # for change logs
34
+ spec.add_dependency 'openstudio_measure_tester', '~> 0.3.1'
34
35
  spec.add_dependency 'openstudio-workflow', '~> 2.2.0'
35
- spec.add_dependency 'openstudio_measure_tester', '~> 0.3.0'
36
36
  spec.add_dependency 'parallel', '~> 1.19.1'
37
37
 
38
38
  spec.add_development_dependency 'openstudio-standards', '~> 0.2.13' # for os_lib unit tests
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openstudio-extension
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katherine Fleming
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2021-04-22 00:00:00.000000000 Z
14
+ date: 2021-06-02 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bcl
@@ -56,33 +56,33 @@ dependencies:
56
56
  - !ruby/object:Gem::Version
57
57
  version: 4.18.0
58
58
  - !ruby/object:Gem::Dependency
59
- name: openstudio-workflow
59
+ name: openstudio_measure_tester
60
60
  requirement: !ruby/object:Gem::Requirement
61
61
  requirements:
62
62
  - - "~>"
63
63
  - !ruby/object:Gem::Version
64
- version: 2.2.0
64
+ version: 0.3.1
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - "~>"
70
70
  - !ruby/object:Gem::Version
71
- version: 2.2.0
71
+ version: 0.3.1
72
72
  - !ruby/object:Gem::Dependency
73
- name: openstudio_measure_tester
73
+ name: openstudio-workflow
74
74
  requirement: !ruby/object:Gem::Requirement
75
75
  requirements:
76
76
  - - "~>"
77
77
  - !ruby/object:Gem::Version
78
- version: 0.3.0
78
+ version: 2.2.0
79
79
  type: :runtime
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
83
  - - "~>"
84
84
  - !ruby/object:Gem::Version
85
- version: 0.3.0
85
+ version: 2.2.0
86
86
  - !ruby/object:Gem::Dependency
87
87
  name: parallel
88
88
  requirement: !ruby/object:Gem::Requirement
@@ -233,7 +233,7 @@ licenses: []
233
233
  metadata:
234
234
  bug_tracker_uri: https://github.com/NREL/openstudio-extension-gem/issues
235
235
  changelog_uri: https://github.com/NREL/openstudio-extension-gem/blob/develop/CHANGELOG.md
236
- source_code_uri: https://github.com/NREL/openstudio-extension-gem/tree/v0.4.2
236
+ source_code_uri: https://github.com/NREL/openstudio-extension-gem/tree/v0.4.3
237
237
  post_install_message:
238
238
  rdoc_options: []
239
239
  require_paths: