urbanopt-cli 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: 2408b4efcec3352931f0121fabf1459e66cdfff4
4
- data.tar.gz: 6a2b3d67fdeacdedf0ffaa2d5bd36410ce72beeb
3
+ metadata.gz: 402a4f72ad3e67514221ec16a53524fdab902b1d
4
+ data.tar.gz: 826a536d3cf4f5a6d0080b163398e2f1f14478fc
5
5
  SHA512:
6
- metadata.gz: bd54c28dc9e62e070e8074ef1cef135b9ed6241d8412e5c21764042b1ebe51f27d14e068eba4cc798f63a334b30466c4cf7d08f38a84ecb960053c5e29b7d129
7
- data.tar.gz: 40bdf1d80b2d484c56659b9ebe63fa297979eb5b205ddea65b446e81e6df6e25fda65f00e2868d787b0a517664bcfafae9a556cacef3482947b680e2b9e3db32
6
+ metadata.gz: ec31c346dc3e9525f1b69c9e2c20d321db3f0a749f31b4bf5c87cd508c1ca5f790d02ad240c6ee8f6315ded6c6328c864ae1f60f2334058291703627af6d8995
7
+ data.tar.gz: 8ac753b397fccf84bfa0ee4249533123479d02c859a072bce0e710556851637fc67e7c3d600ad9644d221646b539def34380d542798f479e0ac7762e5a65bbfd
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## Version 0.2.1
4
+
5
+ Date Range: 03/31/20 - 03/31/20
6
+
7
+ - Fixed [#77]( https://github.com/urbanopt/urbanopt-cli/issues/77 ), Undefined local variable
8
+
3
9
  ## Version 0.2.0
4
10
 
5
11
  Date Range: 02/14/20 - 03/31/20
@@ -67,8 +67,5 @@ else
67
67
  # gem 'urbanopt-geojson', github: 'URBANopt/urbanopt-geojson-gem', branch: 'develop'
68
68
  end
69
69
 
70
- # simplecov has an unneccesary dependency on native json gem, use fork that does not require this
71
- gem 'simplecov', github: 'NREL/simplecov'
72
-
73
70
  # Fix rack version temporarily to work with Ruby 2.2.4
74
71
  gem 'rack', '2.1.2'
@@ -134,10 +134,6 @@ module URBANopt
134
134
  # params\
135
135
  # +scenario+:: _string_ Path to csv file that defines the scenario\
136
136
  # +feature_file_path+:: _string_ Path to Feature File used to describe set of features in the district
137
- #
138
- # FIXME: This only works when scenario_file and feature_file are in the project root directory
139
- # This works when called with filename (from inside project directory) and with absolute filepaths
140
- # Also, feels a little weird that now I'm only using instance variables and not passing anything to this function. I guess it's ok?
141
137
  def self.run_func
142
138
  name = File.basename(@scenario_file_name, File.extname(@scenario_file_name))
143
139
  run_dir = File.join(@root_dir, 'run', name.downcase)
@@ -147,8 +143,9 @@ module URBANopt
147
143
  reopt_files_dir = File.join(@root_dir, 'reopt/')
148
144
  num_header_rows = 1
149
145
  # FIXME: This can be cleaned up in Ruby 2.5 with Dir.children(<"foldername">)
146
+ # TODO: Better way of grabbing assumptions file than the first file in the folder
150
147
  reopt_files_dir_contents_list = Dir["#{reopt_files_dir}/*"]
151
- reopt_folder_path, reopt_assumptions_filename = File.split(reopt_files_dir_contents_list[0])
148
+ reopt_assumptions_filename = File.basename(reopt_files_dir_contents_list[0])
152
149
 
153
150
  if @feature_id
154
151
  feature_run_dir = File.join(run_dir, @feature_id)
@@ -167,8 +164,7 @@ module URBANopt
167
164
  def self.create_scenario_csv_file(feature_id)
168
165
  feature_file_json = JSON.parse(File.read(File.absolute_path(@user_input[:feature])), symbolize_names: true)
169
166
  Dir["#{@feature_path}/mappers/*.rb"].each do |mapper_file|
170
- mapper_path, mapper_name = File.split(mapper_file)
171
- mapper_name = mapper_name.split('.')[0]
167
+ mapper_name = File.basename(mapper_file, File.extname(mapper_file))
172
168
  scenario_file_name = if feature_id == 'SKIP'
173
169
  "#{mapper_name.downcase}_scenario.csv"
174
170
  else
@@ -253,13 +249,13 @@ module URBANopt
253
249
 
254
250
  # Download mapper files to user's local machine
255
251
  remote_mapper_files.each do |mapper_file|
256
- mapper_path, mapper_name = File.split(mapper_file)
252
+ mapper_name = File.basename(mapper_file)
257
253
  mapper_download = open(mapper_file, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE)
258
254
  IO.copy_stream(mapper_download, File.join(mappers_dir_abs_path, mapper_name))
259
255
  end
260
256
 
261
257
  # Download gemfile to user's local machine
262
- gem_path, gem_name = File.split(example_gem_file)
258
+ gem_name = File.basename(example_gem_file)
263
259
  example_gem_download = open(example_gem_file, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE)
264
260
  IO.copy_stream(example_gem_download, File.join(dir_name, gem_name))
265
261
 
@@ -274,26 +270,26 @@ module URBANopt
274
270
  end
275
271
 
276
272
  # Download config file to user's local machine
277
- config_path, config_name = File.split(config_file)
273
+ config_name = File.basename(config_file)
278
274
  config_download = open(config_file, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE)
279
275
  IO.copy_stream(config_download, File.join(dir_name, config_name))
280
276
 
281
277
  # Download weather file to user's local machine
282
278
  remote_weather_files.each do |weather_file|
283
- weather_path, weather_name = File.split(weather_file)
279
+ weather_name = File.basename(weather_file)
284
280
  weather_download = open(weather_file, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE)
285
281
  IO.copy_stream(weather_download, File.join(weather_dir_abs_path, weather_name))
286
282
  end
287
283
 
288
284
  # Download osm files to user's local machine
289
285
  osm_files.each do |osm_file|
290
- osm_path, osm_name = File.split(osm_file)
286
+ osm_name = File.basename(osm_file)
291
287
  osm_download = open(osm_file, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE)
292
288
  IO.copy_stream(osm_download, File.join(osm_dir_abs_path, osm_name))
293
289
  end
294
290
 
295
291
  # Download feature file to user's local machine
296
- feature_path, feature_name = File.split(example_feature_file)
292
+ feature_name = File.basename(example_feature_file)
297
293
  example_feature_download = open(example_feature_file, ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE)
298
294
  IO.copy_stream(example_feature_download, File.join(dir_name, feature_name))
299
295
  end
@@ -351,7 +347,7 @@ module URBANopt
351
347
  abort("\nYou must provide '-f' flag and a valid path to a FeatureFile!\n---\n\n")
352
348
  end
353
349
  if @user_input[:scenario].to_s.include? '-'
354
- @scenario_folder = scenario_file_name.split(/\W+/)[0].capitalize.to_s
350
+ @scenario_folder = @scenario_file_name.split(/\W+/)[0].capitalize.to_s
355
351
  @feature_id = (@feature_name.split(/\W+/)[1]).to_s
356
352
  else
357
353
  @scenario_folder = @scenario_file_name.split('.')[0].capitalize.to_s
@@ -388,7 +384,7 @@ module URBANopt
388
384
  puts "\nPost-processing OpenDSS results\n"
389
385
  opendss_folder = File.join(@root_dir, 'run', @scenario_name.split('.')[0], 'opendss')
390
386
  if File.directory?(opendss_folder)
391
- opendss_folder_path, opendss_folder_name = File.split(opendss_folder)
387
+ opendss_folder_name = File.basename(opendss_folder)
392
388
  opendss_post_processor = URBANopt::Scenario::OpenDSSPostProcessor.new(scenario_report, opendss_results_dir_name = opendss_folder_name)
393
389
  opendss_post_processor.run
394
390
  puts "\nDone\n"
@@ -1,5 +1,5 @@
1
1
  module URBANopt
2
2
  module CLI
3
- VERSION = '0.2.0'.freeze
3
+ VERSION = '0.2.1'.freeze
4
4
  end
5
5
  end
@@ -41,6 +41,6 @@ Gem::Specification.new do |spec|
41
41
  spec.add_development_dependency 'bundler', '~> 1.17'
42
42
  spec.add_development_dependency 'github_api', '~> 0.18'
43
43
  spec.add_development_dependency 'rake', '~> 12.3'
44
- spec.add_development_dependency 'rspec', '~> 3.0'
44
+ spec.add_development_dependency 'rspec', '~> 3.7'
45
45
  spec.add_development_dependency 'rubocop', '~> 0.54.0'
46
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urbanopt-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Moore
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '3.0'
103
+ version: '3.7'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '3.0'
110
+ version: '3.7'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rubocop
113
113
  requirement: !ruby/object:Gem::Requirement