urbanopt-scenario 0.2.0 → 0.3.0.pre1

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
- SHA1:
3
- metadata.gz: 268f5db33f1444f7e4daddf2f6055b5a5c7f9f03
4
- data.tar.gz: 8a2af9239f2433fc2ffc883e69e8748f1ba69d9b
2
+ SHA256:
3
+ metadata.gz: 6f3b7d2011137b207de9f896a21ec59a4aaf58d730b5ddf6d0044487fa5c52e3
4
+ data.tar.gz: ee379c34924b4a6217434ce6e57500674ac5a158c69fcb939cb2730c65377c77
5
5
  SHA512:
6
- metadata.gz: c9110c7e58e8f9d47891f46ac2519a436ba6733e11bd4a2e4907ba65bb85c39ce635133ec1edb0fc0380dea2bd5438b432ad0cdc31c370aed76afa75d6351839
7
- data.tar.gz: e6bb432c9ef28be6db0511da9f1a58e7fc94438b5a0655924eb9654688a9bf358909715724b234d072d5d15774dfe63f5e7f30e5cce06857628ef8ddc442ce67
6
+ metadata.gz: 06fc50c836b10099c13c05329f815db355940733f7fbc39979688c7fbb9e4a2732f0d303b969a3be9d16166f3996bdeccd91b339f366a20fc4761d81228af484
7
+ data.tar.gz: 29f0f9becdd8b064bbc5d2e36bc7bd031e221fc2bef185dc15160057cab22f3c0472cd5dfaebc8999e3db6fa0149b58a5c9383b4e64f374f8493ef256ec53cd6
data/.rubocop.yml CHANGED
@@ -6,5 +6,5 @@ AllCops:
6
6
 
7
7
 
8
8
  inherit_from:
9
- - http://s3.amazonaws.com/openstudio-resources/styles/rubocop.yml
9
+ - http://s3.amazonaws.com/openstudio-resources/styles/rubocop_v3.yml
10
10
 
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # URBANopt Scenario Gem
2
2
 
3
+ ## Version 0.3.0.pre1
4
+ Date Range: 04/01/20 - 05/18/20:
5
+
6
+ Updating to OpenStudio 3.0 and Ruby 2.5
7
+
8
+ - Fixed [#114]( https://github.com/urbanopt/urbanopt-scenario-gem/pull/114 ), Bug fix
9
+ - Fixed [#117]( https://github.com/urbanopt/urbanopt-scenario-gem/pull/117 ), Added utility cost outputs to reports
10
+ - Fixed [#118]( https://github.com/urbanopt/urbanopt-scenario-gem/pull/118 ), test Jenkins using pipeline to run OpenStudio 3.0.0
11
+
3
12
  ## Version 0.2.0
4
13
 
5
14
 
data/Gemfile CHANGED
@@ -11,8 +11,8 @@ gemspec
11
11
  # checkout the latest version (develop) from github.
12
12
  allow_local = ENV['FAVOR_LOCAL_GEMS']
13
13
 
14
- # Uncomment the extension and common measures gem if you need to test local development versions. Otherwise
15
- # these are included in the model articulation gem.
14
+ # Uncomment the extension gem if you need to test local development versions. Otherwise
15
+ # is is included in the model articulation gem.
16
16
  #
17
17
  # if allow_local && File.exist?('../OpenStudio-extension-gem')
18
18
  # gem 'openstudio-extension', path: '../OpenStudio-extension-gem'
@@ -20,11 +20,11 @@ allow_local = ENV['FAVOR_LOCAL_GEMS']
20
20
  # gem 'openstudio-extension', github: 'NREL/OpenStudio-extension-gem', branch: 'develop'
21
21
  # end
22
22
 
23
- # if allow_local && File.exist?('../openstudio-common-measures-gem')
24
- # gem 'openstudio-common-measures', path: '../openstudio-common-measures-gem'
25
- # elsif allow_local
26
- # gem 'openstudio-common-measures', github: 'NREL/openstudio-common-measures-gem', branch: 'develop'
27
- # end
23
+ if allow_local && File.exist?('../openstudio-common-measures-gem')
24
+ gem 'openstudio-common-measures', path: '../openstudio-common-measures-gem'
25
+ elsif allow_local
26
+ gem 'openstudio-common-measures', github: 'NREL/openstudio-common-measures-gem', branch: 'develop'
27
+ end
28
28
 
29
29
  if allow_local && File.exist?('../openstudio-model-articulation-gem')
30
30
  gem 'openstudio-model-articulation', path: '../openstudio-model-articulation-gem'
@@ -37,6 +37,3 @@ if allow_local && File.exist?('../urbanopt-core-gem')
37
37
  elsif allow_local
38
38
  gem 'urbanopt-core', github: 'URBANopt/urbanopt-core-gem', branch: 'develop'
39
39
  end
40
-
41
- # simplecov has an unnecessary dependency on native json gem, use fork that does not require this
42
- gem 'simplecov', github: 'NREL/simplecov'
data/Rakefile CHANGED
@@ -37,7 +37,7 @@ RSpec::Core::RakeTask.new(:spec)
37
37
  require 'openstudio/extension/rake_task'
38
38
  require 'urbanopt/scenario'
39
39
  rake_task = OpenStudio::Extension::RakeTask.new
40
- rake_task.set_extension_class(URBANopt::Scenario::Extension)
40
+ rake_task.set_extension_class(URBANopt::Scenario::Extension, 'urbanopt/urbanopt-scenario-gem')
41
41
 
42
42
  require 'rubocop/rake_task'
43
43
  RuboCop::RakeTask.new
@@ -185,12 +185,15 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
185
185
  # result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,Heating:Gas,#{reporting_frequency};").get
186
186
  # result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,WaterSystems:Gas,#{reporting_frequency};").get
187
187
  # result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,InteriorEquipment:Gas,#{reporting_frequency};").get
188
+ result << OpenStudio::IdfObject.load("Output:Variable,*,Heating Coil Heating Rate,hourly; !- HVAC Average [W];").get
188
189
 
189
190
  timeseries_data = ['District Cooling Chilled Water Rate', 'District Cooling Mass Flow Rate',
190
191
  'District Cooling Inlet Temperature', 'District Cooling Outlet Temperature',
191
192
  'District Heating Hot Water Rate', 'District Heating Mass Flow Rate',
192
- 'District Heating Inlet Temperature', 'District Heating Outlet Temperature']
193
+ 'District Heating Inlet Temperature', 'District Heating Outlet Temperature','Cooling Coil Total Cooling Rate',
194
+ 'Heating Coil Heating Rate']
193
195
 
196
+
194
197
  timeseries_data.each do |ts|
195
198
  result << OpenStudio::IdfObject.load("Output:Variable,*,#{ts},#{reporting_frequency};").get
196
199
  end
@@ -583,6 +586,19 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
583
586
  photovoltaic_power = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Electric Loads Satisfied' AND RowName='Photovoltaic Power' AND ColumnName='Electricity'")
584
587
  feature_report.reporting_periods[0].energy_production[:electricity_produced][:photovoltaic] = convert_units(photovoltaic_power, 'GJ', 'kBtu')
585
588
 
589
+ ## Total utility cost
590
+ total_utility_cost = sql_query(runner, sql_file, 'Economics Results Summary Report', "TableName='Annual Cost' AND RowName='Cost' AND ColumnName='Total'")
591
+ feature_report.reporting_periods[0].total_utility_cost = total_utility_cost
592
+
593
+ ## Utility Costs
594
+ # electricity utility cost
595
+ elec_utility_cost = sql_query(runner, sql_file, 'Economics Results Summary Report', "TableName='Annual Cost' AND RowName='Cost' AND ColumnName='Electric'")
596
+ feature_report.reporting_periods[0].utility_costs[0][:fuel_type] = 'Electricity'
597
+ feature_report.reporting_periods[0].utility_costs[0][:total_cost] = elec_utility_cost
598
+ # gas utility cost
599
+ gas_utility_cost = sql_query(runner, sql_file, 'Economics Results Summary Report', "TableName='Annual Cost' AND RowName='Cost' AND ColumnName='Gas'")
600
+ feature_report.reporting_periods[0].utility_costs << {:fuel_type => 'Natural Gas', :total_cost => gas_utility_cost}
601
+
586
602
  ## comfort_result
587
603
  # time_setpoint_not_met_during_occupied_cooling
588
604
  time_setpoint_not_met_during_occupied_cooling = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Comfort and Setpoint Not Met Summary' AND RowName='Time Setpoint Not Met During Occupied Cooling' AND ColumnName='Facility'")
@@ -639,7 +655,9 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
639
655
  'District Heating Hot Water Rate',
640
656
  'District Heating Mass Flow Rate',
641
657
  'District Heating Inlet Temperature',
642
- 'District Heating Outlet Temperature'
658
+ 'District Heating Outlet Temperature',
659
+ 'Cooling Coil Total Cooling Rate',
660
+ 'Heating Coil Heating Rate'
643
661
  ]
644
662
 
645
663
  # add thermal comfort timeseries
@@ -760,15 +778,20 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
760
778
  'kWh'
761
779
  when 'gal'
762
780
  'm3'
781
+ when 'W'
782
+ 'W'
763
783
  end
764
784
  end
785
+
765
786
  # loop through each value and apply unit conversion
766
787
  os_vec = values[key_cnt]
767
788
  if !timeseries_name.include? 'Zone Thermal Comfort'
768
789
  for i in 0..os_vec.length - 1
769
- unless new_unit == old_unit || !ts.is_initialized
790
+
791
+ unless new_unit == old_unit || old_unit.nil? || new_unit.nil? || !ts.is_initialized
770
792
  os_vec[i] = OpenStudio.convert(os_vec[i], old_unit, new_unit).get
771
793
  end
794
+
772
795
  end
773
796
  end
774
797
 
@@ -914,8 +937,11 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
914
937
  datetimes = []
915
938
  # check what timeseries is available
916
939
  available_ts = sql_file.availableTimeSeries
940
+
917
941
  # get the timeseries for any of available timeseries
918
- ts_d = sql_file.timeSeries(ann_env_pd.to_s, reporting_frequency.to_s, available_ts[0], '')
942
+ # RK: code enhancement needed
943
+ ts_d = sql_file.timeSeries(ann_env_pd.to_s, reporting_frequency.to_s, available_ts[2], '')
944
+
919
945
  timeseries_d = ts_d.get
920
946
  # get formated datetimes
921
947
  timeseries_d.dateTimes.each do |datetime|
@@ -926,6 +952,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
926
952
  # insert datetime header to names
927
953
  final_timeseries_names.insert(0, 'Datetime')
928
954
 
955
+
929
956
  # rubocop: enable Metrics/BlockLength
930
957
  runner.registerInfo("new final_timeseries_names size: #{final_timeseries_names.size}")
931
958
 
@@ -43,14 +43,14 @@ module URBANopt
43
43
  ##
44
44
  class ReportingPeriod
45
45
  attr_accessor :id, :name, :multiplier, :start_date, :end_date, :month, :day_of_month, :year, :total_site_energy, :total_source_energy,
46
- :net_site_energy, :net_source_energy, :net_utility_cost, :electricity, :natural_gas, :additional_fuel, :district_cooling,
47
- :district_heating, :water, :electricity_produced, :end_uses, :energy_production, :photovoltaic, :utility_costs,
46
+ :net_site_energy, :net_source_energy, :total_utility_cost, :net_utility_cost, :utility_costs, :electricity, :natural_gas, :additional_fuel, :district_cooling,
47
+ :district_heating, :water, :electricity_produced, :end_uses, :energy_production, :photovoltaic,
48
48
  :fuel_type, :total_cost, :usage_cost, :demand_cost, :comfort_result, :time_setpoint_not_met_during_occupied_cooling,
49
49
  :time_setpoint_not_met_during_occupied_heating, :time_setpoint_not_met_during_occupied_hours, :hours_out_of_comfort_bounds_PMV, :hours_out_of_comfort_bounds_PPD #:nodoc:
50
50
  # ReportingPeriod class initializes the reporting period attributes:
51
51
  # +:id+ , +:name+ , +:multiplier+ , +:start_date+ , +:end_date+ , +:month+ , +:day_of_month+ , +:year+ , +:total_site_energy+ , +:total_source_energy+ ,
52
- # +:net_site_energy+ , +:net_source_energy+ , +:net_utility_cost+ , +:electricity+ , +:natural_gas+ , +:additional_fuel+ , +:district_cooling+ ,
53
- # +:district_heating+ , +:water+ , +:electricity_produced+ , +:end_uses+ , +:energy_production+ , +:photovoltaic+ , +:utility_costs+ ,
52
+ # +:net_site_energy+ , +:net_source_energy+ , +:total_utility_cost , +:net_utility_cost+ , +:utility_costs+ , +:electricity+ , +:natural_gas+ , +:additional_fuel+ , +:district_cooling+ ,
53
+ # +:district_heating+ , +:water+ , +:electricity_produced+ , +:end_uses+ , +:energy_production+ , +:photovoltaic+ ,
54
54
  # +:fuel_type+ , +:total_cost+ , +:usage_cost+ , +:demand_cost+ , +:comfort_result+ , +:time_setpoint_not_met_during_occupied_cooling+ ,
55
55
  # +:time_setpoint_not_met_during_occupied_heating+ , +:time_setpoint_not_met_during_occupied_hours+
56
56
  ##
@@ -72,6 +72,7 @@ module URBANopt
72
72
  @net_site_energy = hash [:net_site_energy]
73
73
  @net_source_energy = hash [:net_source_energy]
74
74
  @net_utility_cost = hash [:net_utility_cost]
75
+ @total_utility_cost = hash [:total_utility_cost]
75
76
  @electricity = hash [:electricity]
76
77
  @natural_gas = hash [:natural_gas]
77
78
  @additional_fuel = hash [:additional_fuel]
@@ -109,6 +110,7 @@ module URBANopt
109
110
  hash [:net_site_energy] = nil
110
111
  hash [:net_source_energy] = nil
111
112
  hash [:net_utility_cost] = nil
113
+ hash [:total_utility_cost] = nil
112
114
  hash [:electricity] = nil
113
115
  hash [:natural_gas] = nil
114
116
  hash [:additional_fuel] = nil
@@ -144,6 +146,7 @@ module URBANopt
144
146
  result[:net_site_energy] = @net_site_energy if @net_site_energy
145
147
  result[:net_source_energy] = @net_source_energy if @net_source_energy
146
148
  result[:net_utility_cost] = @net_utility_cost if @net_utility_cost
149
+ result[:total_utility_cost] = @total_utility_cost if @total_utility_cost
147
150
  result[:electricity] = @electricity if @electricity
148
151
  result[:natural_gas] = @natural_gas if @natural_gas
149
152
  result[:additional_fuel] = @additional_fuel if @additional_fuel
@@ -212,6 +215,7 @@ module URBANopt
212
215
  existing_period.total_source_energy = add_values(existing_period.total_source_energy, new_period.total_source_energy)
213
216
  existing_period.net_source_energy = add_values(existing_period.net_source_energy, new_period.net_source_energy)
214
217
  existing_period.net_utility_cost = add_values(existing_period.net_utility_cost, new_period.net_utility_cost)
218
+ existing_period.total_utility_cost = add_values(existing_period.total_utility_cost, new_period.total_utility_cost)
215
219
  existing_period.electricity = add_values(existing_period.electricity, new_period.electricity)
216
220
  existing_period.natural_gas = add_values(existing_period.natural_gas, new_period.natural_gas)
217
221
  existing_period.additional_fuel = add_values(existing_period.additional_fuel, new_period.additional_fuel)
@@ -231,9 +235,9 @@ module URBANopt
231
235
  end
232
236
 
233
237
  if existing_period.utility_costs
234
-
238
+ #RK: this need to be updated
235
239
  existing_period.utility_costs.each_with_index do |item, i|
236
- existing_period.utility_costs[i][:fuel_type] = add_values(existing_period.utility_costs[i][:fuel_type], new_period.utility_costs[i][:fuel_type])
240
+ existing_period.utility_costs[i][:fuel_type] = existing_period.utility_costs[i][:fuel_type]
237
241
  existing_period.utility_costs[i][:total_cost] = add_values(existing_period.utility_costs[i][:total_cost], new_period.utility_costs[i][:total_cost])
238
242
  existing_period.utility_costs[i][:usage_cost] = add_values(existing_period.utility_costs[i][:usage_cost], new_period.utility_costs[i][:usage_cost])
239
243
  existing_period.utility_costs[i][:demand_cost] = add_values(existing_period.utility_costs[i][:demand_cost], new_period.utility_costs[i][:demand_cost])
@@ -273,10 +273,20 @@
273
273
  "description": "Net source energy (kBtu)",
274
274
  "type": "number"
275
275
  },
276
+ "total_utility_cost": {
277
+ "description": "Total utility cost",
278
+ "type": "number"
279
+ },
276
280
  "net_utility_cost": {
277
- "description": "Total utility cost for reporting period includes generation",
281
+ "description": "Net utility cost for reporting period includes generation",
278
282
  "type": "number"
279
283
  },
284
+ "utility_costs": {
285
+ "type": "array",
286
+ "items": {
287
+ "$ref": "#/definitions/UtilityCost"
288
+ }
289
+ },
280
290
  "electricity": {
281
291
  "description": "Sum of all electricity used, does not include electricity produced (kWh)",
282
292
  "type": "number"
@@ -324,12 +334,6 @@
324
334
  },
325
335
  "additionalProperties": false
326
336
  },
327
- "utility_costs": {
328
- "type": "array",
329
- "items": {
330
- "$ref": "#/definitions/UtilityCost"
331
- }
332
- },
333
337
  "comfort_result": {
334
338
  "$ref": "#/definitions/ComfortResult"
335
339
  }
@@ -30,6 +30,6 @@
30
30
 
31
31
  module URBANopt
32
32
  module Scenario
33
- VERSION = '0.2.0'.freeze
33
+ VERSION = '0.3.0.pre1'.freeze
34
34
  end
35
35
  end
@@ -21,20 +21,19 @@ Gem::Specification.new do |spec|
21
21
  spec.bindir = 'exe'
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ['lib']
24
- spec.required_ruby_version = '~> 2.2.4'
24
+ spec.required_ruby_version = '~> 2.5.0'
25
25
 
26
- spec.add_development_dependency 'bundler', '~> 1.14'
27
- spec.add_development_dependency 'github_api', '~> 0.18.0'
28
- spec.add_development_dependency 'rake', '~> 12.3'
26
+ spec.add_development_dependency 'bundler', '~> 2.1'
27
+ spec.add_development_dependency 'rake', '~> 13.0'
29
28
  spec.add_development_dependency 'rspec', '~> 3.7'
30
29
 
31
30
  spec.add_dependency 'json-schema'
32
31
  spec.add_dependency 'json_pure'
33
- spec.add_dependency 'openstudio-model-articulation', '~> 0.1.1'
34
- spec.add_dependency 'urbanopt-core', '~> 0.2.0'
32
+ spec.add_dependency 'openstudio-common-measures', '~> 0.2.0'
33
+ spec.add_dependency 'openstudio-model-articulation', '~> 0.2.0'
34
+ spec.add_dependency 'urbanopt-core', '~> 0.3.0.pre2'
35
35
 
36
36
  # lock the version of these dependencies due to using older version of Ruby.
37
- spec.add_dependency 'public_suffix', '3.1.1'
38
- spec.add_development_dependency 'rack', '2.1.2'
39
-
37
+ # spec.add_dependency 'public_suffix', '3.1.1'
38
+ # spec.add_development_dependency 'rack', '2.1.2'
40
39
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urbanopt-scenario
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rawad El Kontar
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-03-30 00:00:00.000000000 Z
12
+ date: 2020-05-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -17,42 +17,28 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.14'
20
+ version: '2.1'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.14'
28
- - !ruby/object:Gem::Dependency
29
- name: github_api
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - "~>"
33
- - !ruby/object:Gem::Version
34
- version: 0.18.0
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - "~>"
40
- - !ruby/object:Gem::Version
41
- version: 0.18.0
27
+ version: '2.1'
42
28
  - !ruby/object:Gem::Dependency
43
29
  name: rake
44
30
  requirement: !ruby/object:Gem::Requirement
45
31
  requirements:
46
32
  - - "~>"
47
33
  - !ruby/object:Gem::Version
48
- version: '12.3'
34
+ version: '13.0'
49
35
  type: :development
50
36
  prerelease: false
51
37
  version_requirements: !ruby/object:Gem::Requirement
52
38
  requirements:
53
39
  - - "~>"
54
40
  - !ruby/object:Gem::Version
55
- version: '12.3'
41
+ version: '13.0'
56
42
  - !ruby/object:Gem::Dependency
57
43
  name: rspec
58
44
  requirement: !ruby/object:Gem::Requirement
@@ -96,21 +82,21 @@ dependencies:
96
82
  - !ruby/object:Gem::Version
97
83
  version: '0'
98
84
  - !ruby/object:Gem::Dependency
99
- name: openstudio-model-articulation
85
+ name: openstudio-common-measures
100
86
  requirement: !ruby/object:Gem::Requirement
101
87
  requirements:
102
88
  - - "~>"
103
89
  - !ruby/object:Gem::Version
104
- version: 0.1.1
90
+ version: 0.2.0
105
91
  type: :runtime
106
92
  prerelease: false
107
93
  version_requirements: !ruby/object:Gem::Requirement
108
94
  requirements:
109
95
  - - "~>"
110
96
  - !ruby/object:Gem::Version
111
- version: 0.1.1
97
+ version: 0.2.0
112
98
  - !ruby/object:Gem::Dependency
113
- name: urbanopt-core
99
+ name: openstudio-model-articulation
114
100
  requirement: !ruby/object:Gem::Requirement
115
101
  requirements:
116
102
  - - "~>"
@@ -124,33 +110,19 @@ dependencies:
124
110
  - !ruby/object:Gem::Version
125
111
  version: 0.2.0
126
112
  - !ruby/object:Gem::Dependency
127
- name: public_suffix
113
+ name: urbanopt-core
128
114
  requirement: !ruby/object:Gem::Requirement
129
115
  requirements:
130
- - - '='
116
+ - - "~>"
131
117
  - !ruby/object:Gem::Version
132
- version: 3.1.1
118
+ version: 0.3.0.pre2
133
119
  type: :runtime
134
120
  prerelease: false
135
121
  version_requirements: !ruby/object:Gem::Requirement
136
122
  requirements:
137
- - - '='
138
- - !ruby/object:Gem::Version
139
- version: 3.1.1
140
- - !ruby/object:Gem::Dependency
141
- name: rack
142
- requirement: !ruby/object:Gem::Requirement
143
- requirements:
144
- - - '='
145
- - !ruby/object:Gem::Version
146
- version: 2.1.2
147
- type: :development
148
- prerelease: false
149
- version_requirements: !ruby/object:Gem::Requirement
150
- requirements:
151
- - - '='
123
+ - - "~>"
152
124
  - !ruby/object:Gem::Version
153
- version: 2.1.2
125
+ version: 0.3.0.pre2
154
126
  description: Library to export data point OSW files from URBANopt Scenario CSV
155
127
  email:
156
128
  - rawad.elkontar@nrel.gov
@@ -192,7 +164,6 @@ files:
192
164
  - docs/package-lock.json
193
165
  - docs/package.json
194
166
  - docs/schemas/scenario-schema.md
195
- - lib/change_log.rb
196
167
  - lib/measures/.rubocop.yml
197
168
  - lib/measures/default_feature_reports/LICENSE.md
198
169
  - lib/measures/default_feature_reports/README.md
@@ -252,15 +223,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
252
223
  requirements:
253
224
  - - "~>"
254
225
  - !ruby/object:Gem::Version
255
- version: 2.2.4
226
+ version: 2.5.0
256
227
  required_rubygems_version: !ruby/object:Gem::Requirement
257
228
  requirements:
258
- - - ">="
229
+ - - ">"
259
230
  - !ruby/object:Gem::Version
260
- version: '0'
231
+ version: 1.3.1
261
232
  requirements: []
262
- rubyforge_project:
263
- rubygems_version: 2.4.5.1
233
+ rubygems_version: 3.1.2
264
234
  signing_key:
265
235
  specification_version: 4
266
236
  summary: Library to export data point OSW files from URBANopt Scenario CSV
data/lib/change_log.rb DELETED
@@ -1,147 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'github_api'
4
- require 'date'
5
- require 'optparse'
6
- require 'optparse/date'
7
-
8
- # Instructions:
9
- # Get a token from github's settings (https://github.com/settings/tokens)
10
- #
11
- # Example:
12
- # ruby change_log.rb -t abcdefghijklmnopqrstuvwxyz -s 2017-09-06
13
- #
14
-
15
- options = {}
16
- OptionParser.new do |opts|
17
- opts.banner = "Usage: change_log.rb [options]\n" \
18
- 'Prints New, Open, Closed Issues, and number of accepted PRs'
19
- opts.separator ''
20
-
21
- # defaults, go back 90 days
22
- options[:start_date] = Date.today - 90
23
- options[:end_date] = Date.today
24
-
25
- opts.on('-s', '--start-date [DATE]', Date, 'Start of data (e.g. 2017-09-06)') do |v|
26
- options[:start_date] = v
27
- end
28
- opts.on('-e', '--end-date [DATE]', Date, 'End of data (e.g. 2017-09-13)') do |v|
29
- options[:end_date] = v
30
- end
31
- opts.on('-t', '--token [String]', String, 'Github API Token') do |v|
32
- options[:token] = v
33
- end
34
- end.parse!
35
-
36
- # Convert dates to time objects
37
- options[:start_date] = Time.parse(options[:start_date].to_s)
38
- options[:end_date] = Time.parse(options[:end_date].to_s)
39
- puts options
40
-
41
- ### Repository options
42
- repo_owner = 'URBANopt'
43
- repo = 'urbanopt-scenario-gem'
44
-
45
- github = Github.new
46
- if options[:token]
47
- puts 'Using github token'
48
- github = Github.new oauth_token: options[:token]
49
- end
50
-
51
- total_open_issues = []
52
- total_open_pull_requests = []
53
- new_issues = []
54
- closed_issues = []
55
- accepted_pull_requests = []
56
-
57
- def get_num(issue)
58
- issue.html_url.split('/')[-1].to_i
59
- end
60
-
61
- def get_issue_num(issue)
62
- "\##{get_num(issue)}"
63
- end
64
-
65
- def get_html_url(issue)
66
- issue.html_url
67
- end
68
-
69
- def get_title(issue)
70
- issue.title
71
- end
72
-
73
- def print_issue(issue)
74
- is_feature = false
75
- issue.labels.each { |label| is_feature = true if label.name == 'Feature Request' }
76
-
77
- if is_feature
78
- "- Improved [#{get_issue_num(issue)}]( #{get_html_url(issue)} ), #{get_title(issue)}"
79
- else
80
- "- Fixed [#{get_issue_num(issue)}]( #{get_html_url(issue)} ), #{get_title(issue)}"
81
- end
82
- end
83
-
84
- # Process Open Issues
85
- results = -1
86
- page = 1
87
- while results != 0
88
- resp = github.issues.list user: repo_owner, repo: repo, sort: 'created', direction: 'asc',
89
- state: 'open', per_page: 100, page: page
90
- results = resp.length
91
- resp.env[:body].each do |issue, _index|
92
- created = Time.parse(issue.created_at)
93
- if !issue.key?(:pull_request)
94
- total_open_issues << issue
95
- if created >= options[:start_date] && created <= options[:end_date]
96
- new_issues << issue
97
- end
98
- else
99
- total_open_pull_requests << issue
100
- end
101
- end
102
-
103
- page += 1
104
- end
105
-
106
- # Process Closed Issues
107
- results = -1
108
- page = 1
109
- while results != 0
110
- resp = github.issues.list user: repo_owner, repo: repo, sort: 'created', direction: 'asc',
111
- state: 'closed', per_page: 100, page: page
112
- results = resp.length
113
- resp.env[:body].each do |issue, _index|
114
- created = Time.parse(issue.created_at)
115
- closed = Time.parse(issue.closed_at)
116
- if !issue.key?(:pull_request)
117
- if created >= options[:start_date] && created <= options[:end_date]
118
- new_issues << issue
119
- end
120
- if closed >= options[:start_date] && closed <= options[:end_date]
121
- closed_issues << issue
122
- end
123
- elsif closed >= options[:start_date] && closed <= options[:end_date]
124
- accepted_pull_requests << issue
125
- end
126
- end
127
-
128
- page += 1
129
- end
130
-
131
- closed_issues.sort! { |x, y| get_num(x) <=> get_num(y) }
132
- new_issues.sort! { |x, y| get_num(x) <=> get_num(y) }
133
- accepted_pull_requests.sort! { |x, y| get_num(x) <=> get_num(y) }
134
- total_open_pull_requests.sort! { |x, y| get_num(x) <=> get_num(y) }
135
-
136
- puts "Total Open Issues: #{total_open_issues.length}"
137
- puts "Total Open Pull Requests: #{total_open_pull_requests.length}"
138
- puts "\nDate Range: #{options[:start_date].strftime('%m/%d/%y')} - #{options[:end_date].strftime('%m/%d/%y')}:"
139
- puts "\nNew Issues: #{new_issues.length} (" + new_issues.map { |issue| get_issue_num(issue) }.join(', ') + ')'
140
-
141
- puts "\nClosed Issues: #{closed_issues.length}"
142
- closed_issues.each { |issue| puts print_issue(issue) }
143
-
144
- puts "\nAccepted Pull Requests: #{accepted_pull_requests.length}"
145
- accepted_pull_requests.each { |issue| puts print_issue(issue) }
146
-
147
- puts "\nAll Open Issues: #{total_open_issues.length} (" + total_open_issues.map { |issue| get_issue_num(issue) }.join(', ') + ')'