openstudio-analysis 1.0.0.rc6 → 1.0.0.rc7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8ad533e87c735403c0c06a10ab0e26d60acb1ae
4
- data.tar.gz: 96438625a69587a4aed66c35f7a7089723d31341
3
+ metadata.gz: ca20af75f85fbafc9d10757ab3dc8cc0623dc86b
4
+ data.tar.gz: 5d29bcb006606075cd7e90264c265a92972feff4
5
5
  SHA512:
6
- metadata.gz: 326927ea97066c7e340bdcac9ec385baa49715d23e520a4b12e03cc3f4c275f245576d1a7fb7e83ee770646ead6ed44de4a8d3db92b7d71c1bf3113bf5e1376d
7
- data.tar.gz: 3d1e74e51031c70855304754cd938ef14f21780ed9d5eae2af7f654b257a323165833160bcfee2b871c53e7039bf5154a6d1c093365641e1fbb9c2ad896fedd0
6
+ metadata.gz: 2310be20b3f47cfa92908af55844d93889a65ecf7bc16d325f09eba3af134e507705046f8f9b85459dd10a993ed9216fade89744abf3e6b12a8ab08bfd2182bb
7
+ data.tar.gz: 5f123620fc35e5ebd7045614841514ccda620495f78c1497521bbfa7b09c42a38bceeed1ef248c3bef5e62094084d145c216655d8018ea7c28486037be202245
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  OpenStudio Analysis Gem Change Log
2
2
  ==================================
3
3
 
4
+ Version 1.0.0.rc7
5
+ -----------------
6
+ * Use more recent version of BCL gem for underscoring strings
7
+
4
8
  Version 1.0.0.pre.rc6
5
9
  ---------------------
6
10
  * When creating OSWs from batch datapoints, set the default run_directory to ./run
@@ -128,7 +128,7 @@ module OpenStudio
128
128
 
129
129
  # return the machine name of the analysis
130
130
  def name
131
- @display_name.snake_case
131
+ @display_name.to_underscore
132
132
  end
133
133
 
134
134
  # return a hash.
@@ -235,7 +235,7 @@ module OpenStudio
235
235
  else
236
236
  @name = SecureRandom.uuid
237
237
  end
238
- @analysis_name = @name.snake_case
238
+ @analysis_name = @name.to_underscore
239
239
 
240
240
  fail 'Require setting not found: measure_path' unless config_hash[:measure_paths]
241
241
  config_hash[:measure_paths] = [config_hash[:measure_paths]] unless config_hash[:measure_paths].respond_to?(:each)
@@ -266,7 +266,7 @@ module OpenStudio
266
266
  unless (Pathname.new path).absolute?
267
267
  path = File.expand_path(File.join(@root_path, path))
268
268
  end
269
- @models << { name: model_name.snake_case, display_name: model_name, type: type, path: path }
269
+ @models << { name: model_name.to_underscore, display_name: model_name, type: type, path: path }
270
270
  end
271
271
 
272
272
  # Assign optional attributes
@@ -426,9 +426,9 @@ module OpenStudio
426
426
 
427
427
  if b_settings
428
428
  @version = row[1].chomp if row[0] == 'Spreadsheet Version'
429
- @settings["#{row[0].snake_case}"] = row[1] if row[0]
429
+ @settings["#{row[0].to_underscore}"] = row[1] if row[0]
430
430
  if @settings['cluster_name']
431
- @settings['cluster_name'] = @settings['cluster_name'].snake_case
431
+ @settings['cluster_name'] = @settings['cluster_name'].to_underscore
432
432
  end
433
433
 
434
434
  if row[0] == 'AWS Tag'
@@ -445,7 +445,7 @@ module OpenStudio
445
445
  else
446
446
  @name = SecureRandom.uuid
447
447
  end
448
- @analysis_name = @name.snake_case
448
+ @analysis_name = @name.to_underscore
449
449
  end
450
450
  if row[0] == 'Export Directory'
451
451
  tmp_filepath = row[1]
@@ -463,7 +463,7 @@ module OpenStudio
463
463
  @measure_paths << File.expand_path(File.join(@root_path, tmp_filepath))
464
464
  end
465
465
  end
466
- @run_setup["#{row[0].snake_case}"] = row[1] if row[0]
466
+ @run_setup["#{row[0].to_underscore}"] = row[1] if row[0]
467
467
 
468
468
  # type cast
469
469
  if @run_setup['allow_multiple_jobs']
@@ -476,14 +476,14 @@ module OpenStudio
476
476
  if row[0]
477
477
  v = row[1]
478
478
  v.to_i if v % 1 == 0
479
- @problem["#{row[0].snake_case}"] = v
479
+ @problem["#{row[0].to_underscore}"] = v
480
480
  end
481
481
 
482
482
  elsif b_algorithm_setup
483
483
  if row[0] && !row[0].empty?
484
484
  v = row[1]
485
485
  v = v.to_i if v % 1 == 0
486
- @algorithm["#{row[0].snake_case}"] = v
486
+ @algorithm["#{row[0].to_underscore}"] = v
487
487
  end
488
488
  elsif b_weather_files
489
489
  if row[0] == 'Weather File'
@@ -506,7 +506,7 @@ module OpenStudio
506
506
  unless (Pathname.new model_path).absolute?
507
507
  model_path = File.expand_path(File.join(@root_path, model_path))
508
508
  end
509
- @models << { name: tmp_m_name.snake_case, display_name: tmp_m_name, type: row[2], path: model_path }
509
+ @models << { name: tmp_m_name.to_underscore, display_name: tmp_m_name, type: row[2], path: model_path }
510
510
  end
511
511
  elsif b_other_libs
512
512
  # determine if the path is relative
@@ -788,7 +788,7 @@ module OpenStudio
788
788
  if row[:measure_file_name_directory]
789
789
  data['data'][measure_index]['measure_file_name_directory'] = row[:measure_file_name_directory]
790
790
  else
791
- data['data'][measure_index]['measure_file_name_directory'] = row[:measure_file_name_or_var_display_name].underscore
791
+ data['data'][measure_index]['measure_file_name_directory'] = row[:measure_file_name_or_var_display_name].to_underscore
792
792
  end
793
793
  data['data'][measure_index]['measure_type'] = row[:measure_type_or_parameter_name_in_measure]
794
794
  data['data'][measure_index]['version'] = @version_id
@@ -52,6 +52,7 @@ module OpenStudio
52
52
  step_hash[:measure_id] = step[:uuid] if step[:uuid]
53
53
  step_hash[:version_id] = step[:version_uuid] if step[:version_uuid]
54
54
  step_hash[:description] = step[:description] if step[:description]
55
+ step_hash[:modeler_description] = step[:modeler_description] if step[:modeler_description]
55
56
  step_hash[:taxonomy] = step[:taxonomy] if step[:taxonomy]
56
57
  step_hash[:measure_type] = step[:measure_type]
57
58
  step_hash[:measure_type] = 'ModelMeasure' if step_hash[:measure_type] == 'RubyMeasure'
@@ -1,5 +1,5 @@
1
1
  module OpenStudio
2
2
  module Analysis
3
- VERSION = '1.0.0.rc6'
3
+ VERSION = '1.0.0.rc7'
4
4
  end
5
5
  end
@@ -1,25 +1,5 @@
1
- # add the underscore from rails for snake_casing strings
2
-
3
- class String
4
- def underscore
5
- gsub(/::/, '/')
6
- .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
7
- .gsub(/([a-z\d])([A-Z])/, '\1_\2')
8
- .tr('-', '_')
9
- .downcase
10
- end
11
-
12
- def snake_case
13
- return gsub(/\s/, '_').squeeze('_').downcase
14
- end
15
-
16
- def to_bool
17
- return true if self == true || self =~ (/(true|t|yes|y|1)$/i)
18
- return false if self == false || self =~ (/(false|f|no|n|0)$/i)
19
- fail "invalid value for Boolean: '#{self}'"
20
- end
21
- end
22
1
 
2
+ # Typecast Variable Values by a string.
23
3
  def typecast_value(variable_type, value, inspect_string = false)
24
4
  out_value = nil
25
5
  unless value.nil?
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.add_dependency 'roo', '~> 2.4'
28
28
  s.add_dependency 'rubyzip', '~> 1.2'
29
29
  s.add_dependency 'semantic', '~> 1.4'
30
- s.add_dependency 'bcl', '~> 0.5.5'
30
+ s.add_dependency 'bcl', '~> 0.5.7'
31
31
  s.add_dependency 'dencity', '~> 0.1.0'
32
32
 
33
33
  s.add_development_dependency 'bundler', '~> 1.7'
@@ -401,7 +401,7 @@ describe OpenStudio::Analysis::Translator::Excel do
401
401
 
402
402
  it 'should process' do
403
403
  model_uuid = @excel.models.first[:name]
404
- expect(model_uuid).to match /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/
404
+ expect(model_uuid).to match /[0-9a-f]{8}_[0-9a-f]{4}_[0-9a-f]{4}_[0-9a-f]{4}_[0-9a-f]{12}/
405
405
  end
406
406
 
407
407
  it 'should error out with missing measure information' do
@@ -420,7 +420,7 @@ describe OpenStudio::Analysis::Translator::Excel do
420
420
 
421
421
  it 'should process' do
422
422
  model_uuid = @excel.models.first[:name]
423
- expect(model_uuid).to match /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/
423
+ expect(model_uuid).to match /[0-9a-f]{8}_[0-9a-f]{4}_[0-9a-f]{4}_[0-9a-f]{4}_[0-9a-f]{12}/
424
424
  end
425
425
 
426
426
  it 'should process and save short display names' do
@@ -523,12 +523,12 @@ describe OpenStudio::Analysis::Translator::Excel do
523
523
 
524
524
  it 'should save the analysis' do
525
525
  expect { @excel.analysis }.to raise_error /There are more than one seed models defined in the excel file. Call .analyses. to return the array/
526
- model_uuid = "#{@excel.name.snake_case}_#{@excel.models.first[:name]}"
526
+ model_uuid = "#{@excel.name.to_underscore}_#{@excel.models.first[:name]}"
527
527
 
528
528
  @excel.save_analysis # this will save all the analyses
529
529
 
530
530
  @excel.models.each do |f|
531
- model_uuid = "#{@excel.name.snake_case}_#{f[:name]}"
531
+ model_uuid = "#{@excel.name.to_underscore}_#{f[:name]}"
532
532
  puts model_uuid
533
533
  expect(File.exist?("spec/files/export/analysis/#{model_uuid}.json")).to eq true
534
534
  expect(File.exist?("spec/files/export/analysis/#{model_uuid}.zip")).to eq true
File without changes